diff --git a/assets/howler-d099a844.js b/assets/howler-2fc2b25b.js similarity index 99% rename from assets/howler-d099a844.js rename to assets/howler-2fc2b25b.js index 503acd5d..04c55f3e 100644 --- a/assets/howler-d099a844.js +++ b/assets/howler-2fc2b25b.js @@ -1,4 +1,4 @@ -import{g as L,c as S}from"./index-97d9bef3.js";function D(b,g){for(var r=0;ru[i]})}}}return Object.freeze(Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}))}var O={};/*! +import{g as L,c as S}from"./index-cde51aef.js";function D(b,g){for(var r=0;ru[i]})}}}return Object.freeze(Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}))}var O={};/*! * howler.js v2.2.4 * howlerjs.com * diff --git a/assets/index-9ee6b4cc.css b/assets/index-9ee6b4cc.css deleted file mode 100644 index 37c5cb71..00000000 --- a/assets/index-9ee6b4cc.css +++ /dev/null @@ -1 +0,0 @@ -@font-face{font-family:TTSC-Black-Italic;src:url("/assets/TT Squares Condensed Black Italic-5672aa6e.otf")}@font-face{font-family:TTSC-Black;src:url("/assets/TT Squares Condensed Black-221a58ab.otf")}@font-face{font-family:TTSC-Bold-Italic;src:url("/assets/TT Squares Condensed Bold Italic-906bdd16.otf")}@font-face{font-family:TTSC-Bold;src:url("/assets/TT Squares Condensed Bold-7edd675d.otf")}@font-face{font-family:TTSC-Light-Italic;src:url("/assets/TT Squares Condensed Light Italic-da726055.otf")}@font-face{font-family:TTSC-Light;src:url("/assets/TT Squares Condensed Light-cc406c21.otf")}@font-face{font-family:TTSC-Regular-Italic;src:url("/assets/TT Squares Condensed Regular Italic-e5fdfada.otf")}@font-face{font-family:TTSC-Regular;src:url("/assets/TT Squares Condensed Regular-9a6ac9aa.otf")}@font-face{font-family:TTSC-Thin-Italic;src:url("/assets/TT Squares Condensed Thin italic-550453e0.otf")}@font-face{font-family:TTSC-Thin;src:url("/assets/TT Squares Condensed Thin-1f34237c.otf")}html,body{margin:0;padding:0;height:100%;font-family:TTSC-Regular}#root{height:100%;overflow:hidden}::-webkit-scrollbar{width:.1em}::-webkit-scrollbar-track{box-shadow:transparent}::-webkit-scrollbar-thumb{background:rgb(0,149,100);background:-moz-linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1)}.horizontalScroll ::-webkit-scrollbar{height:.1em}.horizontalScroll ::-webkit-scrollbar-track{box-shadow:transparent}.horizontalScroll ::-webkit-scrollbar-thumb{background:rgb(0,149,100);background:-moz-linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1)}.root{overflow:hidden;margin:0;padding:0}#editor-scene{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;outline:none;-webkit-tap-highlight-color:rgba(255,255,255,0)}.loadingIndicator{display:none;pointer-events:none;position:absolute;left:0;right:0;top:0;bottom:0;width:80px;height:80px;margin:auto;border-radius:10px;filter:drop-shadow(1px 1px 2px black)}.loadingIndicator.active{display:block}.loadingIndicator>img{position:absolute;left:0;right:0;top:0;bottom:0;width:65%;height:65%;margin:auto}.rotate{animation:rotate 2.2s linear infinite}.sectionTitle{position:absolute;top:34px;left:32px;color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:16px}.generalTitle{position:absolute;top:16px;left:32px;color:#fff;opacity:.7;font-size:12px;padding:0;text-shadow:1px 1px 2px black;text-transform:uppercase}@keyframes rotate{to{transform:rotate(360deg)}}._container_1fjfz_1{width:100vw;height:100vh;margin:auto;position:absolute;display:flex;justify-content:center;align-items:center}._messageWindow_1fjfz_11{width:500px;height:150px;margin:auto;display:flex;padding:0 0 10px;background:rgb(4,17,22);-webkit-clip-path:polygon(0 0,100% 0,95% 100%,4% 100%);clip-path:polygon(0 0,100% 0,95% 100%,4% 100%);justify-content:space-around;align-items:center;flex-direction:column}._messageTitle_1fjfz_25{font-family:TTSC-Bold;font-weight:800;text-transform:uppercase!important;line-height:106%;color:#5eb086;height:40px;display:flex;align-items:center}._buttonContainer_1fjfz_36{width:100%;display:flex;height:40px;justify-content:space-around;-webkit-user-select:none;user-select:none}._iconButtonWrap_1fm7l_1{display:inline-block;position:relative;z-index:1;cursor:pointer}._iconButtonWrap_1fm7l_1 ._buttonBackground_1fm7l_8{height:100%;width:auto!important}._iconButtonWrap_1fm7l_1 ._buttonBackground_1fm7l_8 ._buttonBackgroundColor_1fm7l_13,._iconButtonWrap_1fm7l_1 ._buttonBackground_1fm7l_8 ._innerBackgroundColor_1fm7l_16,._iconButtonWrap_1fm7l_1._dark_1fm7l_20 ._buttonBackground_1fm7l_8 ._buttonBackgroundColor_1fm7l_13{fill:#eaf4ef}._iconButtonWrap_1fm7l_1._dark_1fm7l_20 ._buttonBackground_1fm7l_8 ._innerBackgroundColor_1fm7l_16{fill:#000}._iconButtonWrap_1fm7l_1 ._iconWrap_1fm7l_28{display:block;position:absolute;left:0;top:0;z-index:1;height:100%;width:100%}._iconButtonWrap_1fm7l_1 ._icon_1fm7l_1{top:50%;left:50%;-ms-transform:translateX(-50%) translateY(-50%);-webkit-transform:translateX(-50%) translateY(-50%);transform:translate(-50%) translateY(-50%);position:absolute;height:46%!important;max-width:46%}._iconButtonWrap_1fm7l_1 ._icon_1fm7l_1 *{fill:#000}._iconButtonWrap_1fm7l_1._dark_1fm7l_20 ._icon_1fm7l_1 *{fill:#fff}._iconButtonWrap_1fm7l_1:hover ._buttonBackgroundColor_1fm7l_13{fill:#ffc000!important;stroke:#000!important}._iconButtonWrap_1fm7l_1:hover ._innerBackgroundColor_1fm7l_16{fill:#ffc000!important}._iconButtonWrap_1fm7l_1:hover ._icon_1fm7l_1 *{fill:#eaf4ef!important}._iconButtonWrap_1fm7l_1:active ._buttonBackgroundColor_1fm7l_13{fill:#fdc503!important}._iconButtonWrap_1fm7l_1:active ._innerBackgroundColor_1fm7l_16{fill:#000!important}._iconButtonWrap_1fm7l_1:active ._icon_1fm7l_1 *{fill:#fdc503}._iconButtonWrap_1fm7l_1._active_1fm7l_83 ._buttonBackgroundColor_1fm7l_13,._iconButtonWrap_1fm7l_1._active_1fm7l_83 ._innerBackgroundColor_1fm7l_16{fill:#000!important}._iconButtonWrap_1fm7l_1._active_1fm7l_83 ._icon_1fm7l_1 *{fill:#fdc503}._buttonWrap_1fm7l_95{border:1px solid #000000;background:#000000;padding:0;margin:0;display:inline-block;cursor:pointer}._buttonWrap_1fm7l_95 ._icon_1fm7l_1{top:40%!important}._buttonWrap_1fm7l_95 ._buttonIconWrap_1fm7l_108{vertical-align:middle;size:inherit;margin-right:18px;position:relative;display:inline-block}._buttonWrap_1fm7l_95 ._buttonIconWrap_1fm7l_108 svg{width:auto;height:120%;top:50%;left:50%;-ms-transform:translateX(-50%) translateY(-50%);-webkit-transform:translateX(-50%) translateY(-50%);transform:translate(-50%) translateY(-50%);position:absolute}._buttonWrap_1fm7l_95 ._innerWrap_1fm7l_127{border:1px solid #FFFFFF;font-family:TTSC-Bold;font-weight:800;background:#FFFFFF;color:#000;padding:8px 14px 6px!important;text-transform:uppercase!important;line-height:106%}._buttonWrap_1fm7l_95:disabled ._innerWrap_1fm7l_127{color:#7e7e7e}._buttonWrap_1fm7l_95._dark_1fm7l_20 ._innerWrap_1fm7l_127{border:1px solid #FFFFFF;font-family:TTSC-Bold;background:#000000;color:#fff;text-transform:uppercase!important;padding:8px 14px 6px!important}._buttonWrap_1fm7l_95:hover:enabled ._innerWrap_1fm7l_127{border:1px solid #FFC000;font-family:TTSC-Bold;background:#FFC000;color:#efefef}._buttonWrap_1fm7l_95:hover:enabled ._innerWrap_1fm7l_127 *{fill:#efefef!important}._buttonWrap_1fm7l_95:active:enabled ._innerWrap_1fm7l_127{border:1px solid #FFC000;font-family:TTSC-Bold;background:#000000;color:#ffc000}._buttonWrap_1fm7l_95:active:enabled ._innerWrap_1fm7l_127 *{fill:#ffc000!important}._backgroundImg_1yy0g_1{background:black;background-attachment:fixed;background-repeat:no-repeat;background-position:center center;height:100vh;width:100vw;background-size:cover;display:fixed;flex-direction:column;align-items:center;overflow:hidden;position:absolute;z-index:-100}._darkBackground_1yy0g_16{background-color:#1e2530;height:100vh;width:100vw;background-size:cover;display:fixed;flex-direction:column;align-items:center;overflow:hidden;position:absolute;z-index:-100}._logo_1yy0g_29{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:auto;height:100vh;opacity:.3}._buttonContainer_1x1gj_1{position:absolute;bottom:20px;left:32px;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);text-align:center}._buttonContainer_1x1gj_1 ._buttonLeft_1x1gj_10{float:left}._buttonContainer_1x1gj_1 ._buttonRight_1x1gj_14{float:Right}._buttonContainer_1x1gj_1 ._buttonCenter_1x1gj_18{margin:0 8px}._buttonContainer_1x1gj_1:after{content:" ";display:block;clear:both}._buttonContainer_1x1gj_1 button{min-width:120px}._sideMenu_1x1gj_33{position:fixed;left:32px;top:98px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._scrollContainer_1x1gj_44{width:90%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:16px;height:calc(100% - 40px)}._scrollContainerOptions_1x1gj_52{width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:16px;height:calc(100% - 100px)}._bottomLine_1x1gj_60{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;bottom:0;left:0;width:100%;height:1px}._editor-container_1x1gj_87{-webkit-user-select:none;user-select:none;flex:1;width:200px;position:relative;text-align:center}._editorButton_1x1gj_94{padding:.15em;display:flex;position:relative;align-items:center;gap:10px;cursor:pointer}._editorText_1x1gj_102{color:#fff;text-transform:capitalize;max-width:100px;white-space:normal;word-wrap:break-word;text-align:left}._selectorContainerPos_1x1gj_112{position:absolute;top:98px;left:280px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000}._selector-container_1x1gj_123{-webkit-user-select:none;user-select:none;flex:1;width:140px;position:relative}._selector-container-column_1x1gj_129{-webkit-user-select:none;user-select:none;flex:1;flex-direction:column;width:140px;position:relative}._selectorButton_1x1gj_137{padding:.25em;display:block;position:relative;opacity:1;float:left;width:62px;text-align:center}._selectorColorPickerUI_1x1gj_146{position:absolute;right:-30px;width:30px;top:55px}._selectorColorPickerButton_1x1gj_152{-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);width:40px;height:40px;display:flex;align-items:center;border-radius:0 8px 8px 0;cursor:pointer}._selectorPickerTabs_1x1gj_162{position:absolute;right:-40px;top:15px;display:flex;flex-direction:column;gap:2px}._selectorColorPickerImg_1x1gj_170{width:20px;height:20px;position:relative;margin:auto}._uploadContainer_1x1gj_176{text-align:center;width:80%;position:relative;margin:16px 10px 16px 16px;padding-right:6px;height:40px;display:flex;align-items:center;justify-content:center}._uploadButton_1x1gj_189{margin:auto;text-align:center;outline-color:#3b434f;color:#d1d7df;outline-width:2px;outline-style:solid;background-color:#1e2530;height:30px;width:80%;font-family:TTSC-Bold;text-transform:uppercase!important;font-size:x-small;display:flex;justify-content:center;align-items:center;-webkit-user-select:none;user-select:none;cursor:pointer}._relativeBox_1x1gj_209{position:relative}._blendshapeGroup_1x1gj_213{flex-direction:column;display:flex;color:#fff}._dropArea_1a0z4_1{height:100vh;width:100vw;border:"2px dashed #aaa";background-size:cover;text-align:"center";display:fixed;flex-direction:column;align-items:center;overflow:hidden;position:absolute;z-index:10000}._mainTitleWrap_4fb0s_1{background:rgba(5,11,14,.8);position:absolute;top:-28px;padding:8px 0 6px;font-size:12px;width:104px;text-align:center;color:#5eb086;text-transform:uppercase}._mainTitleWrap_4fb0s_1 ._mainTitle_4fb0s_1{font-size:12px;text-transform:uppercase}._topLine_4fb0s_18{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;top:0;left:0;width:100%;height:1px}._ContainerPositionTop_v15ql_2{padding:0;margin:0 0 105px;width:180px;height:35px;z-index:1000;-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);-webkit-user-select:none;user-select:none;position:absolute;border-radius:20px 20px 0 0;align-items:center}._ContainerPosition_v15ql_2{padding:0;margin:0 0 20px;width:300px;height:85px;-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none;position:absolute}._Container_v15ql_2{display:flex;min-height:100vh;margin:0;align-items:flex-end;justify-content:center}._arrow-button_v15ql_39{cursor:pointer;overflow:hidden;opacity:.8;width:25px;height:25px;margin:2px 2px 10px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_v15ql_55{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_v15ql_62{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._topLine_v15ql_68{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;top:0;left:0;width:100%;height:1px}._traitInfoTitle_v15ql_96{color:#fff;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px}._flexSelect_v15ql_105{display:flex;justify-content:space-between;width:95%;height:40px;margin:5px auto 0;align-items:center}._flexButtons_v15ql_114{display:flex;justify-content:space-between;width:100px;height:30px;margin:0 auto;align-items:center}._flexButtonsTop_v15ql_122{display:flex;justify-content:space-around;width:150px;height:100%;margin:auto;padding-top:-3 0px;align-items:center}._optionButtons_v15ql_131{cursor:pointer;overflow:hidden;opacity:.8;width:25px;height:25px;margin:auto;text-align:center;align-items:center;display:flex;justify-content:space-around}._optionButtonsSmall_v15ql_143{cursor:pointer;overflow:hidden;opacity:.8;width:20px;height:20px;margin:auto;text-align:center;align-items:center;display:flex;justify-content:space-around}._optionButtons_v15ql_131 img{width:100%;height:100%}._optionButtonsSmall_v15ql_143 img{width:80%;height:80%}._tokenBoxWrap_q4pvo_1{position:relative!important;cursor:pointer;display:inline-block}._tokenBoxWrap_q4pvo_1 ._mask_q4pvo_7{width:91%;height:80%;overflow:hidden;-webkit-mask-image:url(./assets/backgrounds/token-frame-empty.svg);mask-image:url(./assets/backgrounds/token-frame-empty.svg);-webkit-mask-size:100%;mask-size:100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;top:50%;left:50%;-ms-transform:translateX(-50%) translateY(-50%);-webkit-transform:translateX(-50%) translateY(-50%);transform:translate(-50%) translateY(-50%);position:absolute;z-index:0}._tokenBoxWrap_q4pvo_1 ._mask_q4pvo_7 canvas{width:100%!important;height:100%!important}._tokenBoxWrap_q4pvo_1 ._timer_q4pvo_31{color:#fff;position:absolute;width:100%;text-align:center;bottom:2px;left:0;font-size:9px;font-family:TTSC-Bold}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42{position:absolute;bottom:-6px;width:30px;background-color:#303746;padding:0;font-family:TTSC-Bold;color:#ededed;text-align:center;font-size:10px;left:9px}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._mythic_q4pvo_55{background-color:#ffb65d;color:#000}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._epic_q4pvo_60{background-color:#a885f0;color:#000}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._rare_q4pvo_65{background-color:#3b9de3;color:#000}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._uncommon_q4pvo_70{background-color:#04e2b9;color:#000}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._common_q4pvo_75{background-color:#c5dcd0;color:#000}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._none_q4pvo_80{background-color:#303746;color:#ededed}._tokenBoxWrap_q4pvo_1 ._value_q4pvo_85{position:absolute;top:0;left:0;padding:2px 4px;background-color:#091218;color:#efefef;font-size:7px}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95{background-size:100%;background-position:center;background-repeat:no-repeat;height:100%;width:100%;top:50%;left:50%;-ms-transform:translateX(-50%) translateY(-50%);-webkit-transform:translateX(-50%) translateY(-50%);transform:translate(-50%) translateY(-50%);position:absolute;display:block;background-image:url(./assets/backgrounds/token-box-none.svg)}._tokenBoxWrap_q4pvo_1 ._emptyIcon_q4pvo_111{position:absolute;top:50%;left:50%;-ms-transform:translateX(-50%) translateY(-50%);-webkit-transform:translateX(-50%) translateY(-50%);transform:translate(-50%) translateY(-50%);height:100%;max-width:60%;max-height:60%}._tokenBoxWrap_q4pvo_1 ._badge_q4pvo_123{width:20%;top:4px;right:1px;position:absolute}._tokenBoxWrap_q4pvo_1 ._frameActive_q4pvo_131{background-image:url(./assets/backgrounds/token-box-uncommon.svg);height:116%;width:116%;top:50%!important}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._mythic_q4pvo_55{background-image:url(./assets/backgrounds/token-box-uncommon.svg)}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._epic_q4pvo_60{background-image:url(./assets/backgrounds/token-box-epic.svg);z-index:1}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._rare_q4pvo_65{background-image:url(./assets/backgrounds/token-box-rare.svg)}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._uncommon_q4pvo_70{background-image:url(./assets/backgrounds/token-box-uncommon.svg)}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._common_q4pvo_75{background-image:url(./assets/backgrounds/token-box-common.svg)}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._default_q4pvo_159{background-image:url(./assets/backgrounds/token-box-none.svg)}._InformationContainerPos_72ckd_2{position:fixed;right:32px;top:98px;width:350px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._scrollContainer_72ckd_15{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:30px;height:-webkit-calc(100% - 40px);height:calc(100% - 40px);padding-top:5px}._traitInfoTitle_72ckd_27{color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px}._traitInfoText_72ckd_35{color:#b3b3b3;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:30px}._input-box_72ckd_43{width:60px;height:20px;color:#5eb086;background-color:#050b0e80;border:none;font-size:medium;font-weight:500;margin-left:15px}._input-box_72ckd_43:focus{outline:none}._input-box_72ckd_43::selection{background-color:#111f17;color:#5eb086}._flexSelect_72ckd_62{display:flex;justify-content:space-between;width:100%;height:40px;align-items:center}._arrow-button_72ckd_70{cursor:pointer;overflow:hidden;opacity:.8;width:32px;height:32px;margin:2px 2px 10px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_72ckd_86{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_72ckd_93{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._anim-button_72ckd_100:hover{opacity:1}._custom-checkbox_72ckd_105 input[type=checkbox]{display:none}._custom-checkbox_72ckd_105 ._checkbox-container_72ckd_110{display:inline-block;width:20px;height:20px;border:2px solid #284b39;border-radius:5px;cursor:pointer}._custom-checkbox_72ckd_105 ._checkbox-container_72ckd_110._checked_72ckd_119{background-color:#5eb086}._custom-checkbox_72ckd_105 ._checkbox-container_72ckd_110 ._checkmark_72ckd_123{display:none}._custom-checkbox_72ckd_105 input[type=checkbox]:checked+._checkbox-container_72ckd_110{background-color:#5eb086}._custom-checkbox_72ckd_105 input[type=checkbox]:checked+._checkbox-container_72ckd_110 ._checkmark_72ckd_123{display:block}._checkboxHolder_72ckd_136{display:flex;gap:30px;align-items:center;justify-content:center;align-content:center;height:40px}._InformationContainerPos_1yd4c_2{position:fixed;right:32px;top:98px;width:90px;height:270px;-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._scrollContainer_1yd4c_15{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:16px;height:270px}._options-container_1yd4c_24{-webkit-user-select:none;user-select:none;flex:1;width:200px;position:relative;text-align:center}._InformationContainerPos_1m76y_2{position:fixed;right:132px;top:98px;width:250px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._scrollContainer_1m76y_15{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:30px;height:-webkit-calc(100% - 40px);height:calc(100% - 40px)}._centerAlign_1m76y_25{text-align:center}._traitInfoTitle_1m76y_28{text-align:center;color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:14px;word-spacing:2px;margin-bottom:10px}._dropdownFlex_1m76y_38{display:flex;justify-content:space-around;align-items:center;margin:5px}._checkboxFlex_1m76y_44,._simpleFlex_1m76y_49{display:flex;align-items:center;margin:5px}._traitInfoText_1m76y_55{text-align:center;color:#b3b3b3;text-shadow:1px 1px 2px black;font-size:13px;word-spacing:2px;margin-bottom:30px}._dropdownBase_1m76y_64{color:#5eb086!important;background-color:#1e2530!important;font-size:12px;height:30px;display:flex;text-align:center;align-items:center;margin:auto}._dropdownControl_1m76y_74{color:#63af88!important;background-color:#1e2530!important;font-size:12px;height:30px}._dropdownControlSmall_1m76y_80{color:#63af88!important;background-color:#1e2530!important;font-size:12px;height:30px;width:120px}._input-box_1m76y_87{width:60px;height:20px;color:#5eb086;background-color:#050b0e80;border:none;font-size:medium;font-weight:500;margin:4px 15px}._input-box_1m76y_87:focus{outline:none}._input-box_1m76y_87::selection{background-color:#111f17;color:#5eb086}._flexSelect_1m76y_106{display:flex;justify-content:space-between;width:100%;height:40px;align-items:center}._arrow-button_1m76y_114{cursor:pointer;overflow:hidden;opacity:.8;width:32px;height:32px;margin:2px 2px 30px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_1m76y_130{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_1m76y_137{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._anim-button_1m76y_144:hover{opacity:1}._custom-checkbox_1m76y_149 input[type=checkbox]{display:none}._custom-checkbox_1m76y_149 ._checkbox-container_1m76y_154{display:inline-block;width:20px;height:20px;border:2px solid #284b39;border-radius:5px;cursor:pointer}._custom-checkbox_1m76y_149 ._checkbox-container_1m76y_154._checked_1m76y_163{background-color:#5eb086}._custom-checkbox_1m76y_149 ._checkbox-container_1m76y_154 ._checkmark_1m76y_167{display:none}._custom-checkbox_1m76y_149 input[type=checkbox]:checked+._checkbox-container_1m76y_154{background-color:#5eb086}._custom-checkbox_1m76y_149 input[type=checkbox]:checked+._checkbox-container_1m76y_154 ._checkmark_1m76y_167{display:block}._checkboxHolder_1m76y_180{display:flex;gap:30px;align-items:center;justify-content:center;align-content:center;height:40px}._actionButton_1m76y_189{margin:30px auto;text-align:center;outline-color:#3b434f;color:#d1d7df;outline-width:2px;outline-style:solid;background-color:#1e2530;height:30px;width:80%;font-family:TTSC-Bold;text-transform:uppercase!important;font-size:x-small;display:flex;justify-content:center;align-items:center;-webkit-user-select:none;user-select:none;cursor:pointer}._tabHolder_1m76y_209{width:95%;display:flex;justify-content:center;margin:auto}._tabButton_1m76y_215{margin:2px 3px;text-align:center;outline-color:#5eb086;color:#5eb086;outline-width:1px;width:60px;outline-style:solid;background-color:#1e2530;height:15px;padding:2px 10px;font-family:TTSC-Bold;text-transform:uppercase!important;font-size:x-small;display:flex;justify-content:center;align-items:center;-webkit-user-select:none;user-select:none;cursor:pointer}._tabButtonSelected_1m76y_235{outline-color:#34634b;color:#478666;cursor:auto}._slider-container_1y6nx_1{display:flex;align-items:center;text-align:center;margin-top:10px}._slider_1y6nx_1{width:100%;margin-right:10px}._infoContainer_1y6nx_13{display:flex;justify-content:space-between}._input-box_1y6nx_18{width:60px;height:20px;color:#5eb086;background-color:#050b0e80;border:none;font-size:medium;font-weight:500;margin-left:15px}._input-box_1y6nx_18:focus{outline:none}._input-box_1y6nx_18::selection{background-color:#111f17;color:#5eb086}.Dropdown-root{position:relative}.Dropdown-control{position:relative;overflow:hidden;background-color:#fff;border:1px solid #ccc;border-radius:2px;box-sizing:border-box;color:#333;cursor:default;outline:none;padding:8px 52px 8px 10px;transition:all .2s ease}.Dropdown-control:hover{box-shadow:0 1px #0000000f}.Dropdown-arrow{border-color:#999 transparent transparent;border-style:solid;border-width:5px 5px 0;content:" ";display:block;height:0;margin-top:-ceil(2.5);position:absolute;right:10px;top:14px;width:0}.is-open .Dropdown-arrow{border-color:transparent transparent #999;border-width:0 5px 5px}.Dropdown-menu{background-color:#fff;border:1px solid #ccc;box-shadow:0 1px #0000000f;box-sizing:border-box;margin-top:-1px;max-height:200px;overflow-y:auto;position:absolute;top:100%;width:100%;z-index:1000;-webkit-overflow-scrolling:touch}.Dropdown-menu .Dropdown-group>.Dropdown-title{padding:8px 10px;color:#333;font-weight:700;text-transform:capitalize}.Dropdown-option{box-sizing:border-box;color:#333c;cursor:pointer;display:block;padding:8px 10px}.Dropdown-option:last-child{border-bottom-right-radius:2px;border-bottom-left-radius:2px}.Dropdown-option:hover,.Dropdown-option.is-selected{background-color:#f2f9fc;color:#333}.Dropdown-noresults{box-sizing:border-box;color:#ccc;cursor:default;display:block;padding:8px 10px}._InformationContainerPos_rgqwy_1{position:fixed;left:32px;top:98px;width:350px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._traitInfoTitle_rgqwy_13{color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px}._traitInfoText_rgqwy_21{color:#b3b3b3;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px}._flexSelect_rgqwy_30{display:flex;justify-content:space-between;width:90%;height:40px;align-items:center}._arrow-button_rgqwy_37{cursor:pointer;overflow:hidden;opacity:.8;width:32px;height:32px;margin:2px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_rgqwy_51{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_rgqwy_58{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._scrollContainer_rgqwy_65{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:30px;height:-webkit-calc(100% - 40px);height:calc(100% - 40px)}._custom-checkbox_rgqwy_76 input[type=checkbox]{display:none}._custom-checkbox_rgqwy_76 ._checkbox-container_rgqwy_81{display:inline-block;width:20px;height:20px;border:2px solid #284b39;border-radius:5px;cursor:pointer}._custom-checkbox_rgqwy_76 ._checkbox-container_rgqwy_81._checked_rgqwy_90{background-color:#5eb086}._custom-checkbox_rgqwy_76 ._checkbox-container_rgqwy_81 ._checkmark_rgqwy_94{display:none}._custom-checkbox_rgqwy_76 input[type=checkbox]:checked+._checkbox-container_rgqwy_81{background-color:#5eb086}._custom-checkbox_rgqwy_76 input[type=checkbox]:checked+._checkbox-container_rgqwy_81 ._checkmark_rgqwy_94{display:block}._checkboxHolder_rgqwy_107{display:flex;gap:5px;align-items:center;justify-content:left;height:40px}._buttonContainer_rgqwy_114{position:absolute;bottom:20px;left:32px;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);text-align:center}._buttonContainer_rgqwy_114 ._buttonLeft_rgqwy_123{float:left}._buttonContainer_rgqwy_114 ._buttonRight_rgqwy_127{float:Right}._buttonContainer_rgqwy_114 ._buttonCenter_rgqwy_131{margin:0 8px}._buttonContainer_rgqwy_114:after{content:" ";display:block;clear:both}._buttonContainer_rgqwy_114 button{min-width:120px}._InformationContainerPos_11mqa_2{position:fixed;right:32px;top:98px;width:350px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none;text-align:right}._scrollContainer_11mqa_16{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:30px;height:-webkit-calc(100% - 40px);height:calc(100% - 40px)}._traitInfoTitle_11mqa_28{color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px;text-align:right}._traitInfoText_11mqa_38{color:#b3b3b3;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:30px;text-align:right}._input-box_11mqa_47{width:60px;height:20px;color:#5eb086;background-color:#050b0e80;border:none;font-size:medium;font-weight:500;margin-left:15px}._input-box_11mqa_47:focus{outline:none}._input-box_11mqa_47::selection{background-color:#111f17;color:#5eb086}._flexSelect_11mqa_66{display:flex;justify-content:center;width:100%;height:30px;align-items:center;margin-top:10px;margin-bottom:30px}._arrow-button_11mqa_76{cursor:pointer;overflow:hidden;opacity:.8;width:25px;height:25px;margin:2px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_11mqa_91{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_11mqa_98{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._anim-button_11mqa_105:hover{opacity:1}._custom-checkbox_11mqa_110 input[type=checkbox]{display:none}._custom-checkbox_11mqa_110 ._checkbox-container_11mqa_115{display:inline-block;width:20px;height:20px;border:2px solid #284b39;border-radius:5px;cursor:pointer}._custom-checkbox_11mqa_110 ._checkbox-container_11mqa_115._checked_11mqa_124{background-color:#5eb086}._custom-checkbox_11mqa_110 ._checkbox-container_11mqa_115 ._checkmark_11mqa_128{display:none}._custom-checkbox_11mqa_110 input[type=checkbox]:checked+._checkbox-container_11mqa_115{background-color:#5eb086}._custom-checkbox_11mqa_110 input[type=checkbox]:checked+._checkbox-container_11mqa_115 ._checkmark_11mqa_128{display:block}._checkboxHolder_11mqa_141{display:flex;gap:30px;align-items:center;justify-content:center;align-content:center;height:40px}._InformationContainerPos_b0msk_1{position:fixed;left:32px;top:98px;width:300px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._traitInfoTitle_b0msk_13{color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:14px;word-spacing:2px;margin-bottom:10px;text-align:center}._traitInfoText_b0msk_22{color:#b3b3b3;text-shadow:1px 1px 2px black;font-size:14px;word-spacing:2px;margin-bottom:6px;display:flex;justify-content:left}._flexSelect_b0msk_33{display:flex;justify-content:space-between;width:100%;height:20px;align-items:center}._arrow-button_b0msk_40{cursor:pointer;overflow:hidden;opacity:.8;width:22px;height:22px;margin:2px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_b0msk_54{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_b0msk_61{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._scrollContainer_b0msk_68{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:30px;height:-webkit-calc(100% - 40px);height:calc(100% - 40px)}._custom-checkbox_b0msk_79 input[type=checkbox]{display:none}._custom-checkbox_b0msk_79 ._checkbox-container_b0msk_84{display:inline-block;width:20px;height:20px;border:2px solid #284b39;border-radius:5px;cursor:pointer}._custom-checkbox_b0msk_79 ._checkbox-container_b0msk_84._checked_b0msk_93{background-color:#5eb086}._custom-checkbox_b0msk_79 ._checkbox-container_b0msk_84 ._checkmark_b0msk_97{display:none}._custom-checkbox_b0msk_79 input[type=checkbox]:checked+._checkbox-container_b0msk_84{background-color:#5eb086}._custom-checkbox_b0msk_79 input[type=checkbox]:checked+._checkbox-container_b0msk_84 ._checkmark_b0msk_97{display:block}._checkboxHolder_b0msk_110{display:flex;gap:5px;align-items:center;justify-content:left;height:40px}._classdisabled_hpzv8_1{pointer-events:none;opacity:.5}._container_hpzv8_6{display:flex;height:inherit;justify-content:center;align-items:center;flex-direction:column}._classContainer_hpzv8_14{text-align:center;color:#f0f8ff;overflow-x:scroll;overflow-y:hidden;white-space:nowrap;padding:2em;display:flex;justify-content:center;align-items:center;z-index:10}._classContainer_hpzv8_14 ._class_hpzv8_1,._classContainer_hpzv8_14 ._classdisabled_hpzv8_1{flex:1;display:flex;cursor:pointer;width:15em;flex-direction:column;margin:24px 8px 8px;align-items:center;justify-content:center}._classContainer_hpzv8_14 ._icon_hpzv8_39{flex:1;z-index:2;margin-top:-4vh}@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 2){._classContainer_hpzv8_14 ._icon_hpzv8_39{flex:1;z-index:2;margin-top:-1.5vh}}@media only screen and (min-device-width: 0) and (max-device-width: 768px) and (-webkit-min-device-pixel-ratio: 2){._classContainer_hpzv8_14 ._icon_hpzv8_39{flex:1;z-index:2;margin-top:-1vh}}._classContainer_hpzv8_14 ._icon_hpzv8_39 img{background:#000;width:100%;height:auto;max-width:3em}._classContainer_hpzv8_14 ._name_hpzv8_70{font-size:1.5em;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%;margin-top:1vh}._classContainer_hpzv8_14 ._description_hpzv8_79{font-size:1em;flex:1}._classContainer_hpzv8_14 ._classFrame_hpzv8_84{flex:1;width:100%;display:flex;align-items:center;justify-content:center;position:relative;z-index:0;overflow:hidden;background-size:contain;background-position:center;background-repeat:no-repeat;mask-size:100%;-webkit-mask-size:100%;mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat}._classContainer_hpzv8_14 ._classFrame_hpzv8_84 ._frameContainer_hpzv8_104{width:100%;flex:1}._classContainer_hpzv8_14 ._classFrame_hpzv8_84 ._frame_hpzv8_104{width:100%;height:auto}._classContainer_hpzv8_14 ._classFrame_hpzv8_84 ._image_hpzv8_114{width:100%;height:auto;max-width:230px}._classContainer_hpzv8_14 ._classFrame_hpzv8_84 ._lockedContainer_hpzv8_120{position:absolute}._classContainer_hpzv8_14 ._classFrame_hpzv8_84 ._locked_hpzv8_120{width:100%;height:auto;max-width:2vw}._classContainer_hpzv8_14 ._class_hpzv8_1:hover ._name_hpzv8_70{color:#fcc000}._buttonContainer_hpzv8_134{position:absolute;bottom:20px;left:32px;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);text-align:center}._buttonContainer_hpzv8_134 ._buttonLeft_hpzv8_143{float:left}._buttonContainer_hpzv8_134 ._buttonRight_hpzv8_147{float:Right}._buttonContainer_hpzv8_134 ._buttonCenter_hpzv8_151{margin:0 8px}._buttonContainer_hpzv8_134:after{content:" ";display:block;clear:both}._buttonContainer_hpzv8_134 button{min-width:120px}._topLine_hpzv8_165,._bottomLine_hpzv8_191{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);width:100%;height:1px;z-index:10}._buttonContainer_1ueuk_1{position:absolute;left:0;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);top:50%;transform:translateY(-50%);-webkit-transform:translateY(-50%);text-align:center;height:320px}._buttonContainer_1ueuk_1 ._button_1ueuk_1{background:none!important;border:none!important;cursor:pointer;margin:0 32px;height:320px;width:126px;position:relative}._buttonContainer_1ueuk_1 ._button_1ueuk_1 img{height:100%;transition:all .3s ease-in-out;position:absolute;left:0;top:0}._buttonContainer_1ueuk_1 ._button_1ueuk_1:hover img{top:-8px}._container_q73cc_1{display:flex;height:inherit;flex-direction:column}._container_q73cc_1 ._mintContainer_q73cc_6{width:100%;margin:auto;height:250px;max-width:350px;position:relative;text-align:center;z-index:1;display:flex;color:#f0f8ff;-webkit-user-select:none;user-select:none;align-items:center;flex-direction:column;justify-content:center}._container_q73cc_1 ._mintContainer_q73cc_6:before{top:0;left:0;right:0;bottom:0;content:"";z-index:-1;position:absolute;background:rgb(4,17,22);-webkit-clip-path:polygon(0 0,100% 0,90% 100%,9% 100%);clip-path:polygon(0 0,100% 0,90% 100%,9% 100%)}._container_q73cc_1 ._mintContainer_q73cc_6 ._mainTitleWrap_q73cc_33{z-index:0;width:100px;color:#5eb086;font-size:24px;text-align:center;padding:8px 0;background:rgb(12,20,24);margin:-24px auto;position:relative}._container_q73cc_1 ._mintContainer_q73cc_6 ._mainTitleWrap_q73cc_33 ._mainTitle_q73cc_33{text-transform:uppercase}._container_q73cc_1 ._mintContainer_q73cc_6 ._mintButtonContainer_q73cc_49{width:100%;display:flex;margin-top:auto;margin-bottom:15px;align-items:center;flex-direction:column}._container_q73cc_1 ._mintContainer_q73cc_6 ._mintButtonContainer_q73cc_49 ._mintButton_q73cc_49>div{padding:16px!important}._container_q73cc_1 ._mintContainer_q73cc_6 ._mintButtonContainer_q73cc_49 ._genesisText_q73cc_60{opacity:.4;margin-top:5px}._container_q73cc_1 ._mintContainer_q73cc_6 ._mintButtonContainer_q73cc_49 ._genesisText_q73cc_60 ._required_q73cc_64:after{content:"*";color:red}._container_q73cc_1 ._mintContainer_q73cc_6 ._mintButtonContainer_q73cc_49 ._divider_q73cc_68{width:80%;height:1px;margin:8px 0;opacity:.2;background:#e0e6e5}._container_q73cc_1 ._bottomContainer_q73cc_75{z-index:0;display:flex;padding:20px 32px;justify-content:space-between}._container_q73cc_1 ._bottomContainer_q73cc_75 button{min-width:120px}._mintInfo_q73cc_85{height:15px;padding-bottom:25px;opacity:.5}._topLine_q73cc_91{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);top:0;left:0;width:100%;height:1px;position:absolute;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1)}._bottomLine_q73cc_104{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;bottom:0;left:0;width:100%;height:1px}._buttonContainer_1fd4o_1{position:absolute;bottom:20px;left:32px;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);text-align:center}._buttonContainer_1fd4o_1 ._buttonLeft_1fd4o_10{float:left}._buttonContainer_1fd4o_1 ._buttonRight_1fd4o_14{float:Right}._buttonContainer_1fd4o_1 ._buttonCenter_1fd4o_18{margin:0 8px}._buttonContainer_1fd4o_1:after{content:" ";display:block;clear:both}._buttonContainer_1fd4o_1 button{min-width:120px}._button_13dfi_1{margin:0 8px} diff --git a/assets/index-a2dd8f68.css b/assets/index-a2dd8f68.css new file mode 100644 index 00000000..ee35878a --- /dev/null +++ b/assets/index-a2dd8f68.css @@ -0,0 +1 @@ +@font-face{font-family:TTSC-Black-Italic;src:url("/assets/TT Squares Condensed Black Italic-5672aa6e.otf")}@font-face{font-family:TTSC-Black;src:url("/assets/TT Squares Condensed Black-221a58ab.otf")}@font-face{font-family:TTSC-Bold-Italic;src:url("/assets/TT Squares Condensed Bold Italic-906bdd16.otf")}@font-face{font-family:TTSC-Bold;src:url("/assets/TT Squares Condensed Bold-7edd675d.otf")}@font-face{font-family:TTSC-Light-Italic;src:url("/assets/TT Squares Condensed Light Italic-da726055.otf")}@font-face{font-family:TTSC-Light;src:url("/assets/TT Squares Condensed Light-cc406c21.otf")}@font-face{font-family:TTSC-Regular-Italic;src:url("/assets/TT Squares Condensed Regular Italic-e5fdfada.otf")}@font-face{font-family:TTSC-Regular;src:url("/assets/TT Squares Condensed Regular-9a6ac9aa.otf")}@font-face{font-family:TTSC-Thin-Italic;src:url("/assets/TT Squares Condensed Thin italic-550453e0.otf")}@font-face{font-family:TTSC-Thin;src:url("/assets/TT Squares Condensed Thin-1f34237c.otf")}html,body{margin:0;padding:0;height:100%;font-family:TTSC-Regular}#root{height:100%;overflow:hidden}::-webkit-scrollbar{width:.1em}::-webkit-scrollbar-track{box-shadow:transparent}::-webkit-scrollbar-thumb{background:rgb(0,149,100);background:-moz-linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1)}.horizontalScroll ::-webkit-scrollbar{height:.1em}.horizontalScroll ::-webkit-scrollbar-track{box-shadow:transparent}.horizontalScroll ::-webkit-scrollbar-thumb{background:rgb(0,149,100);background:-moz-linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1)}.root{overflow:hidden;margin:0;padding:0}#editor-scene{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;outline:none;-webkit-tap-highlight-color:rgba(255,255,255,0)}.loadingIndicator{display:none;pointer-events:none;position:absolute;left:0;right:0;top:0;bottom:0;width:80px;height:80px;margin:auto;border-radius:10px;filter:drop-shadow(1px 1px 2px black)}.loadingIndicator.active{display:block}.loadingIndicator>img{position:absolute;left:0;right:0;top:0;bottom:0;width:65%;height:65%;margin:auto}.rotate{animation:rotate 2.2s linear infinite}.sectionTitle{position:absolute;top:34px;left:32px;color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:16px}.generalTitle{position:absolute;top:16px;left:32px;color:#fff;opacity:.7;font-size:12px;padding:0;text-shadow:1px 1px 2px black;text-transform:uppercase}@keyframes rotate{to{transform:rotate(360deg)}}._container_1fjfz_1{width:100vw;height:100vh;margin:auto;position:absolute;display:flex;justify-content:center;align-items:center}._messageWindow_1fjfz_11{width:500px;height:150px;margin:auto;display:flex;padding:0 0 10px;background:rgb(4,17,22);-webkit-clip-path:polygon(0 0,100% 0,95% 100%,4% 100%);clip-path:polygon(0 0,100% 0,95% 100%,4% 100%);justify-content:space-around;align-items:center;flex-direction:column}._messageTitle_1fjfz_25{font-family:TTSC-Bold;font-weight:800;text-transform:uppercase!important;line-height:106%;color:#5eb086;height:40px;display:flex;align-items:center}._buttonContainer_1fjfz_36{width:100%;display:flex;height:40px;justify-content:space-around;-webkit-user-select:none;user-select:none}._iconButtonWrap_1fm7l_1{display:inline-block;position:relative;z-index:1;cursor:pointer}._iconButtonWrap_1fm7l_1 ._buttonBackground_1fm7l_8{height:100%;width:auto!important}._iconButtonWrap_1fm7l_1 ._buttonBackground_1fm7l_8 ._buttonBackgroundColor_1fm7l_13,._iconButtonWrap_1fm7l_1 ._buttonBackground_1fm7l_8 ._innerBackgroundColor_1fm7l_16,._iconButtonWrap_1fm7l_1._dark_1fm7l_20 ._buttonBackground_1fm7l_8 ._buttonBackgroundColor_1fm7l_13{fill:#eaf4ef}._iconButtonWrap_1fm7l_1._dark_1fm7l_20 ._buttonBackground_1fm7l_8 ._innerBackgroundColor_1fm7l_16{fill:#000}._iconButtonWrap_1fm7l_1 ._iconWrap_1fm7l_28{display:block;position:absolute;left:0;top:0;z-index:1;height:100%;width:100%}._iconButtonWrap_1fm7l_1 ._icon_1fm7l_1{top:50%;left:50%;-ms-transform:translateX(-50%) translateY(-50%);-webkit-transform:translateX(-50%) translateY(-50%);transform:translate(-50%) translateY(-50%);position:absolute;height:46%!important;max-width:46%}._iconButtonWrap_1fm7l_1 ._icon_1fm7l_1 *{fill:#000}._iconButtonWrap_1fm7l_1._dark_1fm7l_20 ._icon_1fm7l_1 *{fill:#fff}._iconButtonWrap_1fm7l_1:hover ._buttonBackgroundColor_1fm7l_13{fill:#ffc000!important;stroke:#000!important}._iconButtonWrap_1fm7l_1:hover ._innerBackgroundColor_1fm7l_16{fill:#ffc000!important}._iconButtonWrap_1fm7l_1:hover ._icon_1fm7l_1 *{fill:#eaf4ef!important}._iconButtonWrap_1fm7l_1:active ._buttonBackgroundColor_1fm7l_13{fill:#fdc503!important}._iconButtonWrap_1fm7l_1:active ._innerBackgroundColor_1fm7l_16{fill:#000!important}._iconButtonWrap_1fm7l_1:active ._icon_1fm7l_1 *{fill:#fdc503}._iconButtonWrap_1fm7l_1._active_1fm7l_83 ._buttonBackgroundColor_1fm7l_13,._iconButtonWrap_1fm7l_1._active_1fm7l_83 ._innerBackgroundColor_1fm7l_16{fill:#000!important}._iconButtonWrap_1fm7l_1._active_1fm7l_83 ._icon_1fm7l_1 *{fill:#fdc503}._buttonWrap_1fm7l_95{border:1px solid #000000;background:#000000;padding:0;margin:0;display:inline-block;cursor:pointer}._buttonWrap_1fm7l_95 ._icon_1fm7l_1{top:40%!important}._buttonWrap_1fm7l_95 ._buttonIconWrap_1fm7l_108{vertical-align:middle;size:inherit;margin-right:18px;position:relative;display:inline-block}._buttonWrap_1fm7l_95 ._buttonIconWrap_1fm7l_108 svg{width:auto;height:120%;top:50%;left:50%;-ms-transform:translateX(-50%) translateY(-50%);-webkit-transform:translateX(-50%) translateY(-50%);transform:translate(-50%) translateY(-50%);position:absolute}._buttonWrap_1fm7l_95 ._innerWrap_1fm7l_127{border:1px solid #FFFFFF;font-family:TTSC-Bold;font-weight:800;background:#FFFFFF;color:#000;padding:8px 14px 6px!important;text-transform:uppercase!important;line-height:106%}._buttonWrap_1fm7l_95:disabled ._innerWrap_1fm7l_127{color:#7e7e7e}._buttonWrap_1fm7l_95._dark_1fm7l_20 ._innerWrap_1fm7l_127{border:1px solid #FFFFFF;font-family:TTSC-Bold;background:#000000;color:#fff;text-transform:uppercase!important;padding:8px 14px 6px!important}._buttonWrap_1fm7l_95:hover:enabled ._innerWrap_1fm7l_127{border:1px solid #FFC000;font-family:TTSC-Bold;background:#FFC000;color:#efefef}._buttonWrap_1fm7l_95:hover:enabled ._innerWrap_1fm7l_127 *{fill:#efefef!important}._buttonWrap_1fm7l_95:active:enabled ._innerWrap_1fm7l_127{border:1px solid #FFC000;font-family:TTSC-Bold;background:#000000;color:#ffc000}._buttonWrap_1fm7l_95:active:enabled ._innerWrap_1fm7l_127 *{fill:#ffc000!important}._backgroundImg_1yy0g_1{background:black;background-attachment:fixed;background-repeat:no-repeat;background-position:center center;height:100vh;width:100vw;background-size:cover;display:fixed;flex-direction:column;align-items:center;overflow:hidden;position:absolute;z-index:-100}._darkBackground_1yy0g_16{background-color:#1e2530;height:100vh;width:100vw;background-size:cover;display:fixed;flex-direction:column;align-items:center;overflow:hidden;position:absolute;z-index:-100}._logo_1yy0g_29{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:auto;height:100vh;opacity:.3}._buttonContainer_1x1gj_1{position:absolute;bottom:20px;left:32px;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);text-align:center}._buttonContainer_1x1gj_1 ._buttonLeft_1x1gj_10{float:left}._buttonContainer_1x1gj_1 ._buttonRight_1x1gj_14{float:Right}._buttonContainer_1x1gj_1 ._buttonCenter_1x1gj_18{margin:0 8px}._buttonContainer_1x1gj_1:after{content:" ";display:block;clear:both}._buttonContainer_1x1gj_1 button{min-width:120px}._sideMenu_1x1gj_33{position:fixed;left:32px;top:98px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._scrollContainer_1x1gj_44{width:90%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:16px;height:calc(100% - 40px)}._scrollContainerOptions_1x1gj_52{width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:16px;height:calc(100% - 100px)}._bottomLine_1x1gj_60{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;bottom:0;left:0;width:100%;height:1px}._editor-container_1x1gj_87{-webkit-user-select:none;user-select:none;flex:1;width:200px;position:relative;text-align:center}._editorButton_1x1gj_94{padding:.15em;display:flex;position:relative;align-items:center;gap:10px;cursor:pointer}._editorText_1x1gj_102{color:#fff;text-transform:capitalize;max-width:100px;white-space:normal;word-wrap:break-word;text-align:left}._selectorContainerPos_1x1gj_112{position:absolute;top:98px;left:280px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000}._selector-container_1x1gj_123{-webkit-user-select:none;user-select:none;flex:1;width:140px;position:relative}._selector-container-column_1x1gj_129{-webkit-user-select:none;user-select:none;flex:1;flex-direction:column;width:140px;position:relative}._selectorButton_1x1gj_137{padding:.25em;display:block;position:relative;opacity:1;float:left;width:62px;text-align:center}._selectorColorPickerUI_1x1gj_146{position:absolute;right:-30px;width:30px;top:55px}._selectorColorPickerButton_1x1gj_152{-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);width:40px;height:40px;display:flex;align-items:center;border-radius:0 8px 8px 0;cursor:pointer}._selectorPickerTabs_1x1gj_162{position:absolute;right:-40px;top:15px;display:flex;flex-direction:column;gap:2px}._selectorColorPickerImg_1x1gj_170{width:20px;height:20px;position:relative;margin:auto}._uploadContainer_1x1gj_176{text-align:center;width:80%;position:relative;margin:16px 10px 16px 16px;padding-right:6px;height:40px;display:flex;align-items:center;justify-content:center}._uploadButton_1x1gj_189{margin:auto;text-align:center;outline-color:#3b434f;color:#d1d7df;outline-width:2px;outline-style:solid;background-color:#1e2530;height:30px;width:80%;font-family:TTSC-Bold;text-transform:uppercase!important;font-size:x-small;display:flex;justify-content:center;align-items:center;-webkit-user-select:none;user-select:none;cursor:pointer}._relativeBox_1x1gj_209{position:relative}._blendshapeGroup_1x1gj_213{flex-direction:column;display:flex;color:#fff}._dropArea_1a0z4_1{height:100vh;width:100vw;border:"2px dashed #aaa";background-size:cover;text-align:"center";display:fixed;flex-direction:column;align-items:center;overflow:hidden;position:absolute;z-index:10000}._mainTitleWrap_4fb0s_1{background:rgba(5,11,14,.8);position:absolute;top:-28px;padding:8px 0 6px;font-size:12px;width:104px;text-align:center;color:#5eb086;text-transform:uppercase}._mainTitleWrap_4fb0s_1 ._mainTitle_4fb0s_1{font-size:12px;text-transform:uppercase}._topLine_4fb0s_18{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;top:0;left:0;width:100%;height:1px}._ContainerPositionTop_v15ql_2{padding:0;margin:0 0 105px;width:180px;height:35px;z-index:1000;-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);-webkit-user-select:none;user-select:none;position:absolute;border-radius:20px 20px 0 0;align-items:center}._ContainerPosition_v15ql_2{padding:0;margin:0 0 20px;width:300px;height:85px;-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none;position:absolute}._Container_v15ql_2{display:flex;min-height:100vh;margin:0;align-items:flex-end;justify-content:center}._arrow-button_v15ql_39{cursor:pointer;overflow:hidden;opacity:.8;width:25px;height:25px;margin:2px 2px 10px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_v15ql_55{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_v15ql_62{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._topLine_v15ql_68{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;top:0;left:0;width:100%;height:1px}._traitInfoTitle_v15ql_96{color:#fff;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px}._flexSelect_v15ql_105{display:flex;justify-content:space-between;width:95%;height:40px;margin:5px auto 0;align-items:center}._flexButtons_v15ql_114{display:flex;justify-content:space-between;width:100px;height:30px;margin:0 auto;align-items:center}._flexButtonsTop_v15ql_122{display:flex;justify-content:space-around;width:150px;height:100%;margin:auto;padding-top:-3 0px;align-items:center}._optionButtons_v15ql_131{cursor:pointer;overflow:hidden;opacity:.8;width:25px;height:25px;margin:auto;text-align:center;align-items:center;display:flex;justify-content:space-around}._optionButtonsSmall_v15ql_143{cursor:pointer;overflow:hidden;opacity:.8;width:20px;height:20px;margin:auto;text-align:center;align-items:center;display:flex;justify-content:space-around}._optionButtons_v15ql_131 img{width:100%;height:100%}._optionButtonsSmall_v15ql_143 img{width:80%;height:80%}._tokenBoxWrap_q4pvo_1{position:relative!important;cursor:pointer;display:inline-block}._tokenBoxWrap_q4pvo_1 ._mask_q4pvo_7{width:91%;height:80%;overflow:hidden;-webkit-mask-image:url(./assets/backgrounds/token-frame-empty.svg);mask-image:url(./assets/backgrounds/token-frame-empty.svg);-webkit-mask-size:100%;mask-size:100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;top:50%;left:50%;-ms-transform:translateX(-50%) translateY(-50%);-webkit-transform:translateX(-50%) translateY(-50%);transform:translate(-50%) translateY(-50%);position:absolute;z-index:0}._tokenBoxWrap_q4pvo_1 ._mask_q4pvo_7 canvas{width:100%!important;height:100%!important}._tokenBoxWrap_q4pvo_1 ._timer_q4pvo_31{color:#fff;position:absolute;width:100%;text-align:center;bottom:2px;left:0;font-size:9px;font-family:TTSC-Bold}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42{position:absolute;bottom:-6px;width:30px;background-color:#303746;padding:0;font-family:TTSC-Bold;color:#ededed;text-align:center;font-size:10px;left:9px}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._mythic_q4pvo_55{background-color:#ffb65d;color:#000}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._epic_q4pvo_60{background-color:#a885f0;color:#000}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._rare_q4pvo_65{background-color:#3b9de3;color:#000}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._uncommon_q4pvo_70{background-color:#04e2b9;color:#000}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._common_q4pvo_75{background-color:#c5dcd0;color:#000}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._none_q4pvo_80{background-color:#303746;color:#ededed}._tokenBoxWrap_q4pvo_1 ._value_q4pvo_85{position:absolute;top:0;left:0;padding:2px 4px;background-color:#091218;color:#efefef;font-size:7px}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95{background-size:100%;background-position:center;background-repeat:no-repeat;height:100%;width:100%;top:50%;left:50%;-ms-transform:translateX(-50%) translateY(-50%);-webkit-transform:translateX(-50%) translateY(-50%);transform:translate(-50%) translateY(-50%);position:absolute;display:block;background-image:url(./assets/backgrounds/token-box-none.svg)}._tokenBoxWrap_q4pvo_1 ._emptyIcon_q4pvo_111{position:absolute;top:50%;left:50%;-ms-transform:translateX(-50%) translateY(-50%);-webkit-transform:translateX(-50%) translateY(-50%);transform:translate(-50%) translateY(-50%);height:100%;max-width:60%;max-height:60%}._tokenBoxWrap_q4pvo_1 ._badge_q4pvo_123{width:20%;top:4px;right:1px;position:absolute}._tokenBoxWrap_q4pvo_1 ._frameActive_q4pvo_131{background-image:url(./assets/backgrounds/token-box-uncommon.svg);height:116%;width:116%;top:50%!important}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._mythic_q4pvo_55{background-image:url(./assets/backgrounds/token-box-uncommon.svg)}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._epic_q4pvo_60{background-image:url(./assets/backgrounds/token-box-epic.svg);z-index:1}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._rare_q4pvo_65{background-image:url(./assets/backgrounds/token-box-rare.svg)}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._uncommon_q4pvo_70{background-image:url(./assets/backgrounds/token-box-uncommon.svg)}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._common_q4pvo_75{background-image:url(./assets/backgrounds/token-box-common.svg)}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._default_q4pvo_159{background-image:url(./assets/backgrounds/token-box-none.svg)}._InformationContainerPos_72ckd_2{position:fixed;right:32px;top:98px;width:350px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._scrollContainer_72ckd_15{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:30px;height:-webkit-calc(100% - 40px);height:calc(100% - 40px);padding-top:5px}._traitInfoTitle_72ckd_27{color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px}._traitInfoText_72ckd_35{color:#b3b3b3;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:30px}._input-box_72ckd_43{width:60px;height:20px;color:#5eb086;background-color:#050b0e80;border:none;font-size:medium;font-weight:500;margin-left:15px}._input-box_72ckd_43:focus{outline:none}._input-box_72ckd_43::selection{background-color:#111f17;color:#5eb086}._flexSelect_72ckd_62{display:flex;justify-content:space-between;width:100%;height:40px;align-items:center}._arrow-button_72ckd_70{cursor:pointer;overflow:hidden;opacity:.8;width:32px;height:32px;margin:2px 2px 10px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_72ckd_86{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_72ckd_93{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._anim-button_72ckd_100:hover{opacity:1}._custom-checkbox_72ckd_105 input[type=checkbox]{display:none}._custom-checkbox_72ckd_105 ._checkbox-container_72ckd_110{display:inline-block;width:20px;height:20px;border:2px solid #284b39;border-radius:5px;cursor:pointer}._custom-checkbox_72ckd_105 ._checkbox-container_72ckd_110._checked_72ckd_119{background-color:#5eb086}._custom-checkbox_72ckd_105 ._checkbox-container_72ckd_110 ._checkmark_72ckd_123{display:none}._custom-checkbox_72ckd_105 input[type=checkbox]:checked+._checkbox-container_72ckd_110{background-color:#5eb086}._custom-checkbox_72ckd_105 input[type=checkbox]:checked+._checkbox-container_72ckd_110 ._checkmark_72ckd_123{display:block}._checkboxHolder_72ckd_136{display:flex;gap:30px;align-items:center;justify-content:center;align-content:center;height:40px}._InformationContainerPos_1dnrx_2{position:fixed;right:32px;top:98px;width:90px;height:auto;-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._scrollContainer_1dnrx_15{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:16px;height:300px}._options-container_1dnrx_24{-webkit-user-select:none;user-select:none;flex:1;width:200px;position:relative;text-align:center}._InformationContainerPos_1m76y_2{position:fixed;right:132px;top:98px;width:250px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._scrollContainer_1m76y_15{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:30px;height:-webkit-calc(100% - 40px);height:calc(100% - 40px)}._centerAlign_1m76y_25{text-align:center}._traitInfoTitle_1m76y_28{text-align:center;color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:14px;word-spacing:2px;margin-bottom:10px}._dropdownFlex_1m76y_38{display:flex;justify-content:space-around;align-items:center;margin:5px}._checkboxFlex_1m76y_44,._simpleFlex_1m76y_49{display:flex;align-items:center;margin:5px}._traitInfoText_1m76y_55{text-align:center;color:#b3b3b3;text-shadow:1px 1px 2px black;font-size:13px;word-spacing:2px;margin-bottom:30px}._dropdownBase_1m76y_64{color:#5eb086!important;background-color:#1e2530!important;font-size:12px;height:30px;display:flex;text-align:center;align-items:center;margin:auto}._dropdownControl_1m76y_74{color:#63af88!important;background-color:#1e2530!important;font-size:12px;height:30px}._dropdownControlSmall_1m76y_80{color:#63af88!important;background-color:#1e2530!important;font-size:12px;height:30px;width:120px}._input-box_1m76y_87{width:60px;height:20px;color:#5eb086;background-color:#050b0e80;border:none;font-size:medium;font-weight:500;margin:4px 15px}._input-box_1m76y_87:focus{outline:none}._input-box_1m76y_87::selection{background-color:#111f17;color:#5eb086}._flexSelect_1m76y_106{display:flex;justify-content:space-between;width:100%;height:40px;align-items:center}._arrow-button_1m76y_114{cursor:pointer;overflow:hidden;opacity:.8;width:32px;height:32px;margin:2px 2px 30px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_1m76y_130{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_1m76y_137{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._anim-button_1m76y_144:hover{opacity:1}._custom-checkbox_1m76y_149 input[type=checkbox]{display:none}._custom-checkbox_1m76y_149 ._checkbox-container_1m76y_154{display:inline-block;width:20px;height:20px;border:2px solid #284b39;border-radius:5px;cursor:pointer}._custom-checkbox_1m76y_149 ._checkbox-container_1m76y_154._checked_1m76y_163{background-color:#5eb086}._custom-checkbox_1m76y_149 ._checkbox-container_1m76y_154 ._checkmark_1m76y_167{display:none}._custom-checkbox_1m76y_149 input[type=checkbox]:checked+._checkbox-container_1m76y_154{background-color:#5eb086}._custom-checkbox_1m76y_149 input[type=checkbox]:checked+._checkbox-container_1m76y_154 ._checkmark_1m76y_167{display:block}._checkboxHolder_1m76y_180{display:flex;gap:30px;align-items:center;justify-content:center;align-content:center;height:40px}._actionButton_1m76y_189{margin:30px auto;text-align:center;outline-color:#3b434f;color:#d1d7df;outline-width:2px;outline-style:solid;background-color:#1e2530;height:30px;width:80%;font-family:TTSC-Bold;text-transform:uppercase!important;font-size:x-small;display:flex;justify-content:center;align-items:center;-webkit-user-select:none;user-select:none;cursor:pointer}._tabHolder_1m76y_209{width:95%;display:flex;justify-content:center;margin:auto}._tabButton_1m76y_215{margin:2px 3px;text-align:center;outline-color:#5eb086;color:#5eb086;outline-width:1px;width:60px;outline-style:solid;background-color:#1e2530;height:15px;padding:2px 10px;font-family:TTSC-Bold;text-transform:uppercase!important;font-size:x-small;display:flex;justify-content:center;align-items:center;-webkit-user-select:none;user-select:none;cursor:pointer}._tabButtonSelected_1m76y_235{outline-color:#34634b;color:#478666;cursor:auto}._slider-container_1y6nx_1{display:flex;align-items:center;text-align:center;margin-top:10px}._slider_1y6nx_1{width:100%;margin-right:10px}._infoContainer_1y6nx_13{display:flex;justify-content:space-between}._input-box_1y6nx_18{width:60px;height:20px;color:#5eb086;background-color:#050b0e80;border:none;font-size:medium;font-weight:500;margin-left:15px}._input-box_1y6nx_18:focus{outline:none}._input-box_1y6nx_18::selection{background-color:#111f17;color:#5eb086}.Dropdown-root{position:relative}.Dropdown-control{position:relative;overflow:hidden;background-color:#fff;border:1px solid #ccc;border-radius:2px;box-sizing:border-box;color:#333;cursor:default;outline:none;padding:8px 52px 8px 10px;transition:all .2s ease}.Dropdown-control:hover{box-shadow:0 1px #0000000f}.Dropdown-arrow{border-color:#999 transparent transparent;border-style:solid;border-width:5px 5px 0;content:" ";display:block;height:0;margin-top:-ceil(2.5);position:absolute;right:10px;top:14px;width:0}.is-open .Dropdown-arrow{border-color:transparent transparent #999;border-width:0 5px 5px}.Dropdown-menu{background-color:#fff;border:1px solid #ccc;box-shadow:0 1px #0000000f;box-sizing:border-box;margin-top:-1px;max-height:200px;overflow-y:auto;position:absolute;top:100%;width:100%;z-index:1000;-webkit-overflow-scrolling:touch}.Dropdown-menu .Dropdown-group>.Dropdown-title{padding:8px 10px;color:#333;font-weight:700;text-transform:capitalize}.Dropdown-option{box-sizing:border-box;color:#333c;cursor:pointer;display:block;padding:8px 10px}.Dropdown-option:last-child{border-bottom-right-radius:2px;border-bottom-left-radius:2px}.Dropdown-option:hover,.Dropdown-option.is-selected{background-color:#f2f9fc;color:#333}.Dropdown-noresults{box-sizing:border-box;color:#ccc;cursor:default;display:block;padding:8px 10px}._InformationContainerPos_10g06_2{position:fixed;right:132px;top:98px;width:250px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._scrollContainer_10g06_15{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:30px;height:-webkit-calc(100% - 40px);height:calc(100% - 40px)}._centerAlign_10g06_25{text-align:center}._traitInfoTitle_10g06_28{text-align:center;color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:14px;word-spacing:2px;margin-bottom:10px}._traitInfoText_10g06_39{color:#b3b3b3;text-shadow:1px 1px 2px black;font-size:14px;word-spacing:2px;margin-bottom:6px;display:flex;justify-content:left}._custom-checkbox_10g06_51 input[type=checkbox]{display:none}._custom-checkbox_10g06_51 ._checkbox-container_10g06_56{display:inline-block;width:20px;height:20px;border:2px solid #284b39;border-radius:5px;cursor:pointer}._custom-checkbox_10g06_51 ._checkbox-container_10g06_56._checked_10g06_65{background-color:#5eb086}._custom-checkbox_10g06_51 ._checkbox-container_10g06_56 ._checkmark_10g06_69{display:none}._custom-checkbox_10g06_51 input[type=checkbox]:checked+._checkbox-container_10g06_56{background-color:#5eb086}._custom-checkbox_10g06_51 input[type=checkbox]:checked+._checkbox-container_10g06_56 ._checkmark_10g06_69{display:block}._checkboxHolder_10g06_82{display:flex;gap:5px;align-items:center;justify-content:left;height:40px}._actionButton_10g06_92{margin:10px auto;text-align:center;outline-color:#3b434f;color:#d1d7df;outline-width:2px;outline-style:solid;background-color:#1e2530;height:30px;width:80%;font-family:TTSC-Bold;text-transform:uppercase!important;font-size:x-small;display:flex;justify-content:center;align-items:center;-webkit-user-select:none;user-select:none;cursor:pointer}._InformationContainerPos_rgqwy_1{position:fixed;left:32px;top:98px;width:350px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._traitInfoTitle_rgqwy_13{color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px}._traitInfoText_rgqwy_21{color:#b3b3b3;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px}._flexSelect_rgqwy_30{display:flex;justify-content:space-between;width:90%;height:40px;align-items:center}._arrow-button_rgqwy_37{cursor:pointer;overflow:hidden;opacity:.8;width:32px;height:32px;margin:2px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_rgqwy_51{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_rgqwy_58{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._scrollContainer_rgqwy_65{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:30px;height:-webkit-calc(100% - 40px);height:calc(100% - 40px)}._custom-checkbox_rgqwy_76 input[type=checkbox]{display:none}._custom-checkbox_rgqwy_76 ._checkbox-container_rgqwy_81{display:inline-block;width:20px;height:20px;border:2px solid #284b39;border-radius:5px;cursor:pointer}._custom-checkbox_rgqwy_76 ._checkbox-container_rgqwy_81._checked_rgqwy_90{background-color:#5eb086}._custom-checkbox_rgqwy_76 ._checkbox-container_rgqwy_81 ._checkmark_rgqwy_94{display:none}._custom-checkbox_rgqwy_76 input[type=checkbox]:checked+._checkbox-container_rgqwy_81{background-color:#5eb086}._custom-checkbox_rgqwy_76 input[type=checkbox]:checked+._checkbox-container_rgqwy_81 ._checkmark_rgqwy_94{display:block}._checkboxHolder_rgqwy_107{display:flex;gap:5px;align-items:center;justify-content:left;height:40px}._buttonContainer_rgqwy_114{position:absolute;bottom:20px;left:32px;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);text-align:center}._buttonContainer_rgqwy_114 ._buttonLeft_rgqwy_123{float:left}._buttonContainer_rgqwy_114 ._buttonRight_rgqwy_127{float:Right}._buttonContainer_rgqwy_114 ._buttonCenter_rgqwy_131{margin:0 8px}._buttonContainer_rgqwy_114:after{content:" ";display:block;clear:both}._buttonContainer_rgqwy_114 button{min-width:120px}._InformationContainerPos_11mqa_2{position:fixed;right:32px;top:98px;width:350px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none;text-align:right}._scrollContainer_11mqa_16{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:30px;height:-webkit-calc(100% - 40px);height:calc(100% - 40px)}._traitInfoTitle_11mqa_28{color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px;text-align:right}._traitInfoText_11mqa_38{color:#b3b3b3;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:30px;text-align:right}._input-box_11mqa_47{width:60px;height:20px;color:#5eb086;background-color:#050b0e80;border:none;font-size:medium;font-weight:500;margin-left:15px}._input-box_11mqa_47:focus{outline:none}._input-box_11mqa_47::selection{background-color:#111f17;color:#5eb086}._flexSelect_11mqa_66{display:flex;justify-content:center;width:100%;height:30px;align-items:center;margin-top:10px;margin-bottom:30px}._arrow-button_11mqa_76{cursor:pointer;overflow:hidden;opacity:.8;width:25px;height:25px;margin:2px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_11mqa_91{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_11mqa_98{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._anim-button_11mqa_105:hover{opacity:1}._custom-checkbox_11mqa_110 input[type=checkbox]{display:none}._custom-checkbox_11mqa_110 ._checkbox-container_11mqa_115{display:inline-block;width:20px;height:20px;border:2px solid #284b39;border-radius:5px;cursor:pointer}._custom-checkbox_11mqa_110 ._checkbox-container_11mqa_115._checked_11mqa_124{background-color:#5eb086}._custom-checkbox_11mqa_110 ._checkbox-container_11mqa_115 ._checkmark_11mqa_128{display:none}._custom-checkbox_11mqa_110 input[type=checkbox]:checked+._checkbox-container_11mqa_115{background-color:#5eb086}._custom-checkbox_11mqa_110 input[type=checkbox]:checked+._checkbox-container_11mqa_115 ._checkmark_11mqa_128{display:block}._checkboxHolder_11mqa_141{display:flex;gap:30px;align-items:center;justify-content:center;align-content:center;height:40px}._InformationContainerPos_b0msk_1{position:fixed;left:32px;top:98px;width:300px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._traitInfoTitle_b0msk_13{color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:14px;word-spacing:2px;margin-bottom:10px;text-align:center}._traitInfoText_b0msk_22{color:#b3b3b3;text-shadow:1px 1px 2px black;font-size:14px;word-spacing:2px;margin-bottom:6px;display:flex;justify-content:left}._flexSelect_b0msk_33{display:flex;justify-content:space-between;width:100%;height:20px;align-items:center}._arrow-button_b0msk_40{cursor:pointer;overflow:hidden;opacity:.8;width:22px;height:22px;margin:2px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_b0msk_54{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_b0msk_61{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._scrollContainer_b0msk_68{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:30px;height:-webkit-calc(100% - 40px);height:calc(100% - 40px)}._custom-checkbox_b0msk_79 input[type=checkbox]{display:none}._custom-checkbox_b0msk_79 ._checkbox-container_b0msk_84{display:inline-block;width:20px;height:20px;border:2px solid #284b39;border-radius:5px;cursor:pointer}._custom-checkbox_b0msk_79 ._checkbox-container_b0msk_84._checked_b0msk_93{background-color:#5eb086}._custom-checkbox_b0msk_79 ._checkbox-container_b0msk_84 ._checkmark_b0msk_97{display:none}._custom-checkbox_b0msk_79 input[type=checkbox]:checked+._checkbox-container_b0msk_84{background-color:#5eb086}._custom-checkbox_b0msk_79 input[type=checkbox]:checked+._checkbox-container_b0msk_84 ._checkmark_b0msk_97{display:block}._checkboxHolder_b0msk_110{display:flex;gap:5px;align-items:center;justify-content:left;height:40px}._classdisabled_hpzv8_1{pointer-events:none;opacity:.5}._container_hpzv8_6{display:flex;height:inherit;justify-content:center;align-items:center;flex-direction:column}._classContainer_hpzv8_14{text-align:center;color:#f0f8ff;overflow-x:scroll;overflow-y:hidden;white-space:nowrap;padding:2em;display:flex;justify-content:center;align-items:center;z-index:10}._classContainer_hpzv8_14 ._class_hpzv8_1,._classContainer_hpzv8_14 ._classdisabled_hpzv8_1{flex:1;display:flex;cursor:pointer;width:15em;flex-direction:column;margin:24px 8px 8px;align-items:center;justify-content:center}._classContainer_hpzv8_14 ._icon_hpzv8_39{flex:1;z-index:2;margin-top:-4vh}@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 2){._classContainer_hpzv8_14 ._icon_hpzv8_39{flex:1;z-index:2;margin-top:-1.5vh}}@media only screen and (min-device-width: 0) and (max-device-width: 768px) and (-webkit-min-device-pixel-ratio: 2){._classContainer_hpzv8_14 ._icon_hpzv8_39{flex:1;z-index:2;margin-top:-1vh}}._classContainer_hpzv8_14 ._icon_hpzv8_39 img{background:#000;width:100%;height:auto;max-width:3em}._classContainer_hpzv8_14 ._name_hpzv8_70{font-size:1.5em;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%;margin-top:1vh}._classContainer_hpzv8_14 ._description_hpzv8_79{font-size:1em;flex:1}._classContainer_hpzv8_14 ._classFrame_hpzv8_84{flex:1;width:100%;display:flex;align-items:center;justify-content:center;position:relative;z-index:0;overflow:hidden;background-size:contain;background-position:center;background-repeat:no-repeat;mask-size:100%;-webkit-mask-size:100%;mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat}._classContainer_hpzv8_14 ._classFrame_hpzv8_84 ._frameContainer_hpzv8_104{width:100%;flex:1}._classContainer_hpzv8_14 ._classFrame_hpzv8_84 ._frame_hpzv8_104{width:100%;height:auto}._classContainer_hpzv8_14 ._classFrame_hpzv8_84 ._image_hpzv8_114{width:100%;height:auto;max-width:230px}._classContainer_hpzv8_14 ._classFrame_hpzv8_84 ._lockedContainer_hpzv8_120{position:absolute}._classContainer_hpzv8_14 ._classFrame_hpzv8_84 ._locked_hpzv8_120{width:100%;height:auto;max-width:2vw}._classContainer_hpzv8_14 ._class_hpzv8_1:hover ._name_hpzv8_70{color:#fcc000}._buttonContainer_hpzv8_134{position:absolute;bottom:20px;left:32px;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);text-align:center}._buttonContainer_hpzv8_134 ._buttonLeft_hpzv8_143{float:left}._buttonContainer_hpzv8_134 ._buttonRight_hpzv8_147{float:Right}._buttonContainer_hpzv8_134 ._buttonCenter_hpzv8_151{margin:0 8px}._buttonContainer_hpzv8_134:after{content:" ";display:block;clear:both}._buttonContainer_hpzv8_134 button{min-width:120px}._topLine_hpzv8_165,._bottomLine_hpzv8_191{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);width:100%;height:1px;z-index:10}._buttonContainer_1ueuk_1{position:absolute;left:0;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);top:50%;transform:translateY(-50%);-webkit-transform:translateY(-50%);text-align:center;height:320px}._buttonContainer_1ueuk_1 ._button_1ueuk_1{background:none!important;border:none!important;cursor:pointer;margin:0 32px;height:320px;width:126px;position:relative}._buttonContainer_1ueuk_1 ._button_1ueuk_1 img{height:100%;transition:all .3s ease-in-out;position:absolute;left:0;top:0}._buttonContainer_1ueuk_1 ._button_1ueuk_1:hover img{top:-8px}._container_q73cc_1{display:flex;height:inherit;flex-direction:column}._container_q73cc_1 ._mintContainer_q73cc_6{width:100%;margin:auto;height:250px;max-width:350px;position:relative;text-align:center;z-index:1;display:flex;color:#f0f8ff;-webkit-user-select:none;user-select:none;align-items:center;flex-direction:column;justify-content:center}._container_q73cc_1 ._mintContainer_q73cc_6:before{top:0;left:0;right:0;bottom:0;content:"";z-index:-1;position:absolute;background:rgb(4,17,22);-webkit-clip-path:polygon(0 0,100% 0,90% 100%,9% 100%);clip-path:polygon(0 0,100% 0,90% 100%,9% 100%)}._container_q73cc_1 ._mintContainer_q73cc_6 ._mainTitleWrap_q73cc_33{z-index:0;width:100px;color:#5eb086;font-size:24px;text-align:center;padding:8px 0;background:rgb(12,20,24);margin:-24px auto;position:relative}._container_q73cc_1 ._mintContainer_q73cc_6 ._mainTitleWrap_q73cc_33 ._mainTitle_q73cc_33{text-transform:uppercase}._container_q73cc_1 ._mintContainer_q73cc_6 ._mintButtonContainer_q73cc_49{width:100%;display:flex;margin-top:auto;margin-bottom:15px;align-items:center;flex-direction:column}._container_q73cc_1 ._mintContainer_q73cc_6 ._mintButtonContainer_q73cc_49 ._mintButton_q73cc_49>div{padding:16px!important}._container_q73cc_1 ._mintContainer_q73cc_6 ._mintButtonContainer_q73cc_49 ._genesisText_q73cc_60{opacity:.4;margin-top:5px}._container_q73cc_1 ._mintContainer_q73cc_6 ._mintButtonContainer_q73cc_49 ._genesisText_q73cc_60 ._required_q73cc_64:after{content:"*";color:red}._container_q73cc_1 ._mintContainer_q73cc_6 ._mintButtonContainer_q73cc_49 ._divider_q73cc_68{width:80%;height:1px;margin:8px 0;opacity:.2;background:#e0e6e5}._container_q73cc_1 ._bottomContainer_q73cc_75{z-index:0;display:flex;padding:20px 32px;justify-content:space-between}._container_q73cc_1 ._bottomContainer_q73cc_75 button{min-width:120px}._mintInfo_q73cc_85{height:15px;padding-bottom:25px;opacity:.5}._topLine_q73cc_91{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);top:0;left:0;width:100%;height:1px;position:absolute;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1)}._bottomLine_q73cc_104{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;bottom:0;left:0;width:100%;height:1px}._buttonContainer_1fd4o_1{position:absolute;bottom:20px;left:32px;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);text-align:center}._buttonContainer_1fd4o_1 ._buttonLeft_1fd4o_10{float:left}._buttonContainer_1fd4o_1 ._buttonRight_1fd4o_14{float:Right}._buttonContainer_1fd4o_1 ._buttonCenter_1fd4o_18{margin:0 8px}._buttonContainer_1fd4o_1:after{content:" ";display:block;clear:both}._buttonContainer_1fd4o_1 button{min-width:120px}._button_13dfi_1{margin:0 8px} diff --git a/assets/index-97d9bef3.js b/assets/index-cde51aef.js similarity index 59% rename from assets/index-97d9bef3.js rename to assets/index-cde51aef.js index 86e2d175..16a18d05 100644 --- a/assets/index-97d9bef3.js +++ b/assets/index-cde51aef.js @@ -1,4 +1,4 @@ -var CW=Object.defineProperty;var TW=(n,e,t)=>e in n?CW(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var We=(n,e,t)=>(TW(n,typeof e!="symbol"?e+"":e,t),t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();var Na=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function oc(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function IW(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var Q4={exports:{}},Ix={},z4={exports:{}},Dt={};/** +var TW=Object.defineProperty;var IW=(n,e,t)=>e in n?TW(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Ne=(n,e,t)=>(IW(n,typeof e!="symbol"?e+"":e,t),t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();var ka=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function oc(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function RW(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var z4={exports:{}},Rx={},G4={exports:{}},Dt={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var CW=Object.defineProperty;var TW=(n,e,t)=>e in n?CW(n,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var s0=Symbol.for("react.element"),RW=Symbol.for("react.portal"),UW=Symbol.for("react.fragment"),FW=Symbol.for("react.strict_mode"),PW=Symbol.for("react.profiler"),LW=Symbol.for("react.provider"),DW=Symbol.for("react.context"),NW=Symbol.for("react.forward_ref"),OW=Symbol.for("react.suspense"),kW=Symbol.for("react.memo"),HW=Symbol.for("react.lazy"),EU=Symbol.iterator;function QW(n){return n===null||typeof n!="object"?null:(n=EU&&n[EU]||n["@@iterator"],typeof n=="function"?n:null)}var G4={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},V4=Object.assign,j4={};function kd(n,e,t){this.props=n,this.context=e,this.refs=j4,this.updater=t||G4}kd.prototype.isReactComponent={};kd.prototype.setState=function(n,e){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,e,"setState")};kd.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function W4(){}W4.prototype=kd.prototype;function nI(n,e,t){this.props=n,this.context=e,this.refs=j4,this.updater=t||G4}var rI=nI.prototype=new W4;rI.constructor=nI;V4(rI,kd.prototype);rI.isPureReactComponent=!0;var BU=Array.isArray,K4=Object.prototype.hasOwnProperty,iI={current:null},X4={key:!0,ref:!0,__self:!0,__source:!0};function Y4(n,e,t){var r,i={},s=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)K4.call(e,r)&&!X4.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=t;else if(1e in n?CW(n,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var WW=be,KW=Symbol.for("react.element"),XW=Symbol.for("react.fragment"),YW=Object.prototype.hasOwnProperty,$W=WW.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ZW={key:!0,ref:!0,__self:!0,__source:!0};function Z4(n,e,t){var r,i={},s=null,o=null;t!==void 0&&(s=""+t),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)YW.call(e,r)&&!ZW.hasOwnProperty(r)&&(i[r]=e[r]);if(n&&n.defaultProps)for(r in e=n.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:KW,type:n,key:s,ref:o,props:i,_owner:$W.current}}Ix.Fragment=XW;Ix.jsx=Z4;Ix.jsxs=Z4;Q4.exports=Ix;var k=Q4.exports,oI={exports:{}};const JW={},qW=Object.freeze(Object.defineProperty({__proto__:null,default:JW},Symbol.toStringTag,{value:"Module"})),e9=IW(qW);oI.exports;(function(n){(function(e,t){function r(T,y){if(!T)throw new Error(y||"Assertion failed")}function i(T,y){T.super_=y;var E=function(){};E.prototype=y.prototype,T.prototype=new E,T.prototype.constructor=T}function s(T,y,E){if(s.isBN(T))return T;this.negative=0,this.words=null,this.length=0,this.red=null,T!==null&&((y==="le"||y==="be")&&(E=y,y=10),this._init(T||0,y||10,E||"be"))}typeof e=="object"?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=e9.Buffer}catch{}s.isBN=function(y){return y instanceof s?!0:y!==null&&typeof y=="object"&&y.constructor.wordSize===s.wordSize&&Array.isArray(y.words)},s.max=function(y,E){return y.cmp(E)>0?y:E},s.min=function(y,E){return y.cmp(E)<0?y:E},s.prototype._init=function(y,E,R){if(typeof y=="number")return this._initNumber(y,E,R);if(typeof y=="object")return this._initArray(y,E,R);E==="hex"&&(E=16),r(E===(E|0)&&E>=2&&E<=36),y=y.toString().replace(/\s+/g,"");var F=0;y[0]==="-"&&(F++,this.negative=1),F=0;F-=3)z=y[F]|y[F-1]<<8|y[F-2]<<16,this.words[O]|=z<>>26-j&67108863,j+=24,j>=26&&(j-=26,O++);else if(R==="le")for(F=0,O=0;F>>26-j&67108863,j+=24,j>=26&&(j-=26,O++);return this._strip()};function a(T,y){var E=T.charCodeAt(y);if(E>=48&&E<=57)return E-48;if(E>=65&&E<=70)return E-55;if(E>=97&&E<=102)return E-87;r(!1,"Invalid character in "+T)}function l(T,y,E){var R=a(T,E);return E-1>=y&&(R|=a(T,E-1)<<4),R}s.prototype._parseHex=function(y,E,R){this.length=Math.ceil((y.length-E)/6),this.words=new Array(this.length);for(var F=0;F=E;F-=2)j=l(y,E,F)<=18?(O-=18,z+=1,this.words[z]|=j>>>26):O+=8;else{var H=y.length-E;for(F=H%2===0?E+1:E;F=18?(O-=18,z+=1,this.words[z]|=j>>>26):O+=8}this._strip()};function c(T,y,E,R){for(var F=0,O=0,z=Math.min(T.length,E),j=y;j=49?O=H-49+10:H>=17?O=H-17+10:O=H,r(H>=0&&O1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=u}catch{s.prototype.inspect=u}else s.prototype.inspect=u;function u(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(y,E){y=y||10,E=E|0||1;var R;if(y===16||y==="hex"){R="";for(var F=0,O=0,z=0;z>>24-F&16777215,F+=2,F>=26&&(F-=26,z--),O!==0||z!==this.length-1?R=f[6-H.length]+H+R:R=H+R}for(O!==0&&(R=O.toString(16)+R);R.length%E!==0;)R="0"+R;return this.negative!==0&&(R="-"+R),R}if(y===(y|0)&&y>=2&&y<=36){var C=h[y],W=d[y];R="";var ee=this.clone();for(ee.negative=0;!ee.isZero();){var P=ee.modrn(W).toString(y);ee=ee.idivn(W),ee.isZero()?R=P+R:R=f[C-P.length]+P+R}for(this.isZero()&&(R="0"+R);R.length%E!==0;)R="0"+R;return this.negative!==0&&(R="-"+R),R}r(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var y=this.words[0];return this.length===2?y+=this.words[1]*67108864:this.length===3&&this.words[2]===1?y+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-y:y},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(y,E){return this.toArrayLike(o,y,E)}),s.prototype.toArray=function(y,E){return this.toArrayLike(Array,y,E)};var m=function(y,E){return y.allocUnsafe?y.allocUnsafe(E):new y(E)};s.prototype.toArrayLike=function(y,E,R){this._strip();var F=this.byteLength(),O=R||Math.max(1,F);r(F<=O,"byte array longer than desired length"),r(O>0,"Requested array length <= 0");var z=m(y,O),j=E==="le"?"LE":"BE";return this["_toArrayLike"+j](z,F),z},s.prototype._toArrayLikeLE=function(y,E){for(var R=0,F=0,O=0,z=0;O>8&255),R>16&255),z===6?(R>24&255),F=0,z=0):(F=j>>>24,z+=2)}if(R=0&&(y[R--]=j>>8&255),R>=0&&(y[R--]=j>>16&255),z===6?(R>=0&&(y[R--]=j>>24&255),F=0,z=0):(F=j>>>24,z+=2)}if(R>=0)for(y[R--]=F;R>=0;)y[R--]=0},Math.clz32?s.prototype._countBits=function(y){return 32-Math.clz32(y)}:s.prototype._countBits=function(y){var E=y,R=0;return E>=4096&&(R+=13,E>>>=13),E>=64&&(R+=7,E>>>=7),E>=8&&(R+=4,E>>>=4),E>=2&&(R+=2,E>>>=2),R+E},s.prototype._zeroBits=function(y){if(y===0)return 26;var E=y,R=0;return E&8191||(R+=13,E>>>=13),E&127||(R+=7,E>>>=7),E&15||(R+=4,E>>>=4),E&3||(R+=2,E>>>=2),E&1||R++,R},s.prototype.bitLength=function(){var y=this.words[this.length-1],E=this._countBits(y);return(this.length-1)*26+E};function g(T){for(var y=new Array(T.bitLength()),E=0;E>>F&1}return y}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var y=0,E=0;Ey.length?this.clone().ior(y):y.clone().ior(this)},s.prototype.uor=function(y){return this.length>y.length?this.clone().iuor(y):y.clone().iuor(this)},s.prototype.iuand=function(y){var E;this.length>y.length?E=y:E=this;for(var R=0;Ry.length?this.clone().iand(y):y.clone().iand(this)},s.prototype.uand=function(y){return this.length>y.length?this.clone().iuand(y):y.clone().iuand(this)},s.prototype.iuxor=function(y){var E,R;this.length>y.length?(E=this,R=y):(E=y,R=this);for(var F=0;Fy.length?this.clone().ixor(y):y.clone().ixor(this)},s.prototype.uxor=function(y){return this.length>y.length?this.clone().iuxor(y):y.clone().iuxor(this)},s.prototype.inotn=function(y){r(typeof y=="number"&&y>=0);var E=Math.ceil(y/26)|0,R=y%26;this._expand(E),R>0&&E--;for(var F=0;F0&&(this.words[F]=~this.words[F]&67108863>>26-R),this._strip()},s.prototype.notn=function(y){return this.clone().inotn(y)},s.prototype.setn=function(y,E){r(typeof y=="number"&&y>=0);var R=y/26|0,F=y%26;return this._expand(R+1),E?this.words[R]=this.words[R]|1<y.length?(R=this,F=y):(R=y,F=this);for(var O=0,z=0;z>>26;for(;O!==0&&z>>26;if(this.length=R.length,O!==0)this.words[this.length]=O,this.length++;else if(R!==this)for(;zy.length?this.clone().iadd(y):y.clone().iadd(this)},s.prototype.isub=function(y){if(y.negative!==0){y.negative=0;var E=this.iadd(y);return y.negative=1,E._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(y),this.negative=1,this._normSign();var R=this.cmp(y);if(R===0)return this.negative=0,this.length=1,this.words[0]=0,this;var F,O;R>0?(F=this,O=y):(F=y,O=this);for(var z=0,j=0;j>26,this.words[j]=E&67108863;for(;z!==0&&j>26,this.words[j]=E&67108863;if(z===0&&j>>26,ee=H&67108863,P=Math.min(C,y.length-1),re=Math.max(0,C-T.length+1);re<=P;re++){var ue=C-re|0;F=T.words[ue]|0,O=y.words[re]|0,z=F*O+ee,W+=z/67108864|0,ee=z&67108863}E.words[C]=ee|0,H=W|0}return H!==0?E.words[C]=H|0:E.length--,E._strip()}var v=function(y,E,R){var F=y.words,O=E.words,z=R.words,j=0,H,C,W,ee=F[0]|0,P=ee&8191,re=ee>>>13,ue=F[1]|0,le=ue&8191,me=ue>>>13,ie=F[2]|0,ge=ie&8191,_e=ie>>>13,se=F[3]|0,Q=se&8191,fe=se>>>13,Ae=F[4]|0,Z=Ae&8191,q=Ae>>>13,he=F[5]|0,X=he&8191,G=he>>>13,ne=F[6]|0,Y=ne&8191,de=ne>>>13,ae=F[7]|0,Ee=ae&8191,V=ae>>>13,U=F[8]|0,N=U&8191,K=U>>>13,oe=F[9]|0,pe=oe&8191,ve=oe>>>13,Ce=O[0]|0,Le=Ce&8191,Re=Ce>>>13,$e=O[1]|0,ce=$e&8191,Pe=$e>>>13,Me=O[2]|0,Te=Me&8191,Fe=Me>>>13,De=O[3]|0,Ze=De&8191,At=De>>>13,Pn=O[4]|0,rt=Pn&8191,xt=Pn>>>13,Tr=O[5]|0,tn=Tr&8191,qt=Tr>>>13,Zr=O[6]|0,en=Zr&8191,nn=Zr>>>13,Ks=O[7]|0,Xt=Ks&8191,Yt=Ks>>>13,Ii=O[8]|0,rn=Ii&8191,sn=Ii>>>13,da=O[9]|0,un=da&8191,on=da>>>13;R.negative=y.negative^E.negative,R.length=19,H=Math.imul(P,Le),C=Math.imul(P,Re),C=C+Math.imul(re,Le)|0,W=Math.imul(re,Re);var te=(j+H|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(te>>>26)|0,te&=67108863,H=Math.imul(le,Le),C=Math.imul(le,Re),C=C+Math.imul(me,Le)|0,W=Math.imul(me,Re),H=H+Math.imul(P,ce)|0,C=C+Math.imul(P,Pe)|0,C=C+Math.imul(re,ce)|0,W=W+Math.imul(re,Pe)|0;var ye=(j+H|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(ye>>>26)|0,ye&=67108863,H=Math.imul(ge,Le),C=Math.imul(ge,Re),C=C+Math.imul(_e,Le)|0,W=Math.imul(_e,Re),H=H+Math.imul(le,ce)|0,C=C+Math.imul(le,Pe)|0,C=C+Math.imul(me,ce)|0,W=W+Math.imul(me,Pe)|0,H=H+Math.imul(P,Te)|0,C=C+Math.imul(P,Fe)|0,C=C+Math.imul(re,Te)|0,W=W+Math.imul(re,Fe)|0;var Be=(j+H|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(Be>>>26)|0,Be&=67108863,H=Math.imul(Q,Le),C=Math.imul(Q,Re),C=C+Math.imul(fe,Le)|0,W=Math.imul(fe,Re),H=H+Math.imul(ge,ce)|0,C=C+Math.imul(ge,Pe)|0,C=C+Math.imul(_e,ce)|0,W=W+Math.imul(_e,Pe)|0,H=H+Math.imul(le,Te)|0,C=C+Math.imul(le,Fe)|0,C=C+Math.imul(me,Te)|0,W=W+Math.imul(me,Fe)|0,H=H+Math.imul(P,Ze)|0,C=C+Math.imul(P,At)|0,C=C+Math.imul(re,Ze)|0,W=W+Math.imul(re,At)|0;var Se=(j+H|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(Se>>>26)|0,Se&=67108863,H=Math.imul(Z,Le),C=Math.imul(Z,Re),C=C+Math.imul(q,Le)|0,W=Math.imul(q,Re),H=H+Math.imul(Q,ce)|0,C=C+Math.imul(Q,Pe)|0,C=C+Math.imul(fe,ce)|0,W=W+Math.imul(fe,Pe)|0,H=H+Math.imul(ge,Te)|0,C=C+Math.imul(ge,Fe)|0,C=C+Math.imul(_e,Te)|0,W=W+Math.imul(_e,Fe)|0,H=H+Math.imul(le,Ze)|0,C=C+Math.imul(le,At)|0,C=C+Math.imul(me,Ze)|0,W=W+Math.imul(me,At)|0,H=H+Math.imul(P,rt)|0,C=C+Math.imul(P,xt)|0,C=C+Math.imul(re,rt)|0,W=W+Math.imul(re,xt)|0;var we=(j+H|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(we>>>26)|0,we&=67108863,H=Math.imul(X,Le),C=Math.imul(X,Re),C=C+Math.imul(G,Le)|0,W=Math.imul(G,Re),H=H+Math.imul(Z,ce)|0,C=C+Math.imul(Z,Pe)|0,C=C+Math.imul(q,ce)|0,W=W+Math.imul(q,Pe)|0,H=H+Math.imul(Q,Te)|0,C=C+Math.imul(Q,Fe)|0,C=C+Math.imul(fe,Te)|0,W=W+Math.imul(fe,Fe)|0,H=H+Math.imul(ge,Ze)|0,C=C+Math.imul(ge,At)|0,C=C+Math.imul(_e,Ze)|0,W=W+Math.imul(_e,At)|0,H=H+Math.imul(le,rt)|0,C=C+Math.imul(le,xt)|0,C=C+Math.imul(me,rt)|0,W=W+Math.imul(me,xt)|0,H=H+Math.imul(P,tn)|0,C=C+Math.imul(P,qt)|0,C=C+Math.imul(re,tn)|0,W=W+Math.imul(re,qt)|0;var Oe=(j+H|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,H=Math.imul(Y,Le),C=Math.imul(Y,Re),C=C+Math.imul(de,Le)|0,W=Math.imul(de,Re),H=H+Math.imul(X,ce)|0,C=C+Math.imul(X,Pe)|0,C=C+Math.imul(G,ce)|0,W=W+Math.imul(G,Pe)|0,H=H+Math.imul(Z,Te)|0,C=C+Math.imul(Z,Fe)|0,C=C+Math.imul(q,Te)|0,W=W+Math.imul(q,Fe)|0,H=H+Math.imul(Q,Ze)|0,C=C+Math.imul(Q,At)|0,C=C+Math.imul(fe,Ze)|0,W=W+Math.imul(fe,At)|0,H=H+Math.imul(ge,rt)|0,C=C+Math.imul(ge,xt)|0,C=C+Math.imul(_e,rt)|0,W=W+Math.imul(_e,xt)|0,H=H+Math.imul(le,tn)|0,C=C+Math.imul(le,qt)|0,C=C+Math.imul(me,tn)|0,W=W+Math.imul(me,qt)|0,H=H+Math.imul(P,en)|0,C=C+Math.imul(P,nn)|0,C=C+Math.imul(re,en)|0,W=W+Math.imul(re,nn)|0;var Xe=(j+H|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(Xe>>>26)|0,Xe&=67108863,H=Math.imul(Ee,Le),C=Math.imul(Ee,Re),C=C+Math.imul(V,Le)|0,W=Math.imul(V,Re),H=H+Math.imul(Y,ce)|0,C=C+Math.imul(Y,Pe)|0,C=C+Math.imul(de,ce)|0,W=W+Math.imul(de,Pe)|0,H=H+Math.imul(X,Te)|0,C=C+Math.imul(X,Fe)|0,C=C+Math.imul(G,Te)|0,W=W+Math.imul(G,Fe)|0,H=H+Math.imul(Z,Ze)|0,C=C+Math.imul(Z,At)|0,C=C+Math.imul(q,Ze)|0,W=W+Math.imul(q,At)|0,H=H+Math.imul(Q,rt)|0,C=C+Math.imul(Q,xt)|0,C=C+Math.imul(fe,rt)|0,W=W+Math.imul(fe,xt)|0,H=H+Math.imul(ge,tn)|0,C=C+Math.imul(ge,qt)|0,C=C+Math.imul(_e,tn)|0,W=W+Math.imul(_e,qt)|0,H=H+Math.imul(le,en)|0,C=C+Math.imul(le,nn)|0,C=C+Math.imul(me,en)|0,W=W+Math.imul(me,nn)|0,H=H+Math.imul(P,Xt)|0,C=C+Math.imul(P,Yt)|0,C=C+Math.imul(re,Xt)|0,W=W+Math.imul(re,Yt)|0;var qe=(j+H|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(qe>>>26)|0,qe&=67108863,H=Math.imul(N,Le),C=Math.imul(N,Re),C=C+Math.imul(K,Le)|0,W=Math.imul(K,Re),H=H+Math.imul(Ee,ce)|0,C=C+Math.imul(Ee,Pe)|0,C=C+Math.imul(V,ce)|0,W=W+Math.imul(V,Pe)|0,H=H+Math.imul(Y,Te)|0,C=C+Math.imul(Y,Fe)|0,C=C+Math.imul(de,Te)|0,W=W+Math.imul(de,Fe)|0,H=H+Math.imul(X,Ze)|0,C=C+Math.imul(X,At)|0,C=C+Math.imul(G,Ze)|0,W=W+Math.imul(G,At)|0,H=H+Math.imul(Z,rt)|0,C=C+Math.imul(Z,xt)|0,C=C+Math.imul(q,rt)|0,W=W+Math.imul(q,xt)|0,H=H+Math.imul(Q,tn)|0,C=C+Math.imul(Q,qt)|0,C=C+Math.imul(fe,tn)|0,W=W+Math.imul(fe,qt)|0,H=H+Math.imul(ge,en)|0,C=C+Math.imul(ge,nn)|0,C=C+Math.imul(_e,en)|0,W=W+Math.imul(_e,nn)|0,H=H+Math.imul(le,Xt)|0,C=C+Math.imul(le,Yt)|0,C=C+Math.imul(me,Xt)|0,W=W+Math.imul(me,Yt)|0,H=H+Math.imul(P,rn)|0,C=C+Math.imul(P,sn)|0,C=C+Math.imul(re,rn)|0,W=W+Math.imul(re,sn)|0;var tt=(j+H|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(tt>>>26)|0,tt&=67108863,H=Math.imul(pe,Le),C=Math.imul(pe,Re),C=C+Math.imul(ve,Le)|0,W=Math.imul(ve,Re),H=H+Math.imul(N,ce)|0,C=C+Math.imul(N,Pe)|0,C=C+Math.imul(K,ce)|0,W=W+Math.imul(K,Pe)|0,H=H+Math.imul(Ee,Te)|0,C=C+Math.imul(Ee,Fe)|0,C=C+Math.imul(V,Te)|0,W=W+Math.imul(V,Fe)|0,H=H+Math.imul(Y,Ze)|0,C=C+Math.imul(Y,At)|0,C=C+Math.imul(de,Ze)|0,W=W+Math.imul(de,At)|0,H=H+Math.imul(X,rt)|0,C=C+Math.imul(X,xt)|0,C=C+Math.imul(G,rt)|0,W=W+Math.imul(G,xt)|0,H=H+Math.imul(Z,tn)|0,C=C+Math.imul(Z,qt)|0,C=C+Math.imul(q,tn)|0,W=W+Math.imul(q,qt)|0,H=H+Math.imul(Q,en)|0,C=C+Math.imul(Q,nn)|0,C=C+Math.imul(fe,en)|0,W=W+Math.imul(fe,nn)|0,H=H+Math.imul(ge,Xt)|0,C=C+Math.imul(ge,Yt)|0,C=C+Math.imul(_e,Xt)|0,W=W+Math.imul(_e,Yt)|0,H=H+Math.imul(le,rn)|0,C=C+Math.imul(le,sn)|0,C=C+Math.imul(me,rn)|0,W=W+Math.imul(me,sn)|0,H=H+Math.imul(P,un)|0,C=C+Math.imul(P,on)|0,C=C+Math.imul(re,un)|0,W=W+Math.imul(re,on)|0;var ft=(j+H|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(ft>>>26)|0,ft&=67108863,H=Math.imul(pe,ce),C=Math.imul(pe,Pe),C=C+Math.imul(ve,ce)|0,W=Math.imul(ve,Pe),H=H+Math.imul(N,Te)|0,C=C+Math.imul(N,Fe)|0,C=C+Math.imul(K,Te)|0,W=W+Math.imul(K,Fe)|0,H=H+Math.imul(Ee,Ze)|0,C=C+Math.imul(Ee,At)|0,C=C+Math.imul(V,Ze)|0,W=W+Math.imul(V,At)|0,H=H+Math.imul(Y,rt)|0,C=C+Math.imul(Y,xt)|0,C=C+Math.imul(de,rt)|0,W=W+Math.imul(de,xt)|0,H=H+Math.imul(X,tn)|0,C=C+Math.imul(X,qt)|0,C=C+Math.imul(G,tn)|0,W=W+Math.imul(G,qt)|0,H=H+Math.imul(Z,en)|0,C=C+Math.imul(Z,nn)|0,C=C+Math.imul(q,en)|0,W=W+Math.imul(q,nn)|0,H=H+Math.imul(Q,Xt)|0,C=C+Math.imul(Q,Yt)|0,C=C+Math.imul(fe,Xt)|0,W=W+Math.imul(fe,Yt)|0,H=H+Math.imul(ge,rn)|0,C=C+Math.imul(ge,sn)|0,C=C+Math.imul(_e,rn)|0,W=W+Math.imul(_e,sn)|0,H=H+Math.imul(le,un)|0,C=C+Math.imul(le,on)|0,C=C+Math.imul(me,un)|0,W=W+Math.imul(me,on)|0;var mt=(j+H|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(mt>>>26)|0,mt&=67108863,H=Math.imul(pe,Te),C=Math.imul(pe,Fe),C=C+Math.imul(ve,Te)|0,W=Math.imul(ve,Fe),H=H+Math.imul(N,Ze)|0,C=C+Math.imul(N,At)|0,C=C+Math.imul(K,Ze)|0,W=W+Math.imul(K,At)|0,H=H+Math.imul(Ee,rt)|0,C=C+Math.imul(Ee,xt)|0,C=C+Math.imul(V,rt)|0,W=W+Math.imul(V,xt)|0,H=H+Math.imul(Y,tn)|0,C=C+Math.imul(Y,qt)|0,C=C+Math.imul(de,tn)|0,W=W+Math.imul(de,qt)|0,H=H+Math.imul(X,en)|0,C=C+Math.imul(X,nn)|0,C=C+Math.imul(G,en)|0,W=W+Math.imul(G,nn)|0,H=H+Math.imul(Z,Xt)|0,C=C+Math.imul(Z,Yt)|0,C=C+Math.imul(q,Xt)|0,W=W+Math.imul(q,Yt)|0,H=H+Math.imul(Q,rn)|0,C=C+Math.imul(Q,sn)|0,C=C+Math.imul(fe,rn)|0,W=W+Math.imul(fe,sn)|0,H=H+Math.imul(ge,un)|0,C=C+Math.imul(ge,on)|0,C=C+Math.imul(_e,un)|0,W=W+Math.imul(_e,on)|0;var st=(j+H|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(st>>>26)|0,st&=67108863,H=Math.imul(pe,Ze),C=Math.imul(pe,At),C=C+Math.imul(ve,Ze)|0,W=Math.imul(ve,At),H=H+Math.imul(N,rt)|0,C=C+Math.imul(N,xt)|0,C=C+Math.imul(K,rt)|0,W=W+Math.imul(K,xt)|0,H=H+Math.imul(Ee,tn)|0,C=C+Math.imul(Ee,qt)|0,C=C+Math.imul(V,tn)|0,W=W+Math.imul(V,qt)|0,H=H+Math.imul(Y,en)|0,C=C+Math.imul(Y,nn)|0,C=C+Math.imul(de,en)|0,W=W+Math.imul(de,nn)|0,H=H+Math.imul(X,Xt)|0,C=C+Math.imul(X,Yt)|0,C=C+Math.imul(G,Xt)|0,W=W+Math.imul(G,Yt)|0,H=H+Math.imul(Z,rn)|0,C=C+Math.imul(Z,sn)|0,C=C+Math.imul(q,rn)|0,W=W+Math.imul(q,sn)|0,H=H+Math.imul(Q,un)|0,C=C+Math.imul(Q,on)|0,C=C+Math.imul(fe,un)|0,W=W+Math.imul(fe,on)|0;var Wt=(j+H|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,H=Math.imul(pe,rt),C=Math.imul(pe,xt),C=C+Math.imul(ve,rt)|0,W=Math.imul(ve,xt),H=H+Math.imul(N,tn)|0,C=C+Math.imul(N,qt)|0,C=C+Math.imul(K,tn)|0,W=W+Math.imul(K,qt)|0,H=H+Math.imul(Ee,en)|0,C=C+Math.imul(Ee,nn)|0,C=C+Math.imul(V,en)|0,W=W+Math.imul(V,nn)|0,H=H+Math.imul(Y,Xt)|0,C=C+Math.imul(Y,Yt)|0,C=C+Math.imul(de,Xt)|0,W=W+Math.imul(de,Yt)|0,H=H+Math.imul(X,rn)|0,C=C+Math.imul(X,sn)|0,C=C+Math.imul(G,rn)|0,W=W+Math.imul(G,sn)|0,H=H+Math.imul(Z,un)|0,C=C+Math.imul(Z,on)|0,C=C+Math.imul(q,un)|0,W=W+Math.imul(q,on)|0;var fn=(j+H|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(fn>>>26)|0,fn&=67108863,H=Math.imul(pe,tn),C=Math.imul(pe,qt),C=C+Math.imul(ve,tn)|0,W=Math.imul(ve,qt),H=H+Math.imul(N,en)|0,C=C+Math.imul(N,nn)|0,C=C+Math.imul(K,en)|0,W=W+Math.imul(K,nn)|0,H=H+Math.imul(Ee,Xt)|0,C=C+Math.imul(Ee,Yt)|0,C=C+Math.imul(V,Xt)|0,W=W+Math.imul(V,Yt)|0,H=H+Math.imul(Y,rn)|0,C=C+Math.imul(Y,sn)|0,C=C+Math.imul(de,rn)|0,W=W+Math.imul(de,sn)|0,H=H+Math.imul(X,un)|0,C=C+Math.imul(X,on)|0,C=C+Math.imul(G,un)|0,W=W+Math.imul(G,on)|0;var yn=(j+H|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(yn>>>26)|0,yn&=67108863,H=Math.imul(pe,en),C=Math.imul(pe,nn),C=C+Math.imul(ve,en)|0,W=Math.imul(ve,nn),H=H+Math.imul(N,Xt)|0,C=C+Math.imul(N,Yt)|0,C=C+Math.imul(K,Xt)|0,W=W+Math.imul(K,Yt)|0,H=H+Math.imul(Ee,rn)|0,C=C+Math.imul(Ee,sn)|0,C=C+Math.imul(V,rn)|0,W=W+Math.imul(V,sn)|0,H=H+Math.imul(Y,un)|0,C=C+Math.imul(Y,on)|0,C=C+Math.imul(de,un)|0,W=W+Math.imul(de,on)|0;var Jr=(j+H|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(Jr>>>26)|0,Jr&=67108863,H=Math.imul(pe,Xt),C=Math.imul(pe,Yt),C=C+Math.imul(ve,Xt)|0,W=Math.imul(ve,Yt),H=H+Math.imul(N,rn)|0,C=C+Math.imul(N,sn)|0,C=C+Math.imul(K,rn)|0,W=W+Math.imul(K,sn)|0,H=H+Math.imul(Ee,un)|0,C=C+Math.imul(Ee,on)|0,C=C+Math.imul(V,un)|0,W=W+Math.imul(V,on)|0;var Vt=(j+H|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,H=Math.imul(pe,rn),C=Math.imul(pe,sn),C=C+Math.imul(ve,rn)|0,W=Math.imul(ve,sn),H=H+Math.imul(N,un)|0,C=C+Math.imul(N,on)|0,C=C+Math.imul(K,un)|0,W=W+Math.imul(K,on)|0;var at=(j+H|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(at>>>26)|0,at&=67108863,H=Math.imul(pe,un),C=Math.imul(pe,on),C=C+Math.imul(ve,un)|0,W=Math.imul(ve,on);var or=(j+H|0)+((C&8191)<<13)|0;return j=(W+(C>>>13)|0)+(or>>>26)|0,or&=67108863,z[0]=te,z[1]=ye,z[2]=Be,z[3]=Se,z[4]=we,z[5]=Oe,z[6]=Xe,z[7]=qe,z[8]=tt,z[9]=ft,z[10]=mt,z[11]=st,z[12]=Wt,z[13]=fn,z[14]=yn,z[15]=Jr,z[16]=Vt,z[17]=at,z[18]=or,j!==0&&(z[19]=j,R.length++),R};Math.imul||(v=p);function w(T,y,E){E.negative=y.negative^T.negative,E.length=T.length+y.length;for(var R=0,F=0,O=0;O>>26)|0,F+=z>>>26,z&=67108863}E.words[O]=j,R=z,z=F}return R!==0?E.words[O]=R:E.length--,E._strip()}function _(T,y,E){return w(T,y,E)}s.prototype.mulTo=function(y,E){var R,F=this.length+y.length;return this.length===10&&y.length===10?R=v(this,y,E):F<63?R=p(this,y,E):F<1024?R=w(this,y,E):R=_(this,y,E),R},s.prototype.mul=function(y){var E=new s(null);return E.words=new Array(this.length+y.length),this.mulTo(y,E)},s.prototype.mulf=function(y){var E=new s(null);return E.words=new Array(this.length+y.length),_(this,y,E)},s.prototype.imul=function(y){return this.clone().mulTo(y,this)},s.prototype.imuln=function(y){var E=y<0;E&&(y=-y),r(typeof y=="number"),r(y<67108864);for(var R=0,F=0;F>=26,R+=O/67108864|0,R+=z>>>26,this.words[F]=z&67108863}return R!==0&&(this.words[F]=R,this.length++),E?this.ineg():this},s.prototype.muln=function(y){return this.clone().imuln(y)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(y){var E=g(y);if(E.length===0)return new s(1);for(var R=this,F=0;F=0);var E=y%26,R=(y-E)/26,F=67108863>>>26-E<<26-E,O;if(E!==0){var z=0;for(O=0;O>>26-E}z&&(this.words[O]=z,this.length++)}if(R!==0){for(O=this.length-1;O>=0;O--)this.words[O+R]=this.words[O];for(O=0;O=0);var F;E?F=(E-E%26)/26:F=0;var O=y%26,z=Math.min((y-O)/26,this.length),j=67108863^67108863>>>O<z)for(this.length-=z,C=0;C=0&&(W!==0||C>=F);C--){var ee=this.words[C]|0;this.words[C]=W<<26-O|ee>>>O,W=ee&j}return H&&W!==0&&(H.words[H.length++]=W),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(y,E,R){return r(this.negative===0),this.iushrn(y,E,R)},s.prototype.shln=function(y){return this.clone().ishln(y)},s.prototype.ushln=function(y){return this.clone().iushln(y)},s.prototype.shrn=function(y){return this.clone().ishrn(y)},s.prototype.ushrn=function(y){return this.clone().iushrn(y)},s.prototype.testn=function(y){r(typeof y=="number"&&y>=0);var E=y%26,R=(y-E)/26,F=1<=0);var E=y%26,R=(y-E)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=R)return this;if(E!==0&&R++,this.length=Math.min(R,this.length),E!==0){var F=67108863^67108863>>>E<=67108864;E++)this.words[E]-=67108864,E===this.length-1?this.words[E+1]=1:this.words[E+1]++;return this.length=Math.max(this.length,E+1),this},s.prototype.isubn=function(y){if(r(typeof y=="number"),r(y<67108864),y<0)return this.iaddn(-y);if(this.negative!==0)return this.negative=0,this.iaddn(y),this.negative=1,this;if(this.words[0]-=y,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var E=0;E>26)-(H/67108864|0),this.words[O+R]=z&67108863}for(;O>26,this.words[O+R]=z&67108863;if(j===0)return this._strip();for(r(j===-1),j=0,O=0;O>26,this.words[O]=z&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(y,E){var R=this.length-y.length,F=this.clone(),O=y,z=O.words[O.length-1]|0,j=this._countBits(z);R=26-j,R!==0&&(O=O.ushln(R),F.iushln(R),z=O.words[O.length-1]|0);var H=F.length-O.length,C;if(E!=="mod"){C=new s(null),C.length=H+1,C.words=new Array(C.length);for(var W=0;W=0;P--){var re=(F.words[O.length+P]|0)*67108864+(F.words[O.length+P-1]|0);for(re=Math.min(re/z|0,67108863),F._ishlnsubmul(O,re,P);F.negative!==0;)re--,F.negative=0,F._ishlnsubmul(O,1,P),F.isZero()||(F.negative^=1);C&&(C.words[P]=re)}return C&&C._strip(),F._strip(),E!=="div"&&R!==0&&F.iushrn(R),{div:C||null,mod:F}},s.prototype.divmod=function(y,E,R){if(r(!y.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var F,O,z;return this.negative!==0&&y.negative===0?(z=this.neg().divmod(y,E),E!=="mod"&&(F=z.div.neg()),E!=="div"&&(O=z.mod.neg(),R&&O.negative!==0&&O.iadd(y)),{div:F,mod:O}):this.negative===0&&y.negative!==0?(z=this.divmod(y.neg(),E),E!=="mod"&&(F=z.div.neg()),{div:F,mod:z.mod}):this.negative&y.negative?(z=this.neg().divmod(y.neg(),E),E!=="div"&&(O=z.mod.neg(),R&&O.negative!==0&&O.isub(y)),{div:z.div,mod:O}):y.length>this.length||this.cmp(y)<0?{div:new s(0),mod:this}:y.length===1?E==="div"?{div:this.divn(y.words[0]),mod:null}:E==="mod"?{div:null,mod:new s(this.modrn(y.words[0]))}:{div:this.divn(y.words[0]),mod:new s(this.modrn(y.words[0]))}:this._wordDiv(y,E)},s.prototype.div=function(y){return this.divmod(y,"div",!1).div},s.prototype.mod=function(y){return this.divmod(y,"mod",!1).mod},s.prototype.umod=function(y){return this.divmod(y,"mod",!0).mod},s.prototype.divRound=function(y){var E=this.divmod(y);if(E.mod.isZero())return E.div;var R=E.div.negative!==0?E.mod.isub(y):E.mod,F=y.ushrn(1),O=y.andln(1),z=R.cmp(F);return z<0||O===1&&z===0?E.div:E.div.negative!==0?E.div.isubn(1):E.div.iaddn(1)},s.prototype.modrn=function(y){var E=y<0;E&&(y=-y),r(y<=67108863);for(var R=(1<<26)%y,F=0,O=this.length-1;O>=0;O--)F=(R*F+(this.words[O]|0))%y;return E?-F:F},s.prototype.modn=function(y){return this.modrn(y)},s.prototype.idivn=function(y){var E=y<0;E&&(y=-y),r(y<=67108863);for(var R=0,F=this.length-1;F>=0;F--){var O=(this.words[F]|0)+R*67108864;this.words[F]=O/y|0,R=O%y}return this._strip(),E?this.ineg():this},s.prototype.divn=function(y){return this.clone().idivn(y)},s.prototype.egcd=function(y){r(y.negative===0),r(!y.isZero());var E=this,R=y.clone();E.negative!==0?E=E.umod(y):E=E.clone();for(var F=new s(1),O=new s(0),z=new s(0),j=new s(1),H=0;E.isEven()&&R.isEven();)E.iushrn(1),R.iushrn(1),++H;for(var C=R.clone(),W=E.clone();!E.isZero();){for(var ee=0,P=1;!(E.words[0]&P)&&ee<26;++ee,P<<=1);if(ee>0)for(E.iushrn(ee);ee-- >0;)(F.isOdd()||O.isOdd())&&(F.iadd(C),O.isub(W)),F.iushrn(1),O.iushrn(1);for(var re=0,ue=1;!(R.words[0]&ue)&&re<26;++re,ue<<=1);if(re>0)for(R.iushrn(re);re-- >0;)(z.isOdd()||j.isOdd())&&(z.iadd(C),j.isub(W)),z.iushrn(1),j.iushrn(1);E.cmp(R)>=0?(E.isub(R),F.isub(z),O.isub(j)):(R.isub(E),z.isub(F),j.isub(O))}return{a:z,b:j,gcd:R.iushln(H)}},s.prototype._invmp=function(y){r(y.negative===0),r(!y.isZero());var E=this,R=y.clone();E.negative!==0?E=E.umod(y):E=E.clone();for(var F=new s(1),O=new s(0),z=R.clone();E.cmpn(1)>0&&R.cmpn(1)>0;){for(var j=0,H=1;!(E.words[0]&H)&&j<26;++j,H<<=1);if(j>0)for(E.iushrn(j);j-- >0;)F.isOdd()&&F.iadd(z),F.iushrn(1);for(var C=0,W=1;!(R.words[0]&W)&&C<26;++C,W<<=1);if(C>0)for(R.iushrn(C);C-- >0;)O.isOdd()&&O.iadd(z),O.iushrn(1);E.cmp(R)>=0?(E.isub(R),F.isub(O)):(R.isub(E),O.isub(F))}var ee;return E.cmpn(1)===0?ee=F:ee=O,ee.cmpn(0)<0&&ee.iadd(y),ee},s.prototype.gcd=function(y){if(this.isZero())return y.abs();if(y.isZero())return this.abs();var E=this.clone(),R=y.clone();E.negative=0,R.negative=0;for(var F=0;E.isEven()&&R.isEven();F++)E.iushrn(1),R.iushrn(1);do{for(;E.isEven();)E.iushrn(1);for(;R.isEven();)R.iushrn(1);var O=E.cmp(R);if(O<0){var z=E;E=R,R=z}else if(O===0||R.cmpn(1)===0)break;E.isub(R)}while(!0);return R.iushln(F)},s.prototype.invm=function(y){return this.egcd(y).a.umod(y)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(y){return this.words[0]&y},s.prototype.bincn=function(y){r(typeof y=="number");var E=y%26,R=(y-E)/26,F=1<>>26,j&=67108863,this.words[z]=j}return O!==0&&(this.words[z]=O,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(y){var E=y<0;if(this.negative!==0&&!E)return-1;if(this.negative===0&&E)return 1;this._strip();var R;if(this.length>1)R=1;else{E&&(y=-y),r(y<=67108863,"Number is too big");var F=this.words[0]|0;R=F===y?0:Fy.length)return 1;if(this.length=0;R--){var F=this.words[R]|0,O=y.words[R]|0;if(F!==O){FO&&(E=1);break}}return E},s.prototype.gtn=function(y){return this.cmpn(y)===1},s.prototype.gt=function(y){return this.cmp(y)===1},s.prototype.gten=function(y){return this.cmpn(y)>=0},s.prototype.gte=function(y){return this.cmp(y)>=0},s.prototype.ltn=function(y){return this.cmpn(y)===-1},s.prototype.lt=function(y){return this.cmp(y)===-1},s.prototype.lten=function(y){return this.cmpn(y)<=0},s.prototype.lte=function(y){return this.cmp(y)<=0},s.prototype.eqn=function(y){return this.cmpn(y)===0},s.prototype.eq=function(y){return this.cmp(y)===0},s.red=function(y){return new L(y)},s.prototype.toRed=function(y){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),y.convertTo(this)._forceRed(y)},s.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(y){return this.red=y,this},s.prototype.forceRed=function(y){return r(!this.red,"Already a number in reduction context"),this._forceRed(y)},s.prototype.redAdd=function(y){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,y)},s.prototype.redIAdd=function(y){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,y)},s.prototype.redSub=function(y){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,y)},s.prototype.redISub=function(y){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,y)},s.prototype.redShl=function(y){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,y)},s.prototype.redMul=function(y){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.mul(this,y)},s.prototype.redIMul=function(y){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.imul(this,y)},s.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(y){return r(this.red&&!y.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,y)};var x={k256:null,p224:null,p192:null,p25519:null};function b(T,y){this.name=T,this.p=new s(y,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}b.prototype._tmp=function(){var y=new s(null);return y.words=new Array(Math.ceil(this.n/13)),y},b.prototype.ireduce=function(y){var E=y,R;do this.split(E,this.tmp),E=this.imulK(E),E=E.iadd(this.tmp),R=E.bitLength();while(R>this.n);var F=R0?E.isub(this.p):E.strip!==void 0?E.strip():E._strip(),E},b.prototype.split=function(y,E){y.iushrn(this.n,0,E)},b.prototype.imulK=function(y){return y.imul(this.k)};function B(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(B,b),B.prototype.split=function(y,E){for(var R=4194303,F=Math.min(y.length,9),O=0;O>>22,z=j}z>>>=22,y.words[O-10]=z,z===0&&y.length>10?y.length-=10:y.length-=9},B.prototype.imulK=function(y){y.words[y.length]=0,y.words[y.length+1]=0,y.length+=2;for(var E=0,R=0;R>>=26,y.words[R]=O,E=F}return E!==0&&(y.words[y.length++]=E),y},s._prime=function(y){if(x[y])return x[y];var E;if(y==="k256")E=new B;else if(y==="p224")E=new M;else if(y==="p192")E=new I;else if(y==="p25519")E=new S;else throw new Error("Unknown prime "+y);return x[y]=E,E};function L(T){if(typeof T=="string"){var y=s._prime(T);this.m=y.p,this.prime=y}else r(T.gtn(1),"modulus must be greater than 1"),this.m=T,this.prime=null}L.prototype._verify1=function(y){r(y.negative===0,"red works only with positives"),r(y.red,"red works only with red numbers")},L.prototype._verify2=function(y,E){r((y.negative|E.negative)===0,"red works only with positives"),r(y.red&&y.red===E.red,"red works only with red numbers")},L.prototype.imod=function(y){return this.prime?this.prime.ireduce(y)._forceRed(this):(A(y,y.umod(this.m)._forceRed(this)),y)},L.prototype.neg=function(y){return y.isZero()?y.clone():this.m.sub(y)._forceRed(this)},L.prototype.add=function(y,E){this._verify2(y,E);var R=y.add(E);return R.cmp(this.m)>=0&&R.isub(this.m),R._forceRed(this)},L.prototype.iadd=function(y,E){this._verify2(y,E);var R=y.iadd(E);return R.cmp(this.m)>=0&&R.isub(this.m),R},L.prototype.sub=function(y,E){this._verify2(y,E);var R=y.sub(E);return R.cmpn(0)<0&&R.iadd(this.m),R._forceRed(this)},L.prototype.isub=function(y,E){this._verify2(y,E);var R=y.isub(E);return R.cmpn(0)<0&&R.iadd(this.m),R},L.prototype.shl=function(y,E){return this._verify1(y),this.imod(y.ushln(E))},L.prototype.imul=function(y,E){return this._verify2(y,E),this.imod(y.imul(E))},L.prototype.mul=function(y,E){return this._verify2(y,E),this.imod(y.mul(E))},L.prototype.isqr=function(y){return this.imul(y,y.clone())},L.prototype.sqr=function(y){return this.mul(y,y)},L.prototype.sqrt=function(y){if(y.isZero())return y.clone();var E=this.m.andln(3);if(r(E%2===1),E===3){var R=this.m.add(new s(1)).iushrn(2);return this.pow(y,R)}for(var F=this.m.subn(1),O=0;!F.isZero()&&F.andln(1)===0;)O++,F.iushrn(1);r(!F.isZero());var z=new s(1).toRed(this),j=z.redNeg(),H=this.m.subn(1).iushrn(1),C=this.m.bitLength();for(C=new s(2*C*C).toRed(this);this.pow(C,H).cmp(j)!==0;)C.redIAdd(j);for(var W=this.pow(C,F),ee=this.pow(y,F.addn(1).iushrn(1)),P=this.pow(y,F),re=O;P.cmp(z)!==0;){for(var ue=P,le=0;ue.cmp(z)!==0;le++)ue=ue.redSqr();r(le=0;O--){for(var W=E.words[O],ee=C-1;ee>=0;ee--){var P=W>>ee&1;if(z!==F[0]&&(z=this.sqr(z)),P===0&&j===0){H=0;continue}j<<=1,j|=P,H++,!(H!==R&&(O!==0||ee!==0))&&(z=this.mul(z,F[j]),H=0,j=0)}C=26}return z},L.prototype.convertTo=function(y){var E=y.umod(this.m);return E===y?E.clone():E},L.prototype.convertFrom=function(y){var E=y.clone();return E.red=null,E},s.mont=function(y){return new D(y)};function D(T){L.call(this,T),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(D,L),D.prototype.convertTo=function(y){return this.imod(y.ushln(this.shift))},D.prototype.convertFrom=function(y){var E=this.imod(y.mul(this.rinv));return E.red=null,E},D.prototype.imul=function(y,E){if(y.isZero()||E.isZero())return y.words[0]=0,y.length=1,y;var R=y.imul(E),F=R.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=R.isub(F).iushrn(this.shift),z=O;return O.cmp(this.m)>=0?z=O.isub(this.m):O.cmpn(0)<0&&(z=O.iadd(this.m)),z._forceRed(this)},D.prototype.mul=function(y,E){if(y.isZero()||E.isZero())return new s(0)._forceRed(this);var R=y.mul(E),F=R.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=R.isub(F).iushrn(this.shift),z=O;return O.cmp(this.m)>=0?z=O.isub(this.m):O.cmpn(0)<0&&(z=O.iadd(this.m)),z._forceRed(this)},D.prototype.invm=function(y){var E=this.imod(y._invmp(this.m).mul(this.r2));return E._forceRed(this)}})(n,Na)})(oI);var t9=oI.exports;const _t=oc(t9),n9="logger/5.7.0";let MU=!1,CU=!1;const ew={debug:1,default:2,info:2,warning:3,error:4,off:5};let TU=ew.default,hb=null;function r9(){try{const n=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{n.push(e)}}),n.length)throw new Error("missing "+n.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(n){return n.message}return null}const IU=r9();var MS;(function(n){n.DEBUG="DEBUG",n.INFO="INFO",n.WARNING="WARNING",n.ERROR="ERROR",n.OFF="OFF"})(MS||(MS={}));var jo;(function(n){n.UNKNOWN_ERROR="UNKNOWN_ERROR",n.NOT_IMPLEMENTED="NOT_IMPLEMENTED",n.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",n.NETWORK_ERROR="NETWORK_ERROR",n.SERVER_ERROR="SERVER_ERROR",n.TIMEOUT="TIMEOUT",n.BUFFER_OVERRUN="BUFFER_OVERRUN",n.NUMERIC_FAULT="NUMERIC_FAULT",n.MISSING_NEW="MISSING_NEW",n.INVALID_ARGUMENT="INVALID_ARGUMENT",n.MISSING_ARGUMENT="MISSING_ARGUMENT",n.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",n.CALL_EXCEPTION="CALL_EXCEPTION",n.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",n.NONCE_EXPIRED="NONCE_EXPIRED",n.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",n.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",n.TRANSACTION_REPLACED="TRANSACTION_REPLACED",n.ACTION_REJECTED="ACTION_REJECTED"})(jo||(jo={}));const RU="0123456789abcdef";let xe=class Rr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();ew[r]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(TU>ew[r])&&console.log.apply(console,t)}debug(...e){this._log(Rr.levels.DEBUG,e)}info(...e){this._log(Rr.levels.INFO,e)}warn(...e){this._log(Rr.levels.WARNING,e)}makeError(e,t,r){if(CU)return this.makeError("censored error",t,{});t||(t=Rr.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(l=>{const c=r[l];try{if(c instanceof Uint8Array){let A="";for(let u=0;u>4],A+=RU[c[u]&15];i.push(l+"=Uint8Array(0x"+A+")")}else i.push(l+"="+JSON.stringify(c))}catch{i.push(l+"="+JSON.stringify(r[l].toString()))}}),i.push(`code=${t}`),i.push(`version=${this.version}`);const s=e;let o="";switch(t){case jo.NUMERIC_FAULT:{o="NUMERIC_FAULT";const l=e;switch(l){case"overflow":case"underflow":case"division-by-zero":o+="-"+l;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case jo.CALL_EXCEPTION:case jo.INSUFFICIENT_FUNDS:case jo.MISSING_NEW:case jo.NONCE_EXPIRED:case jo.REPLACEMENT_UNDERPRICED:case jo.TRANSACTION_REPLACED:case jo.UNPREDICTABLE_GAS_LIMIT:o=t;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=t,Object.keys(r).forEach(function(l){a[l]=r[l]}),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,Rr.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,i){e||this.throwError(t,r,i)}assertArgument(e,t,r,i){e||this.throwArgumentError(t,r,i)}checkNormalize(e){IU&&this.throwError("platform missing String.prototype.normalize",Rr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:IU})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,Rr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,Rr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r?r=": "+r:r="",et&&this.throwError("too many arguments"+r,Rr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",Rr.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",Rr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Rr.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return hb||(hb=new Rr(n9)),hb}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",Rr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),MU){if(!e)return;this.globalLogger().throwError("error censorship permanent",Rr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}CU=!!e,MU=!!t}static setLogLevel(e){const t=ew[e.toLowerCase()];if(t==null){Rr.globalLogger().warn("invalid log level - "+e);return}TU=t}static from(e){return new Rr(e)}};xe.errors=jo;xe.levels=MS;const i9="bytes/5.7.0",Zn=new xe(i9);function J4(n){return!!n.toHexString}function jh(n){return n.slice||(n.slice=function(){const e=Array.prototype.slice.call(arguments);return jh(new Uint8Array(Array.prototype.slice.apply(n,e)))}),n}function aI(n){return It(n)&&!(n.length%2)||Rx(n)}function UU(n){return typeof n=="number"&&n==n&&n%1===0}function Rx(n){if(n==null)return!1;if(n.constructor===Uint8Array)return!0;if(typeof n=="string"||!UU(n.length)||n.length<0)return!1;for(let e=0;e=256)return!1}return!0}function pt(n,e){if(e||(e={}),typeof n=="number"){Zn.checkSafeUint53(n,"invalid arrayify value");const t=[];for(;n;)t.unshift(n&255),n=parseInt(String(n/256));return t.length===0&&t.push(0),jh(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof n=="string"&&n.substring(0,2)!=="0x"&&(n="0x"+n),J4(n)&&(n=n.toHexString()),It(n)){let t=n.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":Zn.throwArgumentError("hex data is odd-length","value",n));const r=[];for(let i=0;ipt(i)),t=e.reduce((i,s)=>i+s.length,0),r=new Uint8Array(t);return e.reduce((i,s)=>(r.set(s,i),i+s.length),0),jh(r)}function fd(n){let e=pt(n);if(e.length===0)return e;let t=0;for(;te&&Zn.throwArgumentError("value out of range","value",arguments[0]);const t=new Uint8Array(e);return t.set(n,e-n.length),jh(t)}function It(n,e){return!(typeof n!="string"||!n.match(/^0x[0-9A-Fa-f]*$/)||e&&n.length!==2+2*e)}const db="0123456789abcdef";function lt(n,e){if(e||(e={}),typeof n=="number"){Zn.checkSafeUint53(n,"invalid hexlify value");let t="";for(;n;)t=db[n&15]+t,n=Math.floor(n/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if(typeof n=="bigint")return n=n.toString(16),n.length%2?"0x0"+n:"0x"+n;if(e.allowMissingPrefix&&typeof n=="string"&&n.substring(0,2)!=="0x"&&(n="0x"+n),J4(n))return n.toHexString();if(It(n))return n.length%2&&(e.hexPad==="left"?n="0x0"+n.substring(2):e.hexPad==="right"?n+="0":Zn.throwArgumentError("hex data is odd-length","value",n)),n.toLowerCase();if(Rx(n)){let t="0x";for(let r=0;r>4]+db[i&15]}return t}return Zn.throwArgumentError("invalid hexlify value","value",n)}function Bu(n){if(typeof n!="string")n=lt(n);else if(!It(n)||n.length%2)return null;return(n.length-2)/2}function mi(n,e,t){return typeof n!="string"?n=lt(n):(!It(n)||n.length%2)&&Zn.throwArgumentError("invalid hexData","value",n),e=2+2*e,t!=null?"0x"+n.substring(e,2+2*t):"0x"+n.substring(e)}function $i(n){let e="0x";return n.forEach(t=>{e+=lt(t).substring(2)}),e}function Ux(n){const e=o9(lt(n,{hexPad:"left"}));return e==="0x"?"0x0":e}function o9(n){typeof n!="string"&&(n=lt(n)),It(n)||Zn.throwArgumentError("invalid hex string","value",n),n=n.substring(2);let e=0;for(;e2*e+2&&Zn.throwArgumentError("value out of range","value",arguments[1]);n.length<2*e+2;)n="0x0"+n.substring(2);return n}function Fx(n){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(aI(n)){let t=pt(n);t.length===64?(e.v=27+(t[32]>>7),t[32]&=127,e.r=lt(t.slice(0,32)),e.s=lt(t.slice(32,64))):t.length===65?(e.r=lt(t.slice(0,32)),e.s=lt(t.slice(32,64)),e.v=t[64]):Zn.throwArgumentError("invalid signature string","signature",n),e.v<27&&(e.v===0||e.v===1?e.v+=27:Zn.throwArgumentError("signature invalid v byte","signature",n)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(t[32]|=128),e._vs=lt(t.slice(32,64))}else{if(e.r=n.r,e.s=n.s,e.v=n.v,e.recoveryParam=n.recoveryParam,e._vs=n._vs,e._vs!=null){const i=s9(pt(e._vs),32);e._vs=lt(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&Zn.throwArgumentError("signature recoveryParam mismatch _vs","signature",n),i[0]&=127;const o=lt(i);e.s==null?e.s=o:e.s!==o&&Zn.throwArgumentError("signature v mismatch _vs","signature",n)}if(e.recoveryParam==null)e.v==null?Zn.throwArgumentError("signature missing v and recoveryParam","signature",n):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&Zn.throwArgumentError("signature recoveryParam mismatch v","signature",n)}e.r==null||!It(e.r)?Zn.throwArgumentError("signature missing or invalid r","signature",n):e.r=rr(e.r,32),e.s==null||!It(e.s)?Zn.throwArgumentError("signature missing or invalid s","signature",n):e.s=rr(e.s,32);const t=pt(e.s);t[0]>=128&&Zn.throwArgumentError("signature s out of range","signature",n),e.recoveryParam&&(t[0]|=128);const r=lt(t);e._vs&&(It(e._vs)||Zn.throwArgumentError("signature invalid _vs","signature",n),e._vs=rr(e._vs,32)),e._vs==null?e._vs=r:e._vs!==r&&Zn.throwArgumentError("signature _vs mismatch v and s","signature",n)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const a9="bignumber/5.7.0";var Kw=_t.BN;const Cl=new xe(a9),pb={},FU=9007199254740991;let PU=!1;class Ve{constructor(e,t){e!==pb&&Cl.throwError("cannot call constructor directly; use BigNumber.from",xe.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Gi(Nt(this).fromTwos(e))}toTwos(e){return Gi(Nt(this).toTwos(e))}abs(){return this._hex[0]==="-"?Ve.from(this._hex.substring(1)):this}add(e){return Gi(Nt(this).add(Nt(e)))}sub(e){return Gi(Nt(this).sub(Nt(e)))}div(e){return Ve.from(e).isZero()&&Ys("division-by-zero","div"),Gi(Nt(this).div(Nt(e)))}mul(e){return Gi(Nt(this).mul(Nt(e)))}mod(e){const t=Nt(e);return t.isNeg()&&Ys("division-by-zero","mod"),Gi(Nt(this).umod(t))}pow(e){const t=Nt(e);return t.isNeg()&&Ys("negative-power","pow"),Gi(Nt(this).pow(t))}and(e){const t=Nt(e);return(this.isNegative()||t.isNeg())&&Ys("unbound-bitwise-result","and"),Gi(Nt(this).and(t))}or(e){const t=Nt(e);return(this.isNegative()||t.isNeg())&&Ys("unbound-bitwise-result","or"),Gi(Nt(this).or(t))}xor(e){const t=Nt(e);return(this.isNegative()||t.isNeg())&&Ys("unbound-bitwise-result","xor"),Gi(Nt(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Ys("negative-width","mask"),Gi(Nt(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Ys("negative-width","shl"),Gi(Nt(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Ys("negative-width","shr"),Gi(Nt(this).shrn(e))}eq(e){return Nt(this).eq(Nt(e))}lt(e){return Nt(this).lt(Nt(e))}lte(e){return Nt(this).lte(Nt(e))}gt(e){return Nt(this).gt(Nt(e))}gte(e){return Nt(this).gte(Nt(e))}isNegative(){return this._hex[0]==="-"}isZero(){return Nt(this).isZero()}toNumber(){try{return Nt(this).toNumber()}catch{Ys("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Cl.throwError("this platform does not support BigInt",xe.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?PU||(PU=!0,Cl.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Cl.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",xe.errors.UNEXPECTED_ARGUMENT,{}):Cl.throwError("BigNumber.toString does not accept parameters",xe.errors.UNEXPECTED_ARGUMENT,{})),Nt(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof Ve)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new Ve(pb,lg(e)):e.match(/^-?[0-9]+$/)?new Ve(pb,lg(new Kw(e))):Cl.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Ys("underflow","BigNumber.from",e),(e>=FU||e<=-FU)&&Ys("overflow","BigNumber.from",e),Ve.from(String(e));const t=e;if(typeof t=="bigint")return Ve.from(t.toString());if(Rx(t))return Ve.from(lt(t));if(t)if(t.toHexString){const r=t.toHexString();if(typeof r=="string")return Ve.from(r)}else{let r=t._hex;if(r==null&&t.type==="BigNumber"&&(r=t.hex),typeof r=="string"&&(It(r)||r[0]==="-"&&It(r.substring(1))))return Ve.from(r)}return Cl.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function lg(n){if(typeof n!="string")return lg(n.toString(16));if(n[0]==="-")return n=n.substring(1),n[0]==="-"&&Cl.throwArgumentError("invalid hex","value",n),n=lg(n),n==="0x00"?n:"-"+n;if(n.substring(0,2)!=="0x"&&(n="0x"+n),n==="0x")return"0x00";for(n.length%2&&(n="0x0"+n.substring(2));n.length>4&&n.substring(0,4)==="0x00";)n="0x"+n.substring(4);return n}function Gi(n){return Ve.from(lg(n))}function Nt(n){const e=Ve.from(n).toHexString();return e[0]==="-"?new Kw("-"+e.substring(3),16):new Kw(e.substring(2),16)}function Ys(n,e,t){const r={fault:n,operation:e};return t!=null&&(r.value=t),Cl.throwError(n,xe.errors.NUMERIC_FAULT,r)}function l9(n){return new Kw(n,36).toString(16)}const c9="properties/5.7.0";var A9=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const Xw=new xe(c9);function Ue(n,e,t){Object.defineProperty(n,e,{enumerable:!0,value:t,writable:!1})}function Cs(n,e){for(let t=0;t<32;t++){if(n[e])return n[e];if(!n.prototype||typeof n.prototype!="object")break;n=Object.getPrototypeOf(n.prototype).constructor}return null}function wr(n){return A9(this,void 0,void 0,function*(){const e=Object.keys(n).map(r=>{const i=n[r];return Promise.resolve(i).then(s=>({key:r,value:s}))});return(yield Promise.all(e)).reduce((r,i)=>(r[i.key]=i.value,r),{})})}function u9(n,e){(!n||typeof n!="object")&&Xw.throwArgumentError("invalid object","object",n),Object.keys(n).forEach(t=>{e[t]||Xw.throwArgumentError("invalid object key - "+t,"transaction:"+t,n)})}function Hn(n){const e={};for(const t in n)e[t]=n[t];return e}const f9={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function q4(n){if(n==null||f9[typeof n])return!0;if(Array.isArray(n)||typeof n=="object"){if(!Object.isFrozen(n))return!1;const e=Object.keys(n);for(let t=0;tPs(e)));if(typeof n=="object"){const e={};for(const t in n){const r=n[t];r!==void 0&&Ue(e,t,Ps(r))}return e}return Xw.throwArgumentError(`Cannot deepCopy ${typeof n}`,"object",n)}function Ps(n){return h9(n)}class o0{constructor(e){for(const t in e)this[t]=Ps(e[t])}}const d9="abstract-provider/5.7.0";var p9=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const m9=new xe(d9);class g9 extends o0{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class a0{constructor(){m9.checkAbstract(new.target,a0),Ue(this,"_isProvider",!0)}getFeeData(){return p9(this,void 0,void 0,function*(){const{block:e,gasPrice:t}=yield wr({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(o=>null)});let r=null,i=null,s=null;return e&&e.baseFeePerGas&&(r=e.baseFeePerGas,s=Ve.from("1500000000"),i=e.baseFeePerGas.mul(2).add(s)),{lastBaseFeePerGas:r,maxFeePerGas:i,maxPriorityFeePerGas:s,gasPrice:t}})}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}static isProvider(e){return!!(e&&e._isProvider)}}const v9="networks/5.7.1",LU=new xe(v9);function y9(n){return n&&typeof n.renetwork=="function"}function Fl(n){const e=function(t,r){r==null&&(r={});const i=[];if(t.InfuraProvider&&r.infura!=="-")try{i.push(new t.InfuraProvider(n,r.infura))}catch{}if(t.EtherscanProvider&&r.etherscan!=="-")try{i.push(new t.EtherscanProvider(n,r.etherscan))}catch{}if(t.AlchemyProvider&&r.alchemy!=="-")try{i.push(new t.AlchemyProvider(n,r.alchemy))}catch{}if(t.PocketProvider&&r.pocket!=="-"){const s=["goerli","ropsten","rinkeby","sepolia"];try{const o=new t.PocketProvider(n,r.pocket);o.network&&s.indexOf(o.network.name)===-1&&i.push(o)}catch{}}if(t.CloudflareProvider&&r.cloudflare!=="-")try{i.push(new t.CloudflareProvider(n))}catch{}if(t.AnkrProvider&&r.ankr!=="-")try{const s=["ropsten"],o=new t.AnkrProvider(n,r.ankr);o.network&&s.indexOf(o.network.name)===-1&&i.push(o)}catch{}if(i.length===0)return null;if(t.FallbackProvider){let s=1;return r.quorum!=null?s=r.quorum:n==="homestead"&&(s=2),new t.FallbackProvider(i,s)}return i[0]};return e.renetwork=function(t){return Fl(t)},e}function Yw(n,e){const t=function(r,i){return r.JsonRpcProvider?new r.JsonRpcProvider(n,e):null};return t.renetwork=function(r){return Yw(n,r)},t}const DU={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:Fl("homestead")},NU={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:Fl("ropsten")},OU={chainId:63,name:"classicMordor",_defaultProvider:Yw("https://www.ethercluster.com/mordor","classicMordor")},k0={unspecified:{chainId:0,name:"unspecified"},homestead:DU,mainnet:DU,morden:{chainId:2,name:"morden"},ropsten:NU,testnet:NU,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:Fl("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:Fl("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:Fl("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:Fl("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:Yw("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:OU,classicTestnet:OU,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:Yw("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:Fl("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:Fl("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function eH(n){if(n==null)return null;if(typeof n=="number"){for(const r in k0){const i=k0[r];if(i.chainId===n)return{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress||null,_defaultProvider:i._defaultProvider||null}}return{chainId:n,name:"unknown"}}if(typeof n=="string"){const r=k0[n];return r==null?null:{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress,_defaultProvider:r._defaultProvider||null}}const e=k0[n.name];if(!e)return typeof n.chainId!="number"&&LU.throwArgumentError("invalid network chainId","network",n),n;n.chainId!==0&&n.chainId!==e.chainId&&LU.throwArgumentError("network chainId mismatch","network",n);let t=n._defaultProvider||null;return t==null&&e._defaultProvider&&(y9(e._defaultProvider)?t=e._defaultProvider.renetwork(n):t=e._defaultProvider),{name:n.name,chainId:e.chainId,ensAddress:n.ensAddress||e.ensAddress||null,_defaultProvider:t}}function tH(n){n=atob(n);const e=[];for(let t=0;t0;)r.push(o%this.base),o=o/this.base|0}let i="";for(let s=0;t[s]===0&&s=0;--s)i+=this.alphabet[r[s]];return i}decode(e){if(typeof e!="string")throw new TypeError("Expected String");let t=[];if(e.length===0)return new Uint8Array(t);t.push(0);for(let r=0;r>=8;for(;s>0;)t.push(s&255),s>>=8}for(let r=0;e[r]===this._leader&&r0?y:E},s.min=function(y,E){return y.cmp(E)<0?y:E},s.prototype._init=function(y,E,R){if(typeof y=="number")return this._initNumber(y,E,R);if(typeof y=="object")return this._initArray(y,E,R);E==="hex"&&(E=16),r(E===(E|0)&&E>=2&&E<=36),y=y.toString().replace(/\s+/g,"");var F=0;y[0]==="-"&&(F++,this.negative=1),F=0;F-=3)z=y[F]|y[F-1]<<8|y[F-2]<<16,this.words[O]|=z<>>26-j&67108863,j+=24,j>=26&&(j-=26,O++);else if(R==="le")for(F=0,O=0;F>>26-j&67108863,j+=24,j>=26&&(j-=26,O++);return this._strip()};function a(T,y){var E=T.charCodeAt(y);if(E>=48&&E<=57)return E-48;if(E>=65&&E<=70)return E-55;if(E>=97&&E<=102)return E-87;r(!1,"Invalid character in "+T)}function l(T,y,E){var R=a(T,E);return E-1>=y&&(R|=a(T,E-1)<<4),R}s.prototype._parseHex=function(y,E,R){this.length=Math.ceil((y.length-E)/6),this.words=new Array(this.length);for(var F=0;F=E;F-=2)j=l(y,E,F)<=18?(O-=18,z+=1,this.words[z]|=j>>>26):O+=8;else{var Q=y.length-E;for(F=Q%2===0?E+1:E;F=18?(O-=18,z+=1,this.words[z]|=j>>>26):O+=8}this._strip()};function c(T,y,E,R){for(var F=0,O=0,z=Math.min(T.length,E),j=y;j=49?O=Q-49+10:Q>=17?O=Q-17+10:O=Q,r(Q>=0&&O1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=u}catch{s.prototype.inspect=u}else s.prototype.inspect=u;function u(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(y,E){y=y||10,E=E|0||1;var R;if(y===16||y==="hex"){R="";for(var F=0,O=0,z=0;z>>24-F&16777215,F+=2,F>=26&&(F-=26,z--),O!==0||z!==this.length-1?R=f[6-Q.length]+Q+R:R=Q+R}for(O!==0&&(R=O.toString(16)+R);R.length%E!==0;)R="0"+R;return this.negative!==0&&(R="-"+R),R}if(y===(y|0)&&y>=2&&y<=36){var C=h[y],W=d[y];R="";var ee=this.clone();for(ee.negative=0;!ee.isZero();){var P=ee.modrn(W).toString(y);ee=ee.idivn(W),ee.isZero()?R=P+R:R=f[C-P.length]+P+R}for(this.isZero()&&(R="0"+R);R.length%E!==0;)R="0"+R;return this.negative!==0&&(R="-"+R),R}r(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var y=this.words[0];return this.length===2?y+=this.words[1]*67108864:this.length===3&&this.words[2]===1?y+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-y:y},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(y,E){return this.toArrayLike(o,y,E)}),s.prototype.toArray=function(y,E){return this.toArrayLike(Array,y,E)};var m=function(y,E){return y.allocUnsafe?y.allocUnsafe(E):new y(E)};s.prototype.toArrayLike=function(y,E,R){this._strip();var F=this.byteLength(),O=R||Math.max(1,F);r(F<=O,"byte array longer than desired length"),r(O>0,"Requested array length <= 0");var z=m(y,O),j=E==="le"?"LE":"BE";return this["_toArrayLike"+j](z,F),z},s.prototype._toArrayLikeLE=function(y,E){for(var R=0,F=0,O=0,z=0;O>8&255),R>16&255),z===6?(R>24&255),F=0,z=0):(F=j>>>24,z+=2)}if(R=0&&(y[R--]=j>>8&255),R>=0&&(y[R--]=j>>16&255),z===6?(R>=0&&(y[R--]=j>>24&255),F=0,z=0):(F=j>>>24,z+=2)}if(R>=0)for(y[R--]=F;R>=0;)y[R--]=0},Math.clz32?s.prototype._countBits=function(y){return 32-Math.clz32(y)}:s.prototype._countBits=function(y){var E=y,R=0;return E>=4096&&(R+=13,E>>>=13),E>=64&&(R+=7,E>>>=7),E>=8&&(R+=4,E>>>=4),E>=2&&(R+=2,E>>>=2),R+E},s.prototype._zeroBits=function(y){if(y===0)return 26;var E=y,R=0;return E&8191||(R+=13,E>>>=13),E&127||(R+=7,E>>>=7),E&15||(R+=4,E>>>=4),E&3||(R+=2,E>>>=2),E&1||R++,R},s.prototype.bitLength=function(){var y=this.words[this.length-1],E=this._countBits(y);return(this.length-1)*26+E};function g(T){for(var y=new Array(T.bitLength()),E=0;E>>F&1}return y}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var y=0,E=0;Ey.length?this.clone().ior(y):y.clone().ior(this)},s.prototype.uor=function(y){return this.length>y.length?this.clone().iuor(y):y.clone().iuor(this)},s.prototype.iuand=function(y){var E;this.length>y.length?E=y:E=this;for(var R=0;Ry.length?this.clone().iand(y):y.clone().iand(this)},s.prototype.uand=function(y){return this.length>y.length?this.clone().iuand(y):y.clone().iuand(this)},s.prototype.iuxor=function(y){var E,R;this.length>y.length?(E=this,R=y):(E=y,R=this);for(var F=0;Fy.length?this.clone().ixor(y):y.clone().ixor(this)},s.prototype.uxor=function(y){return this.length>y.length?this.clone().iuxor(y):y.clone().iuxor(this)},s.prototype.inotn=function(y){r(typeof y=="number"&&y>=0);var E=Math.ceil(y/26)|0,R=y%26;this._expand(E),R>0&&E--;for(var F=0;F0&&(this.words[F]=~this.words[F]&67108863>>26-R),this._strip()},s.prototype.notn=function(y){return this.clone().inotn(y)},s.prototype.setn=function(y,E){r(typeof y=="number"&&y>=0);var R=y/26|0,F=y%26;return this._expand(R+1),E?this.words[R]=this.words[R]|1<y.length?(R=this,F=y):(R=y,F=this);for(var O=0,z=0;z>>26;for(;O!==0&&z>>26;if(this.length=R.length,O!==0)this.words[this.length]=O,this.length++;else if(R!==this)for(;zy.length?this.clone().iadd(y):y.clone().iadd(this)},s.prototype.isub=function(y){if(y.negative!==0){y.negative=0;var E=this.iadd(y);return y.negative=1,E._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(y),this.negative=1,this._normSign();var R=this.cmp(y);if(R===0)return this.negative=0,this.length=1,this.words[0]=0,this;var F,O;R>0?(F=this,O=y):(F=y,O=this);for(var z=0,j=0;j>26,this.words[j]=E&67108863;for(;z!==0&&j>26,this.words[j]=E&67108863;if(z===0&&j>>26,ee=Q&67108863,P=Math.min(C,y.length-1),re=Math.max(0,C-T.length+1);re<=P;re++){var ue=C-re|0;F=T.words[ue]|0,O=y.words[re]|0,z=F*O+ee,W+=z/67108864|0,ee=z&67108863}E.words[C]=ee|0,Q=W|0}return Q!==0?E.words[C]=Q|0:E.length--,E._strip()}var v=function(y,E,R){var F=y.words,O=E.words,z=R.words,j=0,Q,C,W,ee=F[0]|0,P=ee&8191,re=ee>>>13,ue=F[1]|0,le=ue&8191,me=ue>>>13,ie=F[2]|0,ge=ie&8191,_e=ie>>>13,se=F[3]|0,H=se&8191,fe=se>>>13,Ae=F[4]|0,J=Ae&8191,q=Ae>>>13,he=F[5]|0,X=he&8191,G=he>>>13,ne=F[6]|0,Y=ne&8191,de=ne>>>13,ae=F[7]|0,Ee=ae&8191,V=ae>>>13,U=F[8]|0,N=U&8191,K=U>>>13,oe=F[9]|0,pe=oe&8191,ve=oe>>>13,Ce=O[0]|0,Le=Ce&8191,Re=Ce>>>13,$e=O[1]|0,ce=$e&8191,Pe=$e>>>13,Se=O[2]|0,Te=Se&8191,Fe=Se>>>13,De=O[3]|0,Ze=De&8191,At=De>>>13,Pn=O[4]|0,rt=Pn&8191,xt=Pn>>>13,Tr=O[5]|0,tn=Tr&8191,qt=Tr>>>13,Jr=O[6]|0,en=Jr&8191,nn=Jr>>>13,Ks=O[7]|0,Xt=Ks&8191,Yt=Ks>>>13,Ii=O[8]|0,rn=Ii&8191,sn=Ii>>>13,ma=O[9]|0,un=ma&8191,on=ma>>>13;R.negative=y.negative^E.negative,R.length=19,Q=Math.imul(P,Le),C=Math.imul(P,Re),C=C+Math.imul(re,Le)|0,W=Math.imul(re,Re);var te=(j+Q|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(te>>>26)|0,te&=67108863,Q=Math.imul(le,Le),C=Math.imul(le,Re),C=C+Math.imul(me,Le)|0,W=Math.imul(me,Re),Q=Q+Math.imul(P,ce)|0,C=C+Math.imul(P,Pe)|0,C=C+Math.imul(re,ce)|0,W=W+Math.imul(re,Pe)|0;var ye=(j+Q|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(ye>>>26)|0,ye&=67108863,Q=Math.imul(ge,Le),C=Math.imul(ge,Re),C=C+Math.imul(_e,Le)|0,W=Math.imul(_e,Re),Q=Q+Math.imul(le,ce)|0,C=C+Math.imul(le,Pe)|0,C=C+Math.imul(me,ce)|0,W=W+Math.imul(me,Pe)|0,Q=Q+Math.imul(P,Te)|0,C=C+Math.imul(P,Fe)|0,C=C+Math.imul(re,Te)|0,W=W+Math.imul(re,Fe)|0;var Be=(j+Q|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(Be>>>26)|0,Be&=67108863,Q=Math.imul(H,Le),C=Math.imul(H,Re),C=C+Math.imul(fe,Le)|0,W=Math.imul(fe,Re),Q=Q+Math.imul(ge,ce)|0,C=C+Math.imul(ge,Pe)|0,C=C+Math.imul(_e,ce)|0,W=W+Math.imul(_e,Pe)|0,Q=Q+Math.imul(le,Te)|0,C=C+Math.imul(le,Fe)|0,C=C+Math.imul(me,Te)|0,W=W+Math.imul(me,Fe)|0,Q=Q+Math.imul(P,Ze)|0,C=C+Math.imul(P,At)|0,C=C+Math.imul(re,Ze)|0,W=W+Math.imul(re,At)|0;var Me=(j+Q|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(Me>>>26)|0,Me&=67108863,Q=Math.imul(J,Le),C=Math.imul(J,Re),C=C+Math.imul(q,Le)|0,W=Math.imul(q,Re),Q=Q+Math.imul(H,ce)|0,C=C+Math.imul(H,Pe)|0,C=C+Math.imul(fe,ce)|0,W=W+Math.imul(fe,Pe)|0,Q=Q+Math.imul(ge,Te)|0,C=C+Math.imul(ge,Fe)|0,C=C+Math.imul(_e,Te)|0,W=W+Math.imul(_e,Fe)|0,Q=Q+Math.imul(le,Ze)|0,C=C+Math.imul(le,At)|0,C=C+Math.imul(me,Ze)|0,W=W+Math.imul(me,At)|0,Q=Q+Math.imul(P,rt)|0,C=C+Math.imul(P,xt)|0,C=C+Math.imul(re,rt)|0,W=W+Math.imul(re,xt)|0;var we=(j+Q|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(we>>>26)|0,we&=67108863,Q=Math.imul(X,Le),C=Math.imul(X,Re),C=C+Math.imul(G,Le)|0,W=Math.imul(G,Re),Q=Q+Math.imul(J,ce)|0,C=C+Math.imul(J,Pe)|0,C=C+Math.imul(q,ce)|0,W=W+Math.imul(q,Pe)|0,Q=Q+Math.imul(H,Te)|0,C=C+Math.imul(H,Fe)|0,C=C+Math.imul(fe,Te)|0,W=W+Math.imul(fe,Fe)|0,Q=Q+Math.imul(ge,Ze)|0,C=C+Math.imul(ge,At)|0,C=C+Math.imul(_e,Ze)|0,W=W+Math.imul(_e,At)|0,Q=Q+Math.imul(le,rt)|0,C=C+Math.imul(le,xt)|0,C=C+Math.imul(me,rt)|0,W=W+Math.imul(me,xt)|0,Q=Q+Math.imul(P,tn)|0,C=C+Math.imul(P,qt)|0,C=C+Math.imul(re,tn)|0,W=W+Math.imul(re,qt)|0;var ke=(j+Q|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(ke>>>26)|0,ke&=67108863,Q=Math.imul(Y,Le),C=Math.imul(Y,Re),C=C+Math.imul(de,Le)|0,W=Math.imul(de,Re),Q=Q+Math.imul(X,ce)|0,C=C+Math.imul(X,Pe)|0,C=C+Math.imul(G,ce)|0,W=W+Math.imul(G,Pe)|0,Q=Q+Math.imul(J,Te)|0,C=C+Math.imul(J,Fe)|0,C=C+Math.imul(q,Te)|0,W=W+Math.imul(q,Fe)|0,Q=Q+Math.imul(H,Ze)|0,C=C+Math.imul(H,At)|0,C=C+Math.imul(fe,Ze)|0,W=W+Math.imul(fe,At)|0,Q=Q+Math.imul(ge,rt)|0,C=C+Math.imul(ge,xt)|0,C=C+Math.imul(_e,rt)|0,W=W+Math.imul(_e,xt)|0,Q=Q+Math.imul(le,tn)|0,C=C+Math.imul(le,qt)|0,C=C+Math.imul(me,tn)|0,W=W+Math.imul(me,qt)|0,Q=Q+Math.imul(P,en)|0,C=C+Math.imul(P,nn)|0,C=C+Math.imul(re,en)|0,W=W+Math.imul(re,nn)|0;var Xe=(j+Q|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(Xe>>>26)|0,Xe&=67108863,Q=Math.imul(Ee,Le),C=Math.imul(Ee,Re),C=C+Math.imul(V,Le)|0,W=Math.imul(V,Re),Q=Q+Math.imul(Y,ce)|0,C=C+Math.imul(Y,Pe)|0,C=C+Math.imul(de,ce)|0,W=W+Math.imul(de,Pe)|0,Q=Q+Math.imul(X,Te)|0,C=C+Math.imul(X,Fe)|0,C=C+Math.imul(G,Te)|0,W=W+Math.imul(G,Fe)|0,Q=Q+Math.imul(J,Ze)|0,C=C+Math.imul(J,At)|0,C=C+Math.imul(q,Ze)|0,W=W+Math.imul(q,At)|0,Q=Q+Math.imul(H,rt)|0,C=C+Math.imul(H,xt)|0,C=C+Math.imul(fe,rt)|0,W=W+Math.imul(fe,xt)|0,Q=Q+Math.imul(ge,tn)|0,C=C+Math.imul(ge,qt)|0,C=C+Math.imul(_e,tn)|0,W=W+Math.imul(_e,qt)|0,Q=Q+Math.imul(le,en)|0,C=C+Math.imul(le,nn)|0,C=C+Math.imul(me,en)|0,W=W+Math.imul(me,nn)|0,Q=Q+Math.imul(P,Xt)|0,C=C+Math.imul(P,Yt)|0,C=C+Math.imul(re,Xt)|0,W=W+Math.imul(re,Yt)|0;var qe=(j+Q|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(qe>>>26)|0,qe&=67108863,Q=Math.imul(N,Le),C=Math.imul(N,Re),C=C+Math.imul(K,Le)|0,W=Math.imul(K,Re),Q=Q+Math.imul(Ee,ce)|0,C=C+Math.imul(Ee,Pe)|0,C=C+Math.imul(V,ce)|0,W=W+Math.imul(V,Pe)|0,Q=Q+Math.imul(Y,Te)|0,C=C+Math.imul(Y,Fe)|0,C=C+Math.imul(de,Te)|0,W=W+Math.imul(de,Fe)|0,Q=Q+Math.imul(X,Ze)|0,C=C+Math.imul(X,At)|0,C=C+Math.imul(G,Ze)|0,W=W+Math.imul(G,At)|0,Q=Q+Math.imul(J,rt)|0,C=C+Math.imul(J,xt)|0,C=C+Math.imul(q,rt)|0,W=W+Math.imul(q,xt)|0,Q=Q+Math.imul(H,tn)|0,C=C+Math.imul(H,qt)|0,C=C+Math.imul(fe,tn)|0,W=W+Math.imul(fe,qt)|0,Q=Q+Math.imul(ge,en)|0,C=C+Math.imul(ge,nn)|0,C=C+Math.imul(_e,en)|0,W=W+Math.imul(_e,nn)|0,Q=Q+Math.imul(le,Xt)|0,C=C+Math.imul(le,Yt)|0,C=C+Math.imul(me,Xt)|0,W=W+Math.imul(me,Yt)|0,Q=Q+Math.imul(P,rn)|0,C=C+Math.imul(P,sn)|0,C=C+Math.imul(re,rn)|0,W=W+Math.imul(re,sn)|0;var tt=(j+Q|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(tt>>>26)|0,tt&=67108863,Q=Math.imul(pe,Le),C=Math.imul(pe,Re),C=C+Math.imul(ve,Le)|0,W=Math.imul(ve,Re),Q=Q+Math.imul(N,ce)|0,C=C+Math.imul(N,Pe)|0,C=C+Math.imul(K,ce)|0,W=W+Math.imul(K,Pe)|0,Q=Q+Math.imul(Ee,Te)|0,C=C+Math.imul(Ee,Fe)|0,C=C+Math.imul(V,Te)|0,W=W+Math.imul(V,Fe)|0,Q=Q+Math.imul(Y,Ze)|0,C=C+Math.imul(Y,At)|0,C=C+Math.imul(de,Ze)|0,W=W+Math.imul(de,At)|0,Q=Q+Math.imul(X,rt)|0,C=C+Math.imul(X,xt)|0,C=C+Math.imul(G,rt)|0,W=W+Math.imul(G,xt)|0,Q=Q+Math.imul(J,tn)|0,C=C+Math.imul(J,qt)|0,C=C+Math.imul(q,tn)|0,W=W+Math.imul(q,qt)|0,Q=Q+Math.imul(H,en)|0,C=C+Math.imul(H,nn)|0,C=C+Math.imul(fe,en)|0,W=W+Math.imul(fe,nn)|0,Q=Q+Math.imul(ge,Xt)|0,C=C+Math.imul(ge,Yt)|0,C=C+Math.imul(_e,Xt)|0,W=W+Math.imul(_e,Yt)|0,Q=Q+Math.imul(le,rn)|0,C=C+Math.imul(le,sn)|0,C=C+Math.imul(me,rn)|0,W=W+Math.imul(me,sn)|0,Q=Q+Math.imul(P,un)|0,C=C+Math.imul(P,on)|0,C=C+Math.imul(re,un)|0,W=W+Math.imul(re,on)|0;var ft=(j+Q|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(ft>>>26)|0,ft&=67108863,Q=Math.imul(pe,ce),C=Math.imul(pe,Pe),C=C+Math.imul(ve,ce)|0,W=Math.imul(ve,Pe),Q=Q+Math.imul(N,Te)|0,C=C+Math.imul(N,Fe)|0,C=C+Math.imul(K,Te)|0,W=W+Math.imul(K,Fe)|0,Q=Q+Math.imul(Ee,Ze)|0,C=C+Math.imul(Ee,At)|0,C=C+Math.imul(V,Ze)|0,W=W+Math.imul(V,At)|0,Q=Q+Math.imul(Y,rt)|0,C=C+Math.imul(Y,xt)|0,C=C+Math.imul(de,rt)|0,W=W+Math.imul(de,xt)|0,Q=Q+Math.imul(X,tn)|0,C=C+Math.imul(X,qt)|0,C=C+Math.imul(G,tn)|0,W=W+Math.imul(G,qt)|0,Q=Q+Math.imul(J,en)|0,C=C+Math.imul(J,nn)|0,C=C+Math.imul(q,en)|0,W=W+Math.imul(q,nn)|0,Q=Q+Math.imul(H,Xt)|0,C=C+Math.imul(H,Yt)|0,C=C+Math.imul(fe,Xt)|0,W=W+Math.imul(fe,Yt)|0,Q=Q+Math.imul(ge,rn)|0,C=C+Math.imul(ge,sn)|0,C=C+Math.imul(_e,rn)|0,W=W+Math.imul(_e,sn)|0,Q=Q+Math.imul(le,un)|0,C=C+Math.imul(le,on)|0,C=C+Math.imul(me,un)|0,W=W+Math.imul(me,on)|0;var mt=(j+Q|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(mt>>>26)|0,mt&=67108863,Q=Math.imul(pe,Te),C=Math.imul(pe,Fe),C=C+Math.imul(ve,Te)|0,W=Math.imul(ve,Fe),Q=Q+Math.imul(N,Ze)|0,C=C+Math.imul(N,At)|0,C=C+Math.imul(K,Ze)|0,W=W+Math.imul(K,At)|0,Q=Q+Math.imul(Ee,rt)|0,C=C+Math.imul(Ee,xt)|0,C=C+Math.imul(V,rt)|0,W=W+Math.imul(V,xt)|0,Q=Q+Math.imul(Y,tn)|0,C=C+Math.imul(Y,qt)|0,C=C+Math.imul(de,tn)|0,W=W+Math.imul(de,qt)|0,Q=Q+Math.imul(X,en)|0,C=C+Math.imul(X,nn)|0,C=C+Math.imul(G,en)|0,W=W+Math.imul(G,nn)|0,Q=Q+Math.imul(J,Xt)|0,C=C+Math.imul(J,Yt)|0,C=C+Math.imul(q,Xt)|0,W=W+Math.imul(q,Yt)|0,Q=Q+Math.imul(H,rn)|0,C=C+Math.imul(H,sn)|0,C=C+Math.imul(fe,rn)|0,W=W+Math.imul(fe,sn)|0,Q=Q+Math.imul(ge,un)|0,C=C+Math.imul(ge,on)|0,C=C+Math.imul(_e,un)|0,W=W+Math.imul(_e,on)|0;var st=(j+Q|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(st>>>26)|0,st&=67108863,Q=Math.imul(pe,Ze),C=Math.imul(pe,At),C=C+Math.imul(ve,Ze)|0,W=Math.imul(ve,At),Q=Q+Math.imul(N,rt)|0,C=C+Math.imul(N,xt)|0,C=C+Math.imul(K,rt)|0,W=W+Math.imul(K,xt)|0,Q=Q+Math.imul(Ee,tn)|0,C=C+Math.imul(Ee,qt)|0,C=C+Math.imul(V,tn)|0,W=W+Math.imul(V,qt)|0,Q=Q+Math.imul(Y,en)|0,C=C+Math.imul(Y,nn)|0,C=C+Math.imul(de,en)|0,W=W+Math.imul(de,nn)|0,Q=Q+Math.imul(X,Xt)|0,C=C+Math.imul(X,Yt)|0,C=C+Math.imul(G,Xt)|0,W=W+Math.imul(G,Yt)|0,Q=Q+Math.imul(J,rn)|0,C=C+Math.imul(J,sn)|0,C=C+Math.imul(q,rn)|0,W=W+Math.imul(q,sn)|0,Q=Q+Math.imul(H,un)|0,C=C+Math.imul(H,on)|0,C=C+Math.imul(fe,un)|0,W=W+Math.imul(fe,on)|0;var Wt=(j+Q|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,Q=Math.imul(pe,rt),C=Math.imul(pe,xt),C=C+Math.imul(ve,rt)|0,W=Math.imul(ve,xt),Q=Q+Math.imul(N,tn)|0,C=C+Math.imul(N,qt)|0,C=C+Math.imul(K,tn)|0,W=W+Math.imul(K,qt)|0,Q=Q+Math.imul(Ee,en)|0,C=C+Math.imul(Ee,nn)|0,C=C+Math.imul(V,en)|0,W=W+Math.imul(V,nn)|0,Q=Q+Math.imul(Y,Xt)|0,C=C+Math.imul(Y,Yt)|0,C=C+Math.imul(de,Xt)|0,W=W+Math.imul(de,Yt)|0,Q=Q+Math.imul(X,rn)|0,C=C+Math.imul(X,sn)|0,C=C+Math.imul(G,rn)|0,W=W+Math.imul(G,sn)|0,Q=Q+Math.imul(J,un)|0,C=C+Math.imul(J,on)|0,C=C+Math.imul(q,un)|0,W=W+Math.imul(q,on)|0;var fn=(j+Q|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(fn>>>26)|0,fn&=67108863,Q=Math.imul(pe,tn),C=Math.imul(pe,qt),C=C+Math.imul(ve,tn)|0,W=Math.imul(ve,qt),Q=Q+Math.imul(N,en)|0,C=C+Math.imul(N,nn)|0,C=C+Math.imul(K,en)|0,W=W+Math.imul(K,nn)|0,Q=Q+Math.imul(Ee,Xt)|0,C=C+Math.imul(Ee,Yt)|0,C=C+Math.imul(V,Xt)|0,W=W+Math.imul(V,Yt)|0,Q=Q+Math.imul(Y,rn)|0,C=C+Math.imul(Y,sn)|0,C=C+Math.imul(de,rn)|0,W=W+Math.imul(de,sn)|0,Q=Q+Math.imul(X,un)|0,C=C+Math.imul(X,on)|0,C=C+Math.imul(G,un)|0,W=W+Math.imul(G,on)|0;var yn=(j+Q|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(yn>>>26)|0,yn&=67108863,Q=Math.imul(pe,en),C=Math.imul(pe,nn),C=C+Math.imul(ve,en)|0,W=Math.imul(ve,nn),Q=Q+Math.imul(N,Xt)|0,C=C+Math.imul(N,Yt)|0,C=C+Math.imul(K,Xt)|0,W=W+Math.imul(K,Yt)|0,Q=Q+Math.imul(Ee,rn)|0,C=C+Math.imul(Ee,sn)|0,C=C+Math.imul(V,rn)|0,W=W+Math.imul(V,sn)|0,Q=Q+Math.imul(Y,un)|0,C=C+Math.imul(Y,on)|0,C=C+Math.imul(de,un)|0,W=W+Math.imul(de,on)|0;var qr=(j+Q|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(qr>>>26)|0,qr&=67108863,Q=Math.imul(pe,Xt),C=Math.imul(pe,Yt),C=C+Math.imul(ve,Xt)|0,W=Math.imul(ve,Yt),Q=Q+Math.imul(N,rn)|0,C=C+Math.imul(N,sn)|0,C=C+Math.imul(K,rn)|0,W=W+Math.imul(K,sn)|0,Q=Q+Math.imul(Ee,un)|0,C=C+Math.imul(Ee,on)|0,C=C+Math.imul(V,un)|0,W=W+Math.imul(V,on)|0;var Vt=(j+Q|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,Q=Math.imul(pe,rn),C=Math.imul(pe,sn),C=C+Math.imul(ve,rn)|0,W=Math.imul(ve,sn),Q=Q+Math.imul(N,un)|0,C=C+Math.imul(N,on)|0,C=C+Math.imul(K,un)|0,W=W+Math.imul(K,on)|0;var at=(j+Q|0)+((C&8191)<<13)|0;j=(W+(C>>>13)|0)+(at>>>26)|0,at&=67108863,Q=Math.imul(pe,un),C=Math.imul(pe,on),C=C+Math.imul(ve,un)|0,W=Math.imul(ve,on);var or=(j+Q|0)+((C&8191)<<13)|0;return j=(W+(C>>>13)|0)+(or>>>26)|0,or&=67108863,z[0]=te,z[1]=ye,z[2]=Be,z[3]=Me,z[4]=we,z[5]=ke,z[6]=Xe,z[7]=qe,z[8]=tt,z[9]=ft,z[10]=mt,z[11]=st,z[12]=Wt,z[13]=fn,z[14]=yn,z[15]=qr,z[16]=Vt,z[17]=at,z[18]=or,j!==0&&(z[19]=j,R.length++),R};Math.imul||(v=p);function w(T,y,E){E.negative=y.negative^T.negative,E.length=T.length+y.length;for(var R=0,F=0,O=0;O>>26)|0,F+=z>>>26,z&=67108863}E.words[O]=j,R=z,z=F}return R!==0?E.words[O]=R:E.length--,E._strip()}function _(T,y,E){return w(T,y,E)}s.prototype.mulTo=function(y,E){var R,F=this.length+y.length;return this.length===10&&y.length===10?R=v(this,y,E):F<63?R=p(this,y,E):F<1024?R=w(this,y,E):R=_(this,y,E),R},s.prototype.mul=function(y){var E=new s(null);return E.words=new Array(this.length+y.length),this.mulTo(y,E)},s.prototype.mulf=function(y){var E=new s(null);return E.words=new Array(this.length+y.length),_(this,y,E)},s.prototype.imul=function(y){return this.clone().mulTo(y,this)},s.prototype.imuln=function(y){var E=y<0;E&&(y=-y),r(typeof y=="number"),r(y<67108864);for(var R=0,F=0;F>=26,R+=O/67108864|0,R+=z>>>26,this.words[F]=z&67108863}return R!==0&&(this.words[F]=R,this.length++),E?this.ineg():this},s.prototype.muln=function(y){return this.clone().imuln(y)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(y){var E=g(y);if(E.length===0)return new s(1);for(var R=this,F=0;F=0);var E=y%26,R=(y-E)/26,F=67108863>>>26-E<<26-E,O;if(E!==0){var z=0;for(O=0;O>>26-E}z&&(this.words[O]=z,this.length++)}if(R!==0){for(O=this.length-1;O>=0;O--)this.words[O+R]=this.words[O];for(O=0;O=0);var F;E?F=(E-E%26)/26:F=0;var O=y%26,z=Math.min((y-O)/26,this.length),j=67108863^67108863>>>O<z)for(this.length-=z,C=0;C=0&&(W!==0||C>=F);C--){var ee=this.words[C]|0;this.words[C]=W<<26-O|ee>>>O,W=ee&j}return Q&&W!==0&&(Q.words[Q.length++]=W),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(y,E,R){return r(this.negative===0),this.iushrn(y,E,R)},s.prototype.shln=function(y){return this.clone().ishln(y)},s.prototype.ushln=function(y){return this.clone().iushln(y)},s.prototype.shrn=function(y){return this.clone().ishrn(y)},s.prototype.ushrn=function(y){return this.clone().iushrn(y)},s.prototype.testn=function(y){r(typeof y=="number"&&y>=0);var E=y%26,R=(y-E)/26,F=1<=0);var E=y%26,R=(y-E)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=R)return this;if(E!==0&&R++,this.length=Math.min(R,this.length),E!==0){var F=67108863^67108863>>>E<=67108864;E++)this.words[E]-=67108864,E===this.length-1?this.words[E+1]=1:this.words[E+1]++;return this.length=Math.max(this.length,E+1),this},s.prototype.isubn=function(y){if(r(typeof y=="number"),r(y<67108864),y<0)return this.iaddn(-y);if(this.negative!==0)return this.negative=0,this.iaddn(y),this.negative=1,this;if(this.words[0]-=y,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var E=0;E>26)-(Q/67108864|0),this.words[O+R]=z&67108863}for(;O>26,this.words[O+R]=z&67108863;if(j===0)return this._strip();for(r(j===-1),j=0,O=0;O>26,this.words[O]=z&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(y,E){var R=this.length-y.length,F=this.clone(),O=y,z=O.words[O.length-1]|0,j=this._countBits(z);R=26-j,R!==0&&(O=O.ushln(R),F.iushln(R),z=O.words[O.length-1]|0);var Q=F.length-O.length,C;if(E!=="mod"){C=new s(null),C.length=Q+1,C.words=new Array(C.length);for(var W=0;W=0;P--){var re=(F.words[O.length+P]|0)*67108864+(F.words[O.length+P-1]|0);for(re=Math.min(re/z|0,67108863),F._ishlnsubmul(O,re,P);F.negative!==0;)re--,F.negative=0,F._ishlnsubmul(O,1,P),F.isZero()||(F.negative^=1);C&&(C.words[P]=re)}return C&&C._strip(),F._strip(),E!=="div"&&R!==0&&F.iushrn(R),{div:C||null,mod:F}},s.prototype.divmod=function(y,E,R){if(r(!y.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var F,O,z;return this.negative!==0&&y.negative===0?(z=this.neg().divmod(y,E),E!=="mod"&&(F=z.div.neg()),E!=="div"&&(O=z.mod.neg(),R&&O.negative!==0&&O.iadd(y)),{div:F,mod:O}):this.negative===0&&y.negative!==0?(z=this.divmod(y.neg(),E),E!=="mod"&&(F=z.div.neg()),{div:F,mod:z.mod}):this.negative&y.negative?(z=this.neg().divmod(y.neg(),E),E!=="div"&&(O=z.mod.neg(),R&&O.negative!==0&&O.isub(y)),{div:z.div,mod:O}):y.length>this.length||this.cmp(y)<0?{div:new s(0),mod:this}:y.length===1?E==="div"?{div:this.divn(y.words[0]),mod:null}:E==="mod"?{div:null,mod:new s(this.modrn(y.words[0]))}:{div:this.divn(y.words[0]),mod:new s(this.modrn(y.words[0]))}:this._wordDiv(y,E)},s.prototype.div=function(y){return this.divmod(y,"div",!1).div},s.prototype.mod=function(y){return this.divmod(y,"mod",!1).mod},s.prototype.umod=function(y){return this.divmod(y,"mod",!0).mod},s.prototype.divRound=function(y){var E=this.divmod(y);if(E.mod.isZero())return E.div;var R=E.div.negative!==0?E.mod.isub(y):E.mod,F=y.ushrn(1),O=y.andln(1),z=R.cmp(F);return z<0||O===1&&z===0?E.div:E.div.negative!==0?E.div.isubn(1):E.div.iaddn(1)},s.prototype.modrn=function(y){var E=y<0;E&&(y=-y),r(y<=67108863);for(var R=(1<<26)%y,F=0,O=this.length-1;O>=0;O--)F=(R*F+(this.words[O]|0))%y;return E?-F:F},s.prototype.modn=function(y){return this.modrn(y)},s.prototype.idivn=function(y){var E=y<0;E&&(y=-y),r(y<=67108863);for(var R=0,F=this.length-1;F>=0;F--){var O=(this.words[F]|0)+R*67108864;this.words[F]=O/y|0,R=O%y}return this._strip(),E?this.ineg():this},s.prototype.divn=function(y){return this.clone().idivn(y)},s.prototype.egcd=function(y){r(y.negative===0),r(!y.isZero());var E=this,R=y.clone();E.negative!==0?E=E.umod(y):E=E.clone();for(var F=new s(1),O=new s(0),z=new s(0),j=new s(1),Q=0;E.isEven()&&R.isEven();)E.iushrn(1),R.iushrn(1),++Q;for(var C=R.clone(),W=E.clone();!E.isZero();){for(var ee=0,P=1;!(E.words[0]&P)&&ee<26;++ee,P<<=1);if(ee>0)for(E.iushrn(ee);ee-- >0;)(F.isOdd()||O.isOdd())&&(F.iadd(C),O.isub(W)),F.iushrn(1),O.iushrn(1);for(var re=0,ue=1;!(R.words[0]&ue)&&re<26;++re,ue<<=1);if(re>0)for(R.iushrn(re);re-- >0;)(z.isOdd()||j.isOdd())&&(z.iadd(C),j.isub(W)),z.iushrn(1),j.iushrn(1);E.cmp(R)>=0?(E.isub(R),F.isub(z),O.isub(j)):(R.isub(E),z.isub(F),j.isub(O))}return{a:z,b:j,gcd:R.iushln(Q)}},s.prototype._invmp=function(y){r(y.negative===0),r(!y.isZero());var E=this,R=y.clone();E.negative!==0?E=E.umod(y):E=E.clone();for(var F=new s(1),O=new s(0),z=R.clone();E.cmpn(1)>0&&R.cmpn(1)>0;){for(var j=0,Q=1;!(E.words[0]&Q)&&j<26;++j,Q<<=1);if(j>0)for(E.iushrn(j);j-- >0;)F.isOdd()&&F.iadd(z),F.iushrn(1);for(var C=0,W=1;!(R.words[0]&W)&&C<26;++C,W<<=1);if(C>0)for(R.iushrn(C);C-- >0;)O.isOdd()&&O.iadd(z),O.iushrn(1);E.cmp(R)>=0?(E.isub(R),F.isub(O)):(R.isub(E),O.isub(F))}var ee;return E.cmpn(1)===0?ee=F:ee=O,ee.cmpn(0)<0&&ee.iadd(y),ee},s.prototype.gcd=function(y){if(this.isZero())return y.abs();if(y.isZero())return this.abs();var E=this.clone(),R=y.clone();E.negative=0,R.negative=0;for(var F=0;E.isEven()&&R.isEven();F++)E.iushrn(1),R.iushrn(1);do{for(;E.isEven();)E.iushrn(1);for(;R.isEven();)R.iushrn(1);var O=E.cmp(R);if(O<0){var z=E;E=R,R=z}else if(O===0||R.cmpn(1)===0)break;E.isub(R)}while(!0);return R.iushln(F)},s.prototype.invm=function(y){return this.egcd(y).a.umod(y)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(y){return this.words[0]&y},s.prototype.bincn=function(y){r(typeof y=="number");var E=y%26,R=(y-E)/26,F=1<>>26,j&=67108863,this.words[z]=j}return O!==0&&(this.words[z]=O,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(y){var E=y<0;if(this.negative!==0&&!E)return-1;if(this.negative===0&&E)return 1;this._strip();var R;if(this.length>1)R=1;else{E&&(y=-y),r(y<=67108863,"Number is too big");var F=this.words[0]|0;R=F===y?0:Fy.length)return 1;if(this.length=0;R--){var F=this.words[R]|0,O=y.words[R]|0;if(F!==O){FO&&(E=1);break}}return E},s.prototype.gtn=function(y){return this.cmpn(y)===1},s.prototype.gt=function(y){return this.cmp(y)===1},s.prototype.gten=function(y){return this.cmpn(y)>=0},s.prototype.gte=function(y){return this.cmp(y)>=0},s.prototype.ltn=function(y){return this.cmpn(y)===-1},s.prototype.lt=function(y){return this.cmp(y)===-1},s.prototype.lten=function(y){return this.cmpn(y)<=0},s.prototype.lte=function(y){return this.cmp(y)<=0},s.prototype.eqn=function(y){return this.cmpn(y)===0},s.prototype.eq=function(y){return this.cmp(y)===0},s.red=function(y){return new L(y)},s.prototype.toRed=function(y){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),y.convertTo(this)._forceRed(y)},s.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(y){return this.red=y,this},s.prototype.forceRed=function(y){return r(!this.red,"Already a number in reduction context"),this._forceRed(y)},s.prototype.redAdd=function(y){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,y)},s.prototype.redIAdd=function(y){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,y)},s.prototype.redSub=function(y){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,y)},s.prototype.redISub=function(y){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,y)},s.prototype.redShl=function(y){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,y)},s.prototype.redMul=function(y){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.mul(this,y)},s.prototype.redIMul=function(y){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.imul(this,y)},s.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(y){return r(this.red&&!y.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,y)};var x={k256:null,p224:null,p192:null,p25519:null};function b(T,y){this.name=T,this.p=new s(y,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}b.prototype._tmp=function(){var y=new s(null);return y.words=new Array(Math.ceil(this.n/13)),y},b.prototype.ireduce=function(y){var E=y,R;do this.split(E,this.tmp),E=this.imulK(E),E=E.iadd(this.tmp),R=E.bitLength();while(R>this.n);var F=R0?E.isub(this.p):E.strip!==void 0?E.strip():E._strip(),E},b.prototype.split=function(y,E){y.iushrn(this.n,0,E)},b.prototype.imulK=function(y){return y.imul(this.k)};function B(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(B,b),B.prototype.split=function(y,E){for(var R=4194303,F=Math.min(y.length,9),O=0;O>>22,z=j}z>>>=22,y.words[O-10]=z,z===0&&y.length>10?y.length-=10:y.length-=9},B.prototype.imulK=function(y){y.words[y.length]=0,y.words[y.length+1]=0,y.length+=2;for(var E=0,R=0;R>>=26,y.words[R]=O,E=F}return E!==0&&(y.words[y.length++]=E),y},s._prime=function(y){if(x[y])return x[y];var E;if(y==="k256")E=new B;else if(y==="p224")E=new S;else if(y==="p192")E=new I;else if(y==="p25519")E=new M;else throw new Error("Unknown prime "+y);return x[y]=E,E};function L(T){if(typeof T=="string"){var y=s._prime(T);this.m=y.p,this.prime=y}else r(T.gtn(1),"modulus must be greater than 1"),this.m=T,this.prime=null}L.prototype._verify1=function(y){r(y.negative===0,"red works only with positives"),r(y.red,"red works only with red numbers")},L.prototype._verify2=function(y,E){r((y.negative|E.negative)===0,"red works only with positives"),r(y.red&&y.red===E.red,"red works only with red numbers")},L.prototype.imod=function(y){return this.prime?this.prime.ireduce(y)._forceRed(this):(A(y,y.umod(this.m)._forceRed(this)),y)},L.prototype.neg=function(y){return y.isZero()?y.clone():this.m.sub(y)._forceRed(this)},L.prototype.add=function(y,E){this._verify2(y,E);var R=y.add(E);return R.cmp(this.m)>=0&&R.isub(this.m),R._forceRed(this)},L.prototype.iadd=function(y,E){this._verify2(y,E);var R=y.iadd(E);return R.cmp(this.m)>=0&&R.isub(this.m),R},L.prototype.sub=function(y,E){this._verify2(y,E);var R=y.sub(E);return R.cmpn(0)<0&&R.iadd(this.m),R._forceRed(this)},L.prototype.isub=function(y,E){this._verify2(y,E);var R=y.isub(E);return R.cmpn(0)<0&&R.iadd(this.m),R},L.prototype.shl=function(y,E){return this._verify1(y),this.imod(y.ushln(E))},L.prototype.imul=function(y,E){return this._verify2(y,E),this.imod(y.imul(E))},L.prototype.mul=function(y,E){return this._verify2(y,E),this.imod(y.mul(E))},L.prototype.isqr=function(y){return this.imul(y,y.clone())},L.prototype.sqr=function(y){return this.mul(y,y)},L.prototype.sqrt=function(y){if(y.isZero())return y.clone();var E=this.m.andln(3);if(r(E%2===1),E===3){var R=this.m.add(new s(1)).iushrn(2);return this.pow(y,R)}for(var F=this.m.subn(1),O=0;!F.isZero()&&F.andln(1)===0;)O++,F.iushrn(1);r(!F.isZero());var z=new s(1).toRed(this),j=z.redNeg(),Q=this.m.subn(1).iushrn(1),C=this.m.bitLength();for(C=new s(2*C*C).toRed(this);this.pow(C,Q).cmp(j)!==0;)C.redIAdd(j);for(var W=this.pow(C,F),ee=this.pow(y,F.addn(1).iushrn(1)),P=this.pow(y,F),re=O;P.cmp(z)!==0;){for(var ue=P,le=0;ue.cmp(z)!==0;le++)ue=ue.redSqr();r(le=0;O--){for(var W=E.words[O],ee=C-1;ee>=0;ee--){var P=W>>ee&1;if(z!==F[0]&&(z=this.sqr(z)),P===0&&j===0){Q=0;continue}j<<=1,j|=P,Q++,!(Q!==R&&(O!==0||ee!==0))&&(z=this.mul(z,F[j]),Q=0,j=0)}C=26}return z},L.prototype.convertTo=function(y){var E=y.umod(this.m);return E===y?E.clone():E},L.prototype.convertFrom=function(y){var E=y.clone();return E.red=null,E},s.mont=function(y){return new D(y)};function D(T){L.call(this,T),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(D,L),D.prototype.convertTo=function(y){return this.imod(y.ushln(this.shift))},D.prototype.convertFrom=function(y){var E=this.imod(y.mul(this.rinv));return E.red=null,E},D.prototype.imul=function(y,E){if(y.isZero()||E.isZero())return y.words[0]=0,y.length=1,y;var R=y.imul(E),F=R.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=R.isub(F).iushrn(this.shift),z=O;return O.cmp(this.m)>=0?z=O.isub(this.m):O.cmpn(0)<0&&(z=O.iadd(this.m)),z._forceRed(this)},D.prototype.mul=function(y,E){if(y.isZero()||E.isZero())return new s(0)._forceRed(this);var R=y.mul(E),F=R.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=R.isub(F).iushrn(this.shift),z=O;return O.cmp(this.m)>=0?z=O.isub(this.m):O.cmpn(0)<0&&(z=O.iadd(this.m)),z._forceRed(this)},D.prototype.invm=function(y){var E=this.imod(y._invmp(this.m).mul(this.r2));return E._forceRed(this)}})(n,ka)})(lI);var n9=lI.exports;const _t=oc(n9),r9="logger/5.7.0";let CU=!1,TU=!1;const tw={debug:1,default:2,info:2,warning:3,error:4,off:5};let IU=tw.default,pb=null;function i9(){try{const n=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{n.push(e)}}),n.length)throw new Error("missing "+n.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(n){return n.message}return null}const RU=i9();var TM;(function(n){n.DEBUG="DEBUG",n.INFO="INFO",n.WARNING="WARNING",n.ERROR="ERROR",n.OFF="OFF"})(TM||(TM={}));var jo;(function(n){n.UNKNOWN_ERROR="UNKNOWN_ERROR",n.NOT_IMPLEMENTED="NOT_IMPLEMENTED",n.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",n.NETWORK_ERROR="NETWORK_ERROR",n.SERVER_ERROR="SERVER_ERROR",n.TIMEOUT="TIMEOUT",n.BUFFER_OVERRUN="BUFFER_OVERRUN",n.NUMERIC_FAULT="NUMERIC_FAULT",n.MISSING_NEW="MISSING_NEW",n.INVALID_ARGUMENT="INVALID_ARGUMENT",n.MISSING_ARGUMENT="MISSING_ARGUMENT",n.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",n.CALL_EXCEPTION="CALL_EXCEPTION",n.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",n.NONCE_EXPIRED="NONCE_EXPIRED",n.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",n.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",n.TRANSACTION_REPLACED="TRANSACTION_REPLACED",n.ACTION_REJECTED="ACTION_REJECTED"})(jo||(jo={}));const UU="0123456789abcdef";let xe=class Rr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();tw[r]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(IU>tw[r])&&console.log.apply(console,t)}debug(...e){this._log(Rr.levels.DEBUG,e)}info(...e){this._log(Rr.levels.INFO,e)}warn(...e){this._log(Rr.levels.WARNING,e)}makeError(e,t,r){if(TU)return this.makeError("censored error",t,{});t||(t=Rr.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(l=>{const c=r[l];try{if(c instanceof Uint8Array){let A="";for(let u=0;u>4],A+=UU[c[u]&15];i.push(l+"=Uint8Array(0x"+A+")")}else i.push(l+"="+JSON.stringify(c))}catch{i.push(l+"="+JSON.stringify(r[l].toString()))}}),i.push(`code=${t}`),i.push(`version=${this.version}`);const s=e;let o="";switch(t){case jo.NUMERIC_FAULT:{o="NUMERIC_FAULT";const l=e;switch(l){case"overflow":case"underflow":case"division-by-zero":o+="-"+l;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case jo.CALL_EXCEPTION:case jo.INSUFFICIENT_FUNDS:case jo.MISSING_NEW:case jo.NONCE_EXPIRED:case jo.REPLACEMENT_UNDERPRICED:case jo.TRANSACTION_REPLACED:case jo.UNPREDICTABLE_GAS_LIMIT:o=t;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=t,Object.keys(r).forEach(function(l){a[l]=r[l]}),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,Rr.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,i){e||this.throwError(t,r,i)}assertArgument(e,t,r,i){e||this.throwArgumentError(t,r,i)}checkNormalize(e){RU&&this.throwError("platform missing String.prototype.normalize",Rr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:RU})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,Rr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,Rr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r?r=": "+r:r="",et&&this.throwError("too many arguments"+r,Rr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",Rr.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",Rr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Rr.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return pb||(pb=new Rr(r9)),pb}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",Rr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),CU){if(!e)return;this.globalLogger().throwError("error censorship permanent",Rr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}TU=!!e,CU=!!t}static setLogLevel(e){const t=tw[e.toLowerCase()];if(t==null){Rr.globalLogger().warn("invalid log level - "+e);return}IU=t}static from(e){return new Rr(e)}};xe.errors=jo;xe.levels=TM;const s9="bytes/5.7.0",Jn=new xe(s9);function q4(n){return!!n.toHexString}function Wh(n){return n.slice||(n.slice=function(){const e=Array.prototype.slice.call(arguments);return Wh(new Uint8Array(Array.prototype.slice.apply(n,e)))}),n}function cI(n){return It(n)&&!(n.length%2)||Ux(n)}function FU(n){return typeof n=="number"&&n==n&&n%1===0}function Ux(n){if(n==null)return!1;if(n.constructor===Uint8Array)return!0;if(typeof n=="string"||!FU(n.length)||n.length<0)return!1;for(let e=0;e=256)return!1}return!0}function pt(n,e){if(e||(e={}),typeof n=="number"){Jn.checkSafeUint53(n,"invalid arrayify value");const t=[];for(;n;)t.unshift(n&255),n=parseInt(String(n/256));return t.length===0&&t.push(0),Wh(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof n=="string"&&n.substring(0,2)!=="0x"&&(n="0x"+n),q4(n)&&(n=n.toHexString()),It(n)){let t=n.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":Jn.throwArgumentError("hex data is odd-length","value",n));const r=[];for(let i=0;ipt(i)),t=e.reduce((i,s)=>i+s.length,0),r=new Uint8Array(t);return e.reduce((i,s)=>(r.set(s,i),i+s.length),0),Wh(r)}function hd(n){let e=pt(n);if(e.length===0)return e;let t=0;for(;te&&Jn.throwArgumentError("value out of range","value",arguments[0]);const t=new Uint8Array(e);return t.set(n,e-n.length),Wh(t)}function It(n,e){return!(typeof n!="string"||!n.match(/^0x[0-9A-Fa-f]*$/)||e&&n.length!==2+2*e)}const mb="0123456789abcdef";function lt(n,e){if(e||(e={}),typeof n=="number"){Jn.checkSafeUint53(n,"invalid hexlify value");let t="";for(;n;)t=mb[n&15]+t,n=Math.floor(n/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if(typeof n=="bigint")return n=n.toString(16),n.length%2?"0x0"+n:"0x"+n;if(e.allowMissingPrefix&&typeof n=="string"&&n.substring(0,2)!=="0x"&&(n="0x"+n),q4(n))return n.toHexString();if(It(n))return n.length%2&&(e.hexPad==="left"?n="0x0"+n.substring(2):e.hexPad==="right"?n+="0":Jn.throwArgumentError("hex data is odd-length","value",n)),n.toLowerCase();if(Ux(n)){let t="0x";for(let r=0;r>4]+mb[i&15]}return t}return Jn.throwArgumentError("invalid hexlify value","value",n)}function Su(n){if(typeof n!="string")n=lt(n);else if(!It(n)||n.length%2)return null;return(n.length-2)/2}function mi(n,e,t){return typeof n!="string"?n=lt(n):(!It(n)||n.length%2)&&Jn.throwArgumentError("invalid hexData","value",n),e=2+2*e,t!=null?"0x"+n.substring(e,2+2*t):"0x"+n.substring(e)}function $i(n){let e="0x";return n.forEach(t=>{e+=lt(t).substring(2)}),e}function Fx(n){const e=a9(lt(n,{hexPad:"left"}));return e==="0x"?"0x0":e}function a9(n){typeof n!="string"&&(n=lt(n)),It(n)||Jn.throwArgumentError("invalid hex string","value",n),n=n.substring(2);let e=0;for(;e2*e+2&&Jn.throwArgumentError("value out of range","value",arguments[1]);n.length<2*e+2;)n="0x0"+n.substring(2);return n}function Px(n){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(cI(n)){let t=pt(n);t.length===64?(e.v=27+(t[32]>>7),t[32]&=127,e.r=lt(t.slice(0,32)),e.s=lt(t.slice(32,64))):t.length===65?(e.r=lt(t.slice(0,32)),e.s=lt(t.slice(32,64)),e.v=t[64]):Jn.throwArgumentError("invalid signature string","signature",n),e.v<27&&(e.v===0||e.v===1?e.v+=27:Jn.throwArgumentError("signature invalid v byte","signature",n)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(t[32]|=128),e._vs=lt(t.slice(32,64))}else{if(e.r=n.r,e.s=n.s,e.v=n.v,e.recoveryParam=n.recoveryParam,e._vs=n._vs,e._vs!=null){const i=o9(pt(e._vs),32);e._vs=lt(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&Jn.throwArgumentError("signature recoveryParam mismatch _vs","signature",n),i[0]&=127;const o=lt(i);e.s==null?e.s=o:e.s!==o&&Jn.throwArgumentError("signature v mismatch _vs","signature",n)}if(e.recoveryParam==null)e.v==null?Jn.throwArgumentError("signature missing v and recoveryParam","signature",n):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&Jn.throwArgumentError("signature recoveryParam mismatch v","signature",n)}e.r==null||!It(e.r)?Jn.throwArgumentError("signature missing or invalid r","signature",n):e.r=ir(e.r,32),e.s==null||!It(e.s)?Jn.throwArgumentError("signature missing or invalid s","signature",n):e.s=ir(e.s,32);const t=pt(e.s);t[0]>=128&&Jn.throwArgumentError("signature s out of range","signature",n),e.recoveryParam&&(t[0]|=128);const r=lt(t);e._vs&&(It(e._vs)||Jn.throwArgumentError("signature invalid _vs","signature",n),e._vs=ir(e._vs,32)),e._vs==null?e._vs=r:e._vs!==r&&Jn.throwArgumentError("signature _vs mismatch v and s","signature",n)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const l9="bignumber/5.7.0";var Xw=_t.BN;const Cl=new xe(l9),gb={},PU=9007199254740991;let LU=!1;class je{constructor(e,t){e!==gb&&Cl.throwError("cannot call constructor directly; use BigNumber.from",xe.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Gi(Nt(this).fromTwos(e))}toTwos(e){return Gi(Nt(this).toTwos(e))}abs(){return this._hex[0]==="-"?je.from(this._hex.substring(1)):this}add(e){return Gi(Nt(this).add(Nt(e)))}sub(e){return Gi(Nt(this).sub(Nt(e)))}div(e){return je.from(e).isZero()&&Ys("division-by-zero","div"),Gi(Nt(this).div(Nt(e)))}mul(e){return Gi(Nt(this).mul(Nt(e)))}mod(e){const t=Nt(e);return t.isNeg()&&Ys("division-by-zero","mod"),Gi(Nt(this).umod(t))}pow(e){const t=Nt(e);return t.isNeg()&&Ys("negative-power","pow"),Gi(Nt(this).pow(t))}and(e){const t=Nt(e);return(this.isNegative()||t.isNeg())&&Ys("unbound-bitwise-result","and"),Gi(Nt(this).and(t))}or(e){const t=Nt(e);return(this.isNegative()||t.isNeg())&&Ys("unbound-bitwise-result","or"),Gi(Nt(this).or(t))}xor(e){const t=Nt(e);return(this.isNegative()||t.isNeg())&&Ys("unbound-bitwise-result","xor"),Gi(Nt(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Ys("negative-width","mask"),Gi(Nt(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Ys("negative-width","shl"),Gi(Nt(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Ys("negative-width","shr"),Gi(Nt(this).shrn(e))}eq(e){return Nt(this).eq(Nt(e))}lt(e){return Nt(this).lt(Nt(e))}lte(e){return Nt(this).lte(Nt(e))}gt(e){return Nt(this).gt(Nt(e))}gte(e){return Nt(this).gte(Nt(e))}isNegative(){return this._hex[0]==="-"}isZero(){return Nt(this).isZero()}toNumber(){try{return Nt(this).toNumber()}catch{Ys("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Cl.throwError("this platform does not support BigInt",xe.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?LU||(LU=!0,Cl.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Cl.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",xe.errors.UNEXPECTED_ARGUMENT,{}):Cl.throwError("BigNumber.toString does not accept parameters",xe.errors.UNEXPECTED_ARGUMENT,{})),Nt(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof je)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new je(gb,cg(e)):e.match(/^-?[0-9]+$/)?new je(gb,cg(new Xw(e))):Cl.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Ys("underflow","BigNumber.from",e),(e>=PU||e<=-PU)&&Ys("overflow","BigNumber.from",e),je.from(String(e));const t=e;if(typeof t=="bigint")return je.from(t.toString());if(Ux(t))return je.from(lt(t));if(t)if(t.toHexString){const r=t.toHexString();if(typeof r=="string")return je.from(r)}else{let r=t._hex;if(r==null&&t.type==="BigNumber"&&(r=t.hex),typeof r=="string"&&(It(r)||r[0]==="-"&&It(r.substring(1))))return je.from(r)}return Cl.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function cg(n){if(typeof n!="string")return cg(n.toString(16));if(n[0]==="-")return n=n.substring(1),n[0]==="-"&&Cl.throwArgumentError("invalid hex","value",n),n=cg(n),n==="0x00"?n:"-"+n;if(n.substring(0,2)!=="0x"&&(n="0x"+n),n==="0x")return"0x00";for(n.length%2&&(n="0x0"+n.substring(2));n.length>4&&n.substring(0,4)==="0x00";)n="0x"+n.substring(4);return n}function Gi(n){return je.from(cg(n))}function Nt(n){const e=je.from(n).toHexString();return e[0]==="-"?new Xw("-"+e.substring(3),16):new Xw(e.substring(2),16)}function Ys(n,e,t){const r={fault:n,operation:e};return t!=null&&(r.value=t),Cl.throwError(n,xe.errors.NUMERIC_FAULT,r)}function c9(n){return new Xw(n,36).toString(16)}const A9="properties/5.7.0";var u9=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const Yw=new xe(A9);function Ue(n,e,t){Object.defineProperty(n,e,{enumerable:!0,value:t,writable:!1})}function Cs(n,e){for(let t=0;t<32;t++){if(n[e])return n[e];if(!n.prototype||typeof n.prototype!="object")break;n=Object.getPrototypeOf(n.prototype).constructor}return null}function wr(n){return u9(this,void 0,void 0,function*(){const e=Object.keys(n).map(r=>{const i=n[r];return Promise.resolve(i).then(s=>({key:r,value:s}))});return(yield Promise.all(e)).reduce((r,i)=>(r[i.key]=i.value,r),{})})}function f9(n,e){(!n||typeof n!="object")&&Yw.throwArgumentError("invalid object","object",n),Object.keys(n).forEach(t=>{e[t]||Yw.throwArgumentError("invalid object key - "+t,"transaction:"+t,n)})}function Qn(n){const e={};for(const t in n)e[t]=n[t];return e}const h9={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function eQ(n){if(n==null||h9[typeof n])return!0;if(Array.isArray(n)||typeof n=="object"){if(!Object.isFrozen(n))return!1;const e=Object.keys(n);for(let t=0;tPs(e)));if(typeof n=="object"){const e={};for(const t in n){const r=n[t];r!==void 0&&Ue(e,t,Ps(r))}return e}return Yw.throwArgumentError(`Cannot deepCopy ${typeof n}`,"object",n)}function Ps(n){return d9(n)}class a0{constructor(e){for(const t in e)this[t]=Ps(e[t])}}const p9="abstract-provider/5.7.0";var m9=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const g9=new xe(p9);class v9 extends a0{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class l0{constructor(){g9.checkAbstract(new.target,l0),Ue(this,"_isProvider",!0)}getFeeData(){return m9(this,void 0,void 0,function*(){const{block:e,gasPrice:t}=yield wr({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(o=>null)});let r=null,i=null,s=null;return e&&e.baseFeePerGas&&(r=e.baseFeePerGas,s=je.from("1500000000"),i=e.baseFeePerGas.mul(2).add(s)),{lastBaseFeePerGas:r,maxFeePerGas:i,maxPriorityFeePerGas:s,gasPrice:t}})}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}static isProvider(e){return!!(e&&e._isProvider)}}const y9="networks/5.7.1",DU=new xe(y9);function w9(n){return n&&typeof n.renetwork=="function"}function Fl(n){const e=function(t,r){r==null&&(r={});const i=[];if(t.InfuraProvider&&r.infura!=="-")try{i.push(new t.InfuraProvider(n,r.infura))}catch{}if(t.EtherscanProvider&&r.etherscan!=="-")try{i.push(new t.EtherscanProvider(n,r.etherscan))}catch{}if(t.AlchemyProvider&&r.alchemy!=="-")try{i.push(new t.AlchemyProvider(n,r.alchemy))}catch{}if(t.PocketProvider&&r.pocket!=="-"){const s=["goerli","ropsten","rinkeby","sepolia"];try{const o=new t.PocketProvider(n,r.pocket);o.network&&s.indexOf(o.network.name)===-1&&i.push(o)}catch{}}if(t.CloudflareProvider&&r.cloudflare!=="-")try{i.push(new t.CloudflareProvider(n))}catch{}if(t.AnkrProvider&&r.ankr!=="-")try{const s=["ropsten"],o=new t.AnkrProvider(n,r.ankr);o.network&&s.indexOf(o.network.name)===-1&&i.push(o)}catch{}if(i.length===0)return null;if(t.FallbackProvider){let s=1;return r.quorum!=null?s=r.quorum:n==="homestead"&&(s=2),new t.FallbackProvider(i,s)}return i[0]};return e.renetwork=function(t){return Fl(t)},e}function $w(n,e){const t=function(r,i){return r.JsonRpcProvider?new r.JsonRpcProvider(n,e):null};return t.renetwork=function(r){return $w(n,r)},t}const NU={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:Fl("homestead")},OU={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:Fl("ropsten")},kU={chainId:63,name:"classicMordor",_defaultProvider:$w("https://www.ethercluster.com/mordor","classicMordor")},Q0={unspecified:{chainId:0,name:"unspecified"},homestead:NU,mainnet:NU,morden:{chainId:2,name:"morden"},ropsten:OU,testnet:OU,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:Fl("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:Fl("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:Fl("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:Fl("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:$w("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:kU,classicTestnet:kU,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:$w("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:Fl("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:Fl("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function tQ(n){if(n==null)return null;if(typeof n=="number"){for(const r in Q0){const i=Q0[r];if(i.chainId===n)return{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress||null,_defaultProvider:i._defaultProvider||null}}return{chainId:n,name:"unknown"}}if(typeof n=="string"){const r=Q0[n];return r==null?null:{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress,_defaultProvider:r._defaultProvider||null}}const e=Q0[n.name];if(!e)return typeof n.chainId!="number"&&DU.throwArgumentError("invalid network chainId","network",n),n;n.chainId!==0&&n.chainId!==e.chainId&&DU.throwArgumentError("network chainId mismatch","network",n);let t=n._defaultProvider||null;return t==null&&e._defaultProvider&&(w9(e._defaultProvider)?t=e._defaultProvider.renetwork(n):t=e._defaultProvider),{name:n.name,chainId:e.chainId,ensAddress:n.ensAddress||e.ensAddress||null,_defaultProvider:t}}function nQ(n){n=atob(n);const e=[];for(let t=0;t0;)r.push(o%this.base),o=o/this.base|0}let i="";for(let s=0;t[s]===0&&s=0;--s)i+=this.alphabet[r[s]];return i}decode(e){if(typeof e!="string")throw new TypeError("Expected String");let t=[];if(e.length===0)return new Uint8Array(t);t.push(0);for(let r=0;r>=8;for(;s>0;)t.push(s&255),s>>=8}for(let r=0;e[r]===this._leader&&r>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ue>>5,this.extraBytes=(ue&31)>>3;for(var le=0;le<50;++le)this.s[le]=0}C.prototype.update=function(P){if(this.finalized)throw new Error(t);var re,ue=typeof P;if(ue!=="string"){if(ue==="object"){if(P===null)throw new Error(e);if(l&&P.constructor===ArrayBuffer)P=new Uint8Array(P);else if(!Array.isArray(P)&&(!l||!ArrayBuffer.isView(P)))throw new Error(e)}else throw new Error(e);re=!0}for(var le=this.blocks,me=this.byteCount,ie=P.length,ge=this.blockCount,_e=0,se=this.s,Q,fe;_e>2]|=P[_e]<>2]|=fe<>2]|=(192|fe>>6)<>2]|=(128|fe&63)<=57344?(le[Q>>2]|=(224|fe>>12)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<>2]|=(240|fe>>18)<>2]|=(128|fe>>12&63)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<=me){for(this.start=Q-me,this.block=le[ge],Q=0;Q>8,ue=P&255;ue>0;)me.unshift(ue),P=P>>8,ue=P&255,++le;return re?me.push(le):me.unshift(le),this.update(me),me.length},C.prototype.encodeString=function(P){var re,ue=typeof P;if(ue!=="string"){if(ue==="object"){if(P===null)throw new Error(e);if(l&&P.constructor===ArrayBuffer)P=new Uint8Array(P);else if(!Array.isArray(P)&&(!l||!ArrayBuffer.isView(P)))throw new Error(e)}else throw new Error(e);re=!0}var le=0,me=P.length;if(re)le=me;else for(var ie=0;ie=57344?le+=3:(ge=65536+((ge&1023)<<10|P.charCodeAt(++ie)&1023),le+=4)}return le+=this.encode(le*8),this.update(P),le},C.prototype.bytepad=function(P,re){for(var ue=this.encode(re),le=0;le>2]|=this.padding[re&3],this.lastByteIndex===this.byteCount)for(P[0]=P[ue],re=1;re>4&15]+c[_e&15]+c[_e>>12&15]+c[_e>>8&15]+c[_e>>20&15]+c[_e>>16&15]+c[_e>>28&15]+c[_e>>24&15];ie%P===0&&(ee(re),me=0)}return le&&(_e=re[me],ge+=c[_e>>4&15]+c[_e&15],le>1&&(ge+=c[_e>>12&15]+c[_e>>8&15]),le>2&&(ge+=c[_e>>20&15]+c[_e>>16&15])),ge},C.prototype.arrayBuffer=function(){this.finalize();var P=this.blockCount,re=this.s,ue=this.outputBlocks,le=this.extraBytes,me=0,ie=0,ge=this.outputBits>>3,_e;le?_e=new ArrayBuffer(ue+1<<2):_e=new ArrayBuffer(ge);for(var se=new Uint32Array(_e);ie>8&255,ge[_e+2]=se>>16&255,ge[_e+3]=se>>24&255;ie%P===0&&ee(re)}return le&&(_e=ie<<2,se=re[me],ge[_e]=se&255,le>1&&(ge[_e+1]=se>>8&255),le>2&&(ge[_e+2]=se>>16&255)),ge};function W(P,re,ue){C.call(this,P,re,ue)}W.prototype=new C,W.prototype.finalize=function(){return this.encode(this.outputBits,!0),C.prototype.finalize.call(this)};var ee=function(P){var re,ue,le,me,ie,ge,_e,se,Q,fe,Ae,Z,q,he,X,G,ne,Y,de,ae,Ee,V,U,N,K,oe,pe,ve,Ce,Le,Re,$e,ce,Pe,Me,Te,Fe,De,Ze,At,Pn,rt,xt,Tr,tn,qt,Zr,en,nn,Ks,Xt,Yt,Ii,rn,sn,da,un,on,te,ye,Be,Se,we;for(le=0;le<48;le+=2)me=P[0]^P[10]^P[20]^P[30]^P[40],ie=P[1]^P[11]^P[21]^P[31]^P[41],ge=P[2]^P[12]^P[22]^P[32]^P[42],_e=P[3]^P[13]^P[23]^P[33]^P[43],se=P[4]^P[14]^P[24]^P[34]^P[44],Q=P[5]^P[15]^P[25]^P[35]^P[45],fe=P[6]^P[16]^P[26]^P[36]^P[46],Ae=P[7]^P[17]^P[27]^P[37]^P[47],Z=P[8]^P[18]^P[28]^P[38]^P[48],q=P[9]^P[19]^P[29]^P[39]^P[49],re=Z^(ge<<1|_e>>>31),ue=q^(_e<<1|ge>>>31),P[0]^=re,P[1]^=ue,P[10]^=re,P[11]^=ue,P[20]^=re,P[21]^=ue,P[30]^=re,P[31]^=ue,P[40]^=re,P[41]^=ue,re=me^(se<<1|Q>>>31),ue=ie^(Q<<1|se>>>31),P[2]^=re,P[3]^=ue,P[12]^=re,P[13]^=ue,P[22]^=re,P[23]^=ue,P[32]^=re,P[33]^=ue,P[42]^=re,P[43]^=ue,re=ge^(fe<<1|Ae>>>31),ue=_e^(Ae<<1|fe>>>31),P[4]^=re,P[5]^=ue,P[14]^=re,P[15]^=ue,P[24]^=re,P[25]^=ue,P[34]^=re,P[35]^=ue,P[44]^=re,P[45]^=ue,re=se^(Z<<1|q>>>31),ue=Q^(q<<1|Z>>>31),P[6]^=re,P[7]^=ue,P[16]^=re,P[17]^=ue,P[26]^=re,P[27]^=ue,P[36]^=re,P[37]^=ue,P[46]^=re,P[47]^=ue,re=fe^(me<<1|ie>>>31),ue=Ae^(ie<<1|me>>>31),P[8]^=re,P[9]^=ue,P[18]^=re,P[19]^=ue,P[28]^=re,P[29]^=ue,P[38]^=re,P[39]^=ue,P[48]^=re,P[49]^=ue,he=P[0],X=P[1],qt=P[11]<<4|P[10]>>>28,Zr=P[10]<<4|P[11]>>>28,ve=P[20]<<3|P[21]>>>29,Ce=P[21]<<3|P[20]>>>29,ye=P[31]<<9|P[30]>>>23,Be=P[30]<<9|P[31]>>>23,rt=P[40]<<18|P[41]>>>14,xt=P[41]<<18|P[40]>>>14,Pe=P[2]<<1|P[3]>>>31,Me=P[3]<<1|P[2]>>>31,G=P[13]<<12|P[12]>>>20,ne=P[12]<<12|P[13]>>>20,en=P[22]<<10|P[23]>>>22,nn=P[23]<<10|P[22]>>>22,Le=P[33]<<13|P[32]>>>19,Re=P[32]<<13|P[33]>>>19,Se=P[42]<<2|P[43]>>>30,we=P[43]<<2|P[42]>>>30,rn=P[5]<<30|P[4]>>>2,sn=P[4]<<30|P[5]>>>2,Te=P[14]<<6|P[15]>>>26,Fe=P[15]<<6|P[14]>>>26,Y=P[25]<<11|P[24]>>>21,de=P[24]<<11|P[25]>>>21,Ks=P[34]<<15|P[35]>>>17,Xt=P[35]<<15|P[34]>>>17,$e=P[45]<<29|P[44]>>>3,ce=P[44]<<29|P[45]>>>3,N=P[6]<<28|P[7]>>>4,K=P[7]<<28|P[6]>>>4,da=P[17]<<23|P[16]>>>9,un=P[16]<<23|P[17]>>>9,De=P[26]<<25|P[27]>>>7,Ze=P[27]<<25|P[26]>>>7,ae=P[36]<<21|P[37]>>>11,Ee=P[37]<<21|P[36]>>>11,Yt=P[47]<<24|P[46]>>>8,Ii=P[46]<<24|P[47]>>>8,Tr=P[8]<<27|P[9]>>>5,tn=P[9]<<27|P[8]>>>5,oe=P[18]<<20|P[19]>>>12,pe=P[19]<<20|P[18]>>>12,on=P[29]<<7|P[28]>>>25,te=P[28]<<7|P[29]>>>25,At=P[38]<<8|P[39]>>>24,Pn=P[39]<<8|P[38]>>>24,V=P[48]<<14|P[49]>>>18,U=P[49]<<14|P[48]>>>18,P[0]=he^~G&Y,P[1]=X^~ne&de,P[10]=N^~oe&ve,P[11]=K^~pe&Ce,P[20]=Pe^~Te&De,P[21]=Me^~Fe&Ze,P[30]=Tr^~qt&en,P[31]=tn^~Zr&nn,P[40]=rn^~da&on,P[41]=sn^~un&te,P[2]=G^~Y&ae,P[3]=ne^~de&Ee,P[12]=oe^~ve&Le,P[13]=pe^~Ce&Re,P[22]=Te^~De&At,P[23]=Fe^~Ze&Pn,P[32]=qt^~en&Ks,P[33]=Zr^~nn&Xt,P[42]=da^~on&ye,P[43]=un^~te&Be,P[4]=Y^~ae&V,P[5]=de^~Ee&U,P[14]=ve^~Le&$e,P[15]=Ce^~Re&ce,P[24]=De^~At&rt,P[25]=Ze^~Pn&xt,P[34]=en^~Ks&Yt,P[35]=nn^~Xt&Ii,P[44]=on^~ye&Se,P[45]=te^~Be&we,P[6]=ae^~V&he,P[7]=Ee^~U&X,P[16]=Le^~$e&N,P[17]=Re^~ce&K,P[26]=At^~rt&Pe,P[27]=Pn^~xt&Me,P[36]=Ks^~Yt&Tr,P[37]=Xt^~Ii&tn,P[46]=ye^~Se&rn,P[47]=Be^~we&sn,P[8]=V^~he&G,P[9]=U^~X&ne,P[18]=$e^~N&oe,P[19]=ce^~K&pe,P[28]=rt^~Pe&Te,P[29]=xt^~Me&Fe,P[38]=Yt^~Tr&qt,P[39]=Ii^~tn&Zr,P[48]=Se^~rn&da,P[49]=we^~sn&un,P[0]^=m[le],P[1]^=m[le+1]};if(a)n.exports=y;else for(R=0;R>6===2;o++)s++;return s}return n===bs.OVERRUN?t.length-e-1:0}function T9(n,e,t,r,i){return n===bs.OVERLONG?(r.push(i),0):(r.push(65533),aH(n,e,t))}const I9=Object.freeze({error:C9,ignore:aH,replace:T9});function lH(n,e){e==null&&(e=I9.error),n=pt(n);const t=[];let r=0;for(;r>7)){t.push(i);continue}let s=null,o=null;if((i&224)===192)s=1,o=127;else if((i&240)===224)s=2,o=2047;else if((i&248)===240)s=3,o=65535;else{(i&192)===128?r+=e(bs.UNEXPECTED_CONTINUE,r-1,n,t):r+=e(bs.BAD_PREFIX,r-1,n,t);continue}if(r-1+s>=n.length){r+=e(bs.OVERRUN,r-1,n,t);continue}let a=i&(1<<8-s-1)-1;for(let l=0;l1114111){r+=e(bs.OUT_OF_RANGE,r-1-s,n,t,a);continue}if(a>=55296&&a<=57343){r+=e(bs.UTF16_SURROGATE,r-1-s,n,t,a);continue}if(a<=o){r+=e(bs.OVERLONG,r-1-s,n,t,a);continue}t.push(a)}}return t}function Ya(n,e=cg.current){e!=cg.current&&(oH.checkNormalize(),n=n.normalize(e));let t=[];for(let r=0;r>6|192),t.push(i&63|128);else if((i&64512)==55296){r++;const s=n.charCodeAt(r);if(r>=n.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);t.push(o>>18|240),t.push(o>>12&63|128),t.push(o>>6&63|128),t.push(o&63|128)}else t.push(i>>12|224),t.push(i>>6&63|128),t.push(i&63|128)}return pt(t)}function R9(n){return n.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function l0(n,e){return R9(lH(n,e))}function U9(n,e=cg.current){return lH(Ya(n,e))}function dh(n){return Er(Ya(n))}const cH="hash/5.7.0";function AH(n,e){e==null&&(e=1);const t=[],r=t.forEach,i=function(s,o){r.call(s,function(a){o>0&&Array.isArray(a)?i(a,o-1):t.push(a)})};return i(n,e),t}function F9(n){const e={};for(let t=0;t>--l&1}const u=31,f=Math.pow(2,u),h=f>>>1,d=h>>1,m=f-1;let g=0;for(let x=0;x1;){let S=b+B>>>1;x>>1|A(),M=M<<1^h,I=(I^h)<<1|h|1;v=M,w=1+I-M}let _=r-4;return p.map(x=>{switch(x-_){case 3:return _+65792+(n[a++]<<16|n[a++]<<8|n[a++]);case 2:return _+256+(n[a++]<<8|n[a++]);case 1:return _+n[a++];default:return x-1}})}function L9(n){let e=0;return()=>n[e++]}function D9(n){return L9(P9(n))}function N9(n){return n&1?~n>>1:n>>1}function O9(n,e){let t=Array(n);for(let r=0;re[o]):t}function H9(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(z9(t,n))}for(;;){let t=n()-1;if(t<0)break;e.push(G9(t,n))}return F9(AH(e))}function Q9(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(t)}return e}function uH(n,e,t){let r=Array(n).fill(void 0).map(()=>[]);for(let i=0;ir[o].push(s));return r}function z9(n,e){let t=1+e(),r=e(),i=Q9(e),s=uH(i.length,1+n,e);return AH(s.map((o,a)=>{const l=o[0],c=o.slice(1);return Array(i[a]).fill(void 0).map((A,u)=>{let f=u*r;return[l+u*t,c.map(h=>h+f)]})}))}function G9(n,e){let t=1+e();return uH(t,1+n,e).map(i=>[i[0],i.slice(1)])}function V9(n){let e=$w(n).sort((r,i)=>r-i);return t();function t(){let r=[];for(;;){let c=$w(n,e);if(c.length==0)break;r.push({set:new Set(c),node:t()})}r.sort((c,A)=>A.set.size-c.set.size);let i=n(),s=i%3;i=i/3|0;let o=!!(i&1);i>>=1;let a=i==1,l=i==2;return{branches:r,valid:s,fe0f:o,save:a,check:l}}}function j9(){return D9(tH("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const Px=j9(),W9=new Set($w(Px)),K9=new Set($w(Px)),X9=H9(Px),Y9=V9(Px),HU=45,QU=95;function fH(n){return U9(n)}function $9(n){return n.filter(e=>e!=65039)}function hH(n){for(let e of n.split(".")){let t=fH(e);try{for(let r=t.lastIndexOf(QU)-1;r>=0;r--)if(t[r]!==QU)throw new Error("underscore only allowed at start");if(t.length>=4&&t.every(r=>r<128)&&t[2]===HU&&t[3]===HU)throw new Error("invalid label extension")}catch(r){throw new Error(`Invalid label "${e}": ${r.message}`)}}return n}function Z9(n){return hH(J9(n,$9))}function J9(n,e){let t=fH(n).reverse(),r=[];for(;t.length;){let i=eK(t);if(i){r.push(...e(i));continue}let s=t.pop();if(W9.has(s)){r.push(s);continue}if(K9.has(s))continue;let o=X9[s];if(o){r.push(...o);continue}throw new Error(`Disallowed codepoint: 0x${s.toString(16).toUpperCase()}`)}return hH(q9(String.fromCodePoint(...r)))}function q9(n){return n.normalize("NFC")}function eK(n,e){var t;let r=Y9,i,s,o=[],a=n.length;for(e&&(e.length=0);a;){let l=n[--a];if(r=(t=r.branches.find(c=>c.set.has(l)))===null||t===void 0?void 0:t.node,!r)break;if(r.save)s=l;else if(r.check&&l===s)break;o.push(l),r.fe0f&&(o.push(65039),a>0&&n[a-1]==65039&&a--),r.valid&&(i=o.slice(),r.valid==2&&i.splice(1,1),e&&e.push(...n.slice(a).reverse()),n.length=a)}return i}const tK=new xe(cH),dH=new Uint8Array(32);dH.fill(0);function zU(n){if(n.length===0)throw new Error("invalid ENS name; empty component");return n}function pH(n){const e=Ya(Z9(n)),t=[];if(n.length===0)return t;let r=0;for(let i=0;i=e.length)throw new Error("invalid ENS name; empty component");return t.push(zU(e.slice(r))),t}function tw(n){typeof n!="string"&&tK.throwArgumentError("invalid ENS name; not a string","name",n);let e=dH;const t=pH(n);for(;t.length;)e=Er(Ms([e,Er(t.pop())]));return lt(e)}function nK(n){return lt(Ms(pH(n).map(e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t})))+"00"}const rK="rlp/5.7.0",Sa=new xe(rK);function GU(n){const e=[];for(;n;)e.unshift(n&255),n>>=8;return e}function VU(n,e,t){let r=0;for(let i=0;ie+1+r&&Sa.throwError("child data too short",xe.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function gH(n,e){if(n.length===0&&Sa.throwError("data too short",xe.errors.BUFFER_OVERRUN,{}),n[e]>=248){const t=n[e]-247;e+1+t>n.length&&Sa.throwError("data short segment too short",xe.errors.BUFFER_OVERRUN,{});const r=VU(n,e+1,t);return e+1+t+r>n.length&&Sa.throwError("data long segment too short",xe.errors.BUFFER_OVERRUN,{}),jU(n,e,e+1+t,t+r)}else if(n[e]>=192){const t=n[e]-192;return e+1+t>n.length&&Sa.throwError("data array too short",xe.errors.BUFFER_OVERRUN,{}),jU(n,e,e+1,t)}else if(n[e]>=184){const t=n[e]-183;e+1+t>n.length&&Sa.throwError("data array too short",xe.errors.BUFFER_OVERRUN,{});const r=VU(n,e+1,t);e+1+t+r>n.length&&Sa.throwError("data array too short",xe.errors.BUFFER_OVERRUN,{});const i=lt(n.slice(e+1+t,e+1+t+r));return{consumed:1+t+r,result:i}}else if(n[e]>=128){const t=n[e]-128;e+1+t>n.length&&Sa.throwError("data too short",xe.errors.BUFFER_OVERRUN,{});const r=lt(n.slice(e+1,e+1+t));return{consumed:1+t,result:r}}return{consumed:1,result:lt(n[e])}}function lI(n){const e=pt(n),t=gH(e,0);return t.consumed!==e.length&&Sa.throwArgumentError("invalid rlp data","data",n),t.result}const iK="address/5.7.0",ph=new xe(iK);function WU(n){It(n,20)||ph.throwArgumentError("invalid address","address",n),n=n.toLowerCase();const e=n.substring(2).split(""),t=new Uint8Array(40);for(let i=0;i<40;i++)t[i]=e[i].charCodeAt(0);const r=pt(Er(t));for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(r[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const sK=9007199254740991;function oK(n){return Math.log10?Math.log10(n):Math.log(n)/Math.LN10}const cI={};for(let n=0;n<10;n++)cI[String(n)]=String(n);for(let n=0;n<26;n++)cI[String.fromCharCode(65+n)]=String(10+n);const KU=Math.floor(oK(sK));function aK(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let e=n.split("").map(r=>cI[r]).join("");for(;e.length>=KU;){let r=e.substring(0,KU);e=parseInt(r,10)%97+e.substring(r.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}function ai(n){let e=null;if(typeof n!="string"&&ph.throwArgumentError("invalid address","address",n),n.match(/^(0x)?[0-9a-fA-F]{40}$/))n.substring(0,2)!=="0x"&&(n="0x"+n),e=WU(n),n.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==n&&ph.throwArgumentError("bad address checksum","address",n);else if(n.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(n.substring(2,4)!==aK(n)&&ph.throwArgumentError("bad icap checksum","address",n),e=l9(n.substring(4));e.length<40;)e="0"+e;e=WU("0x"+e)}else ph.throwArgumentError("invalid address","address",n);return e}function vH(n){let e=null;try{e=ai(n.from)}catch{ph.throwArgumentError("missing from address","transaction",n)}const t=fd(pt(Ve.from(n.nonce).toHexString()));return ai(mi(Er(Lx([e,t])),12))}var lK=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const Gn=new xe(cH),yH=new Uint8Array(32);yH.fill(0);const cK=Ve.from(-1),wH=Ve.from(0),_H=Ve.from(1),AK=Ve.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function uK(n){const e=pt(n),t=e.length%32;return t?$i([e,yH.slice(t)]):lt(e)}const fK=rr(_H.toHexString(),32),hK=rr(wH.toHexString(),32),XU={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},mb=["name","version","chainId","verifyingContract","salt"];function YU(n){return function(e){return typeof e!="string"&&Gn.throwArgumentError(`invalid domain value for ${JSON.stringify(n)}`,`domain.${n}`,e),e}}const dK={name:YU("name"),version:YU("version"),chainId:function(n){try{return Ve.from(n).toString()}catch{}return Gn.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",n)},verifyingContract:function(n){try{return ai(n).toLowerCase()}catch{}return Gn.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",n)},salt:function(n){try{const e=pt(n);if(e.length!==32)throw new Error("bad length");return lt(e)}catch{}return Gn.throwArgumentError('invalid domain value "salt"',"domain.salt",n)}};function gb(n){{const e=n.match(/^(u?)int(\d*)$/);if(e){const t=e[1]==="",r=parseInt(e[2]||"256");(r%8!==0||r>256||e[2]&&e[2]!==String(r))&&Gn.throwArgumentError("invalid numeric width","type",n);const i=AK.mask(t?r-1:r),s=t?i.add(_H).mul(cK):wH;return function(o){const a=Ve.from(o);return(a.lt(s)||a.gt(i))&&Gn.throwArgumentError(`value out-of-bounds for ${n}`,"value",o),rr(a.toTwos(256).toHexString(),32)}}}{const e=n.match(/^bytes(\d+)$/);if(e){const t=parseInt(e[1]);return(t===0||t>32||e[1]!==String(t))&&Gn.throwArgumentError("invalid bytes width","type",n),function(r){return pt(r).length!==t&&Gn.throwArgumentError(`invalid length for ${n}`,"value",r),uK(r)}}}switch(n){case"address":return function(e){return rr(ai(e),32)};case"bool":return function(e){return e?fK:hK};case"bytes":return function(e){return Er(e)};case"string":return function(e){return dh(e)}}return null}function $U(n,e){return`${n}(${e.map(({name:t,type:r})=>r+" "+t).join(",")})`}class ws{constructor(e){Ue(this,"types",Object.freeze(Ps(e))),Ue(this,"_encoderCache",{}),Ue(this,"_types",{});const t={},r={},i={};Object.keys(e).forEach(a=>{t[a]={},r[a]=[],i[a]={}});for(const a in e){const l={};e[a].forEach(c=>{l[c.name]&&Gn.throwArgumentError(`duplicate variable name ${JSON.stringify(c.name)} in ${JSON.stringify(a)}`,"types",e),l[c.name]=!0;const A=c.type.match(/^([^\x5b]*)(\x5b|$)/)[1];A===a&&Gn.throwArgumentError(`circular type reference to ${JSON.stringify(A)}`,"types",e),!gb(A)&&(r[A]||Gn.throwArgumentError(`unknown type ${JSON.stringify(A)}`,"types",e),r[A].push(a),t[a][A]=!0)})}const s=Object.keys(r).filter(a=>r[a].length===0);s.length===0?Gn.throwArgumentError("missing primary type","types",e):s.length>1&&Gn.throwArgumentError(`ambiguous primary types or unused types: ${s.map(a=>JSON.stringify(a)).join(", ")}`,"types",e),Ue(this,"primaryType",s[0]);function o(a,l){l[a]&&Gn.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",e),l[a]=!0,Object.keys(t[a]).forEach(c=>{r[c]&&(o(c,l),Object.keys(l).forEach(A=>{i[A][c]=!0}))}),delete l[a]}o(this.primaryType,{});for(const a in i){const l=Object.keys(i[a]);l.sort(),this._types[a]=$U(a,e[a])+l.map(c=>$U(c,e[c])).join("")}}getEncoder(e){let t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}_getEncoder(e){{const i=gb(e);if(i)return i}const t=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(t){const i=t[1],s=this.getEncoder(i),o=parseInt(t[3]);return a=>{o>=0&&a.length!==o&&Gn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",a);let l=a.map(s);return this._types[i]&&(l=l.map(Er)),Er($i(l))}}const r=this.types[e];if(r){const i=dh(this._types[e]);return s=>{const o=r.map(({name:a,type:l})=>{const c=this.getEncoder(l)(s[a]);return this._types[l]?Er(c):c});return o.unshift(i),$i(o)}}return Gn.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||Gn.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return Er(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,r){if(gb(e))return r(e,t);const i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const o=i[1],a=parseInt(i[3]);return a>=0&&t.length!==a&&Gn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map(l=>this._visit(o,l,r))}const s=this.types[e];return s?s.reduce((o,{name:a,type:l})=>(o[a]=this._visit(l,t[a],r),o),{}):Gn.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new ws(e)}static getPrimaryType(e){return ws.from(e).primaryType}static hashStruct(e,t,r){return ws.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){const i=XU[r];i||Gn.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:i})}return t.sort((r,i)=>mb.indexOf(r.name)-mb.indexOf(i.name)),ws.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return $i(["0x1901",ws.hashDomain(e),ws.from(t).hash(r)])}static hash(e,t,r){return Er(ws.encode(e,t,r))}static resolveNames(e,t,r,i){return lK(this,void 0,void 0,function*(){e=Hn(e);const s={};e.verifyingContract&&!It(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const o=ws.from(t);o.visit(r,(a,l)=>(a==="address"&&!It(l,20)&&(s[l]="0x"),l));for(const a in s)s[a]=yield i(a);return e.verifyingContract&&s[e.verifyingContract]&&(e.verifyingContract=s[e.verifyingContract]),r=o.visit(r,(a,l)=>a==="address"&&s[l]?s[l]:l),{domain:e,value:r}})}static getPayload(e,t,r){ws.hashDomain(e);const i={},s=[];mb.forEach(l=>{const c=e[l];c!=null&&(i[l]=dK[l](c),s.push({name:l,type:XU[l]}))});const o=ws.from(t),a=Hn(t);return a.EIP712Domain?Gn.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):a.EIP712Domain=s,o.encode(r),{types:a,domain:i,primaryType:o.primaryType,message:o.visit(r,(l,c)=>{if(l.match(/^bytes(\d*)/))return lt(pt(c));if(l.match(/^u?int/))return Ve.from(c).toString();switch(l){case"address":return c.toLowerCase();case"bool":return!!c;case"string":return typeof c!="string"&&Gn.throwArgumentError("invalid string","value",c),c}return Gn.throwArgumentError("unsupported type","type",l)})}}}var xH={},kt={},c0=bH;function bH(n,e){if(!n)throw new Error(e||"Assertion failed")}bH.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var TS={exports:{}};typeof Object.create=="function"?TS.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:TS.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}};var pK=TS.exports,mK=c0,gK=pK;kt.inherits=gK;function vK(n,e){return(n.charCodeAt(e)&64512)!==55296||e<0||e+1>=n.length?!1:(n.charCodeAt(e+1)&64512)===56320}function yK(n,e){if(Array.isArray(n))return n.slice();if(!n)return[];var t=[];if(typeof n=="string")if(e){if(e==="hex")for(n=n.replace(/[^a-z0-9]+/ig,""),n.length%2!==0&&(n="0"+n),i=0;i>6|192,t[r++]=s&63|128):vK(n,i)?(s=65536+((s&1023)<<10)+(n.charCodeAt(++i)&1023),t[r++]=s>>18|240,t[r++]=s>>12&63|128,t[r++]=s>>6&63|128,t[r++]=s&63|128):(t[r++]=s>>12|224,t[r++]=s>>6&63|128,t[r++]=s&63|128)}else for(i=0;i>>24|n>>>8&65280|n<<8&16711680|(n&255)<<24;return e>>>0}kt.htonl=EH;function _K(n,e){for(var t="",r=0;r>>0}return s}kt.join32=xK;function bK(n,e){for(var t=new Array(n.length*4),r=0,i=0;r>>24,t[i+1]=s>>>16&255,t[i+2]=s>>>8&255,t[i+3]=s&255):(t[i+3]=s>>>24,t[i+2]=s>>>16&255,t[i+1]=s>>>8&255,t[i]=s&255)}return t}kt.split32=bK;function EK(n,e){return n>>>e|n<<32-e}kt.rotr32=EK;function BK(n,e){return n<>>32-e}kt.rotl32=BK;function SK(n,e){return n+e>>>0}kt.sum32=SK;function MK(n,e,t){return n+e+t>>>0}kt.sum32_3=MK;function CK(n,e,t,r){return n+e+t+r>>>0}kt.sum32_4=CK;function TK(n,e,t,r,i){return n+e+t+r+i>>>0}kt.sum32_5=TK;function IK(n,e,t,r){var i=n[e],s=n[e+1],o=r+s>>>0,a=(o>>0,n[e+1]=o}kt.sum64=IK;function RK(n,e,t,r){var i=e+r>>>0,s=(i>>0}kt.sum64_hi=RK;function UK(n,e,t,r){var i=e+r;return i>>>0}kt.sum64_lo=UK;function FK(n,e,t,r,i,s,o,a){var l=0,c=e;c=c+r>>>0,l+=c>>0,l+=c>>0,l+=c>>0}kt.sum64_4_hi=FK;function PK(n,e,t,r,i,s,o,a){var l=e+r+s+a;return l>>>0}kt.sum64_4_lo=PK;function LK(n,e,t,r,i,s,o,a,l,c){var A=0,u=e;u=u+r>>>0,A+=u>>0,A+=u>>0,A+=u>>0,A+=u>>0}kt.sum64_5_hi=LK;function DK(n,e,t,r,i,s,o,a,l,c){var A=e+r+s+a+c;return A>>>0}kt.sum64_5_lo=DK;function NK(n,e,t){var r=e<<32-t|n>>>t;return r>>>0}kt.rotr64_hi=NK;function OK(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}kt.rotr64_lo=OK;function kK(n,e,t){return n>>>t}kt.shr64_hi=kK;function HK(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}kt.shr64_lo=HK;var Hd={},ZU=kt,QK=c0;function Dx(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Hd.BlockHash=Dx;Dx.prototype.update=function(e,t){if(e=ZU.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var r=e.length%this._delta8;this.pending=e.slice(e.length-r,e.length),this.pending.length===0&&(this.pending=null),e=ZU.join32(e,0,e.length-r,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}sl.g0_256=WK;function KK(n){return za(n,17)^za(n,19)^n>>>10}sl.g1_256=KK;var hd=kt,XK=Hd,YK=sl,vb=hd.rotl32,hp=hd.sum32,$K=hd.sum32_5,ZK=YK.ft_1,IH=XK.BlockHash,JK=[1518500249,1859775393,2400959708,3395469782];function $a(){if(!(this instanceof $a))return new $a;IH.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}hd.inherits($a,IH);var qK=$a;$a.blockSize=512;$a.outSize=160;$a.hmacStrength=80;$a.padLength=64;$a.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),H7(e.length<=this.blockSize);for(var t=e.length;t{s[a.toLowerCase()]=o}):r.headers.keys().forEach(o=>{s[o.toLowerCase()]=r.headers.get(o)}),{headers:s,statusCode:r.status,statusMessage:r.statusText,body:pt(new Uint8Array(i))}})}var j7=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const Ho=new xe(z7);function nF(n){return new Promise(e=>{setTimeout(e,n)})}function gc(n,e){if(n==null)return null;if(typeof n=="string")return n;if(aI(n)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return l0(n)}catch{}return lt(n)}return n}function W7(n){return Ya(n.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))}function K7(n,e,t){const r=typeof n=="object"&&n.throttleLimit!=null?n.throttleLimit:12;Ho.assertArgument(r>0&&r%1===0,"invalid connection throttle limit","connection.throttleLimit",r);const i=typeof n=="object"?n.throttleCallback:null,s=typeof n=="object"&&typeof n.throttleSlotInterval=="number"?n.throttleSlotInterval:100;Ho.assertArgument(s>0&&s%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",s);const o=typeof n=="object"?!!n.errorPassThrough:!1,a={};let l=null;const c={method:"GET"};let A=!1,u=2*60*1e3;if(typeof n=="string")l=n;else if(typeof n=="object"){if((n==null||n.url==null)&&Ho.throwArgumentError("missing URL","connection.url",n),l=n.url,typeof n.timeout=="number"&&n.timeout>0&&(u=n.timeout),n.headers)for(const p in n.headers)a[p.toLowerCase()]={key:p,value:String(n.headers[p])},["if-none-match","if-modified-since"].indexOf(p.toLowerCase())>=0&&(A=!0);if(c.allowGzip=!!n.allowGzip,n.user!=null&&n.password!=null){l.substring(0,6)!=="https:"&&n.allowInsecureAuthentication!==!0&&Ho.throwError("basic authentication requires a secure https url",xe.errors.INVALID_ARGUMENT,{argument:"url",url:l,user:n.user,password:"[REDACTED]"});const p=n.user+":"+n.password;a.authorization={key:"Authorization",value:"Basic "+nH(Ya(p))}}n.skipFetchSetup!=null&&(c.skipFetchSetup=!!n.skipFetchSetup),n.fetchOptions!=null&&(c.fetchOptions=Hn(n.fetchOptions))}const f=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),h=l?l.match(f):null;if(h)try{const p={statusCode:200,statusMessage:"OK",headers:{"content-type":h[1]||"text/plain"},body:h[2]?tH(h[3]):W7(h[3])};let v=p.body;return t&&(v=t(p.body,p)),Promise.resolve(v)}catch(p){Ho.throwError("processing response error",xe.errors.SERVER_ERROR,{body:gc(h[1],h[2]),error:p,requestBody:null,requestMethod:"GET",url:l})}e&&(c.method="POST",c.body=e,a["content-type"]==null&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),a["content-length"]==null&&(a["content-length"]={key:"Content-Length",value:String(e.length)}));const d={};Object.keys(a).forEach(p=>{const v=a[p];d[v.key]=v.value}),c.headers=d;const m=function(){let p=null;return{promise:new Promise(function(_,x){u&&(p=setTimeout(()=>{p!=null&&(p=null,x(Ho.makeError("timeout",xe.errors.TIMEOUT,{requestBody:gc(c.body,d["content-type"]),requestMethod:c.method,timeout:u,url:l})))},u))}),cancel:function(){p!=null&&(clearTimeout(p),p=null)}}}(),g=function(){return j7(this,void 0,void 0,function*(){for(let p=0;p=300)&&(m.cancel(),Ho.throwError("bad response",xe.errors.SERVER_ERROR,{status:v.statusCode,headers:v.headers,body:gc(w,v.headers?v.headers["content-type"]:null),requestBody:gc(c.body,d["content-type"]),requestMethod:c.method,url:l})),t)try{const _=yield t(w,v);return m.cancel(),_}catch(_){if(_.throttleRetry&&p{let a=null;if(s!=null)try{a=JSON.parse(l0(s))}catch(l){Ho.throwError("invalid JSON",xe.errors.SERVER_ERROR,{body:s,error:l})}return t&&(a=t(a,o)),a},i=null;if(e!=null){i=Ya(e);const s=typeof n=="string"?{url:n}:Hn(n);s.headers?Object.keys(s.headers).filter(a=>a.toLowerCase()==="content-type").length!==0||(s.headers=Hn(s.headers),s.headers["content-type"]="application/json"):s.headers={"content-type":"application/json"},n=s}return K7(n,i,r)}function mh(n,e){return e||(e={}),e=Hn(e),e.floor==null&&(e.floor=0),e.ceiling==null&&(e.ceiling=1e4),e.interval==null&&(e.interval=250),new Promise(function(t,r){let i=null,s=!1;const o=()=>s?!1:(s=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout(()=>{o()&&r(new Error("timeout"))},e.timeout));const a=e.retryLimit;let l=0;function c(){return n().then(function(A){if(A!==void 0)o()&&t(A);else if(e.oncePoll)e.oncePoll.once("poll",c);else if(e.onceBlock)e.onceBlock.once("block",c);else if(!s){if(l++,l>a){o()&&r(new Error("retry limit reached"));return}let u=e.interval*parseInt(String(Math.random()*Math.pow(2,l)));ue.ceiling&&(u=e.ceiling),setTimeout(c,u)}return null},function(A){o()&&r(A)})}c()})}var Zw="qpzry9x8gf2tvdw0s3jn54khce6mua7l",US={};for(var Q0=0;Q0>25;return(n&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function QH(n){for(var e=1,t=0;t126)return"Invalid prefix ("+n+")";e=Wh(e)^r>>5}for(e=Wh(e),t=0;tt)throw new TypeError("Exceeds length limit");n=n.toLowerCase();var r=QH(n);if(typeof r=="string")throw new Error(r);for(var i=n+"1",s=0;s>5)throw new Error("Non 5-bit word");r=Wh(r)^o,i+=Zw.charAt(o)}for(s=0;s<6;++s)r=Wh(r);for(r^=1,s=0;s<6;++s){var a=r>>(5-s)*5&31;i+=Zw.charAt(a)}return i}function zH(n,e){if(e=e||90,n.length<8)return n+" too short";if(n.length>e)return"Exceeds length limit";var t=n.toLowerCase(),r=n.toUpperCase();if(n!==t&&n!==r)return"Mixed-case string "+n;n=t;var i=n.lastIndexOf("1");if(i===-1)return"No separator character for "+n;if(i===0)return"Missing prefix for "+n;var s=n.slice(0,i),o=n.slice(i+1);if(o.length<6)return"Data too short";var a=QH(s);if(typeof a=="string")return a;for(var l=[],c=0;c=o.length)&&l.push(u)}return a!==1?"Invalid checksum for "+n:{prefix:s,words:l}}function Y7(){var n=zH.apply(null,arguments);if(typeof n=="object")return n}function $7(n){var e=zH.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function Ox(n,e,t,r){for(var i=0,s=0,o=(1<=t;)s-=t,a.push(i>>s&o);if(r)s>0&&a.push(i<=e)return"Excess padding";if(i<>8,f=A&255;u?l.push(u,f):l.push(f)}return l}t.toArray=r;function i(o){return o.length===1?"0"+o:o}t.zero2=i;function s(o){for(var a="",l=0;l(f>>1)-1?m=(f>>1)-g:m=g,h.isubn(m)):m=0,u[d]=m,h.iushrn(1)}return u}t.getNAF=r;function i(l,c){var A=[[],[]];l=l.clone(),c=c.clone();for(var u=0,f=0,h;l.cmpn(-u)>0||c.cmpn(-f)>0;){var d=l.andln(3)+u&3,m=c.andln(3)+f&3;d===3&&(d=-1),m===3&&(m=-1);var g;d&1?(h=l.andln(7)+u&7,(h===3||h===5)&&m===2?g=-d:g=d):g=0,A[0].push(g);var p;m&1?(h=c.andln(7)+f&7,(h===3||h===5)&&d===2?p=-m:p=m):p=0,A[1].push(p),2*u===g+1&&(u=1-u),2*f===p+1&&(f=1-f),l.iushrn(1),c.iushrn(1)}return A}t.getJSF=i;function s(l,c,A){var u="_"+c;l.prototype[c]=function(){return this[u]!==void 0?this[u]:this[u]=A.call(this)}}t.cachedProperty=s;function o(l){return typeof l=="string"?t.toArray(l,"hex"):l}t.parseBytes=o;function a(l){return new _t(l,"hex","le")}t.intFromLE=a}),Jw=Vs.getNAF,rX=Vs.getJSF,qw=Vs.assert;function BA(n,e){this.type=n,this.p=new _t(e.p,16),this.red=e.prime?_t.red(e.prime):_t.mont(this.p),this.zero=new _t(0).toRed(this.red),this.one=new _t(1).toRed(this.red),this.two=new _t(2).toRed(this.red),this.n=e.n&&new _t(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Gu=BA;BA.prototype.point=function(){throw new Error("Not implemented")};BA.prototype.validate=function(){throw new Error("Not implemented")};BA.prototype._fixedNafMul=function(e,t){qw(e.precomputed);var r=e._getDoubles(),i=Jw(t,1,this._bitLength),s=(1<=a;c--)l=(l<<1)+i[c];o.push(l)}for(var A=this.jpoint(null,null,null),u=this.jpoint(null,null,null),f=s;f>0;f--){for(a=0;a=0;l--){for(var c=0;l>=0&&o[l]===0;l--)c++;if(l>=0&&c++,a=a.dblp(c),l<0)break;var A=o[l];qw(A!==0),e.type==="affine"?A>0?a=a.mixedAdd(s[A-1>>1]):a=a.mixedAdd(s[-A-1>>1].neg()):A>0?a=a.add(s[A-1>>1]):a=a.add(s[-A-1>>1].neg())}return e.type==="affine"?a.toP():a};BA.prototype._wnafMulAdd=function(e,t,r,i,s){var o=this._wnafT1,a=this._wnafT2,l=this._wnafT3,c=0,A,u,f;for(A=0;A=1;A-=2){var d=A-1,m=A;if(o[d]!==1||o[m]!==1){l[d]=Jw(r[d],o[d],this._bitLength),l[m]=Jw(r[m],o[m],this._bitLength),c=Math.max(l[d].length,c),c=Math.max(l[m].length,c);continue}var g=[t[d],null,null,t[m]];t[d].y.cmp(t[m].y)===0?(g[1]=t[d].add(t[m]),g[2]=t[d].toJ().mixedAdd(t[m].neg())):t[d].y.cmp(t[m].y.redNeg())===0?(g[1]=t[d].toJ().mixedAdd(t[m]),g[2]=t[d].add(t[m].neg())):(g[1]=t[d].toJ().mixedAdd(t[m]),g[2]=t[d].toJ().mixedAdd(t[m].neg()));var p=[-3,-1,-5,-7,0,7,5,1,3],v=rX(r[d],r[m]);for(c=Math.max(v[0].length,c),l[d]=new Array(c),l[m]=new Array(c),u=0;u=0;A--){for(var B=0;A>=0;){var M=!0;for(u=0;u=0&&B++,x=x.dblp(B),A<0)break;for(u=0;u0?f=a[u][I-1>>1]:I<0&&(f=a[u][-I-1>>1].neg()),f.type==="affine"?x=x.mixedAdd(f):x=x.add(f))}}for(A=0;A=Math.ceil((e.bitLength()+1)/t.step):!1};Bo.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,s=0;s=0&&(h=c,d=A),u.negative&&(u=u.neg(),f=f.neg()),h.negative&&(h=h.neg(),d=d.neg()),[{a:u,b:f},{a:h,b:d}]};So.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],i=t[1],s=i.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=s.mul(r.a),l=o.mul(i.a),c=s.mul(r.b),A=o.mul(i.b),u=e.sub(a).sub(l),f=c.add(A).neg();return{k1:u,k2:f}};So.prototype.pointFromX=function(e,t){e=new _t(e,16),e.red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(i.redSqr().redSub(r).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(t&&!s||!t&&s)&&(i=i.redNeg()),this.point(e,i)};So.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,i=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return r.redSqr().redISub(s).cmpn(0)===0};So.prototype._endoWnafMulAdd=function(e,t,r){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};$r.prototype.isInfinity=function(){return this.inf};$r.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)};$r.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),i=e.redInvm(),s=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)};$r.prototype.getX=function(){return this.x.fromRed()};$r.prototype.getY=function(){return this.y.fromRed()};$r.prototype.mul=function(e){return e=new _t(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};$r.prototype.mulAdd=function(e,t,r){var i=[this,t],s=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};$r.prototype.jmulAdd=function(e,t,r){var i=[this,t],s=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};$r.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};$r.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,i=function(s){return s.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return t};$r.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function ci(n,e,t,r){Gu.BasePoint.call(this,n,"jacobian"),e===null&&t===null&&r===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new _t(0)):(this.x=new _t(e,16),this.y=new _t(t,16),this.z=new _t(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}uI(ci,Gu.BasePoint);So.prototype.jpoint=function(e,t,r){return new ci(this,e,t,r)};ci.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(r,i)};ci.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};ci.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(t),s=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),l=i.redSub(s),c=o.redSub(a);if(l.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var A=l.redSqr(),u=A.redMul(l),f=i.redMul(A),h=c.redSqr().redIAdd(u).redISub(f).redISub(f),d=c.redMul(f.redISub(h)).redISub(o.redMul(u)),m=this.z.redMul(e.z).redMul(l);return this.curve.jpoint(h,d,m)};ci.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,i=e.x.redMul(t),s=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(i),l=s.redSub(o);if(a.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),A=c.redMul(a),u=r.redMul(c),f=l.redSqr().redIAdd(A).redISub(u).redISub(u),h=l.redMul(u.redISub(f)).redISub(s.redMul(A)),d=this.z.redMul(a);return this.curve.jpoint(f,h,d)};ci.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(s),this.x.cmp(r)===0)return!0}};ci.prototype.inspect=function(){return this.isInfinity()?"":""};ci.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var nw=Gd(function(n,e){var t=e;t.base=Gu,t.short=sX,t.mont=null,t.edwards=null}),rw=Gd(function(n,e){var t=e,r=Vs.assert;function i(a){a.type==="short"?this.curve=new nw.short(a):a.type==="edwards"?this.curve=new nw.edwards(a):this.curve=new nw.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,r(this.g.validate(),"Invalid curve"),r(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}t.PresetCurve=i;function s(a,l){Object.defineProperty(t,a,{configurable:!0,enumerable:!0,get:function(){var c=new i(l);return Object.defineProperty(t,a,{configurable:!0,enumerable:!0,value:c}),c}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:ba.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:ba.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:ba.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:ba.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:ba.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:ba.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:ba.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:ba.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function dA(n){if(!(this instanceof dA))return new dA(n);this.hash=n.hash,this.predResist=!!n.predResist,this.outLen=this.hash.outSize,this.minEntropy=n.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Jo.toArray(n.entropy,n.entropyEnc||"hex"),t=Jo.toArray(n.nonce,n.nonceEnc||"hex"),r=Jo.toArray(n.pers,n.persEnc||"hex");AI(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,r)}var VH=dA;dA.prototype._init=function(e,t,r){var i=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1};dA.prototype.generate=function(e,t,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(i=r,r=t,t=null),r&&(r=Jo.toArray(r,i||"hex"),this._update(r));for(var s=[];s.length"};var oX=Vs.assert;function kx(n,e){if(n instanceof kx)return n;this._importDER(n,e)||(oX(n.r&&n.s,"Signature without r or s"),this.r=new _t(n.r,16),this.s=new _t(n.s,16),n.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=n.recoveryParam)}var Hx=kx;function aX(){this.place=0}function xb(n,e){var t=n[e.place++];if(!(t&128))return t;var r=t&15;if(r===0||r>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function iF(n){for(var e=0,t=n.length-1;!n[e]&&!(n[e+1]&128)&&e>>3);for(n.push(t|128);--t;)n.push(e>>>(t<<3)&255);n.push(e)}kx.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),r[0]&128&&(r=[0].concat(r)),t=iF(t),r=iF(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var i=[2];bb(i,t.length),i=i.concat(t),i.push(2),bb(i,r.length);var s=i.concat(r),o=[48];return bb(o,s.length),o=o.concat(s),Vs.encode(o,e)};var lX=function(){throw new Error("unsupported")},jH=Vs.assert;function wo(n){if(!(this instanceof wo))return new wo(n);typeof n=="string"&&(jH(Object.prototype.hasOwnProperty.call(rw,n),"Unknown curve "+n),n=rw[n]),n instanceof rw.PresetCurve&&(n={curve:n}),this.curve=n.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=n.curve.g,this.g.precompute(n.curve.n.bitLength()+1),this.hash=n.hash||n.curve.hash}var cX=wo;wo.prototype.keyPair=function(e){return new fI(this,e)};wo.prototype.keyFromPrivate=function(e,t){return fI.fromPrivate(this,e,t)};wo.prototype.keyFromPublic=function(e,t){return fI.fromPublic(this,e,t)};wo.prototype.genKeyPair=function(e){e||(e={});for(var t=new VH({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||lX(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new _t(2));;){var s=new _t(t.generate(r));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};wo.prototype._truncateToN=function(e,t){var r=e.byteLength()*8-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e};wo.prototype.sign=function(e,t,r,i){typeof r=="object"&&(i=r,r=null),i||(i={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new _t(e,16));for(var s=this.n.byteLength(),o=t.getPrivate().toArray("be",s),a=e.toArray("be",s),l=new VH({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),c=this.n.sub(new _t(1)),A=0;;A++){var u=i.k?i.k(A):new _t(l.generate(this.n.byteLength()));if(u=this._truncateToN(u,!0),!(u.cmpn(1)<=0||u.cmp(c)>=0)){var f=this.g.mul(u);if(!f.isInfinity()){var h=f.getX(),d=h.umod(this.n);if(d.cmpn(0)!==0){var m=u.invm(this.n).mul(d.mul(t.getPrivate()).iadd(e));if(m=m.umod(this.n),m.cmpn(0)!==0){var g=(f.getY().isOdd()?1:0)|(h.cmp(d)!==0?2:0);return i.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),g^=1),new Hx({r:d,s:m,recoveryParam:g})}}}}}};wo.prototype.verify=function(e,t,r,i){e=this._truncateToN(new _t(e,16)),r=this.keyFromPublic(r,i),t=new Hx(t,"hex");var s=t.r,o=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),l=a.mul(e).umod(this.n),c=a.mul(s).umod(this.n),A;return this.curve._maxwellTrick?(A=this.g.jmulAdd(l,r.getPublic(),c),A.isInfinity()?!1:A.eqXToP(s)):(A=this.g.mulAdd(l,r.getPublic(),c),A.isInfinity()?!1:A.getX().umod(this.n).cmp(s)===0)};wo.prototype.recoverPubKey=function(n,e,t,r){jH((3&t)===t,"The recovery param is more than two bits"),e=new Hx(e,r);var i=this.n,s=new _t(n),o=e.r,a=e.s,l=t&1,c=t>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");c?o=this.curve.pointFromX(o.add(this.curve.n),l):o=this.curve.pointFromX(o,l);var A=e.r.invm(i),u=i.sub(s).mul(A).umod(i),f=a.mul(A).umod(i);return this.g.mulAdd(u,o,f)};wo.prototype.getKeyRecoveryParam=function(n,e,t,r){if(e=new Hx(e,r),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(n,e,i)}catch{continue}if(s.eq(t))return i}throw new Error("Unable to find valid recovery factor")};var AX=Gd(function(n,e){var t=e;t.version="6.5.4",t.utils=Vs,t.rand=function(){throw new Error("unsupported")},t.curve=nw,t.curves=rw,t.ec=cX,t.eddsa=null}),uX=AX.ec;const fX="signing-key/5.7.0",PS=new xe(fX);let Eb=null;function Ca(){return Eb||(Eb=new uX("secp256k1")),Eb}class hX{constructor(e){Ue(this,"curve","secp256k1"),Ue(this,"privateKey",lt(e)),Bu(this.privateKey)!==32&&PS.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=Ca().keyFromPrivate(pt(this.privateKey));Ue(this,"publicKey","0x"+t.getPublic(!1,"hex")),Ue(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Ue(this,"_isSigningKey",!0)}_addPoint(e){const t=Ca().keyFromPublic(pt(this.publicKey)),r=Ca().keyFromPublic(pt(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=Ca().keyFromPrivate(pt(this.privateKey)),r=pt(e);r.length!==32&&PS.throwArgumentError("bad digest length","digest",e);const i=t.sign(r,{canonical:!0});return Fx({recoveryParam:i.recoveryParam,r:rr("0x"+i.r.toString(16),32),s:rr("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const t=Ca().keyFromPrivate(pt(this.privateKey)),r=Ca().keyFromPublic(pt(WH(e)));return rr("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function dX(n,e){const t=Fx(e),r={r:pt(t.r),s:pt(t.s)};return"0x"+Ca().recoverPubKey(pt(n),r,t.recoveryParam).encode("hex",!1)}function WH(n,e){const t=pt(n);if(t.length===32){const r=new hX(t);return e?"0x"+Ca().keyFromPrivate(t).getPublic(!0,"hex"):r.publicKey}else{if(t.length===33)return e?lt(t):"0x"+Ca().keyFromPublic(t).getPublic(!1,"hex");if(t.length===65)return e?"0x"+Ca().keyFromPublic(t).getPublic(!0,"hex"):lt(t)}return PS.throwArgumentError("invalid public or private key","key","[REDACTED]")}const pX="transactions/5.7.0",ac=new xe(pX);var sF;(function(n){n[n.legacy=0]="legacy",n[n.eip2930=1]="eip2930",n[n.eip1559=2]="eip1559"})(sF||(sF={}));function hI(n){return n==="0x"?null:ai(n)}function vi(n){return n==="0x"?iH:Ve.from(n)}function mX(n){const e=WH(n);return ai(mi(Er(mi(e,1)),12))}function KH(n,e){return mX(dX(pt(n),e))}function Es(n,e){const t=fd(Ve.from(n).toHexString());return t.length>32&&ac.throwArgumentError("invalid length for "+e,"transaction:"+e,n),t}function Bb(n,e){return{address:ai(n),storageKeys:(e||[]).map((t,r)=>(Bu(t)!==32&&ac.throwArgumentError("invalid access list storageKey",`accessList[${n}:${r}]`,t),t.toLowerCase()))}}function Vu(n){if(Array.isArray(n))return n.map((t,r)=>Array.isArray(t)?(t.length>2&&ac.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${r}]`,t),Bb(t[0],t[1])):Bb(t.address,t.storageKeys));const e=Object.keys(n).map(t=>{const r=n[t].reduce((i,s)=>(i[s]=!0,i),{});return Bb(t,Object.keys(r).sort())});return e.sort((t,r)=>t.address.localeCompare(r.address)),e}function XH(n){return Vu(n).map(e=>[e.address,e.storageKeys])}function gX(n,e){if(n.gasPrice!=null){const r=Ve.from(n.gasPrice),i=Ve.from(n.maxFeePerGas||0);r.eq(i)||ac.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:r,maxFeePerGas:i})}const t=[Es(n.chainId||0,"chainId"),Es(n.nonce||0,"nonce"),Es(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Es(n.maxFeePerGas||0,"maxFeePerGas"),Es(n.gasLimit||0,"gasLimit"),n.to!=null?ai(n.to):"0x",Es(n.value||0,"value"),n.data||"0x",XH(n.accessList||[])];if(e){const r=Fx(e);t.push(Es(r.recoveryParam,"recoveryParam")),t.push(fd(r.r)),t.push(fd(r.s))}return $i(["0x02",Lx(t)])}function vX(n,e){const t=[Es(n.chainId||0,"chainId"),Es(n.nonce||0,"nonce"),Es(n.gasPrice||0,"gasPrice"),Es(n.gasLimit||0,"gasLimit"),n.to!=null?ai(n.to):"0x",Es(n.value||0,"value"),n.data||"0x",XH(n.accessList||[])];if(e){const r=Fx(e);t.push(Es(r.recoveryParam,"recoveryParam")),t.push(fd(r.r)),t.push(fd(r.s))}return $i(["0x01",Lx(t)])}function YH(n,e,t){try{const r=vi(e[0]).toNumber();if(r!==0&&r!==1)throw new Error("bad recid");n.v=r}catch{ac.throwArgumentError("invalid v for transaction type: 1","v",e[0])}n.r=rr(e[1],32),n.s=rr(e[2],32);try{const r=Er(t(n));n.from=KH(r,{r:n.r,s:n.s,recoveryParam:n.v})}catch{}}function yX(n){const e=lI(n.slice(1));e.length!==9&&e.length!==12&&ac.throwArgumentError("invalid component count for transaction type: 2","payload",lt(n));const t=vi(e[2]),r=vi(e[3]),i={type:2,chainId:vi(e[0]).toNumber(),nonce:vi(e[1]).toNumber(),maxPriorityFeePerGas:t,maxFeePerGas:r,gasPrice:null,gasLimit:vi(e[4]),to:hI(e[5]),value:vi(e[6]),data:e[7],accessList:Vu(e[8])};return e.length===9||(i.hash=Er(n),YH(i,e.slice(9),gX)),i}function wX(n){const e=lI(n.slice(1));e.length!==8&&e.length!==11&&ac.throwArgumentError("invalid component count for transaction type: 1","payload",lt(n));const t={type:1,chainId:vi(e[0]).toNumber(),nonce:vi(e[1]).toNumber(),gasPrice:vi(e[2]),gasLimit:vi(e[3]),to:hI(e[4]),value:vi(e[5]),data:e[6],accessList:Vu(e[7])};return e.length===8||(t.hash=Er(n),YH(t,e.slice(8),vX)),t}function _X(n){const e=lI(n);e.length!==9&&e.length!==6&&ac.throwArgumentError("invalid raw transaction","rawTransaction",n);const t={nonce:vi(e[0]).toNumber(),gasPrice:vi(e[1]),gasLimit:vi(e[2]),to:hI(e[3]),value:vi(e[4]),data:e[5],chainId:0};if(e.length===6)return t;try{t.v=Ve.from(e[6]).toNumber()}catch{return t}if(t.r=rr(e[7],32),t.s=rr(e[8],32),Ve.from(t.r).isZero()&&Ve.from(t.s).isZero())t.chainId=t.v,t.v=0;else{t.chainId=Math.floor((t.v-35)/2),t.chainId<0&&(t.chainId=0);let r=t.v-27;const i=e.slice(0,6);t.chainId!==0&&(i.push(lt(t.chainId)),i.push("0x"),i.push("0x"),r-=t.chainId*2+8);const s=Er(Lx(i));try{t.from=KH(s,{r:lt(t.r),s:lt(t.s),recoveryParam:r})}catch{}t.hash=Er(n)}return t.type=null,t}function xX(n){const e=pt(n);if(e[0]>127)return _X(e);switch(e[0]){case 1:return wX(e);case 2:return yX(e)}return ac.throwError(`unsupported transaction type: ${e[0]}`,xe.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const pp=new xe(Ci);let oF=class it{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const e={},t=this.address.bind(this),r=this.bigNumber.bind(this),i=this.blockTag.bind(this),s=this.data.bind(this),o=this.hash.bind(this),a=this.hex.bind(this),l=this.number.bind(this),c=this.type.bind(this),A=u=>this.data(u,!0);return e.transaction={hash:o,type:c,accessList:it.allowNull(this.accessList.bind(this),null),blockHash:it.allowNull(o,null),blockNumber:it.allowNull(l,null),transactionIndex:it.allowNull(l,null),confirmations:it.allowNull(l,null),from:t,gasPrice:it.allowNull(r),maxPriorityFeePerGas:it.allowNull(r),maxFeePerGas:it.allowNull(r),gasLimit:r,to:it.allowNull(t,null),value:r,nonce:l,data:s,r:it.allowNull(this.uint256),s:it.allowNull(this.uint256),v:it.allowNull(l),creates:it.allowNull(t,null),raw:it.allowNull(s)},e.transactionRequest={from:it.allowNull(t),nonce:it.allowNull(l),gasLimit:it.allowNull(r),gasPrice:it.allowNull(r),maxPriorityFeePerGas:it.allowNull(r),maxFeePerGas:it.allowNull(r),to:it.allowNull(t),value:it.allowNull(r),data:it.allowNull(A),type:it.allowNull(l),accessList:it.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:l,blockNumber:l,transactionHash:o,address:t,topics:it.arrayOf(o),data:s,logIndex:l,blockHash:o},e.receipt={to:it.allowNull(this.address,null),from:it.allowNull(this.address,null),contractAddress:it.allowNull(t,null),transactionIndex:l,root:it.allowNull(a),gasUsed:r,logsBloom:it.allowNull(s),blockHash:o,transactionHash:o,logs:it.arrayOf(this.receiptLog.bind(this)),blockNumber:l,confirmations:it.allowNull(l,null),cumulativeGasUsed:r,effectiveGasPrice:it.allowNull(r),status:it.allowNull(l),type:c},e.block={hash:it.allowNull(o),parentHash:o,number:l,timestamp:l,nonce:it.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:it.allowNull(t),extraData:s,transactions:it.allowNull(it.arrayOf(o)),baseFeePerGas:it.allowNull(r)},e.blockWithTransactions=Hn(e.block),e.blockWithTransactions.transactions=it.allowNull(it.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:it.allowNull(i,void 0),toBlock:it.allowNull(i,void 0),blockHash:it.allowNull(o,void 0),address:it.allowNull(t,void 0),topics:it.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:it.allowNull(l),blockHash:it.allowNull(o),transactionIndex:l,removed:it.allowNull(this.boolean.bind(this)),address:t,data:it.allowFalsish(s,"0x"),topics:it.arrayOf(o),transactionHash:o,logIndex:l},e}accessList(e){return Vu(e||[])}number(e){return e==="0x"?0:Ve.from(e).toNumber()}type(e){return e==="0x"||e==null?0:Ve.from(e).toNumber()}bigNumber(e){return Ve.from(e)}boolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e=e.toLowerCase(),e==="true")return!0;if(e==="false")return!1}throw new Error("invalid boolean - "+e)}hex(e,t){return typeof e=="string"&&(!t&&e.substring(0,2)!=="0x"&&(e="0x"+e),It(e))?e.toLowerCase():pp.throwArgumentError("invalid hash","value",e)}data(e,t){const r=this.hex(e,t);if(r.length%2!==0)throw new Error("invalid data; odd-length - "+e);return r}address(e){return ai(e)}callAddress(e){if(!It(e,32))return null;const t=ai(mi(e,12));return t===w9?null:t}contractAddress(e){return vH(e)}blockTag(e){if(e==null)return"latest";if(e==="earliest")return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if(typeof e=="number"||It(e))return Ux(e);throw new Error("invalid blockTag")}hash(e,t){const r=this.hex(e,t);return Bu(r)!==32?pp.throwArgumentError("invalid hash","value",e):r}difficulty(e){if(e==null)return null;const t=Ve.from(e);try{return t.toNumber()}catch{}return null}uint256(e){if(!It(e))throw new Error("invalid uint256");return rr(e,32)}_block(e,t){e.author!=null&&e.miner==null&&(e.miner=e.author);const r=e._difficulty!=null?e._difficulty:e.difficulty,i=it.check(t,e);return i._difficulty=r==null?null:Ve.from(r),i}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return it.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&Ve.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),e.input!=null&&e.data==null&&(e.data=e.input),e.to==null&&e.creates==null&&(e.creates=this.contractAddress(e)),(e.type===1||e.type===2)&&e.accessList==null&&(e.accessList=[]);const t=it.check(this.formats.transaction,e);if(e.chainId!=null){let r=e.chainId;It(r)&&(r=Ve.from(r).toNumber()),t.chainId=r}else{let r=e.networkId;r==null&&t.v==null&&(r=e.chainId),It(r)&&(r=Ve.from(r).toNumber()),typeof r!="number"&&t.v!=null&&(r=(t.v-35)/2,r<0&&(r=0),r=parseInt(r)),typeof r!="number"&&(r=0),t.chainId=r}return t.blockHash&&t.blockHash.replace(/0/g,"")==="x"&&(t.blockHash=null),t}transaction(e){return xX(e)}receiptLog(e){return it.check(this.formats.receiptLog,e)}receipt(e){const t=it.check(this.formats.receipt,e);if(t.root!=null)if(t.root.length<=4){const r=Ve.from(t.root).toNumber();r===0||r===1?(t.status!=null&&t.status!==r&&pp.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=r,delete t.root):pp.throwArgumentError("invalid alt-root-status","value.root",t.root)}else t.root.length!==66&&pp.throwArgumentError("invalid root hash","value.root",t.root);return t.status!=null&&(t.byzantium=!0),t}topics(e){return Array.isArray(e)?e.map(t=>this.topics(t)):e!=null?this.hash(e,!0):null}filter(e){return it.check(this.formats.filter,e)}filterLog(e){return it.check(this.formats.filterLog,e)}static check(e,t){const r={};for(const i in e)try{const s=e[i](t[i]);s!==void 0&&(r[i]=s)}catch(s){throw s.checkKey=i,s.checkValue=t[i],s}return r}static allowNull(e,t){return function(r){return r==null?t:e(r)}}static allowFalsish(e,t){return function(r){return r?e(r):t}}static arrayOf(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");const r=[];return t.forEach(function(i){r.push(e(i))}),r}}};function bX(n){return n&&typeof n.isCommunityResource=="function"}function aF(n){return bX(n)&&n.isCommunityResource()}let lF=!1;function Qx(){lF||(lF=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var yt=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const Tt=new xe(Ci),EX=10;function cF(n){return n==null?"null":(Bu(n)!==32&&Tt.throwArgumentError("invalid topic","topic",n),n.toLowerCase())}function AF(n){for(n=n.slice();n.length>0&&n[n.length-1]==null;)n.pop();return n.map(e=>{if(Array.isArray(e)){const t={};e.forEach(i=>{t[cF(i)]=!0});const r=Object.keys(t);return r.sort(),r.join("|")}else return cF(e)}).join("&")}function BX(n){return n===""?[]:n.split(/&/g).map(e=>{if(e==="")return[];const t=e.split("|").map(r=>r==="null"?null:r);return t.length===1?t[0]:t})}function rf(n){if(typeof n=="string"){if(n=n.toLowerCase(),Bu(n)===32)return"tx:"+n;if(n.indexOf(":")===-1)return n}else{if(Array.isArray(n))return"filter:*:"+AF(n);if(g9.isForkEvent(n))throw Tt.warn("not implemented"),new Error("not implemented");if(n&&typeof n=="object")return"filter:"+(n.address||"*")+":"+AF(n.topics||[])}throw new Error("invalid event - "+n)}function mp(){return new Date().getTime()}function uF(n){return new Promise(e=>{setTimeout(e,n)})}const SX=["block","network","pending","poll"];let MX=class{constructor(e,t,r){Ue(this,"tag",e),Ue(this,"listener",t),Ue(this,"once",r),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return e[0]!=="tx"?null:e[1]}get filter(){const e=this.tag.split(":");if(e[0]!=="filter")return null;const t=e[1],r=BX(e[2]),i={};return r.length>0&&(i.topics=r),t&&t!=="*"&&(i.address=t),i}pollable(){return this.tag.indexOf(":")>=0||SX.indexOf(this.tag)>=0}};const CX={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Sb(n){return rr(Ve.from(n).toHexString(),32)}function fF(n){return CS.encode(Ms([n,mi(tF(tF(n)),0,4)]))}const $H=new RegExp("^(ipfs)://(.*)$","i"),hF=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),$H,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function iw(n,e){try{return l0(Ag(n,e))}catch{}return null}function Ag(n,e){if(n==="0x")return null;const t=Ve.from(mi(n,e,e+32)).toNumber(),r=Ve.from(mi(n,t,t+32)).toNumber();return mi(n,t+32,t+32+r)}function Mb(n){return n.match(/^ipfs:\/\/ipfs\//i)?n=n.substring(12):n.match(/^ipfs:\/\//i)?n=n.substring(7):Tt.throwArgumentError("unsupported IPFS format","link",n),`https://gateway.ipfs.io/ipfs/${n}`}function dF(n){const e=pt(n);if(e.length>32)throw new Error("internal; should not happen");const t=new Uint8Array(32);return t.set(e,32-e.length),t}function TX(n){if(n.length%32===0)return n;const e=new Uint8Array(Math.ceil(n.length/32)*32);return e.set(n),e}function ZH(n){const e=[];let t=0;for(let r=0;rVe.from(e).eq(1)).catch(e=>{if(e.code===xe.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,t){return yt(this,void 0,void 0,function*(){const r={to:this.address,ccipReadEnabled:!0,data:$i([e,tw(this.name),t||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,r.data=$i(["0x9061b923",ZH([nK(this.name),r.data])]));try{let s=yield this.provider.call(r);return pt(s).length%32===4&&Tt.throwError("resolver threw error",xe.errors.CALL_EXCEPTION,{transaction:r,data:s}),i&&(s=Ag(s,0)),s}catch(s){if(s.code===xe.errors.CALL_EXCEPTION)return null;throw s}})}_fetchBytes(e,t){return yt(this,void 0,void 0,function*(){const r=yield this._fetch(e,t);return r!=null?Ag(r,0):null})}_getAddress(e,t){const r=CX[String(e)];if(r==null&&Tt.throwError(`unsupported coin type: ${e}`,xe.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),r.ilk==="eth")return this.provider.formatter.address(t);const i=pt(t);if(r.p2pkh!=null){const s=t.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(s){const o=parseInt(s[1],16);if(s[2].length===o*2&&o>=1&&o<=75)return fF(Ms([[r.p2pkh],"0x"+s[2]]))}}if(r.p2sh!=null){const s=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(s){const o=parseInt(s[1],16);if(s[2].length===o*2&&o>=1&&o<=75)return fF(Ms([[r.p2sh],"0x"+s[2]]))}}if(r.prefix!=null){const s=i[1];let o=i[0];if(o===0?s!==20&&s!==32&&(o=-1):o=-1,o>=0&&i.length===2+s&&s>=1&&s<=75){const a=rF.toWords(i.slice(2));return a.unshift(o),rF.encode(r.prefix,a)}}return null}getAddress(e){return yt(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===E9?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===xe.errors.CALL_EXCEPTION)return null;throw i}const t=yield this._fetchBytes("0xf1cb7e06",Sb(e));if(t==null||t==="0x")return null;const r=this._getAddress(e,t);return r==null&&Tt.throwError("invalid or unsupported coin data",xe.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),r})}getAvatar(){return yt(this,void 0,void 0,function*(){const e=[{type:"name",content:this.name}];try{const t=yield this.getText("avatar");if(t==null)return null;for(let r=0;ro[l])}return Tt.throwError("invalid or unsupported content hash data",xe.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return yt(this,void 0,void 0,function*(){let t=Ya(e);t=Ms([Sb(64),Sb(t.length),t]),t.length%32!==0&&(t=Ms([t,rr("0x",32-e.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",lt(t));return r==null||r==="0x"?null:l0(r)})}}let Cb=null,IX=1;class dI extends a0{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),Ue(this,"anyNetwork",e==="any"),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(t=>{}),this._ready().catch(t=>{});else{const t=Cs(new.target,"getNetwork")(e);t?(Ue(this,"_network",t),this.emit("network",t,null)):Tt.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return yt(this,void 0,void 0,function*(){if(this._network==null){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch{}e==null&&(e=yield this.detectNetwork()),e||Tt.throwError("no network detected",xe.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:Ue(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return mh(()=>this._ready().then(e=>e,e=>{if(!(e.code===xe.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return Cb==null&&(Cb=new oF),Cb}static getNetwork(e){return eH(e??"homestead")}ccipReadFetch(e,t,r){return yt(this,void 0,void 0,function*(){if(this.disableCcipRead||r.length===0)return null;const i=e.to.toLowerCase(),s=t.toLowerCase(),o=[];for(let a=0;a=0?null:JSON.stringify({data:s,sender:i}),u=yield Nx({url:c,errorPassThrough:!0},A,(h,d)=>(h.status=d.statusCode,h));if(u.data)return u.data;const f=u.message||"unknown error";if(u.status>=400&&u.status<500)return Tt.throwError(`response not found during CCIP fetch: ${f}`,xe.errors.SERVER_ERROR,{url:l,errorMessage:f});o.push(f)}return Tt.throwError(`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,xe.errors.SERVER_ERROR,{urls:r,errorMessages:o})})}_getInternalBlockNumber(e){return yt(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const i=this._internalBlockNumber;try{const s=yield i;if(mp()-s.respTime<=e)return s.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const t=mp(),r=wr({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(i=>null,i=>i)}).then(({blockNumber:i,networkError:s})=>{if(s)throw this._internalBlockNumber===r&&(this._internalBlockNumber=null),s;const o=mp();return i=Ve.from(i).toNumber(),i{this._internalBlockNumber===r&&(this._internalBlockNumber=null)}),(yield r).blockNumber})}poll(){return yt(this,void 0,void 0,function*(){const e=IX++,t=[];let r=null;try{r=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(i){this.emit("error",i);return}if(this._setFastBlockNumber(r),this.emit("poll",e,r),r===this._lastBlockNumber){this.emit("didPoll",e);return}if(this._emitted.block===-2&&(this._emitted.block=r-1),Math.abs(this._emitted.block-r)>1e3)Tt.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",Tt.makeError("network block skew detected",xe.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(let i=this._emitted.block+1;i<=r;i++)this.emit("block",i);this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach(i=>{if(i==="block")return;const s=this._emitted[i];s!=="pending"&&r-s>12&&delete this._emitted[i]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=r-1),this._events.forEach(i=>{switch(i.type){case"tx":{const s=i.hash;let o=this.getTransactionReceipt(s).then(a=>(!a||a.blockNumber==null||(this._emitted["t:"+s]=a.blockNumber,this.emit(s,a)),null)).catch(a=>{this.emit("error",a)});t.push(o);break}case"filter":{if(!i._inflight){i._inflight=!0,i._lastBlockNumber===-2&&(i._lastBlockNumber=r-1);const s=i.filter;s.fromBlock=i._lastBlockNumber+1,s.toBlock=r;const o=s.toBlock-this._maxFilterBlockRange;o>s.fromBlock&&(s.fromBlock=o),s.fromBlock<0&&(s.fromBlock=0);const a=this.getLogs(s).then(l=>{i._inflight=!1,l.length!==0&&l.forEach(c=>{c.blockNumber>i._lastBlockNumber&&(i._lastBlockNumber=c.blockNumber),this._emitted["b:"+c.blockHash]=c.blockNumber,this._emitted["t:"+c.transactionHash]=c.blockNumber,this.emit(s,c)})}).catch(l=>{this.emit("error",l),i._inflight=!1});t.push(a)}break}}}),this._lastBlockNumber=r,Promise.all(t).then(()=>{this.emit("didPoll",e)}).catch(i=>{this.emit("error",i)})})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return yt(this,void 0,void 0,function*(){return Tt.throwError("provider does not support network detection",xe.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return yt(this,void 0,void 0,function*(){const e=yield this._ready(),t=yield this.detectNetwork();if(e.chainId!==t.chainId){if(this.anyNetwork)return this._network=t,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",t,e),yield uF(0),this._network;const r=Tt.makeError("underlying network changed",xe.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:t});throw this.emit("error",r),r}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if(typeof e!="number"||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const e=mp();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(t=>((this._fastBlockNumber==null||t>this._fastBlockNumber)&&(this._fastBlockNumber=t),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){this._fastBlockNumber!=null&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,t,r){return yt(this,void 0,void 0,function*(){return this._waitForTransaction(e,t??1,r||0,null)})}_waitForTransaction(e,t,r,i){return yt(this,void 0,void 0,function*(){const s=yield this.getTransactionReceipt(e);return(s?s.confirmations:0)>=t?s:new Promise((o,a)=>{const l=[];let c=!1;const A=function(){return c?!0:(c=!0,l.forEach(f=>{f()}),!1)},u=f=>{f.confirmations{this.removeListener(e,u)}),i){let f=i.startBlock,h=null;const d=m=>yt(this,void 0,void 0,function*(){c||(yield uF(1e3),this.getTransactionCount(i.from).then(g=>yt(this,void 0,void 0,function*(){if(!c){if(g<=i.nonce)f=m;else{{const p=yield this.getTransaction(e);if(p&&p.blockNumber!=null)return}for(h==null&&(h=f-3,h{c||this.once("block",d)}))});if(c)return;this.once("block",d),l.push(()=>{this.removeListener("block",d)})}if(typeof r=="number"&&r>0){const f=setTimeout(()=>{A()||a(Tt.makeError("timeout exceeded",xe.errors.TIMEOUT,{timeout:r}))},r);f.unref&&f.unref(),l.push(()=>{clearTimeout(f)})}})})}getBlockNumber(){return yt(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return yt(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return Ve.from(e)}catch(t){return Tt.throwError("bad result from backend",xe.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}})}getBalance(e,t){return yt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield wr({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getBalance",r);try{return Ve.from(i)}catch(s){return Tt.throwError("bad result from backend",xe.errors.SERVER_ERROR,{method:"getBalance",params:r,result:i,error:s})}})}getTransactionCount(e,t){return yt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield wr({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getTransactionCount",r);try{return Ve.from(i).toNumber()}catch(s){return Tt.throwError("bad result from backend",xe.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:i,error:s})}})}getCode(e,t){return yt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield wr({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getCode",r);try{return lt(i)}catch(s){return Tt.throwError("bad result from backend",xe.errors.SERVER_ERROR,{method:"getCode",params:r,result:i,error:s})}})}getStorageAt(e,t,r){return yt(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield wr({address:this._getAddress(e),blockTag:this._getBlockTag(r),position:Promise.resolve(t).then(o=>Ux(o))}),s=yield this.perform("getStorageAt",i);try{return lt(s)}catch(o){return Tt.throwError("bad result from backend",xe.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:s,error:o})}})}_wrapTransaction(e,t,r){if(t!=null&&Bu(t)!==32)throw new Error("invalid response - sendTransaction");const i=e;return t!=null&&e.hash!==t&&Tt.throwError("Transaction hash mismatch from Provider.sendTransaction.",xe.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),i.wait=(s,o)=>yt(this,void 0,void 0,function*(){s==null&&(s=1),o==null&&(o=0);let a;s!==0&&r!=null&&(a={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:r});const l=yield this._waitForTransaction(e.hash,s,o,a);return l==null&&s===0?null:(this._emitted["t:"+e.hash]=l.blockNumber,l.status===0&&Tt.throwError("transaction failed",xe.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:l}),l)}),i}sendTransaction(e){return yt(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then(s=>lt(s)),r=this.formatter.transaction(e);r.confirmations==null&&(r.confirmations=0);const i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const s=yield this.perform("sendTransaction",{signedTransaction:t});return this._wrapTransaction(r,s,i)}catch(s){throw s.transaction=r,s.transactionHash=r.hash,s}})}_getTransactionRequest(e){return yt(this,void 0,void 0,function*(){const t=yield e,r={};return["from","to"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s?this._getAddress(s):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s?Ve.from(s):null))}),["type"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s??null))}),t.accessList&&(r.accessList=this.formatter.accessList(t.accessList)),["data"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s?lt(s):null))}),this.formatter.transactionRequest(yield wr(r))})}_getFilter(e){return yt(this,void 0,void 0,function*(){e=yield e;const t={};return e.address!=null&&(t.address=this._getAddress(e.address)),["blockHash","topics"].forEach(r=>{e[r]!=null&&(t[r]=e[r])}),["fromBlock","toBlock"].forEach(r=>{e[r]!=null&&(t[r]=this._getBlockTag(e[r]))}),this.formatter.filter(yield wr(t))})}_call(e,t,r){return yt(this,void 0,void 0,function*(){r>=EX&&Tt.throwError("CCIP read exceeded maximum redirections",xe.errors.SERVER_ERROR,{redirects:r,transaction:e});const i=e.to,s=yield this.perform("call",{transaction:e,blockTag:t});if(r>=0&&t==="latest"&&i!=null&&s.substring(0,10)==="0x556f1830"&&Bu(s)%32===4)try{const o=mi(s,4),a=mi(o,0,32);Ve.from(a).eq(i)||Tt.throwError("CCIP Read sender did not match",xe.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:s});const l=[],c=Ve.from(mi(o,32,64)).toNumber(),A=Ve.from(mi(o,c,c+32)).toNumber(),u=mi(o,c+32);for(let p=0;pyt(this,void 0,void 0,function*(){const s=yield this.perform("getBlock",i);if(s==null)return i.blockHash!=null&&this._emitted["b:"+i.blockHash]==null||i.blockTag!=null&&r>this._emitted.block?null:void 0;if(t){let o=null;for(let l=0;lthis._wrapTransaction(l)),a}return this.formatter.block(s)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return yt(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return mh(()=>yt(this,void 0,void 0,function*(){const r=yield this.perform("getTransaction",t);if(r==null)return this._emitted["t:"+e]==null?null:void 0;const i=this.formatter.transactionResponse(r);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let o=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;o<=0&&(o=1),i.confirmations=o}return this._wrapTransaction(i)}),{oncePoll:this})})}getTransactionReceipt(e){return yt(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return mh(()=>yt(this,void 0,void 0,function*(){const r=yield this.perform("getTransactionReceipt",t);if(r==null)return this._emitted["t:"+e]==null?null:void 0;if(r.blockHash==null)return;const i=this.formatter.receipt(r);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let o=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;o<=0&&(o=1),i.confirmations=o}return i}),{oncePoll:this})})}getLogs(e){return yt(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield wr({filter:this._getFilter(e)}),r=yield this.perform("getLogs",t);return r.forEach(i=>{i.removed==null&&(i.removed=!1)}),oF.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)})}getEtherPrice(){return yt(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return yt(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&Tt.throwArgumentError("invalid BlockTag","blockTag",e);let t=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return t+=e,t<0&&(t=0),this.formatter.blockTag(t)}return this.formatter.blockTag(e)})}getResolver(e){return yt(this,void 0,void 0,function*(){let t=e;for(;;){if(t===""||t==="."||e!=="eth"&&t==="eth")return null;const r=yield this._getResolver(t,"getResolver");if(r!=null){const i=new pF(this,r,e);return t!==e&&!(yield i.supportsWildcard())?null:i}t=t.split(".").slice(1).join(".")}})}_getResolver(e,t){return yt(this,void 0,void 0,function*(){t==null&&(t="ENS");const r=yield this.getNetwork();r.ensAddress||Tt.throwError("network does not support ENS",xe.errors.UNSUPPORTED_OPERATION,{operation:t,network:r.name});try{const i=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+tw(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return yt(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(r){if(It(e))throw r}typeof e!="string"&&Tt.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null})}lookupAddress(e){return yt(this,void 0,void 0,function*(){e=yield e,e=this.formatter.address(e);const t=e.substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(t,"lookupAddress");if(r==null)return null;const i=iw(yield this.call({to:r,data:"0x691f3431"+tw(t).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return yt(this,void 0,void 0,function*(){let t=null;if(It(e)){const s=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",o=yield this._getResolver(s,"getAvatar");if(!o)return null;t=new pF(this,o,s);try{const a=yield t.getAvatar();if(a)return a.url}catch(a){if(a.code!==xe.errors.CALL_EXCEPTION)throw a}try{const a=iw(yield this.call({to:o,data:"0x691f3431"+tw(s).substring(2)}),0);t=yield this.getResolver(a)}catch(a){if(a.code!==xe.errors.CALL_EXCEPTION)throw a;return null}}else if(t=yield this.getResolver(e),!t)return null;const r=yield t.getAvatar();return r==null?null:r.url})}perform(e,t){return Tt.throwError(e+" not implemented",xe.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(t=>t.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(t=>t.pollable()).length>0}_addEventListener(e,t,r){const i=new MX(rf(e),t,r);return this._events.push(i),this._startEvent(i),this}on(e,t){return this._addEventListener(e,t,!1)}once(e,t){return this._addEventListener(e,t,!0)}emit(e,...t){let r=!1,i=[],s=rf(e);return this._events=this._events.filter(o=>o.tag!==s?!0:(setTimeout(()=>{o.listener.apply(this,t)},0),r=!0,o.once?(i.push(o),!1):!0)),i.forEach(o=>{this._stopEvent(o)}),r}listenerCount(e){if(!e)return this._events.length;let t=rf(e);return this._events.filter(r=>r.tag===t).length}listeners(e){if(e==null)return this._events.map(r=>r.listener);let t=rf(e);return this._events.filter(r=>r.tag===t).map(r=>r.listener)}off(e,t){if(t==null)return this.removeAllListeners(e);const r=[];let i=!1,s=rf(e);return this._events=this._events.filter(o=>o.tag!==s||o.listener!=t||i?!0:(i=!0,r.push(o),!1)),r.forEach(o=>{this._stopEvent(o)}),this}removeAllListeners(e){let t=[];if(e==null)t=this._events,this._events=[];else{const r=rf(e);this._events=this._events.filter(i=>i.tag!==r?!0:(t.push(i),!1))}return t.forEach(r=>{this._stopEvent(r)}),this}}const RX="abstract-signer/5.7.0";var Fo=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const Js=new xe(RX),UX=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],FX=[xe.errors.INSUFFICIENT_FUNDS,xe.errors.NONCE_EXPIRED,xe.errors.REPLACEMENT_UNDERPRICED];class A0{constructor(){Js.checkAbstract(new.target,A0),Ue(this,"_isSigner",!0)}getBalance(e){return Fo(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return Fo(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return Fo(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const t=yield wr(this.checkTransaction(e));return yield this.provider.estimateGas(t)})}call(e,t){return Fo(this,void 0,void 0,function*(){this._checkProvider("call");const r=yield wr(this.checkTransaction(e));return yield this.provider.call(r,t)})}sendTransaction(e){return Fo(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const t=yield this.populateTransaction(e),r=yield this.signTransaction(t);return yield this.provider.sendTransaction(r)})}getChainId(){return Fo(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return Fo(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return Fo(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return Fo(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const r in e)UX.indexOf(r)===-1&&Js.throwArgumentError("invalid transaction key: "+r,"transaction",e);const t=Hn(e);return t.from==null?t.from=this.getAddress():t.from=Promise.all([Promise.resolve(t.from),this.getAddress()]).then(r=>(r[0].toLowerCase()!==r[1].toLowerCase()&&Js.throwArgumentError("from address mismatch","transaction",e),r[0])),t}populateTransaction(e){return Fo(this,void 0,void 0,function*(){const t=yield wr(this.checkTransaction(e));t.to!=null&&(t.to=Promise.resolve(t.to).then(i=>Fo(this,void 0,void 0,function*(){if(i==null)return null;const s=yield this.resolveName(i);return s==null&&Js.throwArgumentError("provided ENS name resolves to null","tx.to",i),s})),t.to.catch(i=>{}));const r=t.maxFeePerGas!=null||t.maxPriorityFeePerGas!=null;if(t.gasPrice!=null&&(t.type===2||r)?Js.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(t.type===0||t.type===1)&&r&&Js.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e),(t.type===2||t.type==null)&&t.maxFeePerGas!=null&&t.maxPriorityFeePerGas!=null)t.type=2;else if(t.type===0||t.type===1)t.gasPrice==null&&(t.gasPrice=this.getGasPrice());else{const i=yield this.getFeeData();if(t.type==null)if(i.maxFeePerGas!=null&&i.maxPriorityFeePerGas!=null)if(t.type=2,t.gasPrice!=null){const s=t.gasPrice;delete t.gasPrice,t.maxFeePerGas=s,t.maxPriorityFeePerGas=s}else t.maxFeePerGas==null&&(t.maxFeePerGas=i.maxFeePerGas),t.maxPriorityFeePerGas==null&&(t.maxPriorityFeePerGas=i.maxPriorityFeePerGas);else i.gasPrice!=null?(r&&Js.throwError("network does not support EIP-1559",xe.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),t.gasPrice==null&&(t.gasPrice=i.gasPrice),t.type=0):Js.throwError("failed to get consistent fee data",xe.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else t.type===2&&(t.maxFeePerGas==null&&(t.maxFeePerGas=i.maxFeePerGas),t.maxPriorityFeePerGas==null&&(t.maxPriorityFeePerGas=i.maxPriorityFeePerGas))}return t.nonce==null&&(t.nonce=this.getTransactionCount("pending")),t.gasLimit==null&&(t.gasLimit=this.estimateGas(t).catch(i=>{if(FX.indexOf(i.code)>=0)throw i;return Js.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",xe.errors.UNPREDICTABLE_GAS_LIMIT,{error:i,tx:t})})),t.chainId==null?t.chainId=this.getChainId():t.chainId=Promise.all([Promise.resolve(t.chainId),this.getChainId()]).then(i=>(i[1]!==0&&i[0]!==i[1]&&Js.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield wr(t)})}_checkProvider(e){this.provider||Js.throwError("missing provider",xe.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class pI extends A0{constructor(e,t){super(),Ue(this,"address",e),Ue(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then(()=>{Js.throwError(e,xe.errors.UNSUPPORTED_OPERATION,{operation:t})})}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,t,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new pI(this.address,e)}}var Tl=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const _r=new xe(Ci),PX=["call","estimateGas"];function Om(n,e){if(n==null)return null;if(typeof n.message=="string"&&n.message.match("reverted")){const t=It(n.data)?n.data:null;if(!e||t)return{message:n.message,data:t}}if(typeof n=="object"){for(const t in n){const r=Om(n[t],e);if(r)return r}return null}if(typeof n=="string")try{return Om(JSON.parse(n),e)}catch{}return null}function JH(n,e,t){const r=t.transaction||t.signedTransaction;if(n==="call"){const s=Om(e,!0);if(s)return s.data;_r.throwError("missing revert data in call exception; Transaction reverted without a reason string",xe.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:e})}if(n==="estimateGas"){let s=Om(e.body,!1);s==null&&(s=Om(e,!1)),s&&_r.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",xe.errors.UNPREDICTABLE_GAS_LIMIT,{reason:s.message,method:n,transaction:r,error:e})}let i=e.message;throw e.code===xe.errors.SERVER_ERROR&&e.error&&typeof e.error.message=="string"?i=e.error.message:typeof e.body=="string"?i=e.body:typeof e.responseText=="string"&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&_r.throwError("insufficient funds for intrinsic transaction cost",xe.errors.INSUFFICIENT_FUNDS,{error:e,method:n,transaction:r}),i.match(/nonce (is )?too low/i)&&_r.throwError("nonce has already been used",xe.errors.NONCE_EXPIRED,{error:e,method:n,transaction:r}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&_r.throwError("replacement fee too low",xe.errors.REPLACEMENT_UNDERPRICED,{error:e,method:n,transaction:r}),i.match(/only replay-protected/i)&&_r.throwError("legacy pre-eip-155 transactions not supported",xe.errors.UNSUPPORTED_OPERATION,{error:e,method:n,transaction:r}),PX.indexOf(n)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&_r.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",xe.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:r}),e}function mF(n){return new Promise(function(e){setTimeout(e,n)})}function LX(n){if(n.error){const e=new Error(n.error.message);throw e.code=n.error.code,e.data=n.error.data,e}return n.result}function gp(n){return n&&n.toLowerCase()}const LS={};class qH extends A0{constructor(e,t,r){if(super(),e!==LS)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");Ue(this,"provider",t),r==null&&(r=0),typeof r=="string"?(Ue(this,"_address",this.provider.formatter.address(r)),Ue(this,"_index",null)):typeof r=="number"?(Ue(this,"_index",r),Ue(this,"_address",null)):_r.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(e){return _r.throwError("cannot alter JSON-RPC Signer connection",xe.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new DX(LS,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&_r.throwError("unknown account #"+this._index,xe.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=Hn(e);const t=this.getAddress().then(r=>(r&&(r=r.toLowerCase()),r));if(e.gasLimit==null){const r=Hn(e);r.from=t,e.gasLimit=this.provider.estimateGas(r)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(r=>Tl(this,void 0,void 0,function*(){if(r==null)return null;const i=yield this.provider.resolveName(r);return i==null&&_r.throwArgumentError("provided ENS name resolves to null","tx.to",r),i}))),wr({tx:wr(e),sender:t}).then(({tx:r,sender:i})=>{r.from!=null?r.from.toLowerCase()!==i&&_r.throwArgumentError("from address mismatch","transaction",e):r.from=i;const s=this.provider.constructor.hexlifyTransaction(r,{from:!0});return this.provider.send("eth_sendTransaction",[s]).then(o=>o,o=>(typeof o.message=="string"&&o.message.match(/user denied/i)&&_r.throwError("user rejected transaction",xe.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:r}),JH("sendTransaction",o,s)))})}signTransaction(e){return _r.throwError("signing transactions is unsupported",xe.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return Tl(this,void 0,void 0,function*(){const t=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),r=yield this.sendUncheckedTransaction(e);try{return yield mh(()=>Tl(this,void 0,void 0,function*(){const i=yield this.provider.getTransaction(r);if(i!==null)return this.provider._wrapTransaction(i,r,t)}),{oncePoll:this.provider})}catch(i){throw i.transactionHash=r,i}})}signMessage(e){return Tl(this,void 0,void 0,function*(){const t=typeof e=="string"?Ya(e):e,r=yield this.getAddress();try{return yield this.provider.send("personal_sign",[lt(t),r.toLowerCase()])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&_r.throwError("user rejected signing",xe.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:e}),i}})}_legacySignMessage(e){return Tl(this,void 0,void 0,function*(){const t=typeof e=="string"?Ya(e):e,r=yield this.getAddress();try{return yield this.provider.send("eth_sign",[r.toLowerCase(),lt(t)])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&_r.throwError("user rejected signing",xe.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:e}),i}})}_signTypedData(e,t,r){return Tl(this,void 0,void 0,function*(){const i=yield ws.resolveNames(e,t,r,o=>this.provider.resolveName(o)),s=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[s.toLowerCase(),JSON.stringify(ws.getPayload(i.domain,t,i.value))])}catch(o){throw typeof o.message=="string"&&o.message.match(/user denied/i)&&_r.throwError("user rejected signing",xe.errors.ACTION_REJECTED,{action:"_signTypedData",from:s,messageData:{domain:i.domain,types:t,value:i.value}}),o}})}unlock(e){return Tl(this,void 0,void 0,function*(){const t=this.provider,r=yield this.getAddress();return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])})}}class DX extends qH{sendTransaction(e){return this.sendUncheckedTransaction(e).then(t=>({hash:t,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:r=>this.provider.waitForTransaction(t,r)}))}}const NX={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class ug extends dI{constructor(e,t){let r=t;r==null&&(r=new Promise((i,s)=>{setTimeout(()=>{this.detectNetwork().then(o=>{i(o)},o=>{s(o)})},0)})),super(r),e||(e=Cs(this.constructor,"defaultUrl")()),typeof e=="string"?Ue(this,"connection",Object.freeze({url:e})):Ue(this,"connection",Object.freeze(Hn(e))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return Tl(this,void 0,void 0,function*(){yield mF(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch{try{e=yield this.send("net_version",[])}catch{}}if(e!=null){const t=Cs(this.constructor,"getNetwork");try{return t(Ve.from(e).toNumber())}catch(r){return _r.throwError("could not detect network",xe.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:r})}}return _r.throwError("could not detect network",xe.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new qH(LS,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(t=>this.formatter.address(t)))}send(e,t){const r={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:Ps(r),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const s=Nx(this.connection,JSON.stringify(r),LX).then(o=>(this.emit("debug",{action:"response",request:r,response:o,provider:this}),o),o=>{throw this.emit("debug",{action:"response",error:o,request:r,provider:this}),o});return i&&(this._cache[e]=s,setTimeout(()=>{this._cache[e]=null},0)),s}prepareRequest(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[gp(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[gp(t.address),t.blockTag]];case"getCode":return["eth_getCode",[gp(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[gp(t.address),rr(t.position,32),t.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[t.signedTransaction]];case"getBlock":return t.blockTag?["eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]]:t.blockHash?["eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[t.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[t.transactionHash]];case"call":return["eth_call",[Cs(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[Cs(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&t.filter.address!=null&&(t.filter.address=gp(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return Tl(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){const i=t.transaction;if(i&&i.type!=null&&Ve.from(i.type).isZero()&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const s=yield this.getFeeData();s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null&&(t=Hn(t),t.transaction=Hn(i),delete t.transaction.type)}}const r=this.prepareRequest(e,t);r==null&&_r.throwError(e+" not implemented",xe.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(r[0],r[1])}catch(i){return JH(e,i,t)}})}_startEvent(e){e.tag==="pending"&&this._startPending(),super._startEvent(e)}_startPending(){if(this._pendingFilter!=null)return;const e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then(function(r){function i(){e.send("eth_getFilterChanges",[r]).then(function(s){if(e._pendingFilter!=t)return null;let o=Promise.resolve();return s.forEach(function(a){e._emitted["t:"+a.toLowerCase()]="pending",o=o.then(function(){return e.getTransaction(a).then(function(l){return e.emit("pending",l),null})})}),o.then(function(){return mF(1e3)})}).then(function(){if(e._pendingFilter!=t){e.send("eth_uninstallFilter",[r]);return}return setTimeout(function(){i()},0),null}).catch(s=>{})}return i(),r}).catch(r=>{})}_stopEvent(e){e.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,t){const r=Hn(NX);if(t)for(const s in t)t[s]&&(r[s]=!0);u9(e,r);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(s){if(e[s]==null)return;const o=Ux(Ve.from(e[s]));s==="gasLimit"&&(s="gas"),i[s]=o}),["from","to","data"].forEach(function(s){e[s]!=null&&(i[s]=lt(e[s]))}),e.accessList&&(i.accessList=Vu(e.accessList)),i}}let km=null;try{if(km=WebSocket,km==null)throw new Error("inject please")}catch{const e=new xe(Ci);km=function(){e.throwError("WebSockets not supported in this environment",xe.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var Tb=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const z0=new xe(Ci);let OX=1;class mI extends ug{constructor(e,t){t==="any"&&z0.throwError("WebSocketProvider does not support 'any' network yet",xe.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,t):super("_websocket",t),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?Ue(this,"_websocket",new km(this.connection.url)):Ue(this,"_websocket",e),Ue(this,"_requests",{}),Ue(this,"_subs",{}),Ue(this,"_subIds",{}),Ue(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(i=>{this.websocket.send(this._requests[i].payload)})},this.websocket.onmessage=i=>{const s=i.data,o=JSON.parse(s);if(o.id!=null){const a=String(o.id),l=this._requests[a];if(delete this._requests[a],o.result!==void 0)l.callback(null,o.result),this.emit("debug",{action:"response",request:JSON.parse(l.payload),response:o.result,provider:this});else{let c=null;o.error?(c=new Error(o.error.message||"unknown error"),Ue(c,"code",o.error.code||null),Ue(c,"response",s)):c=new Error("unknown error"),l.callback(c,void 0),this.emit("debug",{action:"response",error:c,request:JSON.parse(l.payload),provider:this})}}else if(o.method==="eth_subscription"){const a=this._subs[o.params.subscription];a&&a.processFunc(o.params.result)}else console.warn("this should not happen")};const r=setInterval(()=>{this.emit("poll")},1e3);r.unref&&r.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){z0.throwError("cannot reset events block on WebSocketProvider",xe.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){z0.throwError("cannot set polling interval on WebSocketProvider",xe.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return Tb(this,void 0,void 0,function*(){return null})}set polling(e){e&&z0.throwError("cannot set polling on WebSocketProvider",xe.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,t){const r=OX++;return new Promise((i,s)=>{function o(l,c){return l?s(l):i(c)}const a=JSON.stringify({method:e,params:t,id:r,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(a),provider:this}),this._requests[String(r)]={callback:o,payload:a},this._wsReady&&this.websocket.send(a)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,t,r){return Tb(this,void 0,void 0,function*(){let i=this._subIds[e];i==null&&(i=Promise.all(t).then(o=>this.send("eth_subscribe",o)),this._subIds[e]=i);const s=yield i;this._subs[s]={tag:e,processFunc:r}})}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],t=>{const r=Ve.from(t.number).toNumber();this._emitted.block=r,this.emit("block",r)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],t=>{this.emit("pending",t)});break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],t=>{t.removed==null&&(t.removed=!1),this.emit(e.filter,this.formatter.filterLog(t))});break;case"tx":{const t=r=>{const i=r.hash;this.getTransactionReceipt(i).then(s=>{s&&this.emit(i,s)})};t(e),this._subscribe("tx",["newHeads"],r=>{this._events.filter(i=>i.type==="tx").forEach(t)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e);break}}_stopEvent(e){let t=e.tag;if(e.type==="tx"){if(this._events.filter(i=>i.type==="tx").length)return;t="tx"}else if(this.listenerCount(e.event))return;const r=this._subIds[t];r&&(delete this._subIds[t],r.then(i=>{this._subs[i]&&(delete this._subs[i],this.send("eth_unsubscribe",[i]))}))}destroy(){return Tb(this,void 0,void 0,function*(){this.websocket.readyState===km.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}var kX=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const hm=new xe(Ci);class eQ extends ug{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return kX(this,void 0,void 0,function*(){let t=this.network;return t==null&&(t=yield e.detectNetwork.call(this),t||hm.throwError("no network detected",xe.errors.UNKNOWN_ERROR,{}),this._network==null&&(Ue(this,"_network",t),this.emit("network",t,null))),t})}}class SA extends eQ{constructor(e,t){hm.checkAbstract(new.target,SA),e=Cs(new.target,"getNetwork")(e),t=Cs(new.target,"getApiKey")(t);const r=Cs(new.target,"getUrl")(e,t);super(r,e),typeof t=="string"?Ue(this,"apiKey",t):t!=null&&Object.keys(t).forEach(i=>{Ue(this,i,t[i])})}_startPending(){hm.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return hm.throwError("API provider does not support signing",xe.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,t){return hm.throwError("not implemented; sub-classes must override getUrl",xe.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const gF=new xe(Ci),sw="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class HX extends mI{constructor(e,t){const r=new tQ(e,t),i=r.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(i,r.network),Ue(this,"apiKey",r.apiKey)}isCommunityResource(){return this.apiKey===sw}}class tQ extends SA{static getWebSocketProvider(e,t){return new HX(e,t)}static getApiKey(e){return e==null?sw:(e&&typeof e!="string"&&gF.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,t){let r=null;switch(e.name){case"homestead":r="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":r="eth-goerli.g.alchemy.com/v2/";break;case"matic":r="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":r="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":r="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":r="arb-goerli.g.alchemy.com/v2/";break;case"optimism":r="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":r="opt-goerli.g.alchemy.com/v2/";break;default:gF.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+r+t,throttleCallback:(i,s)=>(t===sw&&Qx(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===sw}}const QX=new xe(Ci),G0="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function zX(n){switch(n){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return QX.throwArgumentError("unsupported network","name",n)}class GX extends SA{isCommunityResource(){return this.apiKey===G0}static getApiKey(e){return e??G0}static getUrl(e,t){t==null&&(t=G0);const r={allowGzip:!0,url:"https://"+zX(e.name)+t,throttleCallback:(i,s)=>(t.apiKey===G0&&Qx(),Promise.resolve(!0))};return t.projectSecret!=null&&(r.user="",r.password=t.projectSecret),r}}var VX=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const vF=new xe(Ci);class jX extends SA{static getApiKey(e){return e!=null&&vF.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,t){let r=null;switch(e.name){case"homestead":r="https://cloudflare-eth.com/";break;default:vF.throwArgumentError("unsupported network","network",arguments[0])}return r}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return VX(this,void 0,void 0,function*(){return e==="getBlockNumber"?(yield r.perform.call(this,"getBlock",{blockTag:"latest"})).number:r.perform.call(this,e,t)})}}var V0=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const Hc=new xe(Ci);function yF(n){const e={};for(let t in n){if(n[t]==null)continue;let r=n[t];t==="type"&&r===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[t]?r=Ux(lt(r)):t==="accessList"?r="["+Vu(r).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":r=lt(r),e[t]=r)}return e}function WX(n){if(n.status==0&&(n.message==="No records found"||n.message==="No transactions found"))return n.result;if(n.status!=1||typeof n.message!="string"||!n.message.match(/^OK/)){const e=new Error("invalid response");throw e.result=JSON.stringify(n),(n.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return n.result}function wF(n){if(n&&n.status==0&&n.message=="NOTOK"&&(n.result||"").toLowerCase().indexOf("rate limit")>=0){const e=new Error("throttled response");throw e.result=JSON.stringify(n),e.throttleRetry=!0,e}if(n.jsonrpc!="2.0"){const e=new Error("invalid response");throw e.result=JSON.stringify(n),e}if(n.error){const e=new Error(n.error.message||"unknown error");throw n.error.code&&(e.code=n.error.code),n.error.data&&(e.data=n.error.data),e}return n.result}function _F(n){if(n==="pending")throw new Error("pending not supported");return n==="latest"?n:parseInt(n.substring(2),16)}function Ib(n,e,t){if(n==="call"&&e.code===xe.errors.SERVER_ERROR){const i=e.error;if(i&&(i.message.match(/reverted/i)||i.message.match(/VM execution error/i))){let s=i.data;if(s&&(s="0x"+s.replace(/^.*0x/i,"")),It(s))return s;Hc.throwError("missing revert data in call exception",xe.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let r=e.message;throw e.code===xe.errors.SERVER_ERROR&&(e.error&&typeof e.error.message=="string"?r=e.error.message:typeof e.body=="string"?r=e.body:typeof e.responseText=="string"&&(r=e.responseText)),r=(r||"").toLowerCase(),r.match(/insufficient funds/)&&Hc.throwError("insufficient funds for intrinsic transaction cost",xe.errors.INSUFFICIENT_FUNDS,{error:e,method:n,transaction:t}),r.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&Hc.throwError("nonce has already been used",xe.errors.NONCE_EXPIRED,{error:e,method:n,transaction:t}),r.match(/another transaction with same nonce/)&&Hc.throwError("replacement fee too low",xe.errors.REPLACEMENT_UNDERPRICED,{error:e,method:n,transaction:t}),r.match(/execution failed due to an exception|execution reverted/)&&Hc.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",xe.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:t}),e}class KX extends dI{constructor(e,t){super(e),Ue(this,"baseUrl",this.getBaseUrl()),Ue(this,"apiKey",t||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return Hc.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,t){const r=Object.keys(t).reduce((s,o)=>{const a=t[o];return a!=null&&(s+=`&${o}=${a}`),s},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${r}${i}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,t){return t.module=e,t.apikey=this.apiKey,t}fetch(e,t,r){return V0(this,void 0,void 0,function*(){const i=r?this.getPostUrl():this.getUrl(e,t),s=r?this.getPostData(e,t):null,o=e==="proxy"?wF:WX;this.emit("debug",{action:"request",request:i,provider:this});const a={url:i,throttleSlotInterval:1e3,throttleCallback:(A,u)=>(this.isCommunityResource()&&Qx(),Promise.resolve(!0))};let l=null;s&&(a.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},l=Object.keys(s).map(A=>`${A}=${s[A]}`).join("&"));const c=yield Nx(a,l,o||wF);return this.emit("debug",{action:"response",request:i,response:Ps(c),provider:this}),c})}detectNetwork(){return V0(this,void 0,void 0,function*(){return this.network})}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return V0(this,void 0,void 0,function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:t.address,tag:t.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:t.address,tag:t.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:t.address,tag:t.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:t.address,position:t.position,tag:t.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:t.signedTransaction},!0).catch(i=>Ib("sendTransaction",i,t.signedTransaction));case"getBlock":if(t.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:t.blockTag,boolean:t.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:t.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:t.transactionHash});case"call":{if(t.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const i=yF(t.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(s){return Ib("call",s,t.transaction)}}case"estimateGas":{const i=yF(t.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(s){return Ib("estimateGas",s,t.transaction)}}case"getLogs":{const i={action:"getLogs"};if(t.filter.fromBlock&&(i.fromBlock=_F(t.filter.fromBlock)),t.filter.toBlock&&(i.toBlock=_F(t.filter.toBlock)),t.filter.address&&(i.address=t.filter.address),t.filter.topics&&t.filter.topics.length>0&&(t.filter.topics.length>1&&Hc.throwError("unsupported topic count",xe.errors.UNSUPPORTED_OPERATION,{topics:t.filter.topics}),t.filter.topics.length===1)){const a=t.filter.topics[0];(typeof a!="string"||a.length!==66)&&Hc.throwError("unsupported topic format",xe.errors.UNSUPPORTED_OPERATION,{topic0:a}),i.topic0=a}const s=yield this.fetch("logs",i);let o={};for(let a=0;a{["contractAddress","to"].forEach(function(l){o[l]==""&&delete o[l]}),o.creates==null&&o.contractAddress!=null&&(o.creates=o.contractAddress);const a=this.formatter.transactionResponse(o);return o.timeStamp&&(a.timestamp=parseInt(o.timeStamp)),a})})}isCommunityResource(){return this.apiKey==null}}function XX(n){n=n.slice();for(let e=n.length-1;e>0;e--){const t=Math.floor(Math.random()*(e+1)),r=n[e];n[e]=n[t],n[t]=r}return n}var e_=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const su=new xe(Ci);function j0(){return new Date().getTime()}function xF(n){let e=null;for(let t=0;te?null:(r+i)/2}function gh(n){if(n===null)return"null";if(typeof n=="number"||typeof n=="boolean")return JSON.stringify(n);if(typeof n=="string")return n;if(Ve.isBigNumber(n))return n.toString();if(Array.isArray(n))return JSON.stringify(n.map(e=>gh(e)));if(typeof n=="object"){const e=Object.keys(n);return e.sort(),"{"+e.map(t=>{let r=n[t];return typeof r=="function"?r="[function]":r=gh(r),JSON.stringify(t)+":"+r}).join(",")+"}"}throw new Error("unknown value type: "+typeof n)}let YX=1;function EF(n){let e=null,t=null,r=new Promise(o=>{e=function(){t&&(clearTimeout(t),t=null),o()},t=setTimeout(e,n)});const i=o=>(r=r.then(o),r);function s(){return r}return{cancel:e,getPromise:s,wait:i}}const $X=[xe.errors.CALL_EXCEPTION,xe.errors.INSUFFICIENT_FUNDS,xe.errors.NONCE_EXPIRED,xe.errors.REPLACEMENT_UNDERPRICED,xe.errors.UNPREDICTABLE_GAS_LIMIT],ZX=["address","args","errorArgs","errorSignature","method","transaction"];function W0(n,e){const t={weight:n.weight};return Object.defineProperty(t,"provider",{get:()=>n.provider}),n.start&&(t.start=n.start),e&&(t.duration=e-n.start),n.done&&(n.error?t.error=n.error:t.result=n.result||null),t}function JX(n,e){return function(t){const r={};t.forEach(s=>{const o=n(s.result);r[o]||(r[o]={count:0,result:s.result}),r[o].count++});const i=Object.keys(r);for(let s=0;s=e)return o.result}}}function qX(n,e,t){let r=gh;switch(e){case"getBlockNumber":return function(i){const s=i.map(a=>a.result);let o=bF(i.map(a=>a.result),2);if(o!=null)return o=Math.ceil(o),s.indexOf(o+1)>=0&&o++,o>=n._highestBlockNumber&&(n._highestBlockNumber=o),n._highestBlockNumber};case"getGasPrice":return function(i){const s=i.map(o=>o.result);return s.sort(),s[Math.floor(s.length/2)]};case"getEtherPrice":return function(i){return bF(i.map(s=>s.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":r=function(i){return i==null?null:(i=Hn(i),i.confirmations=-1,gh(i))};break;case"getBlock":t.includeTransactions?r=function(i){return i==null?null:(i=Hn(i),i.transactions=i.transactions.map(s=>(s=Hn(s),s.confirmations=-1,s)),gh(i))}:r=function(i){return i==null?null:gh(i)};break;default:throw new Error("unknown method: "+e)}return JX(r,n.quorum)}function vp(n,e){return e_(this,void 0,void 0,function*(){const t=n.provider;return t.blockNumber!=null&&t.blockNumber>=e||e===-1?t:mh(()=>new Promise((r,i)=>{setTimeout(function(){return t.blockNumber>=e?r(t):n.cancelled?r(null):r(void 0)},0)}),{oncePoll:t})})}function eY(n,e,t,r){return e_(this,void 0,void 0,function*(){let i=n.provider;switch(t){case"getBlockNumber":case"getGasPrice":return i[t]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return r.blockTag&&It(r.blockTag)&&(i=yield vp(n,e)),i[t](r.address,r.blockTag||"latest");case"getStorageAt":return r.blockTag&&It(r.blockTag)&&(i=yield vp(n,e)),i.getStorageAt(r.address,r.position,r.blockTag||"latest");case"getBlock":return r.blockTag&&It(r.blockTag)&&(i=yield vp(n,e)),i[r.includeTransactions?"getBlockWithTransactions":"getBlock"](r.blockTag||r.blockHash);case"call":case"estimateGas":return r.blockTag&&It(r.blockTag)&&(i=yield vp(n,e)),t==="call"&&r.blockTag?i[t](r.transaction,r.blockTag):i[t](r.transaction);case"getTransaction":case"getTransactionReceipt":return i[t](r.transactionHash);case"getLogs":{let s=r.filter;return(s.fromBlock&&It(s.fromBlock)||s.toBlock&&It(s.toBlock))&&(i=yield vp(n,e)),i.getLogs(s)}}return su.throwError("unknown method error",xe.errors.UNKNOWN_ERROR,{method:t,params:r})})}class tY extends dI{constructor(e,t){e.length===0&&su.throwArgumentError("missing providers","providers",e);const r=e.map((o,a)=>{if(a0.isProvider(o)){const A=aF(o)?2e3:750;return Object.freeze({provider:o,weight:1,stallTimeout:A,priority:1})}const l=Hn(o);l.priority==null&&(l.priority=1),l.stallTimeout==null&&(l.stallTimeout=aF(o)?2e3:750),l.weight==null&&(l.weight=1);const c=l.weight;return(c%1||c>512||c<1)&&su.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${a}].weight`,c),Object.freeze(l)}),i=r.reduce((o,a)=>o+a.weight,0);t==null?t=i/2:t>i&&su.throwArgumentError("quorum will always fail; larger than total weight","quorum",t);let s=xF(r.map(o=>o.provider.network));s==null&&(s=new Promise((o,a)=>{setTimeout(()=>{this.detectNetwork().then(o,a)},0)})),super(s),Ue(this,"providerConfigs",Object.freeze(r)),Ue(this,"quorum",t),this._highestBlockNumber=-1}detectNetwork(){return e_(this,void 0,void 0,function*(){const e=yield Promise.all(this.providerConfigs.map(t=>t.provider.getNetwork()));return xF(e)})}perform(e,t){return e_(this,void 0,void 0,function*(){if(e==="sendTransaction"){const l=yield Promise.all(this.providerConfigs.map(c=>c.provider.sendTransaction(t.signedTransaction).then(A=>A.hash,A=>A)));for(let c=0;cl.priority-c.priority);const s=this._highestBlockNumber;let o=0,a=!0;for(;;){const l=j0();let c=i.filter(h=>h.runner&&l-h.starth+d.weight,0);for(;c{h.staller=null}),h.runner=eY(h,s,e,t).then(m=>{h.done=!0,h.result=m,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:d,backend:W0(h,j0()),request:{method:e,params:Ps(t)},provider:this})},m=>{h.done=!0,h.error=m,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:d,backend:W0(h,j0()),request:{method:e,params:Ps(t)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:d,backend:W0(h,null),request:{method:e,params:Ps(t)},provider:this}),c+=h.weight}const A=[];i.forEach(h=>{h.done||!h.runner||(A.push(h.runner),h.staller&&A.push(h.staller.getPromise()))}),A.length&&(yield Promise.race(A));const u=i.filter(h=>h.done&&h.error==null);if(u.length>=this.quorum){const h=r(u);if(h!==void 0)return i.forEach(d=>{d.staller&&d.staller.cancel(),d.cancelled=!0}),h;a||(yield EF(100).getPromise()),a=!1}const f=i.reduce((h,d)=>{if(!d.done||d.error==null)return h;const m=d.error.code;return $X.indexOf(m)>=0&&(h[m]||(h[m]={error:d.error,weight:0}),h[m].weight+=d.weight),h},{});if(Object.keys(f).forEach(h=>{const d=f[h];if(d.weight{p.staller&&p.staller.cancel(),p.cancelled=!0});const m=d.error,g={};ZX.forEach(p=>{m[p]!=null&&(g[p]=m[p])}),su.throwError(m.reason||m.message,h,g)}),i.filter(h=>!h.done).length===0)break}return i.forEach(l=>{l.staller&&l.staller.cancel(),l.cancelled=!0}),su.throwError("failed to meet quorum",xe.errors.SERVER_ERROR,{method:e,params:t,results:i.map(l=>W0(l)),provider:this})})}}const nY=null,ow=new xe(Ci),dm="84842078b09946638c03157f83405213";class rY extends mI{constructor(e,t){const r=new nQ(e,t),i=r.connection;i.password&&ow.throwError("INFURA WebSocket project secrets unsupported",xe.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const s=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(s,e),Ue(this,"apiKey",r.projectId),Ue(this,"projectId",r.projectId),Ue(this,"projectSecret",r.projectSecret)}isCommunityResource(){return this.projectId===dm}}class nQ extends SA{static getWebSocketProvider(e,t){return new rY(e,t)}static getApiKey(e){const t={apiKey:dm,projectId:dm,projectSecret:null};return e==null||(typeof e=="string"?t.projectId=e:e.projectSecret!=null?(ow.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),ow.assertArgument(typeof e.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),t.projectId=e.projectId,t.projectSecret=e.projectSecret):e.projectId&&(t.projectId=e.projectId),t.apiKey=t.projectId),t}static getUrl(e,t){let r=null;switch(e?e.name:"unknown"){case"homestead":r="mainnet.infura.io";break;case"goerli":r="goerli.infura.io";break;case"sepolia":r="sepolia.infura.io";break;case"matic":r="polygon-mainnet.infura.io";break;case"maticmum":r="polygon-mumbai.infura.io";break;case"optimism":r="optimism-mainnet.infura.io";break;case"optimism-goerli":r="optimism-goerli.infura.io";break;case"arbitrum":r="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":r="arbitrum-goerli.infura.io";break;default:ow.throwError("unsupported network",xe.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+r+"/v3/"+t.projectId,throttleCallback:(s,o)=>(t.projectId===dm&&Qx(),Promise.resolve(!0))};return t.projectSecret!=null&&(i.user="",i.password=t.projectSecret),i}isCommunityResource(){return this.projectId===dm}}const Rb=new xe(Ci),iY="ETHERS_JS_SHARED";class sY extends SA{static getApiKey(e){return e&&typeof e!="string"&&Rb.throwArgumentError("invalid apiKey","apiKey",e),e||iY}static getUrl(e,t){Rb.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let r=null;switch(e.name){case"homestead":r="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":r="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":r="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":r="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":r="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:Rb.throwArgumentError("unsupported network","network",arguments[0])}return r+"?apiKey="+t}}const BF=new xe(Ci),SF="62e1ad51b37b8e00394bda3b";class oY extends SA{static getApiKey(e){const t={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?t.applicationId=SF:typeof e=="string"?t.applicationId=e:e.applicationSecretKey!=null?(t.applicationId=e.applicationId,t.applicationSecretKey=e.applicationSecretKey):e.applicationId?t.applicationId=e.applicationId:BF.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),t}static getUrl(e,t){let r=null;switch(e?e.name:"unknown"){case"goerli":r="eth-goerli.gateway.pokt.network";break;case"homestead":r="eth-mainnet.gateway.pokt.network";break;case"kovan":r="poa-kovan.gateway.pokt.network";break;case"matic":r="poly-mainnet.gateway.pokt.network";break;case"maticmum":r="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":r="eth-rinkeby.gateway.pokt.network";break;case"ropsten":r="eth-ropsten.gateway.pokt.network";break;default:BF.throwError("unsupported network",xe.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i=`https://${r}/v1/lb/${t.applicationId}`,s={headers:{},url:i};return t.applicationSecretKey!=null&&(s.user="",s.password=t.applicationSecretKey),s}isCommunityResource(){return this.applicationId===SF}}const MF=new xe(Ci);let aY=1;function CF(n,e){const t="Web3LegacyFetcher";return function(r,i){const s={method:r,params:i,id:aY++,jsonrpc:"2.0"};return new Promise((o,a)=>{this.emit("debug",{action:"request",fetcher:t,request:Ps(s),provider:this}),e(s,(l,c)=>{if(l)return this.emit("debug",{action:"response",fetcher:t,error:l,request:s,provider:this}),a(l);if(this.emit("debug",{action:"response",fetcher:t,request:s,response:c,provider:this}),c.error){const A=new Error(c.error.message);return A.code=c.error.code,A.data=c.error.data,a(A)}o(c.result)})})}}function lY(n){return function(e,t){t==null&&(t=[]);const r={method:e,params:t};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:Ps(r),provider:this}),n.request(r).then(i=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,response:i,provider:this}),i),i=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,error:i,provider:this}),i})}}class gI extends ug{constructor(e,t){e==null&&MF.throwArgumentError("missing provider","provider",e);let r=null,i=null,s=null;typeof e=="function"?(r="unknown:",i=e):(r=e.host||e.path||"",!r&&e.isMetaMask&&(r="metamask"),s=e,e.request?(r===""&&(r="eip-1193:"),i=lY(e)):e.sendAsync?i=CF(e,e.sendAsync.bind(e)):e.send?i=CF(e,e.send.bind(e)):MF.throwArgumentError("unsupported provider","provider",e),r||(r="unknown:")),super(r,t),Ue(this,"jsonRpcFetchFunc",i),Ue(this,"provider",s)}send(e,t){return this.jsonRpcFetchFunc(e,t)}}const TF=new xe(Ci);function cY(n,e){if(n==null&&(n="homestead"),typeof n=="string"){const r=n.match(/^(ws|http)s?:/i);if(r)switch(r[1].toLowerCase()){case"http":case"https":return new ug(n);case"ws":case"wss":return new mI(n);default:TF.throwArgumentError("unsupported URL scheme","network",n)}}const t=eH(n);return(!t||!t._defaultProvider)&&TF.throwError("unsupported getDefaultProvider network",xe.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:n}),t._defaultProvider({FallbackProvider:tY,AlchemyProvider:tQ,AnkrProvider:GX,CloudflareProvider:jX,EtherscanProvider:KX,InfuraProvider:nQ,JsonRpcProvider:ug,NodesmithProvider:sY,PocketProvider:oY,Web3Provider:gI,IpcProvider:nY},e)}var AY=!0,Ub="Invariant failed";function kl(n,e){if(!n){if(AY)throw new Error(Ub);var t=typeof e=="function"?e():e,r=t?"".concat(Ub,": ").concat(t):Ub;throw new Error(r)}}var Yo;(function(n){n.Update="Web3ReactUpdate",n.Error="Web3ReactError",n.Deactivate="Web3ReactDeactivate"})(Yo||(Yo={}));function fg(){return fg=Object.assign||function(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function aw(n,e,t){return uY()?aw=Reflect.construct:aw=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),c=new l;return o&&hg(c,o.prototype),c},aw.apply(null,arguments)}function fY(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function t_(n){var e=typeof Map=="function"?new Map:void 0;return t_=function(r){if(r===null||!fY(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return aw(r,arguments,DS(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),hg(i,r)},t_(n)}typeof Symbol<"u"&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")));typeof Symbol<"u"&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));function IF(n,e){try{var t=n()}catch(r){return e(r)}return t&&t.then?t.then(void 0,e):t}function iQ(n){if(typeof n=="string"){n=n.replace(/^Ox/,"0x");var e=Number.parseInt(n,n.trim().substring(0,2)==="0x"?16:10);return Number.isNaN(e)&&kl(!1),e}else return Number.isInteger(n)||kl(!1),n}function sQ(n){typeof n=="string"&&n.match(/^(0x)?[0-9a-fA-F]{40}$/)||kl(!1);for(var e=n.substring(0,2)==="0x"?n:"0x"+n,t=e.toLowerCase().substring(2).split(""),r=new Uint8Array(40),i=0;i<40;i++)r[i]=t[i].charCodeAt(0);for(var s=pt(Er(r)),o=0;o<40;o+=2)s[o>>1]>>4>=8&&(t[o]=t[o].toUpperCase()),(s[o>>1]&15)>=8&&(t[o+1]=t[o+1].toUpperCase());var a="0x"+t.join("");return e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==a&&kl(!1),a}var RF=function(e,t){try{var r=function(o){return Promise.resolve(Promise.all([t.chainId===void 0?e.getChainId():t.chainId,t.account===void 0?e.getAccount():t.account])).then(function(a){var l=a[0],c=a[1],A=iQ(l);if(e.supportedChainIds&&!e.supportedChainIds.includes(A))throw new oQ(A,e.supportedChainIds);var u=c===null?c:sQ(c);return{provider:o,chainId:A,account:u}})},i=t.provider===void 0;return Promise.resolve(i?Promise.resolve(e.getProvider()).then(r):r(t.provider))}catch(s){return Promise.reject(s)}},K0=function(n){rQ(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t}return e}(t_(Error)),oQ=function(n){rQ(e,n);function e(t,r){var i;return i=n.call(this)||this,i.name=i.constructor.name,i.message="Unsupported chain id: "+t+". Supported chain ids are: "+r+".",i}return e}(t_(Error)),zr;(function(n){n[n.ACTIVATE_CONNECTOR=0]="ACTIVATE_CONNECTOR",n[n.UPDATE=1]="UPDATE",n[n.UPDATE_FROM_ERROR=2]="UPDATE_FROM_ERROR",n[n.ERROR=3]="ERROR",n[n.ERROR_FROM_ACTIVATION=4]="ERROR_FROM_ACTIVATION",n[n.DEACTIVATE_CONNECTOR=5]="DEACTIVATE_CONNECTOR"})(zr||(zr={}));function hY(n,e){var t=e.type,r=e.payload;switch(t){case zr.ACTIVATE_CONNECTOR:{var i=r.connector,s=r.provider,o=r.chainId,a=r.account,l=r.onError;return{connector:i,provider:s,chainId:o,account:a,onError:l}}case zr.UPDATE:{var c=r.provider,A=r.chainId,u=r.account;return fg({},n,c===void 0?{}:{provider:c},A===void 0?{}:{chainId:A},u===void 0?{}:{account:u})}case zr.UPDATE_FROM_ERROR:{var f=r.provider,h=r.chainId,d=r.account;return fg({},n,f===void 0?{}:{provider:f},h===void 0?{}:{chainId:h},d===void 0?{}:{account:d},{error:void 0})}case zr.ERROR:{var m=r.error,g=n.connector,p=n.onError;return{connector:g,error:m,onError:p}}case zr.ERROR_FROM_ACTIVATION:{var v=r.connector,w=r.error;return{connector:v,error:w}}case zr.DEACTIVATE_CONNECTOR:return{}}}function dY(){var n=be.useReducer(hY,{}),e=n[0],t=n[1],r=e.connector,i=e.provider,s=e.chainId,o=e.account,a=e.onError,l=e.error,c=be.useRef(-1);c.current+=1;var A=be.useCallback(function(g,p,v){v===void 0&&(v=!1);try{var w=c.current,_=!1;return Promise.resolve(IF(function(){return Promise.resolve(g.activate().then(function(x){return _=!0,x})).then(function(x){return Promise.resolve(RF(g,x)).then(function(b){if(c.current>w)throw new K0;t({type:zr.ACTIVATE_CONNECTOR,payload:fg({connector:g},b,{onError:p})})})})},function(x){if(x instanceof K0)_&&g.deactivate();else{if(v)throw _&&g.deactivate(),x;p?(_&&g.deactivate(),p(x)):t({type:zr.ERROR_FROM_ACTIVATION,payload:{connector:g,error:x}})}}))}catch(x){return Promise.reject(x)}},[]),u=be.useCallback(function(g){t({type:zr.ERROR,payload:{error:g}})},[]),f=be.useCallback(function(){t({type:zr.DEACTIVATE_CONNECTOR})},[]),h=be.useCallback(function(g){try{if(!r)throw Error("This should never happen, it's just so Typescript stops complaining");var p=c.current;return Promise.resolve(function(){if(l)return IF(function(){return Promise.resolve(RF(r,g)).then(function(x){if(c.current>p)throw new K0;t({type:zr.UPDATE_FROM_ERROR,payload:x})})},function(x){x instanceof K0||(a?a(x):t({type:zr.ERROR,payload:{error:x}}))});var v=g.chainId===void 0?void 0:iQ(g.chainId);if(v!==void 0&&r.supportedChainIds&&!r.supportedChainIds.includes(v)){var w=new oQ(v,r.supportedChainIds);a?a(w):t({type:zr.ERROR,payload:{error:w}})}else{var _=typeof g.account=="string"?sQ(g.account):g.account;t({type:zr.UPDATE,payload:{provider:g.provider,chainId:v,account:_}})}}())}catch(v){return Promise.reject(v)}},[r,l,a]),d=be.useCallback(function(g){a?a(g):t({type:zr.ERROR,payload:{error:g}})},[a]),m=be.useCallback(function(){t({type:zr.DEACTIVATE_CONNECTOR})},[]);return be.useEffect(function(){return function(){r&&r.deactivate()}},[r]),be.useEffect(function(){return r&&r.on(Yo.Update,h).on(Yo.Error,d).on(Yo.Deactivate,m),function(){r&&r.off(Yo.Update,h).off(Yo.Error,d).off(Yo.Deactivate,m)}},[r,h,d,m]),{connector:r,provider:i,chainId:s,account:o,activate:A,setError:u,deactivate:f,error:l}}var aQ="primary",vh={};function pY(n){vh[n]&&kl(!1),vh[n]=be.createContext({activate:function(){try{return kl(!1),Promise.resolve()}catch(t){return Promise.reject(t)}},setError:function(){kl(!1)},deactivate:function(){kl(!1)},active:!1}),vh[n].displayName="Web3ReactContext - "+n;var e=vh[n].Provider;return function(r){var i=r.getLibrary,s=r.children,o=dY(),a=o.connector,l=o.provider,c=o.chainId,A=o.account,u=o.activate,f=o.setError,h=o.deactivate,d=o.error,m=a!==void 0&&c!==void 0&&A!==void 0&&!d,g=be.useMemo(function(){return m&&c!==void 0&&Number.isInteger(c)&&a?i(l,a):void 0},[m,i,l,a,c]),p={connector:a,library:g,chainId:c,account:A,activate:u,setError:f,deactivate:h,active:m,error:d};return J.createElement(e,{value:p},s)}}var mY=pY(aQ);function gY(n){return n===void 0&&(n=aQ),Object.keys(vh).includes(n)||kl(!1),vh[n]}function vY(n){return be.useContext(gY(n))}var NS={},lQ={exports:{}},js={},cQ={exports:{}},AQ={};/** + */(function(n){(function(){var e="input is invalid type",t="finalize already called",r=typeof window=="object",i=r?window:{};i.JS_SHA3_NO_WINDOW&&(r=!1);var s=!r&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=ka:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&n.exports,l=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",c="0123456789abcdef".split(""),A=[31,7936,2031616,520093696],u=[4,1024,262144,67108864],f=[1,256,65536,16777216],h=[6,1536,393216,100663296],d=[0,8,16,24],m=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],g=[224,256,384,512],p=[128,256],v=["hex","buffer","arrayBuffer","array","digest"],w={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(P){return Object.prototype.toString.call(P)==="[object Array]"}),l&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(P){return typeof P=="object"&&P.buffer&&P.buffer.constructor===ArrayBuffer});for(var _=function(P,re,ue){return function(le){return new C(P,re,P).update(le)[ue]()}},x=function(P,re,ue){return function(le,me){return new C(P,re,me).update(le)[ue]()}},b=function(P,re,ue){return function(le,me,ie,ge){return y["cshake"+P].update(le,me,ie,ge)[ue]()}},B=function(P,re,ue){return function(le,me,ie,ge){return y["kmac"+P].update(le,me,ie,ge)[ue]()}},S=function(P,re,ue,le){for(var me=0;me>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ue>>5,this.extraBytes=(ue&31)>>3;for(var le=0;le<50;++le)this.s[le]=0}C.prototype.update=function(P){if(this.finalized)throw new Error(t);var re,ue=typeof P;if(ue!=="string"){if(ue==="object"){if(P===null)throw new Error(e);if(l&&P.constructor===ArrayBuffer)P=new Uint8Array(P);else if(!Array.isArray(P)&&(!l||!ArrayBuffer.isView(P)))throw new Error(e)}else throw new Error(e);re=!0}for(var le=this.blocks,me=this.byteCount,ie=P.length,ge=this.blockCount,_e=0,se=this.s,H,fe;_e>2]|=P[_e]<>2]|=fe<>2]|=(192|fe>>6)<>2]|=(128|fe&63)<=57344?(le[H>>2]|=(224|fe>>12)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<>2]|=(240|fe>>18)<>2]|=(128|fe>>12&63)<>2]|=(128|fe>>6&63)<>2]|=(128|fe&63)<=me){for(this.start=H-me,this.block=le[ge],H=0;H>8,ue=P&255;ue>0;)me.unshift(ue),P=P>>8,ue=P&255,++le;return re?me.push(le):me.unshift(le),this.update(me),me.length},C.prototype.encodeString=function(P){var re,ue=typeof P;if(ue!=="string"){if(ue==="object"){if(P===null)throw new Error(e);if(l&&P.constructor===ArrayBuffer)P=new Uint8Array(P);else if(!Array.isArray(P)&&(!l||!ArrayBuffer.isView(P)))throw new Error(e)}else throw new Error(e);re=!0}var le=0,me=P.length;if(re)le=me;else for(var ie=0;ie=57344?le+=3:(ge=65536+((ge&1023)<<10|P.charCodeAt(++ie)&1023),le+=4)}return le+=this.encode(le*8),this.update(P),le},C.prototype.bytepad=function(P,re){for(var ue=this.encode(re),le=0;le>2]|=this.padding[re&3],this.lastByteIndex===this.byteCount)for(P[0]=P[ue],re=1;re>4&15]+c[_e&15]+c[_e>>12&15]+c[_e>>8&15]+c[_e>>20&15]+c[_e>>16&15]+c[_e>>28&15]+c[_e>>24&15];ie%P===0&&(ee(re),me=0)}return le&&(_e=re[me],ge+=c[_e>>4&15]+c[_e&15],le>1&&(ge+=c[_e>>12&15]+c[_e>>8&15]),le>2&&(ge+=c[_e>>20&15]+c[_e>>16&15])),ge},C.prototype.arrayBuffer=function(){this.finalize();var P=this.blockCount,re=this.s,ue=this.outputBlocks,le=this.extraBytes,me=0,ie=0,ge=this.outputBits>>3,_e;le?_e=new ArrayBuffer(ue+1<<2):_e=new ArrayBuffer(ge);for(var se=new Uint32Array(_e);ie>8&255,ge[_e+2]=se>>16&255,ge[_e+3]=se>>24&255;ie%P===0&&ee(re)}return le&&(_e=ie<<2,se=re[me],ge[_e]=se&255,le>1&&(ge[_e+1]=se>>8&255),le>2&&(ge[_e+2]=se>>16&255)),ge};function W(P,re,ue){C.call(this,P,re,ue)}W.prototype=new C,W.prototype.finalize=function(){return this.encode(this.outputBits,!0),C.prototype.finalize.call(this)};var ee=function(P){var re,ue,le,me,ie,ge,_e,se,H,fe,Ae,J,q,he,X,G,ne,Y,de,ae,Ee,V,U,N,K,oe,pe,ve,Ce,Le,Re,$e,ce,Pe,Se,Te,Fe,De,Ze,At,Pn,rt,xt,Tr,tn,qt,Jr,en,nn,Ks,Xt,Yt,Ii,rn,sn,ma,un,on,te,ye,Be,Me,we;for(le=0;le<48;le+=2)me=P[0]^P[10]^P[20]^P[30]^P[40],ie=P[1]^P[11]^P[21]^P[31]^P[41],ge=P[2]^P[12]^P[22]^P[32]^P[42],_e=P[3]^P[13]^P[23]^P[33]^P[43],se=P[4]^P[14]^P[24]^P[34]^P[44],H=P[5]^P[15]^P[25]^P[35]^P[45],fe=P[6]^P[16]^P[26]^P[36]^P[46],Ae=P[7]^P[17]^P[27]^P[37]^P[47],J=P[8]^P[18]^P[28]^P[38]^P[48],q=P[9]^P[19]^P[29]^P[39]^P[49],re=J^(ge<<1|_e>>>31),ue=q^(_e<<1|ge>>>31),P[0]^=re,P[1]^=ue,P[10]^=re,P[11]^=ue,P[20]^=re,P[21]^=ue,P[30]^=re,P[31]^=ue,P[40]^=re,P[41]^=ue,re=me^(se<<1|H>>>31),ue=ie^(H<<1|se>>>31),P[2]^=re,P[3]^=ue,P[12]^=re,P[13]^=ue,P[22]^=re,P[23]^=ue,P[32]^=re,P[33]^=ue,P[42]^=re,P[43]^=ue,re=ge^(fe<<1|Ae>>>31),ue=_e^(Ae<<1|fe>>>31),P[4]^=re,P[5]^=ue,P[14]^=re,P[15]^=ue,P[24]^=re,P[25]^=ue,P[34]^=re,P[35]^=ue,P[44]^=re,P[45]^=ue,re=se^(J<<1|q>>>31),ue=H^(q<<1|J>>>31),P[6]^=re,P[7]^=ue,P[16]^=re,P[17]^=ue,P[26]^=re,P[27]^=ue,P[36]^=re,P[37]^=ue,P[46]^=re,P[47]^=ue,re=fe^(me<<1|ie>>>31),ue=Ae^(ie<<1|me>>>31),P[8]^=re,P[9]^=ue,P[18]^=re,P[19]^=ue,P[28]^=re,P[29]^=ue,P[38]^=re,P[39]^=ue,P[48]^=re,P[49]^=ue,he=P[0],X=P[1],qt=P[11]<<4|P[10]>>>28,Jr=P[10]<<4|P[11]>>>28,ve=P[20]<<3|P[21]>>>29,Ce=P[21]<<3|P[20]>>>29,ye=P[31]<<9|P[30]>>>23,Be=P[30]<<9|P[31]>>>23,rt=P[40]<<18|P[41]>>>14,xt=P[41]<<18|P[40]>>>14,Pe=P[2]<<1|P[3]>>>31,Se=P[3]<<1|P[2]>>>31,G=P[13]<<12|P[12]>>>20,ne=P[12]<<12|P[13]>>>20,en=P[22]<<10|P[23]>>>22,nn=P[23]<<10|P[22]>>>22,Le=P[33]<<13|P[32]>>>19,Re=P[32]<<13|P[33]>>>19,Me=P[42]<<2|P[43]>>>30,we=P[43]<<2|P[42]>>>30,rn=P[5]<<30|P[4]>>>2,sn=P[4]<<30|P[5]>>>2,Te=P[14]<<6|P[15]>>>26,Fe=P[15]<<6|P[14]>>>26,Y=P[25]<<11|P[24]>>>21,de=P[24]<<11|P[25]>>>21,Ks=P[34]<<15|P[35]>>>17,Xt=P[35]<<15|P[34]>>>17,$e=P[45]<<29|P[44]>>>3,ce=P[44]<<29|P[45]>>>3,N=P[6]<<28|P[7]>>>4,K=P[7]<<28|P[6]>>>4,ma=P[17]<<23|P[16]>>>9,un=P[16]<<23|P[17]>>>9,De=P[26]<<25|P[27]>>>7,Ze=P[27]<<25|P[26]>>>7,ae=P[36]<<21|P[37]>>>11,Ee=P[37]<<21|P[36]>>>11,Yt=P[47]<<24|P[46]>>>8,Ii=P[46]<<24|P[47]>>>8,Tr=P[8]<<27|P[9]>>>5,tn=P[9]<<27|P[8]>>>5,oe=P[18]<<20|P[19]>>>12,pe=P[19]<<20|P[18]>>>12,on=P[29]<<7|P[28]>>>25,te=P[28]<<7|P[29]>>>25,At=P[38]<<8|P[39]>>>24,Pn=P[39]<<8|P[38]>>>24,V=P[48]<<14|P[49]>>>18,U=P[49]<<14|P[48]>>>18,P[0]=he^~G&Y,P[1]=X^~ne&de,P[10]=N^~oe&ve,P[11]=K^~pe&Ce,P[20]=Pe^~Te&De,P[21]=Se^~Fe&Ze,P[30]=Tr^~qt&en,P[31]=tn^~Jr&nn,P[40]=rn^~ma&on,P[41]=sn^~un&te,P[2]=G^~Y&ae,P[3]=ne^~de&Ee,P[12]=oe^~ve&Le,P[13]=pe^~Ce&Re,P[22]=Te^~De&At,P[23]=Fe^~Ze&Pn,P[32]=qt^~en&Ks,P[33]=Jr^~nn&Xt,P[42]=ma^~on&ye,P[43]=un^~te&Be,P[4]=Y^~ae&V,P[5]=de^~Ee&U,P[14]=ve^~Le&$e,P[15]=Ce^~Re&ce,P[24]=De^~At&rt,P[25]=Ze^~Pn&xt,P[34]=en^~Ks&Yt,P[35]=nn^~Xt&Ii,P[44]=on^~ye&Me,P[45]=te^~Be&we,P[6]=ae^~V&he,P[7]=Ee^~U&X,P[16]=Le^~$e&N,P[17]=Re^~ce&K,P[26]=At^~rt&Pe,P[27]=Pn^~xt&Se,P[36]=Ks^~Yt&Tr,P[37]=Xt^~Ii&tn,P[46]=ye^~Me&rn,P[47]=Be^~we&sn,P[8]=V^~he&G,P[9]=U^~X&ne,P[18]=$e^~N&oe,P[19]=ce^~K&pe,P[28]=rt^~Pe&Te,P[29]=xt^~Se&Fe,P[38]=Yt^~Tr&qt,P[39]=Ii^~tn&Jr,P[48]=Me^~rn&ma,P[49]=we^~sn&un,P[0]^=m[le],P[1]^=m[le+1]};if(a)n.exports=y;else for(R=0;R>6===2;o++)s++;return s}return n===bs.OVERRUN?t.length-e-1:0}function I9(n,e,t,r,i){return n===bs.OVERLONG?(r.push(i),0):(r.push(65533),lQ(n,e,t))}const R9=Object.freeze({error:T9,ignore:lQ,replace:I9});function cQ(n,e){e==null&&(e=R9.error),n=pt(n);const t=[];let r=0;for(;r>7)){t.push(i);continue}let s=null,o=null;if((i&224)===192)s=1,o=127;else if((i&240)===224)s=2,o=2047;else if((i&248)===240)s=3,o=65535;else{(i&192)===128?r+=e(bs.UNEXPECTED_CONTINUE,r-1,n,t):r+=e(bs.BAD_PREFIX,r-1,n,t);continue}if(r-1+s>=n.length){r+=e(bs.OVERRUN,r-1,n,t);continue}let a=i&(1<<8-s-1)-1;for(let l=0;l1114111){r+=e(bs.OUT_OF_RANGE,r-1-s,n,t,a);continue}if(a>=55296&&a<=57343){r+=e(bs.UTF16_SURROGATE,r-1-s,n,t,a);continue}if(a<=o){r+=e(bs.OVERLONG,r-1-s,n,t,a);continue}t.push(a)}}return t}function $a(n,e=Ag.current){e!=Ag.current&&(aQ.checkNormalize(),n=n.normalize(e));let t=[];for(let r=0;r>6|192),t.push(i&63|128);else if((i&64512)==55296){r++;const s=n.charCodeAt(r);if(r>=n.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);t.push(o>>18|240),t.push(o>>12&63|128),t.push(o>>6&63|128),t.push(o&63|128)}else t.push(i>>12|224),t.push(i>>6&63|128),t.push(i&63|128)}return pt(t)}function U9(n){return n.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function c0(n,e){return U9(cQ(n,e))}function F9(n,e=Ag.current){return cQ($a(n,e))}function mh(n){return Er($a(n))}const AQ="hash/5.7.0";function uQ(n,e){e==null&&(e=1);const t=[],r=t.forEach,i=function(s,o){r.call(s,function(a){o>0&&Array.isArray(a)?i(a,o-1):t.push(a)})};return i(n,e),t}function P9(n){const e={};for(let t=0;t>--l&1}const u=31,f=Math.pow(2,u),h=f>>>1,d=h>>1,m=f-1;let g=0;for(let x=0;x1;){let M=b+B>>>1;x>>1|A(),S=S<<1^h,I=(I^h)<<1|h|1;v=S,w=1+I-S}let _=r-4;return p.map(x=>{switch(x-_){case 3:return _+65792+(n[a++]<<16|n[a++]<<8|n[a++]);case 2:return _+256+(n[a++]<<8|n[a++]);case 1:return _+n[a++];default:return x-1}})}function D9(n){let e=0;return()=>n[e++]}function N9(n){return D9(L9(n))}function O9(n){return n&1?~n>>1:n>>1}function k9(n,e){let t=Array(n);for(let r=0;re[o]):t}function H9(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(G9(t,n))}for(;;){let t=n()-1;if(t<0)break;e.push(V9(t,n))}return P9(uQ(e))}function z9(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(t)}return e}function fQ(n,e,t){let r=Array(n).fill(void 0).map(()=>[]);for(let i=0;ir[o].push(s));return r}function G9(n,e){let t=1+e(),r=e(),i=z9(e),s=fQ(i.length,1+n,e);return uQ(s.map((o,a)=>{const l=o[0],c=o.slice(1);return Array(i[a]).fill(void 0).map((A,u)=>{let f=u*r;return[l+u*t,c.map(h=>h+f)]})}))}function V9(n,e){let t=1+e();return fQ(t,1+n,e).map(i=>[i[0],i.slice(1)])}function j9(n){let e=Zw(n).sort((r,i)=>r-i);return t();function t(){let r=[];for(;;){let c=Zw(n,e);if(c.length==0)break;r.push({set:new Set(c),node:t()})}r.sort((c,A)=>A.set.size-c.set.size);let i=n(),s=i%3;i=i/3|0;let o=!!(i&1);i>>=1;let a=i==1,l=i==2;return{branches:r,valid:s,fe0f:o,save:a,check:l}}}function W9(){return N9(nQ("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const Lx=W9(),K9=new Set(Zw(Lx)),X9=new Set(Zw(Lx)),Y9=H9(Lx),$9=j9(Lx),HU=45,zU=95;function hQ(n){return F9(n)}function Z9(n){return n.filter(e=>e!=65039)}function dQ(n){for(let e of n.split(".")){let t=hQ(e);try{for(let r=t.lastIndexOf(zU)-1;r>=0;r--)if(t[r]!==zU)throw new Error("underscore only allowed at start");if(t.length>=4&&t.every(r=>r<128)&&t[2]===HU&&t[3]===HU)throw new Error("invalid label extension")}catch(r){throw new Error(`Invalid label "${e}": ${r.message}`)}}return n}function J9(n){return dQ(q9(n,Z9))}function q9(n,e){let t=hQ(n).reverse(),r=[];for(;t.length;){let i=tK(t);if(i){r.push(...e(i));continue}let s=t.pop();if(K9.has(s)){r.push(s);continue}if(X9.has(s))continue;let o=Y9[s];if(o){r.push(...o);continue}throw new Error(`Disallowed codepoint: 0x${s.toString(16).toUpperCase()}`)}return dQ(eK(String.fromCodePoint(...r)))}function eK(n){return n.normalize("NFC")}function tK(n,e){var t;let r=$9,i,s,o=[],a=n.length;for(e&&(e.length=0);a;){let l=n[--a];if(r=(t=r.branches.find(c=>c.set.has(l)))===null||t===void 0?void 0:t.node,!r)break;if(r.save)s=l;else if(r.check&&l===s)break;o.push(l),r.fe0f&&(o.push(65039),a>0&&n[a-1]==65039&&a--),r.valid&&(i=o.slice(),r.valid==2&&i.splice(1,1),e&&e.push(...n.slice(a).reverse()),n.length=a)}return i}const nK=new xe(AQ),pQ=new Uint8Array(32);pQ.fill(0);function GU(n){if(n.length===0)throw new Error("invalid ENS name; empty component");return n}function mQ(n){const e=$a(J9(n)),t=[];if(n.length===0)return t;let r=0;for(let i=0;i=e.length)throw new Error("invalid ENS name; empty component");return t.push(GU(e.slice(r))),t}function nw(n){typeof n!="string"&&nK.throwArgumentError("invalid ENS name; not a string","name",n);let e=pQ;const t=mQ(n);for(;t.length;)e=Er(Ss([e,Er(t.pop())]));return lt(e)}function rK(n){return lt(Ss(mQ(n).map(e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t})))+"00"}const iK="rlp/5.7.0",Ca=new xe(iK);function VU(n){const e=[];for(;n;)e.unshift(n&255),n>>=8;return e}function jU(n,e,t){let r=0;for(let i=0;ie+1+r&&Ca.throwError("child data too short",xe.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function vQ(n,e){if(n.length===0&&Ca.throwError("data too short",xe.errors.BUFFER_OVERRUN,{}),n[e]>=248){const t=n[e]-247;e+1+t>n.length&&Ca.throwError("data short segment too short",xe.errors.BUFFER_OVERRUN,{});const r=jU(n,e+1,t);return e+1+t+r>n.length&&Ca.throwError("data long segment too short",xe.errors.BUFFER_OVERRUN,{}),WU(n,e,e+1+t,t+r)}else if(n[e]>=192){const t=n[e]-192;return e+1+t>n.length&&Ca.throwError("data array too short",xe.errors.BUFFER_OVERRUN,{}),WU(n,e,e+1,t)}else if(n[e]>=184){const t=n[e]-183;e+1+t>n.length&&Ca.throwError("data array too short",xe.errors.BUFFER_OVERRUN,{});const r=jU(n,e+1,t);e+1+t+r>n.length&&Ca.throwError("data array too short",xe.errors.BUFFER_OVERRUN,{});const i=lt(n.slice(e+1+t,e+1+t+r));return{consumed:1+t+r,result:i}}else if(n[e]>=128){const t=n[e]-128;e+1+t>n.length&&Ca.throwError("data too short",xe.errors.BUFFER_OVERRUN,{});const r=lt(n.slice(e+1,e+1+t));return{consumed:1+t,result:r}}return{consumed:1,result:lt(n[e])}}function AI(n){const e=pt(n),t=vQ(e,0);return t.consumed!==e.length&&Ca.throwArgumentError("invalid rlp data","data",n),t.result}const sK="address/5.7.0",gh=new xe(sK);function KU(n){It(n,20)||gh.throwArgumentError("invalid address","address",n),n=n.toLowerCase();const e=n.substring(2).split(""),t=new Uint8Array(40);for(let i=0;i<40;i++)t[i]=e[i].charCodeAt(0);const r=pt(Er(t));for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(r[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const oK=9007199254740991;function aK(n){return Math.log10?Math.log10(n):Math.log(n)/Math.LN10}const uI={};for(let n=0;n<10;n++)uI[String(n)]=String(n);for(let n=0;n<26;n++)uI[String.fromCharCode(65+n)]=String(10+n);const XU=Math.floor(aK(oK));function lK(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let e=n.split("").map(r=>uI[r]).join("");for(;e.length>=XU;){let r=e.substring(0,XU);e=parseInt(r,10)%97+e.substring(r.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}function ai(n){let e=null;if(typeof n!="string"&&gh.throwArgumentError("invalid address","address",n),n.match(/^(0x)?[0-9a-fA-F]{40}$/))n.substring(0,2)!=="0x"&&(n="0x"+n),e=KU(n),n.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==n&&gh.throwArgumentError("bad address checksum","address",n);else if(n.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(n.substring(2,4)!==lK(n)&&gh.throwArgumentError("bad icap checksum","address",n),e=c9(n.substring(4));e.length<40;)e="0"+e;e=KU("0x"+e)}else gh.throwArgumentError("invalid address","address",n);return e}function yQ(n){let e=null;try{e=ai(n.from)}catch{gh.throwArgumentError("missing from address","transaction",n)}const t=hd(pt(je.from(n.nonce).toHexString()));return ai(mi(Er(Dx([e,t])),12))}var cK=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const Gn=new xe(AQ),wQ=new Uint8Array(32);wQ.fill(0);const AK=je.from(-1),_Q=je.from(0),xQ=je.from(1),uK=je.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function fK(n){const e=pt(n),t=e.length%32;return t?$i([e,wQ.slice(t)]):lt(e)}const hK=ir(xQ.toHexString(),32),dK=ir(_Q.toHexString(),32),YU={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},vb=["name","version","chainId","verifyingContract","salt"];function $U(n){return function(e){return typeof e!="string"&&Gn.throwArgumentError(`invalid domain value for ${JSON.stringify(n)}`,`domain.${n}`,e),e}}const pK={name:$U("name"),version:$U("version"),chainId:function(n){try{return je.from(n).toString()}catch{}return Gn.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",n)},verifyingContract:function(n){try{return ai(n).toLowerCase()}catch{}return Gn.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",n)},salt:function(n){try{const e=pt(n);if(e.length!==32)throw new Error("bad length");return lt(e)}catch{}return Gn.throwArgumentError('invalid domain value "salt"',"domain.salt",n)}};function yb(n){{const e=n.match(/^(u?)int(\d*)$/);if(e){const t=e[1]==="",r=parseInt(e[2]||"256");(r%8!==0||r>256||e[2]&&e[2]!==String(r))&&Gn.throwArgumentError("invalid numeric width","type",n);const i=uK.mask(t?r-1:r),s=t?i.add(xQ).mul(AK):_Q;return function(o){const a=je.from(o);return(a.lt(s)||a.gt(i))&&Gn.throwArgumentError(`value out-of-bounds for ${n}`,"value",o),ir(a.toTwos(256).toHexString(),32)}}}{const e=n.match(/^bytes(\d+)$/);if(e){const t=parseInt(e[1]);return(t===0||t>32||e[1]!==String(t))&&Gn.throwArgumentError("invalid bytes width","type",n),function(r){return pt(r).length!==t&&Gn.throwArgumentError(`invalid length for ${n}`,"value",r),fK(r)}}}switch(n){case"address":return function(e){return ir(ai(e),32)};case"bool":return function(e){return e?hK:dK};case"bytes":return function(e){return Er(e)};case"string":return function(e){return mh(e)}}return null}function ZU(n,e){return`${n}(${e.map(({name:t,type:r})=>r+" "+t).join(",")})`}class ws{constructor(e){Ue(this,"types",Object.freeze(Ps(e))),Ue(this,"_encoderCache",{}),Ue(this,"_types",{});const t={},r={},i={};Object.keys(e).forEach(a=>{t[a]={},r[a]=[],i[a]={}});for(const a in e){const l={};e[a].forEach(c=>{l[c.name]&&Gn.throwArgumentError(`duplicate variable name ${JSON.stringify(c.name)} in ${JSON.stringify(a)}`,"types",e),l[c.name]=!0;const A=c.type.match(/^([^\x5b]*)(\x5b|$)/)[1];A===a&&Gn.throwArgumentError(`circular type reference to ${JSON.stringify(A)}`,"types",e),!yb(A)&&(r[A]||Gn.throwArgumentError(`unknown type ${JSON.stringify(A)}`,"types",e),r[A].push(a),t[a][A]=!0)})}const s=Object.keys(r).filter(a=>r[a].length===0);s.length===0?Gn.throwArgumentError("missing primary type","types",e):s.length>1&&Gn.throwArgumentError(`ambiguous primary types or unused types: ${s.map(a=>JSON.stringify(a)).join(", ")}`,"types",e),Ue(this,"primaryType",s[0]);function o(a,l){l[a]&&Gn.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",e),l[a]=!0,Object.keys(t[a]).forEach(c=>{r[c]&&(o(c,l),Object.keys(l).forEach(A=>{i[A][c]=!0}))}),delete l[a]}o(this.primaryType,{});for(const a in i){const l=Object.keys(i[a]);l.sort(),this._types[a]=ZU(a,e[a])+l.map(c=>ZU(c,e[c])).join("")}}getEncoder(e){let t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}_getEncoder(e){{const i=yb(e);if(i)return i}const t=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(t){const i=t[1],s=this.getEncoder(i),o=parseInt(t[3]);return a=>{o>=0&&a.length!==o&&Gn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",a);let l=a.map(s);return this._types[i]&&(l=l.map(Er)),Er($i(l))}}const r=this.types[e];if(r){const i=mh(this._types[e]);return s=>{const o=r.map(({name:a,type:l})=>{const c=this.getEncoder(l)(s[a]);return this._types[l]?Er(c):c});return o.unshift(i),$i(o)}}return Gn.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||Gn.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return Er(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,r){if(yb(e))return r(e,t);const i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const o=i[1],a=parseInt(i[3]);return a>=0&&t.length!==a&&Gn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map(l=>this._visit(o,l,r))}const s=this.types[e];return s?s.reduce((o,{name:a,type:l})=>(o[a]=this._visit(l,t[a],r),o),{}):Gn.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new ws(e)}static getPrimaryType(e){return ws.from(e).primaryType}static hashStruct(e,t,r){return ws.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){const i=YU[r];i||Gn.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:i})}return t.sort((r,i)=>vb.indexOf(r.name)-vb.indexOf(i.name)),ws.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return $i(["0x1901",ws.hashDomain(e),ws.from(t).hash(r)])}static hash(e,t,r){return Er(ws.encode(e,t,r))}static resolveNames(e,t,r,i){return cK(this,void 0,void 0,function*(){e=Qn(e);const s={};e.verifyingContract&&!It(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const o=ws.from(t);o.visit(r,(a,l)=>(a==="address"&&!It(l,20)&&(s[l]="0x"),l));for(const a in s)s[a]=yield i(a);return e.verifyingContract&&s[e.verifyingContract]&&(e.verifyingContract=s[e.verifyingContract]),r=o.visit(r,(a,l)=>a==="address"&&s[l]?s[l]:l),{domain:e,value:r}})}static getPayload(e,t,r){ws.hashDomain(e);const i={},s=[];vb.forEach(l=>{const c=e[l];c!=null&&(i[l]=pK[l](c),s.push({name:l,type:YU[l]}))});const o=ws.from(t),a=Qn(t);return a.EIP712Domain?Gn.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):a.EIP712Domain=s,o.encode(r),{types:a,domain:i,primaryType:o.primaryType,message:o.visit(r,(l,c)=>{if(l.match(/^bytes(\d*)/))return lt(pt(c));if(l.match(/^u?int/))return je.from(c).toString();switch(l){case"address":return c.toLowerCase();case"bool":return!!c;case"string":return typeof c!="string"&&Gn.throwArgumentError("invalid string","value",c),c}return Gn.throwArgumentError("unsupported type","type",l)})}}}var bQ={},kt={},A0=EQ;function EQ(n,e){if(!n)throw new Error(e||"Assertion failed")}EQ.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var RM={exports:{}};typeof Object.create=="function"?RM.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:RM.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}};var mK=RM.exports,gK=A0,vK=mK;kt.inherits=vK;function yK(n,e){return(n.charCodeAt(e)&64512)!==55296||e<0||e+1>=n.length?!1:(n.charCodeAt(e+1)&64512)===56320}function wK(n,e){if(Array.isArray(n))return n.slice();if(!n)return[];var t=[];if(typeof n=="string")if(e){if(e==="hex")for(n=n.replace(/[^a-z0-9]+/ig,""),n.length%2!==0&&(n="0"+n),i=0;i>6|192,t[r++]=s&63|128):yK(n,i)?(s=65536+((s&1023)<<10)+(n.charCodeAt(++i)&1023),t[r++]=s>>18|240,t[r++]=s>>12&63|128,t[r++]=s>>6&63|128,t[r++]=s&63|128):(t[r++]=s>>12|224,t[r++]=s>>6&63|128,t[r++]=s&63|128)}else for(i=0;i>>24|n>>>8&65280|n<<8&16711680|(n&255)<<24;return e>>>0}kt.htonl=BQ;function xK(n,e){for(var t="",r=0;r>>0}return s}kt.join32=bK;function EK(n,e){for(var t=new Array(n.length*4),r=0,i=0;r>>24,t[i+1]=s>>>16&255,t[i+2]=s>>>8&255,t[i+3]=s&255):(t[i+3]=s>>>24,t[i+2]=s>>>16&255,t[i+1]=s>>>8&255,t[i]=s&255)}return t}kt.split32=EK;function BK(n,e){return n>>>e|n<<32-e}kt.rotr32=BK;function MK(n,e){return n<>>32-e}kt.rotl32=MK;function SK(n,e){return n+e>>>0}kt.sum32=SK;function CK(n,e,t){return n+e+t>>>0}kt.sum32_3=CK;function TK(n,e,t,r){return n+e+t+r>>>0}kt.sum32_4=TK;function IK(n,e,t,r,i){return n+e+t+r+i>>>0}kt.sum32_5=IK;function RK(n,e,t,r){var i=n[e],s=n[e+1],o=r+s>>>0,a=(o>>0,n[e+1]=o}kt.sum64=RK;function UK(n,e,t,r){var i=e+r>>>0,s=(i>>0}kt.sum64_hi=UK;function FK(n,e,t,r){var i=e+r;return i>>>0}kt.sum64_lo=FK;function PK(n,e,t,r,i,s,o,a){var l=0,c=e;c=c+r>>>0,l+=c>>0,l+=c>>0,l+=c>>0}kt.sum64_4_hi=PK;function LK(n,e,t,r,i,s,o,a){var l=e+r+s+a;return l>>>0}kt.sum64_4_lo=LK;function DK(n,e,t,r,i,s,o,a,l,c){var A=0,u=e;u=u+r>>>0,A+=u>>0,A+=u>>0,A+=u>>0,A+=u>>0}kt.sum64_5_hi=DK;function NK(n,e,t,r,i,s,o,a,l,c){var A=e+r+s+a+c;return A>>>0}kt.sum64_5_lo=NK;function OK(n,e,t){var r=e<<32-t|n>>>t;return r>>>0}kt.rotr64_hi=OK;function kK(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}kt.rotr64_lo=kK;function QK(n,e,t){return n>>>t}kt.shr64_hi=QK;function HK(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}kt.shr64_lo=HK;var Hd={},JU=kt,zK=A0;function Nx(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Hd.BlockHash=Nx;Nx.prototype.update=function(e,t){if(e=JU.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var r=e.length%this._delta8;this.pending=e.slice(e.length-r,e.length),this.pending.length===0&&(this.pending=null),e=JU.join32(e,0,e.length-r,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}sl.g0_256=KK;function XK(n){return Ga(n,17)^Ga(n,19)^n>>>10}sl.g1_256=XK;var dd=kt,YK=Hd,$K=sl,wb=dd.rotl32,dp=dd.sum32,ZK=dd.sum32_5,JK=$K.ft_1,RQ=YK.BlockHash,qK=[1518500249,1859775393,2400959708,3395469782];function Za(){if(!(this instanceof Za))return new Za;RQ.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}dd.inherits(Za,RQ);var e7=Za;Za.blockSize=512;Za.outSize=160;Za.hmacStrength=80;Za.padLength=64;Za.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),H7(e.length<=this.blockSize);for(var t=e.length;t{s[a.toLowerCase()]=o}):r.headers.keys().forEach(o=>{s[o.toLowerCase()]=r.headers.get(o)}),{headers:s,statusCode:r.status,statusMessage:r.statusText,body:pt(new Uint8Array(i))}})}var W7=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const Qo=new xe(G7);function rF(n){return new Promise(e=>{setTimeout(e,n)})}function gc(n,e){if(n==null)return null;if(typeof n=="string")return n;if(cI(n)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return c0(n)}catch{}return lt(n)}return n}function K7(n){return $a(n.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))}function X7(n,e,t){const r=typeof n=="object"&&n.throttleLimit!=null?n.throttleLimit:12;Qo.assertArgument(r>0&&r%1===0,"invalid connection throttle limit","connection.throttleLimit",r);const i=typeof n=="object"?n.throttleCallback:null,s=typeof n=="object"&&typeof n.throttleSlotInterval=="number"?n.throttleSlotInterval:100;Qo.assertArgument(s>0&&s%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",s);const o=typeof n=="object"?!!n.errorPassThrough:!1,a={};let l=null;const c={method:"GET"};let A=!1,u=2*60*1e3;if(typeof n=="string")l=n;else if(typeof n=="object"){if((n==null||n.url==null)&&Qo.throwArgumentError("missing URL","connection.url",n),l=n.url,typeof n.timeout=="number"&&n.timeout>0&&(u=n.timeout),n.headers)for(const p in n.headers)a[p.toLowerCase()]={key:p,value:String(n.headers[p])},["if-none-match","if-modified-since"].indexOf(p.toLowerCase())>=0&&(A=!0);if(c.allowGzip=!!n.allowGzip,n.user!=null&&n.password!=null){l.substring(0,6)!=="https:"&&n.allowInsecureAuthentication!==!0&&Qo.throwError("basic authentication requires a secure https url",xe.errors.INVALID_ARGUMENT,{argument:"url",url:l,user:n.user,password:"[REDACTED]"});const p=n.user+":"+n.password;a.authorization={key:"Authorization",value:"Basic "+rQ($a(p))}}n.skipFetchSetup!=null&&(c.skipFetchSetup=!!n.skipFetchSetup),n.fetchOptions!=null&&(c.fetchOptions=Qn(n.fetchOptions))}const f=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),h=l?l.match(f):null;if(h)try{const p={statusCode:200,statusMessage:"OK",headers:{"content-type":h[1]||"text/plain"},body:h[2]?nQ(h[3]):K7(h[3])};let v=p.body;return t&&(v=t(p.body,p)),Promise.resolve(v)}catch(p){Qo.throwError("processing response error",xe.errors.SERVER_ERROR,{body:gc(h[1],h[2]),error:p,requestBody:null,requestMethod:"GET",url:l})}e&&(c.method="POST",c.body=e,a["content-type"]==null&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),a["content-length"]==null&&(a["content-length"]={key:"Content-Length",value:String(e.length)}));const d={};Object.keys(a).forEach(p=>{const v=a[p];d[v.key]=v.value}),c.headers=d;const m=function(){let p=null;return{promise:new Promise(function(_,x){u&&(p=setTimeout(()=>{p!=null&&(p=null,x(Qo.makeError("timeout",xe.errors.TIMEOUT,{requestBody:gc(c.body,d["content-type"]),requestMethod:c.method,timeout:u,url:l})))},u))}),cancel:function(){p!=null&&(clearTimeout(p),p=null)}}}(),g=function(){return W7(this,void 0,void 0,function*(){for(let p=0;p=300)&&(m.cancel(),Qo.throwError("bad response",xe.errors.SERVER_ERROR,{status:v.statusCode,headers:v.headers,body:gc(w,v.headers?v.headers["content-type"]:null),requestBody:gc(c.body,d["content-type"]),requestMethod:c.method,url:l})),t)try{const _=yield t(w,v);return m.cancel(),_}catch(_){if(_.throttleRetry&&p{let a=null;if(s!=null)try{a=JSON.parse(c0(s))}catch(l){Qo.throwError("invalid JSON",xe.errors.SERVER_ERROR,{body:s,error:l})}return t&&(a=t(a,o)),a},i=null;if(e!=null){i=$a(e);const s=typeof n=="string"?{url:n}:Qn(n);s.headers?Object.keys(s.headers).filter(a=>a.toLowerCase()==="content-type").length!==0||(s.headers=Qn(s.headers),s.headers["content-type"]="application/json"):s.headers={"content-type":"application/json"},n=s}return X7(n,i,r)}function vh(n,e){return e||(e={}),e=Qn(e),e.floor==null&&(e.floor=0),e.ceiling==null&&(e.ceiling=1e4),e.interval==null&&(e.interval=250),new Promise(function(t,r){let i=null,s=!1;const o=()=>s?!1:(s=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout(()=>{o()&&r(new Error("timeout"))},e.timeout));const a=e.retryLimit;let l=0;function c(){return n().then(function(A){if(A!==void 0)o()&&t(A);else if(e.oncePoll)e.oncePoll.once("poll",c);else if(e.onceBlock)e.onceBlock.once("block",c);else if(!s){if(l++,l>a){o()&&r(new Error("retry limit reached"));return}let u=e.interval*parseInt(String(Math.random()*Math.pow(2,l)));ue.ceiling&&(u=e.ceiling),setTimeout(c,u)}return null},function(A){o()&&r(A)})}c()})}var Jw="qpzry9x8gf2tvdw0s3jn54khce6mua7l",PM={};for(var z0=0;z0>25;return(n&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function zQ(n){for(var e=1,t=0;t126)return"Invalid prefix ("+n+")";e=Kh(e)^r>>5}for(e=Kh(e),t=0;tt)throw new TypeError("Exceeds length limit");n=n.toLowerCase();var r=zQ(n);if(typeof r=="string")throw new Error(r);for(var i=n+"1",s=0;s>5)throw new Error("Non 5-bit word");r=Kh(r)^o,i+=Jw.charAt(o)}for(s=0;s<6;++s)r=Kh(r);for(r^=1,s=0;s<6;++s){var a=r>>(5-s)*5&31;i+=Jw.charAt(a)}return i}function GQ(n,e){if(e=e||90,n.length<8)return n+" too short";if(n.length>e)return"Exceeds length limit";var t=n.toLowerCase(),r=n.toUpperCase();if(n!==t&&n!==r)return"Mixed-case string "+n;n=t;var i=n.lastIndexOf("1");if(i===-1)return"No separator character for "+n;if(i===0)return"Missing prefix for "+n;var s=n.slice(0,i),o=n.slice(i+1);if(o.length<6)return"Data too short";var a=zQ(s);if(typeof a=="string")return a;for(var l=[],c=0;c=o.length)&&l.push(u)}return a!==1?"Invalid checksum for "+n:{prefix:s,words:l}}function $7(){var n=GQ.apply(null,arguments);if(typeof n=="object")return n}function Z7(n){var e=GQ.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function kx(n,e,t,r){for(var i=0,s=0,o=(1<=t;)s-=t,a.push(i>>s&o);if(r)s>0&&a.push(i<=e)return"Excess padding";if(i<>8,f=A&255;u?l.push(u,f):l.push(f)}return l}t.toArray=r;function i(o){return o.length===1?"0"+o:o}t.zero2=i;function s(o){for(var a="",l=0;l(f>>1)-1?m=(f>>1)-g:m=g,h.isubn(m)):m=0,u[d]=m,h.iushrn(1)}return u}t.getNAF=r;function i(l,c){var A=[[],[]];l=l.clone(),c=c.clone();for(var u=0,f=0,h;l.cmpn(-u)>0||c.cmpn(-f)>0;){var d=l.andln(3)+u&3,m=c.andln(3)+f&3;d===3&&(d=-1),m===3&&(m=-1);var g;d&1?(h=l.andln(7)+u&7,(h===3||h===5)&&m===2?g=-d:g=d):g=0,A[0].push(g);var p;m&1?(h=c.andln(7)+f&7,(h===3||h===5)&&d===2?p=-m:p=m):p=0,A[1].push(p),2*u===g+1&&(u=1-u),2*f===p+1&&(f=1-f),l.iushrn(1),c.iushrn(1)}return A}t.getJSF=i;function s(l,c,A){var u="_"+c;l.prototype[c]=function(){return this[u]!==void 0?this[u]:this[u]=A.call(this)}}t.cachedProperty=s;function o(l){return typeof l=="string"?t.toArray(l,"hex"):l}t.parseBytes=o;function a(l){return new _t(l,"hex","le")}t.intFromLE=a}),qw=Vs.getNAF,iX=Vs.getJSF,e_=Vs.assert;function MA(n,e){this.type=n,this.p=new _t(e.p,16),this.red=e.prime?_t.red(e.prime):_t.mont(this.p),this.zero=new _t(0).toRed(this.red),this.one=new _t(1).toRed(this.red),this.two=new _t(2).toRed(this.red),this.n=e.n&&new _t(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var ju=MA;MA.prototype.point=function(){throw new Error("Not implemented")};MA.prototype.validate=function(){throw new Error("Not implemented")};MA.prototype._fixedNafMul=function(e,t){e_(e.precomputed);var r=e._getDoubles(),i=qw(t,1,this._bitLength),s=(1<=a;c--)l=(l<<1)+i[c];o.push(l)}for(var A=this.jpoint(null,null,null),u=this.jpoint(null,null,null),f=s;f>0;f--){for(a=0;a=0;l--){for(var c=0;l>=0&&o[l]===0;l--)c++;if(l>=0&&c++,a=a.dblp(c),l<0)break;var A=o[l];e_(A!==0),e.type==="affine"?A>0?a=a.mixedAdd(s[A-1>>1]):a=a.mixedAdd(s[-A-1>>1].neg()):A>0?a=a.add(s[A-1>>1]):a=a.add(s[-A-1>>1].neg())}return e.type==="affine"?a.toP():a};MA.prototype._wnafMulAdd=function(e,t,r,i,s){var o=this._wnafT1,a=this._wnafT2,l=this._wnafT3,c=0,A,u,f;for(A=0;A=1;A-=2){var d=A-1,m=A;if(o[d]!==1||o[m]!==1){l[d]=qw(r[d],o[d],this._bitLength),l[m]=qw(r[m],o[m],this._bitLength),c=Math.max(l[d].length,c),c=Math.max(l[m].length,c);continue}var g=[t[d],null,null,t[m]];t[d].y.cmp(t[m].y)===0?(g[1]=t[d].add(t[m]),g[2]=t[d].toJ().mixedAdd(t[m].neg())):t[d].y.cmp(t[m].y.redNeg())===0?(g[1]=t[d].toJ().mixedAdd(t[m]),g[2]=t[d].add(t[m].neg())):(g[1]=t[d].toJ().mixedAdd(t[m]),g[2]=t[d].toJ().mixedAdd(t[m].neg()));var p=[-3,-1,-5,-7,0,7,5,1,3],v=iX(r[d],r[m]);for(c=Math.max(v[0].length,c),l[d]=new Array(c),l[m]=new Array(c),u=0;u=0;A--){for(var B=0;A>=0;){var S=!0;for(u=0;u=0&&B++,x=x.dblp(B),A<0)break;for(u=0;u0?f=a[u][I-1>>1]:I<0&&(f=a[u][-I-1>>1].neg()),f.type==="affine"?x=x.mixedAdd(f):x=x.add(f))}}for(A=0;A=Math.ceil((e.bitLength()+1)/t.step):!1};Bo.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,s=0;s=0&&(h=c,d=A),u.negative&&(u=u.neg(),f=f.neg()),h.negative&&(h=h.neg(),d=d.neg()),[{a:u,b:f},{a:h,b:d}]};Mo.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],i=t[1],s=i.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=s.mul(r.a),l=o.mul(i.a),c=s.mul(r.b),A=o.mul(i.b),u=e.sub(a).sub(l),f=c.add(A).neg();return{k1:u,k2:f}};Mo.prototype.pointFromX=function(e,t){e=new _t(e,16),e.red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(i.redSqr().redSub(r).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(t&&!s||!t&&s)&&(i=i.redNeg()),this.point(e,i)};Mo.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,i=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return r.redSqr().redISub(s).cmpn(0)===0};Mo.prototype._endoWnafMulAdd=function(e,t,r){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};Zr.prototype.isInfinity=function(){return this.inf};Zr.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)};Zr.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),i=e.redInvm(),s=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)};Zr.prototype.getX=function(){return this.x.fromRed()};Zr.prototype.getY=function(){return this.y.fromRed()};Zr.prototype.mul=function(e){return e=new _t(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Zr.prototype.mulAdd=function(e,t,r){var i=[this,t],s=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};Zr.prototype.jmulAdd=function(e,t,r){var i=[this,t],s=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};Zr.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Zr.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,i=function(s){return s.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return t};Zr.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function ci(n,e,t,r){ju.BasePoint.call(this,n,"jacobian"),e===null&&t===null&&r===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new _t(0)):(this.x=new _t(e,16),this.y=new _t(t,16),this.z=new _t(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}hI(ci,ju.BasePoint);Mo.prototype.jpoint=function(e,t,r){return new ci(this,e,t,r)};ci.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(r,i)};ci.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};ci.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(t),s=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),l=i.redSub(s),c=o.redSub(a);if(l.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var A=l.redSqr(),u=A.redMul(l),f=i.redMul(A),h=c.redSqr().redIAdd(u).redISub(f).redISub(f),d=c.redMul(f.redISub(h)).redISub(o.redMul(u)),m=this.z.redMul(e.z).redMul(l);return this.curve.jpoint(h,d,m)};ci.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,i=e.x.redMul(t),s=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(i),l=s.redSub(o);if(a.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),A=c.redMul(a),u=r.redMul(c),f=l.redSqr().redIAdd(A).redISub(u).redISub(u),h=l.redMul(u.redISub(f)).redISub(s.redMul(A)),d=this.z.redMul(a);return this.curve.jpoint(f,h,d)};ci.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(s),this.x.cmp(r)===0)return!0}};ci.prototype.inspect=function(){return this.isInfinity()?"":""};ci.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var rw=Vd(function(n,e){var t=e;t.base=ju,t.short=oX,t.mont=null,t.edwards=null}),iw=Vd(function(n,e){var t=e,r=Vs.assert;function i(a){a.type==="short"?this.curve=new rw.short(a):a.type==="edwards"?this.curve=new rw.edwards(a):this.curve=new rw.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,r(this.g.validate(),"Invalid curve"),r(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}t.PresetCurve=i;function s(a,l){Object.defineProperty(t,a,{configurable:!0,enumerable:!0,get:function(){var c=new i(l);return Object.defineProperty(t,a,{configurable:!0,enumerable:!0,value:c}),c}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Ba.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Ba.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Ba.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Ba.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Ba.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ba.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ba.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Ba.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function pA(n){if(!(this instanceof pA))return new pA(n);this.hash=n.hash,this.predResist=!!n.predResist,this.outLen=this.hash.outSize,this.minEntropy=n.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=qo.toArray(n.entropy,n.entropyEnc||"hex"),t=qo.toArray(n.nonce,n.nonceEnc||"hex"),r=qo.toArray(n.pers,n.persEnc||"hex");fI(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,r)}var jQ=pA;pA.prototype._init=function(e,t,r){var i=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1};pA.prototype.generate=function(e,t,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(i=r,r=t,t=null),r&&(r=qo.toArray(r,i||"hex"),this._update(r));for(var s=[];s.length"};var aX=Vs.assert;function Qx(n,e){if(n instanceof Qx)return n;this._importDER(n,e)||(aX(n.r&&n.s,"Signature without r or s"),this.r=new _t(n.r,16),this.s=new _t(n.s,16),n.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=n.recoveryParam)}var Hx=Qx;function lX(){this.place=0}function Eb(n,e){var t=n[e.place++];if(!(t&128))return t;var r=t&15;if(r===0||r>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function sF(n){for(var e=0,t=n.length-1;!n[e]&&!(n[e+1]&128)&&e>>3);for(n.push(t|128);--t;)n.push(e>>>(t<<3)&255);n.push(e)}Qx.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),r[0]&128&&(r=[0].concat(r)),t=sF(t),r=sF(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var i=[2];Bb(i,t.length),i=i.concat(t),i.push(2),Bb(i,r.length);var s=i.concat(r),o=[48];return Bb(o,s.length),o=o.concat(s),Vs.encode(o,e)};var cX=function(){throw new Error("unsupported")},WQ=Vs.assert;function wo(n){if(!(this instanceof wo))return new wo(n);typeof n=="string"&&(WQ(Object.prototype.hasOwnProperty.call(iw,n),"Unknown curve "+n),n=iw[n]),n instanceof iw.PresetCurve&&(n={curve:n}),this.curve=n.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=n.curve.g,this.g.precompute(n.curve.n.bitLength()+1),this.hash=n.hash||n.curve.hash}var AX=wo;wo.prototype.keyPair=function(e){return new dI(this,e)};wo.prototype.keyFromPrivate=function(e,t){return dI.fromPrivate(this,e,t)};wo.prototype.keyFromPublic=function(e,t){return dI.fromPublic(this,e,t)};wo.prototype.genKeyPair=function(e){e||(e={});for(var t=new jQ({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||cX(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new _t(2));;){var s=new _t(t.generate(r));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};wo.prototype._truncateToN=function(e,t){var r=e.byteLength()*8-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e};wo.prototype.sign=function(e,t,r,i){typeof r=="object"&&(i=r,r=null),i||(i={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new _t(e,16));for(var s=this.n.byteLength(),o=t.getPrivate().toArray("be",s),a=e.toArray("be",s),l=new jQ({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),c=this.n.sub(new _t(1)),A=0;;A++){var u=i.k?i.k(A):new _t(l.generate(this.n.byteLength()));if(u=this._truncateToN(u,!0),!(u.cmpn(1)<=0||u.cmp(c)>=0)){var f=this.g.mul(u);if(!f.isInfinity()){var h=f.getX(),d=h.umod(this.n);if(d.cmpn(0)!==0){var m=u.invm(this.n).mul(d.mul(t.getPrivate()).iadd(e));if(m=m.umod(this.n),m.cmpn(0)!==0){var g=(f.getY().isOdd()?1:0)|(h.cmp(d)!==0?2:0);return i.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),g^=1),new Hx({r:d,s:m,recoveryParam:g})}}}}}};wo.prototype.verify=function(e,t,r,i){e=this._truncateToN(new _t(e,16)),r=this.keyFromPublic(r,i),t=new Hx(t,"hex");var s=t.r,o=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),l=a.mul(e).umod(this.n),c=a.mul(s).umod(this.n),A;return this.curve._maxwellTrick?(A=this.g.jmulAdd(l,r.getPublic(),c),A.isInfinity()?!1:A.eqXToP(s)):(A=this.g.mulAdd(l,r.getPublic(),c),A.isInfinity()?!1:A.getX().umod(this.n).cmp(s)===0)};wo.prototype.recoverPubKey=function(n,e,t,r){WQ((3&t)===t,"The recovery param is more than two bits"),e=new Hx(e,r);var i=this.n,s=new _t(n),o=e.r,a=e.s,l=t&1,c=t>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");c?o=this.curve.pointFromX(o.add(this.curve.n),l):o=this.curve.pointFromX(o,l);var A=e.r.invm(i),u=i.sub(s).mul(A).umod(i),f=a.mul(A).umod(i);return this.g.mulAdd(u,o,f)};wo.prototype.getKeyRecoveryParam=function(n,e,t,r){if(e=new Hx(e,r),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(n,e,i)}catch{continue}if(s.eq(t))return i}throw new Error("Unable to find valid recovery factor")};var uX=Vd(function(n,e){var t=e;t.version="6.5.4",t.utils=Vs,t.rand=function(){throw new Error("unsupported")},t.curve=rw,t.curves=iw,t.ec=AX,t.eddsa=null}),fX=uX.ec;const hX="signing-key/5.7.0",DM=new xe(hX);let Mb=null;function Ia(){return Mb||(Mb=new fX("secp256k1")),Mb}class dX{constructor(e){Ue(this,"curve","secp256k1"),Ue(this,"privateKey",lt(e)),Su(this.privateKey)!==32&&DM.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=Ia().keyFromPrivate(pt(this.privateKey));Ue(this,"publicKey","0x"+t.getPublic(!1,"hex")),Ue(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Ue(this,"_isSigningKey",!0)}_addPoint(e){const t=Ia().keyFromPublic(pt(this.publicKey)),r=Ia().keyFromPublic(pt(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=Ia().keyFromPrivate(pt(this.privateKey)),r=pt(e);r.length!==32&&DM.throwArgumentError("bad digest length","digest",e);const i=t.sign(r,{canonical:!0});return Px({recoveryParam:i.recoveryParam,r:ir("0x"+i.r.toString(16),32),s:ir("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const t=Ia().keyFromPrivate(pt(this.privateKey)),r=Ia().keyFromPublic(pt(KQ(e)));return ir("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function pX(n,e){const t=Px(e),r={r:pt(t.r),s:pt(t.s)};return"0x"+Ia().recoverPubKey(pt(n),r,t.recoveryParam).encode("hex",!1)}function KQ(n,e){const t=pt(n);if(t.length===32){const r=new dX(t);return e?"0x"+Ia().keyFromPrivate(t).getPublic(!0,"hex"):r.publicKey}else{if(t.length===33)return e?lt(t):"0x"+Ia().keyFromPublic(t).getPublic(!1,"hex");if(t.length===65)return e?"0x"+Ia().keyFromPublic(t).getPublic(!0,"hex"):lt(t)}return DM.throwArgumentError("invalid public or private key","key","[REDACTED]")}const mX="transactions/5.7.0",ac=new xe(mX);var oF;(function(n){n[n.legacy=0]="legacy",n[n.eip2930=1]="eip2930",n[n.eip1559=2]="eip1559"})(oF||(oF={}));function pI(n){return n==="0x"?null:ai(n)}function vi(n){return n==="0x"?sQ:je.from(n)}function gX(n){const e=KQ(n);return ai(mi(Er(mi(e,1)),12))}function XQ(n,e){return gX(pX(pt(n),e))}function Es(n,e){const t=hd(je.from(n).toHexString());return t.length>32&&ac.throwArgumentError("invalid length for "+e,"transaction:"+e,n),t}function Sb(n,e){return{address:ai(n),storageKeys:(e||[]).map((t,r)=>(Su(t)!==32&&ac.throwArgumentError("invalid access list storageKey",`accessList[${n}:${r}]`,t),t.toLowerCase()))}}function Wu(n){if(Array.isArray(n))return n.map((t,r)=>Array.isArray(t)?(t.length>2&&ac.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${r}]`,t),Sb(t[0],t[1])):Sb(t.address,t.storageKeys));const e=Object.keys(n).map(t=>{const r=n[t].reduce((i,s)=>(i[s]=!0,i),{});return Sb(t,Object.keys(r).sort())});return e.sort((t,r)=>t.address.localeCompare(r.address)),e}function YQ(n){return Wu(n).map(e=>[e.address,e.storageKeys])}function vX(n,e){if(n.gasPrice!=null){const r=je.from(n.gasPrice),i=je.from(n.maxFeePerGas||0);r.eq(i)||ac.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:r,maxFeePerGas:i})}const t=[Es(n.chainId||0,"chainId"),Es(n.nonce||0,"nonce"),Es(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Es(n.maxFeePerGas||0,"maxFeePerGas"),Es(n.gasLimit||0,"gasLimit"),n.to!=null?ai(n.to):"0x",Es(n.value||0,"value"),n.data||"0x",YQ(n.accessList||[])];if(e){const r=Px(e);t.push(Es(r.recoveryParam,"recoveryParam")),t.push(hd(r.r)),t.push(hd(r.s))}return $i(["0x02",Dx(t)])}function yX(n,e){const t=[Es(n.chainId||0,"chainId"),Es(n.nonce||0,"nonce"),Es(n.gasPrice||0,"gasPrice"),Es(n.gasLimit||0,"gasLimit"),n.to!=null?ai(n.to):"0x",Es(n.value||0,"value"),n.data||"0x",YQ(n.accessList||[])];if(e){const r=Px(e);t.push(Es(r.recoveryParam,"recoveryParam")),t.push(hd(r.r)),t.push(hd(r.s))}return $i(["0x01",Dx(t)])}function $Q(n,e,t){try{const r=vi(e[0]).toNumber();if(r!==0&&r!==1)throw new Error("bad recid");n.v=r}catch{ac.throwArgumentError("invalid v for transaction type: 1","v",e[0])}n.r=ir(e[1],32),n.s=ir(e[2],32);try{const r=Er(t(n));n.from=XQ(r,{r:n.r,s:n.s,recoveryParam:n.v})}catch{}}function wX(n){const e=AI(n.slice(1));e.length!==9&&e.length!==12&&ac.throwArgumentError("invalid component count for transaction type: 2","payload",lt(n));const t=vi(e[2]),r=vi(e[3]),i={type:2,chainId:vi(e[0]).toNumber(),nonce:vi(e[1]).toNumber(),maxPriorityFeePerGas:t,maxFeePerGas:r,gasPrice:null,gasLimit:vi(e[4]),to:pI(e[5]),value:vi(e[6]),data:e[7],accessList:Wu(e[8])};return e.length===9||(i.hash=Er(n),$Q(i,e.slice(9),vX)),i}function _X(n){const e=AI(n.slice(1));e.length!==8&&e.length!==11&&ac.throwArgumentError("invalid component count for transaction type: 1","payload",lt(n));const t={type:1,chainId:vi(e[0]).toNumber(),nonce:vi(e[1]).toNumber(),gasPrice:vi(e[2]),gasLimit:vi(e[3]),to:pI(e[4]),value:vi(e[5]),data:e[6],accessList:Wu(e[7])};return e.length===8||(t.hash=Er(n),$Q(t,e.slice(8),yX)),t}function xX(n){const e=AI(n);e.length!==9&&e.length!==6&&ac.throwArgumentError("invalid raw transaction","rawTransaction",n);const t={nonce:vi(e[0]).toNumber(),gasPrice:vi(e[1]),gasLimit:vi(e[2]),to:pI(e[3]),value:vi(e[4]),data:e[5],chainId:0};if(e.length===6)return t;try{t.v=je.from(e[6]).toNumber()}catch{return t}if(t.r=ir(e[7],32),t.s=ir(e[8],32),je.from(t.r).isZero()&&je.from(t.s).isZero())t.chainId=t.v,t.v=0;else{t.chainId=Math.floor((t.v-35)/2),t.chainId<0&&(t.chainId=0);let r=t.v-27;const i=e.slice(0,6);t.chainId!==0&&(i.push(lt(t.chainId)),i.push("0x"),i.push("0x"),r-=t.chainId*2+8);const s=Er(Dx(i));try{t.from=XQ(s,{r:lt(t.r),s:lt(t.s),recoveryParam:r})}catch{}t.hash=Er(n)}return t.type=null,t}function bX(n){const e=pt(n);if(e[0]>127)return xX(e);switch(e[0]){case 1:return _X(e);case 2:return wX(e)}return ac.throwError(`unsupported transaction type: ${e[0]}`,xe.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const mp=new xe(Ci);let aF=class it{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const e={},t=this.address.bind(this),r=this.bigNumber.bind(this),i=this.blockTag.bind(this),s=this.data.bind(this),o=this.hash.bind(this),a=this.hex.bind(this),l=this.number.bind(this),c=this.type.bind(this),A=u=>this.data(u,!0);return e.transaction={hash:o,type:c,accessList:it.allowNull(this.accessList.bind(this),null),blockHash:it.allowNull(o,null),blockNumber:it.allowNull(l,null),transactionIndex:it.allowNull(l,null),confirmations:it.allowNull(l,null),from:t,gasPrice:it.allowNull(r),maxPriorityFeePerGas:it.allowNull(r),maxFeePerGas:it.allowNull(r),gasLimit:r,to:it.allowNull(t,null),value:r,nonce:l,data:s,r:it.allowNull(this.uint256),s:it.allowNull(this.uint256),v:it.allowNull(l),creates:it.allowNull(t,null),raw:it.allowNull(s)},e.transactionRequest={from:it.allowNull(t),nonce:it.allowNull(l),gasLimit:it.allowNull(r),gasPrice:it.allowNull(r),maxPriorityFeePerGas:it.allowNull(r),maxFeePerGas:it.allowNull(r),to:it.allowNull(t),value:it.allowNull(r),data:it.allowNull(A),type:it.allowNull(l),accessList:it.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:l,blockNumber:l,transactionHash:o,address:t,topics:it.arrayOf(o),data:s,logIndex:l,blockHash:o},e.receipt={to:it.allowNull(this.address,null),from:it.allowNull(this.address,null),contractAddress:it.allowNull(t,null),transactionIndex:l,root:it.allowNull(a),gasUsed:r,logsBloom:it.allowNull(s),blockHash:o,transactionHash:o,logs:it.arrayOf(this.receiptLog.bind(this)),blockNumber:l,confirmations:it.allowNull(l,null),cumulativeGasUsed:r,effectiveGasPrice:it.allowNull(r),status:it.allowNull(l),type:c},e.block={hash:it.allowNull(o),parentHash:o,number:l,timestamp:l,nonce:it.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:it.allowNull(t),extraData:s,transactions:it.allowNull(it.arrayOf(o)),baseFeePerGas:it.allowNull(r)},e.blockWithTransactions=Qn(e.block),e.blockWithTransactions.transactions=it.allowNull(it.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:it.allowNull(i,void 0),toBlock:it.allowNull(i,void 0),blockHash:it.allowNull(o,void 0),address:it.allowNull(t,void 0),topics:it.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:it.allowNull(l),blockHash:it.allowNull(o),transactionIndex:l,removed:it.allowNull(this.boolean.bind(this)),address:t,data:it.allowFalsish(s,"0x"),topics:it.arrayOf(o),transactionHash:o,logIndex:l},e}accessList(e){return Wu(e||[])}number(e){return e==="0x"?0:je.from(e).toNumber()}type(e){return e==="0x"||e==null?0:je.from(e).toNumber()}bigNumber(e){return je.from(e)}boolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e=e.toLowerCase(),e==="true")return!0;if(e==="false")return!1}throw new Error("invalid boolean - "+e)}hex(e,t){return typeof e=="string"&&(!t&&e.substring(0,2)!=="0x"&&(e="0x"+e),It(e))?e.toLowerCase():mp.throwArgumentError("invalid hash","value",e)}data(e,t){const r=this.hex(e,t);if(r.length%2!==0)throw new Error("invalid data; odd-length - "+e);return r}address(e){return ai(e)}callAddress(e){if(!It(e,32))return null;const t=ai(mi(e,12));return t===_9?null:t}contractAddress(e){return yQ(e)}blockTag(e){if(e==null)return"latest";if(e==="earliest")return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if(typeof e=="number"||It(e))return Fx(e);throw new Error("invalid blockTag")}hash(e,t){const r=this.hex(e,t);return Su(r)!==32?mp.throwArgumentError("invalid hash","value",e):r}difficulty(e){if(e==null)return null;const t=je.from(e);try{return t.toNumber()}catch{}return null}uint256(e){if(!It(e))throw new Error("invalid uint256");return ir(e,32)}_block(e,t){e.author!=null&&e.miner==null&&(e.miner=e.author);const r=e._difficulty!=null?e._difficulty:e.difficulty,i=it.check(t,e);return i._difficulty=r==null?null:je.from(r),i}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return it.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&je.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),e.input!=null&&e.data==null&&(e.data=e.input),e.to==null&&e.creates==null&&(e.creates=this.contractAddress(e)),(e.type===1||e.type===2)&&e.accessList==null&&(e.accessList=[]);const t=it.check(this.formats.transaction,e);if(e.chainId!=null){let r=e.chainId;It(r)&&(r=je.from(r).toNumber()),t.chainId=r}else{let r=e.networkId;r==null&&t.v==null&&(r=e.chainId),It(r)&&(r=je.from(r).toNumber()),typeof r!="number"&&t.v!=null&&(r=(t.v-35)/2,r<0&&(r=0),r=parseInt(r)),typeof r!="number"&&(r=0),t.chainId=r}return t.blockHash&&t.blockHash.replace(/0/g,"")==="x"&&(t.blockHash=null),t}transaction(e){return bX(e)}receiptLog(e){return it.check(this.formats.receiptLog,e)}receipt(e){const t=it.check(this.formats.receipt,e);if(t.root!=null)if(t.root.length<=4){const r=je.from(t.root).toNumber();r===0||r===1?(t.status!=null&&t.status!==r&&mp.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=r,delete t.root):mp.throwArgumentError("invalid alt-root-status","value.root",t.root)}else t.root.length!==66&&mp.throwArgumentError("invalid root hash","value.root",t.root);return t.status!=null&&(t.byzantium=!0),t}topics(e){return Array.isArray(e)?e.map(t=>this.topics(t)):e!=null?this.hash(e,!0):null}filter(e){return it.check(this.formats.filter,e)}filterLog(e){return it.check(this.formats.filterLog,e)}static check(e,t){const r={};for(const i in e)try{const s=e[i](t[i]);s!==void 0&&(r[i]=s)}catch(s){throw s.checkKey=i,s.checkValue=t[i],s}return r}static allowNull(e,t){return function(r){return r==null?t:e(r)}}static allowFalsish(e,t){return function(r){return r?e(r):t}}static arrayOf(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");const r=[];return t.forEach(function(i){r.push(e(i))}),r}}};function EX(n){return n&&typeof n.isCommunityResource=="function"}function lF(n){return EX(n)&&n.isCommunityResource()}let cF=!1;function zx(){cF||(cF=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var yt=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const Tt=new xe(Ci),BX=10;function AF(n){return n==null?"null":(Su(n)!==32&&Tt.throwArgumentError("invalid topic","topic",n),n.toLowerCase())}function uF(n){for(n=n.slice();n.length>0&&n[n.length-1]==null;)n.pop();return n.map(e=>{if(Array.isArray(e)){const t={};e.forEach(i=>{t[AF(i)]=!0});const r=Object.keys(t);return r.sort(),r.join("|")}else return AF(e)}).join("&")}function MX(n){return n===""?[]:n.split(/&/g).map(e=>{if(e==="")return[];const t=e.split("|").map(r=>r==="null"?null:r);return t.length===1?t[0]:t})}function of(n){if(typeof n=="string"){if(n=n.toLowerCase(),Su(n)===32)return"tx:"+n;if(n.indexOf(":")===-1)return n}else{if(Array.isArray(n))return"filter:*:"+uF(n);if(v9.isForkEvent(n))throw Tt.warn("not implemented"),new Error("not implemented");if(n&&typeof n=="object")return"filter:"+(n.address||"*")+":"+uF(n.topics||[])}throw new Error("invalid event - "+n)}function gp(){return new Date().getTime()}function fF(n){return new Promise(e=>{setTimeout(e,n)})}const SX=["block","network","pending","poll"];let CX=class{constructor(e,t,r){Ue(this,"tag",e),Ue(this,"listener",t),Ue(this,"once",r),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return e[0]!=="tx"?null:e[1]}get filter(){const e=this.tag.split(":");if(e[0]!=="filter")return null;const t=e[1],r=MX(e[2]),i={};return r.length>0&&(i.topics=r),t&&t!=="*"&&(i.address=t),i}pollable(){return this.tag.indexOf(":")>=0||SX.indexOf(this.tag)>=0}};const TX={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Cb(n){return ir(je.from(n).toHexString(),32)}function hF(n){return IM.encode(Ss([n,mi(nF(nF(n)),0,4)]))}const ZQ=new RegExp("^(ipfs)://(.*)$","i"),dF=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),ZQ,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function sw(n,e){try{return c0(ug(n,e))}catch{}return null}function ug(n,e){if(n==="0x")return null;const t=je.from(mi(n,e,e+32)).toNumber(),r=je.from(mi(n,t,t+32)).toNumber();return mi(n,t+32,t+32+r)}function Tb(n){return n.match(/^ipfs:\/\/ipfs\//i)?n=n.substring(12):n.match(/^ipfs:\/\//i)?n=n.substring(7):Tt.throwArgumentError("unsupported IPFS format","link",n),`https://gateway.ipfs.io/ipfs/${n}`}function pF(n){const e=pt(n);if(e.length>32)throw new Error("internal; should not happen");const t=new Uint8Array(32);return t.set(e,32-e.length),t}function IX(n){if(n.length%32===0)return n;const e=new Uint8Array(Math.ceil(n.length/32)*32);return e.set(n),e}function JQ(n){const e=[];let t=0;for(let r=0;rje.from(e).eq(1)).catch(e=>{if(e.code===xe.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,t){return yt(this,void 0,void 0,function*(){const r={to:this.address,ccipReadEnabled:!0,data:$i([e,nw(this.name),t||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,r.data=$i(["0x9061b923",JQ([rK(this.name),r.data])]));try{let s=yield this.provider.call(r);return pt(s).length%32===4&&Tt.throwError("resolver threw error",xe.errors.CALL_EXCEPTION,{transaction:r,data:s}),i&&(s=ug(s,0)),s}catch(s){if(s.code===xe.errors.CALL_EXCEPTION)return null;throw s}})}_fetchBytes(e,t){return yt(this,void 0,void 0,function*(){const r=yield this._fetch(e,t);return r!=null?ug(r,0):null})}_getAddress(e,t){const r=TX[String(e)];if(r==null&&Tt.throwError(`unsupported coin type: ${e}`,xe.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),r.ilk==="eth")return this.provider.formatter.address(t);const i=pt(t);if(r.p2pkh!=null){const s=t.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(s){const o=parseInt(s[1],16);if(s[2].length===o*2&&o>=1&&o<=75)return hF(Ss([[r.p2pkh],"0x"+s[2]]))}}if(r.p2sh!=null){const s=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(s){const o=parseInt(s[1],16);if(s[2].length===o*2&&o>=1&&o<=75)return hF(Ss([[r.p2sh],"0x"+s[2]]))}}if(r.prefix!=null){const s=i[1];let o=i[0];if(o===0?s!==20&&s!==32&&(o=-1):o=-1,o>=0&&i.length===2+s&&s>=1&&s<=75){const a=iF.toWords(i.slice(2));return a.unshift(o),iF.encode(r.prefix,a)}}return null}getAddress(e){return yt(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===B9?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===xe.errors.CALL_EXCEPTION)return null;throw i}const t=yield this._fetchBytes("0xf1cb7e06",Cb(e));if(t==null||t==="0x")return null;const r=this._getAddress(e,t);return r==null&&Tt.throwError("invalid or unsupported coin data",xe.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),r})}getAvatar(){return yt(this,void 0,void 0,function*(){const e=[{type:"name",content:this.name}];try{const t=yield this.getText("avatar");if(t==null)return null;for(let r=0;ro[l])}return Tt.throwError("invalid or unsupported content hash data",xe.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return yt(this,void 0,void 0,function*(){let t=$a(e);t=Ss([Cb(64),Cb(t.length),t]),t.length%32!==0&&(t=Ss([t,ir("0x",32-e.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",lt(t));return r==null||r==="0x"?null:c0(r)})}}let Ib=null,RX=1;class mI extends l0{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),Ue(this,"anyNetwork",e==="any"),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(t=>{}),this._ready().catch(t=>{});else{const t=Cs(new.target,"getNetwork")(e);t?(Ue(this,"_network",t),this.emit("network",t,null)):Tt.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return yt(this,void 0,void 0,function*(){if(this._network==null){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch{}e==null&&(e=yield this.detectNetwork()),e||Tt.throwError("no network detected",xe.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:Ue(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return vh(()=>this._ready().then(e=>e,e=>{if(!(e.code===xe.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return Ib==null&&(Ib=new aF),Ib}static getNetwork(e){return tQ(e??"homestead")}ccipReadFetch(e,t,r){return yt(this,void 0,void 0,function*(){if(this.disableCcipRead||r.length===0)return null;const i=e.to.toLowerCase(),s=t.toLowerCase(),o=[];for(let a=0;a=0?null:JSON.stringify({data:s,sender:i}),u=yield Ox({url:c,errorPassThrough:!0},A,(h,d)=>(h.status=d.statusCode,h));if(u.data)return u.data;const f=u.message||"unknown error";if(u.status>=400&&u.status<500)return Tt.throwError(`response not found during CCIP fetch: ${f}`,xe.errors.SERVER_ERROR,{url:l,errorMessage:f});o.push(f)}return Tt.throwError(`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,xe.errors.SERVER_ERROR,{urls:r,errorMessages:o})})}_getInternalBlockNumber(e){return yt(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const i=this._internalBlockNumber;try{const s=yield i;if(gp()-s.respTime<=e)return s.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const t=gp(),r=wr({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(i=>null,i=>i)}).then(({blockNumber:i,networkError:s})=>{if(s)throw this._internalBlockNumber===r&&(this._internalBlockNumber=null),s;const o=gp();return i=je.from(i).toNumber(),i{this._internalBlockNumber===r&&(this._internalBlockNumber=null)}),(yield r).blockNumber})}poll(){return yt(this,void 0,void 0,function*(){const e=RX++,t=[];let r=null;try{r=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(i){this.emit("error",i);return}if(this._setFastBlockNumber(r),this.emit("poll",e,r),r===this._lastBlockNumber){this.emit("didPoll",e);return}if(this._emitted.block===-2&&(this._emitted.block=r-1),Math.abs(this._emitted.block-r)>1e3)Tt.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",Tt.makeError("network block skew detected",xe.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(let i=this._emitted.block+1;i<=r;i++)this.emit("block",i);this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach(i=>{if(i==="block")return;const s=this._emitted[i];s!=="pending"&&r-s>12&&delete this._emitted[i]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=r-1),this._events.forEach(i=>{switch(i.type){case"tx":{const s=i.hash;let o=this.getTransactionReceipt(s).then(a=>(!a||a.blockNumber==null||(this._emitted["t:"+s]=a.blockNumber,this.emit(s,a)),null)).catch(a=>{this.emit("error",a)});t.push(o);break}case"filter":{if(!i._inflight){i._inflight=!0,i._lastBlockNumber===-2&&(i._lastBlockNumber=r-1);const s=i.filter;s.fromBlock=i._lastBlockNumber+1,s.toBlock=r;const o=s.toBlock-this._maxFilterBlockRange;o>s.fromBlock&&(s.fromBlock=o),s.fromBlock<0&&(s.fromBlock=0);const a=this.getLogs(s).then(l=>{i._inflight=!1,l.length!==0&&l.forEach(c=>{c.blockNumber>i._lastBlockNumber&&(i._lastBlockNumber=c.blockNumber),this._emitted["b:"+c.blockHash]=c.blockNumber,this._emitted["t:"+c.transactionHash]=c.blockNumber,this.emit(s,c)})}).catch(l=>{this.emit("error",l),i._inflight=!1});t.push(a)}break}}}),this._lastBlockNumber=r,Promise.all(t).then(()=>{this.emit("didPoll",e)}).catch(i=>{this.emit("error",i)})})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return yt(this,void 0,void 0,function*(){return Tt.throwError("provider does not support network detection",xe.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return yt(this,void 0,void 0,function*(){const e=yield this._ready(),t=yield this.detectNetwork();if(e.chainId!==t.chainId){if(this.anyNetwork)return this._network=t,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",t,e),yield fF(0),this._network;const r=Tt.makeError("underlying network changed",xe.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:t});throw this.emit("error",r),r}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if(typeof e!="number"||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const e=gp();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(t=>((this._fastBlockNumber==null||t>this._fastBlockNumber)&&(this._fastBlockNumber=t),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){this._fastBlockNumber!=null&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,t,r){return yt(this,void 0,void 0,function*(){return this._waitForTransaction(e,t??1,r||0,null)})}_waitForTransaction(e,t,r,i){return yt(this,void 0,void 0,function*(){const s=yield this.getTransactionReceipt(e);return(s?s.confirmations:0)>=t?s:new Promise((o,a)=>{const l=[];let c=!1;const A=function(){return c?!0:(c=!0,l.forEach(f=>{f()}),!1)},u=f=>{f.confirmations{this.removeListener(e,u)}),i){let f=i.startBlock,h=null;const d=m=>yt(this,void 0,void 0,function*(){c||(yield fF(1e3),this.getTransactionCount(i.from).then(g=>yt(this,void 0,void 0,function*(){if(!c){if(g<=i.nonce)f=m;else{{const p=yield this.getTransaction(e);if(p&&p.blockNumber!=null)return}for(h==null&&(h=f-3,h{c||this.once("block",d)}))});if(c)return;this.once("block",d),l.push(()=>{this.removeListener("block",d)})}if(typeof r=="number"&&r>0){const f=setTimeout(()=>{A()||a(Tt.makeError("timeout exceeded",xe.errors.TIMEOUT,{timeout:r}))},r);f.unref&&f.unref(),l.push(()=>{clearTimeout(f)})}})})}getBlockNumber(){return yt(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return yt(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return je.from(e)}catch(t){return Tt.throwError("bad result from backend",xe.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}})}getBalance(e,t){return yt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield wr({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getBalance",r);try{return je.from(i)}catch(s){return Tt.throwError("bad result from backend",xe.errors.SERVER_ERROR,{method:"getBalance",params:r,result:i,error:s})}})}getTransactionCount(e,t){return yt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield wr({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getTransactionCount",r);try{return je.from(i).toNumber()}catch(s){return Tt.throwError("bad result from backend",xe.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:i,error:s})}})}getCode(e,t){return yt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield wr({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getCode",r);try{return lt(i)}catch(s){return Tt.throwError("bad result from backend",xe.errors.SERVER_ERROR,{method:"getCode",params:r,result:i,error:s})}})}getStorageAt(e,t,r){return yt(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield wr({address:this._getAddress(e),blockTag:this._getBlockTag(r),position:Promise.resolve(t).then(o=>Fx(o))}),s=yield this.perform("getStorageAt",i);try{return lt(s)}catch(o){return Tt.throwError("bad result from backend",xe.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:s,error:o})}})}_wrapTransaction(e,t,r){if(t!=null&&Su(t)!==32)throw new Error("invalid response - sendTransaction");const i=e;return t!=null&&e.hash!==t&&Tt.throwError("Transaction hash mismatch from Provider.sendTransaction.",xe.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),i.wait=(s,o)=>yt(this,void 0,void 0,function*(){s==null&&(s=1),o==null&&(o=0);let a;s!==0&&r!=null&&(a={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:r});const l=yield this._waitForTransaction(e.hash,s,o,a);return l==null&&s===0?null:(this._emitted["t:"+e.hash]=l.blockNumber,l.status===0&&Tt.throwError("transaction failed",xe.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:l}),l)}),i}sendTransaction(e){return yt(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then(s=>lt(s)),r=this.formatter.transaction(e);r.confirmations==null&&(r.confirmations=0);const i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const s=yield this.perform("sendTransaction",{signedTransaction:t});return this._wrapTransaction(r,s,i)}catch(s){throw s.transaction=r,s.transactionHash=r.hash,s}})}_getTransactionRequest(e){return yt(this,void 0,void 0,function*(){const t=yield e,r={};return["from","to"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s?this._getAddress(s):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s?je.from(s):null))}),["type"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s??null))}),t.accessList&&(r.accessList=this.formatter.accessList(t.accessList)),["data"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s?lt(s):null))}),this.formatter.transactionRequest(yield wr(r))})}_getFilter(e){return yt(this,void 0,void 0,function*(){e=yield e;const t={};return e.address!=null&&(t.address=this._getAddress(e.address)),["blockHash","topics"].forEach(r=>{e[r]!=null&&(t[r]=e[r])}),["fromBlock","toBlock"].forEach(r=>{e[r]!=null&&(t[r]=this._getBlockTag(e[r]))}),this.formatter.filter(yield wr(t))})}_call(e,t,r){return yt(this,void 0,void 0,function*(){r>=BX&&Tt.throwError("CCIP read exceeded maximum redirections",xe.errors.SERVER_ERROR,{redirects:r,transaction:e});const i=e.to,s=yield this.perform("call",{transaction:e,blockTag:t});if(r>=0&&t==="latest"&&i!=null&&s.substring(0,10)==="0x556f1830"&&Su(s)%32===4)try{const o=mi(s,4),a=mi(o,0,32);je.from(a).eq(i)||Tt.throwError("CCIP Read sender did not match",xe.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:s});const l=[],c=je.from(mi(o,32,64)).toNumber(),A=je.from(mi(o,c,c+32)).toNumber(),u=mi(o,c+32);for(let p=0;pyt(this,void 0,void 0,function*(){const s=yield this.perform("getBlock",i);if(s==null)return i.blockHash!=null&&this._emitted["b:"+i.blockHash]==null||i.blockTag!=null&&r>this._emitted.block?null:void 0;if(t){let o=null;for(let l=0;lthis._wrapTransaction(l)),a}return this.formatter.block(s)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return yt(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return vh(()=>yt(this,void 0,void 0,function*(){const r=yield this.perform("getTransaction",t);if(r==null)return this._emitted["t:"+e]==null?null:void 0;const i=this.formatter.transactionResponse(r);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let o=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;o<=0&&(o=1),i.confirmations=o}return this._wrapTransaction(i)}),{oncePoll:this})})}getTransactionReceipt(e){return yt(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return vh(()=>yt(this,void 0,void 0,function*(){const r=yield this.perform("getTransactionReceipt",t);if(r==null)return this._emitted["t:"+e]==null?null:void 0;if(r.blockHash==null)return;const i=this.formatter.receipt(r);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let o=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;o<=0&&(o=1),i.confirmations=o}return i}),{oncePoll:this})})}getLogs(e){return yt(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield wr({filter:this._getFilter(e)}),r=yield this.perform("getLogs",t);return r.forEach(i=>{i.removed==null&&(i.removed=!1)}),aF.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)})}getEtherPrice(){return yt(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return yt(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&Tt.throwArgumentError("invalid BlockTag","blockTag",e);let t=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return t+=e,t<0&&(t=0),this.formatter.blockTag(t)}return this.formatter.blockTag(e)})}getResolver(e){return yt(this,void 0,void 0,function*(){let t=e;for(;;){if(t===""||t==="."||e!=="eth"&&t==="eth")return null;const r=yield this._getResolver(t,"getResolver");if(r!=null){const i=new mF(this,r,e);return t!==e&&!(yield i.supportsWildcard())?null:i}t=t.split(".").slice(1).join(".")}})}_getResolver(e,t){return yt(this,void 0,void 0,function*(){t==null&&(t="ENS");const r=yield this.getNetwork();r.ensAddress||Tt.throwError("network does not support ENS",xe.errors.UNSUPPORTED_OPERATION,{operation:t,network:r.name});try{const i=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+nw(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return yt(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(r){if(It(e))throw r}typeof e!="string"&&Tt.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null})}lookupAddress(e){return yt(this,void 0,void 0,function*(){e=yield e,e=this.formatter.address(e);const t=e.substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(t,"lookupAddress");if(r==null)return null;const i=sw(yield this.call({to:r,data:"0x691f3431"+nw(t).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return yt(this,void 0,void 0,function*(){let t=null;if(It(e)){const s=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",o=yield this._getResolver(s,"getAvatar");if(!o)return null;t=new mF(this,o,s);try{const a=yield t.getAvatar();if(a)return a.url}catch(a){if(a.code!==xe.errors.CALL_EXCEPTION)throw a}try{const a=sw(yield this.call({to:o,data:"0x691f3431"+nw(s).substring(2)}),0);t=yield this.getResolver(a)}catch(a){if(a.code!==xe.errors.CALL_EXCEPTION)throw a;return null}}else if(t=yield this.getResolver(e),!t)return null;const r=yield t.getAvatar();return r==null?null:r.url})}perform(e,t){return Tt.throwError(e+" not implemented",xe.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(t=>t.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(t=>t.pollable()).length>0}_addEventListener(e,t,r){const i=new CX(of(e),t,r);return this._events.push(i),this._startEvent(i),this}on(e,t){return this._addEventListener(e,t,!1)}once(e,t){return this._addEventListener(e,t,!0)}emit(e,...t){let r=!1,i=[],s=of(e);return this._events=this._events.filter(o=>o.tag!==s?!0:(setTimeout(()=>{o.listener.apply(this,t)},0),r=!0,o.once?(i.push(o),!1):!0)),i.forEach(o=>{this._stopEvent(o)}),r}listenerCount(e){if(!e)return this._events.length;let t=of(e);return this._events.filter(r=>r.tag===t).length}listeners(e){if(e==null)return this._events.map(r=>r.listener);let t=of(e);return this._events.filter(r=>r.tag===t).map(r=>r.listener)}off(e,t){if(t==null)return this.removeAllListeners(e);const r=[];let i=!1,s=of(e);return this._events=this._events.filter(o=>o.tag!==s||o.listener!=t||i?!0:(i=!0,r.push(o),!1)),r.forEach(o=>{this._stopEvent(o)}),this}removeAllListeners(e){let t=[];if(e==null)t=this._events,this._events=[];else{const r=of(e);this._events=this._events.filter(i=>i.tag!==r?!0:(t.push(i),!1))}return t.forEach(r=>{this._stopEvent(r)}),this}}const UX="abstract-signer/5.7.0";var Fo=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const Js=new xe(UX),FX=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],PX=[xe.errors.INSUFFICIENT_FUNDS,xe.errors.NONCE_EXPIRED,xe.errors.REPLACEMENT_UNDERPRICED];class u0{constructor(){Js.checkAbstract(new.target,u0),Ue(this,"_isSigner",!0)}getBalance(e){return Fo(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return Fo(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return Fo(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const t=yield wr(this.checkTransaction(e));return yield this.provider.estimateGas(t)})}call(e,t){return Fo(this,void 0,void 0,function*(){this._checkProvider("call");const r=yield wr(this.checkTransaction(e));return yield this.provider.call(r,t)})}sendTransaction(e){return Fo(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const t=yield this.populateTransaction(e),r=yield this.signTransaction(t);return yield this.provider.sendTransaction(r)})}getChainId(){return Fo(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return Fo(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return Fo(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return Fo(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const r in e)FX.indexOf(r)===-1&&Js.throwArgumentError("invalid transaction key: "+r,"transaction",e);const t=Qn(e);return t.from==null?t.from=this.getAddress():t.from=Promise.all([Promise.resolve(t.from),this.getAddress()]).then(r=>(r[0].toLowerCase()!==r[1].toLowerCase()&&Js.throwArgumentError("from address mismatch","transaction",e),r[0])),t}populateTransaction(e){return Fo(this,void 0,void 0,function*(){const t=yield wr(this.checkTransaction(e));t.to!=null&&(t.to=Promise.resolve(t.to).then(i=>Fo(this,void 0,void 0,function*(){if(i==null)return null;const s=yield this.resolveName(i);return s==null&&Js.throwArgumentError("provided ENS name resolves to null","tx.to",i),s})),t.to.catch(i=>{}));const r=t.maxFeePerGas!=null||t.maxPriorityFeePerGas!=null;if(t.gasPrice!=null&&(t.type===2||r)?Js.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(t.type===0||t.type===1)&&r&&Js.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e),(t.type===2||t.type==null)&&t.maxFeePerGas!=null&&t.maxPriorityFeePerGas!=null)t.type=2;else if(t.type===0||t.type===1)t.gasPrice==null&&(t.gasPrice=this.getGasPrice());else{const i=yield this.getFeeData();if(t.type==null)if(i.maxFeePerGas!=null&&i.maxPriorityFeePerGas!=null)if(t.type=2,t.gasPrice!=null){const s=t.gasPrice;delete t.gasPrice,t.maxFeePerGas=s,t.maxPriorityFeePerGas=s}else t.maxFeePerGas==null&&(t.maxFeePerGas=i.maxFeePerGas),t.maxPriorityFeePerGas==null&&(t.maxPriorityFeePerGas=i.maxPriorityFeePerGas);else i.gasPrice!=null?(r&&Js.throwError("network does not support EIP-1559",xe.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),t.gasPrice==null&&(t.gasPrice=i.gasPrice),t.type=0):Js.throwError("failed to get consistent fee data",xe.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else t.type===2&&(t.maxFeePerGas==null&&(t.maxFeePerGas=i.maxFeePerGas),t.maxPriorityFeePerGas==null&&(t.maxPriorityFeePerGas=i.maxPriorityFeePerGas))}return t.nonce==null&&(t.nonce=this.getTransactionCount("pending")),t.gasLimit==null&&(t.gasLimit=this.estimateGas(t).catch(i=>{if(PX.indexOf(i.code)>=0)throw i;return Js.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",xe.errors.UNPREDICTABLE_GAS_LIMIT,{error:i,tx:t})})),t.chainId==null?t.chainId=this.getChainId():t.chainId=Promise.all([Promise.resolve(t.chainId),this.getChainId()]).then(i=>(i[1]!==0&&i[0]!==i[1]&&Js.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield wr(t)})}_checkProvider(e){this.provider||Js.throwError("missing provider",xe.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class gI extends u0{constructor(e,t){super(),Ue(this,"address",e),Ue(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then(()=>{Js.throwError(e,xe.errors.UNSUPPORTED_OPERATION,{operation:t})})}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,t,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new gI(this.address,e)}}var Tl=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const _r=new xe(Ci),LX=["call","estimateGas"];function km(n,e){if(n==null)return null;if(typeof n.message=="string"&&n.message.match("reverted")){const t=It(n.data)?n.data:null;if(!e||t)return{message:n.message,data:t}}if(typeof n=="object"){for(const t in n){const r=km(n[t],e);if(r)return r}return null}if(typeof n=="string")try{return km(JSON.parse(n),e)}catch{}return null}function qQ(n,e,t){const r=t.transaction||t.signedTransaction;if(n==="call"){const s=km(e,!0);if(s)return s.data;_r.throwError("missing revert data in call exception; Transaction reverted without a reason string",xe.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:e})}if(n==="estimateGas"){let s=km(e.body,!1);s==null&&(s=km(e,!1)),s&&_r.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",xe.errors.UNPREDICTABLE_GAS_LIMIT,{reason:s.message,method:n,transaction:r,error:e})}let i=e.message;throw e.code===xe.errors.SERVER_ERROR&&e.error&&typeof e.error.message=="string"?i=e.error.message:typeof e.body=="string"?i=e.body:typeof e.responseText=="string"&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&_r.throwError("insufficient funds for intrinsic transaction cost",xe.errors.INSUFFICIENT_FUNDS,{error:e,method:n,transaction:r}),i.match(/nonce (is )?too low/i)&&_r.throwError("nonce has already been used",xe.errors.NONCE_EXPIRED,{error:e,method:n,transaction:r}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&_r.throwError("replacement fee too low",xe.errors.REPLACEMENT_UNDERPRICED,{error:e,method:n,transaction:r}),i.match(/only replay-protected/i)&&_r.throwError("legacy pre-eip-155 transactions not supported",xe.errors.UNSUPPORTED_OPERATION,{error:e,method:n,transaction:r}),LX.indexOf(n)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&_r.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",xe.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:r}),e}function gF(n){return new Promise(function(e){setTimeout(e,n)})}function DX(n){if(n.error){const e=new Error(n.error.message);throw e.code=n.error.code,e.data=n.error.data,e}return n.result}function vp(n){return n&&n.toLowerCase()}const NM={};class eH extends u0{constructor(e,t,r){if(super(),e!==NM)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");Ue(this,"provider",t),r==null&&(r=0),typeof r=="string"?(Ue(this,"_address",this.provider.formatter.address(r)),Ue(this,"_index",null)):typeof r=="number"?(Ue(this,"_index",r),Ue(this,"_address",null)):_r.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(e){return _r.throwError("cannot alter JSON-RPC Signer connection",xe.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new NX(NM,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&_r.throwError("unknown account #"+this._index,xe.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=Qn(e);const t=this.getAddress().then(r=>(r&&(r=r.toLowerCase()),r));if(e.gasLimit==null){const r=Qn(e);r.from=t,e.gasLimit=this.provider.estimateGas(r)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(r=>Tl(this,void 0,void 0,function*(){if(r==null)return null;const i=yield this.provider.resolveName(r);return i==null&&_r.throwArgumentError("provided ENS name resolves to null","tx.to",r),i}))),wr({tx:wr(e),sender:t}).then(({tx:r,sender:i})=>{r.from!=null?r.from.toLowerCase()!==i&&_r.throwArgumentError("from address mismatch","transaction",e):r.from=i;const s=this.provider.constructor.hexlifyTransaction(r,{from:!0});return this.provider.send("eth_sendTransaction",[s]).then(o=>o,o=>(typeof o.message=="string"&&o.message.match(/user denied/i)&&_r.throwError("user rejected transaction",xe.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:r}),qQ("sendTransaction",o,s)))})}signTransaction(e){return _r.throwError("signing transactions is unsupported",xe.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return Tl(this,void 0,void 0,function*(){const t=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),r=yield this.sendUncheckedTransaction(e);try{return yield vh(()=>Tl(this,void 0,void 0,function*(){const i=yield this.provider.getTransaction(r);if(i!==null)return this.provider._wrapTransaction(i,r,t)}),{oncePoll:this.provider})}catch(i){throw i.transactionHash=r,i}})}signMessage(e){return Tl(this,void 0,void 0,function*(){const t=typeof e=="string"?$a(e):e,r=yield this.getAddress();try{return yield this.provider.send("personal_sign",[lt(t),r.toLowerCase()])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&_r.throwError("user rejected signing",xe.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:e}),i}})}_legacySignMessage(e){return Tl(this,void 0,void 0,function*(){const t=typeof e=="string"?$a(e):e,r=yield this.getAddress();try{return yield this.provider.send("eth_sign",[r.toLowerCase(),lt(t)])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&_r.throwError("user rejected signing",xe.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:e}),i}})}_signTypedData(e,t,r){return Tl(this,void 0,void 0,function*(){const i=yield ws.resolveNames(e,t,r,o=>this.provider.resolveName(o)),s=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[s.toLowerCase(),JSON.stringify(ws.getPayload(i.domain,t,i.value))])}catch(o){throw typeof o.message=="string"&&o.message.match(/user denied/i)&&_r.throwError("user rejected signing",xe.errors.ACTION_REJECTED,{action:"_signTypedData",from:s,messageData:{domain:i.domain,types:t,value:i.value}}),o}})}unlock(e){return Tl(this,void 0,void 0,function*(){const t=this.provider,r=yield this.getAddress();return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])})}}class NX extends eH{sendTransaction(e){return this.sendUncheckedTransaction(e).then(t=>({hash:t,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:r=>this.provider.waitForTransaction(t,r)}))}}const OX={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class fg extends mI{constructor(e,t){let r=t;r==null&&(r=new Promise((i,s)=>{setTimeout(()=>{this.detectNetwork().then(o=>{i(o)},o=>{s(o)})},0)})),super(r),e||(e=Cs(this.constructor,"defaultUrl")()),typeof e=="string"?Ue(this,"connection",Object.freeze({url:e})):Ue(this,"connection",Object.freeze(Qn(e))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return Tl(this,void 0,void 0,function*(){yield gF(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch{try{e=yield this.send("net_version",[])}catch{}}if(e!=null){const t=Cs(this.constructor,"getNetwork");try{return t(je.from(e).toNumber())}catch(r){return _r.throwError("could not detect network",xe.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:r})}}return _r.throwError("could not detect network",xe.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new eH(NM,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(t=>this.formatter.address(t)))}send(e,t){const r={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:Ps(r),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const s=Ox(this.connection,JSON.stringify(r),DX).then(o=>(this.emit("debug",{action:"response",request:r,response:o,provider:this}),o),o=>{throw this.emit("debug",{action:"response",error:o,request:r,provider:this}),o});return i&&(this._cache[e]=s,setTimeout(()=>{this._cache[e]=null},0)),s}prepareRequest(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[vp(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[vp(t.address),t.blockTag]];case"getCode":return["eth_getCode",[vp(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[vp(t.address),ir(t.position,32),t.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[t.signedTransaction]];case"getBlock":return t.blockTag?["eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]]:t.blockHash?["eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[t.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[t.transactionHash]];case"call":return["eth_call",[Cs(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[Cs(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&t.filter.address!=null&&(t.filter.address=vp(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return Tl(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){const i=t.transaction;if(i&&i.type!=null&&je.from(i.type).isZero()&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const s=yield this.getFeeData();s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null&&(t=Qn(t),t.transaction=Qn(i),delete t.transaction.type)}}const r=this.prepareRequest(e,t);r==null&&_r.throwError(e+" not implemented",xe.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(r[0],r[1])}catch(i){return qQ(e,i,t)}})}_startEvent(e){e.tag==="pending"&&this._startPending(),super._startEvent(e)}_startPending(){if(this._pendingFilter!=null)return;const e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then(function(r){function i(){e.send("eth_getFilterChanges",[r]).then(function(s){if(e._pendingFilter!=t)return null;let o=Promise.resolve();return s.forEach(function(a){e._emitted["t:"+a.toLowerCase()]="pending",o=o.then(function(){return e.getTransaction(a).then(function(l){return e.emit("pending",l),null})})}),o.then(function(){return gF(1e3)})}).then(function(){if(e._pendingFilter!=t){e.send("eth_uninstallFilter",[r]);return}return setTimeout(function(){i()},0),null}).catch(s=>{})}return i(),r}).catch(r=>{})}_stopEvent(e){e.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,t){const r=Qn(OX);if(t)for(const s in t)t[s]&&(r[s]=!0);f9(e,r);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(s){if(e[s]==null)return;const o=Fx(je.from(e[s]));s==="gasLimit"&&(s="gas"),i[s]=o}),["from","to","data"].forEach(function(s){e[s]!=null&&(i[s]=lt(e[s]))}),e.accessList&&(i.accessList=Wu(e.accessList)),i}}let Qm=null;try{if(Qm=WebSocket,Qm==null)throw new Error("inject please")}catch{const e=new xe(Ci);Qm=function(){e.throwError("WebSockets not supported in this environment",xe.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var Rb=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const G0=new xe(Ci);let kX=1;class vI extends fg{constructor(e,t){t==="any"&&G0.throwError("WebSocketProvider does not support 'any' network yet",xe.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,t):super("_websocket",t),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?Ue(this,"_websocket",new Qm(this.connection.url)):Ue(this,"_websocket",e),Ue(this,"_requests",{}),Ue(this,"_subs",{}),Ue(this,"_subIds",{}),Ue(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(i=>{this.websocket.send(this._requests[i].payload)})},this.websocket.onmessage=i=>{const s=i.data,o=JSON.parse(s);if(o.id!=null){const a=String(o.id),l=this._requests[a];if(delete this._requests[a],o.result!==void 0)l.callback(null,o.result),this.emit("debug",{action:"response",request:JSON.parse(l.payload),response:o.result,provider:this});else{let c=null;o.error?(c=new Error(o.error.message||"unknown error"),Ue(c,"code",o.error.code||null),Ue(c,"response",s)):c=new Error("unknown error"),l.callback(c,void 0),this.emit("debug",{action:"response",error:c,request:JSON.parse(l.payload),provider:this})}}else if(o.method==="eth_subscription"){const a=this._subs[o.params.subscription];a&&a.processFunc(o.params.result)}else console.warn("this should not happen")};const r=setInterval(()=>{this.emit("poll")},1e3);r.unref&&r.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){G0.throwError("cannot reset events block on WebSocketProvider",xe.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){G0.throwError("cannot set polling interval on WebSocketProvider",xe.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return Rb(this,void 0,void 0,function*(){return null})}set polling(e){e&&G0.throwError("cannot set polling on WebSocketProvider",xe.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,t){const r=kX++;return new Promise((i,s)=>{function o(l,c){return l?s(l):i(c)}const a=JSON.stringify({method:e,params:t,id:r,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(a),provider:this}),this._requests[String(r)]={callback:o,payload:a},this._wsReady&&this.websocket.send(a)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,t,r){return Rb(this,void 0,void 0,function*(){let i=this._subIds[e];i==null&&(i=Promise.all(t).then(o=>this.send("eth_subscribe",o)),this._subIds[e]=i);const s=yield i;this._subs[s]={tag:e,processFunc:r}})}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],t=>{const r=je.from(t.number).toNumber();this._emitted.block=r,this.emit("block",r)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],t=>{this.emit("pending",t)});break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],t=>{t.removed==null&&(t.removed=!1),this.emit(e.filter,this.formatter.filterLog(t))});break;case"tx":{const t=r=>{const i=r.hash;this.getTransactionReceipt(i).then(s=>{s&&this.emit(i,s)})};t(e),this._subscribe("tx",["newHeads"],r=>{this._events.filter(i=>i.type==="tx").forEach(t)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e);break}}_stopEvent(e){let t=e.tag;if(e.type==="tx"){if(this._events.filter(i=>i.type==="tx").length)return;t="tx"}else if(this.listenerCount(e.event))return;const r=this._subIds[t];r&&(delete this._subIds[t],r.then(i=>{this._subs[i]&&(delete this._subs[i],this.send("eth_unsubscribe",[i]))}))}destroy(){return Rb(this,void 0,void 0,function*(){this.websocket.readyState===Qm.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}var QX=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const dm=new xe(Ci);class tH extends fg{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return QX(this,void 0,void 0,function*(){let t=this.network;return t==null&&(t=yield e.detectNetwork.call(this),t||dm.throwError("no network detected",xe.errors.UNKNOWN_ERROR,{}),this._network==null&&(Ue(this,"_network",t),this.emit("network",t,null))),t})}}class SA extends tH{constructor(e,t){dm.checkAbstract(new.target,SA),e=Cs(new.target,"getNetwork")(e),t=Cs(new.target,"getApiKey")(t);const r=Cs(new.target,"getUrl")(e,t);super(r,e),typeof t=="string"?Ue(this,"apiKey",t):t!=null&&Object.keys(t).forEach(i=>{Ue(this,i,t[i])})}_startPending(){dm.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return dm.throwError("API provider does not support signing",xe.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,t){return dm.throwError("not implemented; sub-classes must override getUrl",xe.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const vF=new xe(Ci),ow="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class HX extends vI{constructor(e,t){const r=new nH(e,t),i=r.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(i,r.network),Ue(this,"apiKey",r.apiKey)}isCommunityResource(){return this.apiKey===ow}}class nH extends SA{static getWebSocketProvider(e,t){return new HX(e,t)}static getApiKey(e){return e==null?ow:(e&&typeof e!="string"&&vF.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,t){let r=null;switch(e.name){case"homestead":r="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":r="eth-goerli.g.alchemy.com/v2/";break;case"matic":r="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":r="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":r="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":r="arb-goerli.g.alchemy.com/v2/";break;case"optimism":r="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":r="opt-goerli.g.alchemy.com/v2/";break;default:vF.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+r+t,throttleCallback:(i,s)=>(t===ow&&zx(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===ow}}const zX=new xe(Ci),V0="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function GX(n){switch(n){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return zX.throwArgumentError("unsupported network","name",n)}class VX extends SA{isCommunityResource(){return this.apiKey===V0}static getApiKey(e){return e??V0}static getUrl(e,t){t==null&&(t=V0);const r={allowGzip:!0,url:"https://"+GX(e.name)+t,throttleCallback:(i,s)=>(t.apiKey===V0&&zx(),Promise.resolve(!0))};return t.projectSecret!=null&&(r.user="",r.password=t.projectSecret),r}}var jX=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const yF=new xe(Ci);class WX extends SA{static getApiKey(e){return e!=null&&yF.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,t){let r=null;switch(e.name){case"homestead":r="https://cloudflare-eth.com/";break;default:yF.throwArgumentError("unsupported network","network",arguments[0])}return r}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return jX(this,void 0,void 0,function*(){return e==="getBlockNumber"?(yield r.perform.call(this,"getBlock",{blockTag:"latest"})).number:r.perform.call(this,e,t)})}}var j0=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const Hc=new xe(Ci);function wF(n){const e={};for(let t in n){if(n[t]==null)continue;let r=n[t];t==="type"&&r===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[t]?r=Fx(lt(r)):t==="accessList"?r="["+Wu(r).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":r=lt(r),e[t]=r)}return e}function KX(n){if(n.status==0&&(n.message==="No records found"||n.message==="No transactions found"))return n.result;if(n.status!=1||typeof n.message!="string"||!n.message.match(/^OK/)){const e=new Error("invalid response");throw e.result=JSON.stringify(n),(n.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return n.result}function _F(n){if(n&&n.status==0&&n.message=="NOTOK"&&(n.result||"").toLowerCase().indexOf("rate limit")>=0){const e=new Error("throttled response");throw e.result=JSON.stringify(n),e.throttleRetry=!0,e}if(n.jsonrpc!="2.0"){const e=new Error("invalid response");throw e.result=JSON.stringify(n),e}if(n.error){const e=new Error(n.error.message||"unknown error");throw n.error.code&&(e.code=n.error.code),n.error.data&&(e.data=n.error.data),e}return n.result}function xF(n){if(n==="pending")throw new Error("pending not supported");return n==="latest"?n:parseInt(n.substring(2),16)}function Ub(n,e,t){if(n==="call"&&e.code===xe.errors.SERVER_ERROR){const i=e.error;if(i&&(i.message.match(/reverted/i)||i.message.match(/VM execution error/i))){let s=i.data;if(s&&(s="0x"+s.replace(/^.*0x/i,"")),It(s))return s;Hc.throwError("missing revert data in call exception",xe.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let r=e.message;throw e.code===xe.errors.SERVER_ERROR&&(e.error&&typeof e.error.message=="string"?r=e.error.message:typeof e.body=="string"?r=e.body:typeof e.responseText=="string"&&(r=e.responseText)),r=(r||"").toLowerCase(),r.match(/insufficient funds/)&&Hc.throwError("insufficient funds for intrinsic transaction cost",xe.errors.INSUFFICIENT_FUNDS,{error:e,method:n,transaction:t}),r.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&Hc.throwError("nonce has already been used",xe.errors.NONCE_EXPIRED,{error:e,method:n,transaction:t}),r.match(/another transaction with same nonce/)&&Hc.throwError("replacement fee too low",xe.errors.REPLACEMENT_UNDERPRICED,{error:e,method:n,transaction:t}),r.match(/execution failed due to an exception|execution reverted/)&&Hc.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",xe.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:t}),e}class XX extends mI{constructor(e,t){super(e),Ue(this,"baseUrl",this.getBaseUrl()),Ue(this,"apiKey",t||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return Hc.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,t){const r=Object.keys(t).reduce((s,o)=>{const a=t[o];return a!=null&&(s+=`&${o}=${a}`),s},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${r}${i}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,t){return t.module=e,t.apikey=this.apiKey,t}fetch(e,t,r){return j0(this,void 0,void 0,function*(){const i=r?this.getPostUrl():this.getUrl(e,t),s=r?this.getPostData(e,t):null,o=e==="proxy"?_F:KX;this.emit("debug",{action:"request",request:i,provider:this});const a={url:i,throttleSlotInterval:1e3,throttleCallback:(A,u)=>(this.isCommunityResource()&&zx(),Promise.resolve(!0))};let l=null;s&&(a.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},l=Object.keys(s).map(A=>`${A}=${s[A]}`).join("&"));const c=yield Ox(a,l,o||_F);return this.emit("debug",{action:"response",request:i,response:Ps(c),provider:this}),c})}detectNetwork(){return j0(this,void 0,void 0,function*(){return this.network})}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return j0(this,void 0,void 0,function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:t.address,tag:t.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:t.address,tag:t.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:t.address,tag:t.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:t.address,position:t.position,tag:t.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:t.signedTransaction},!0).catch(i=>Ub("sendTransaction",i,t.signedTransaction));case"getBlock":if(t.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:t.blockTag,boolean:t.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:t.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:t.transactionHash});case"call":{if(t.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const i=wF(t.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(s){return Ub("call",s,t.transaction)}}case"estimateGas":{const i=wF(t.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(s){return Ub("estimateGas",s,t.transaction)}}case"getLogs":{const i={action:"getLogs"};if(t.filter.fromBlock&&(i.fromBlock=xF(t.filter.fromBlock)),t.filter.toBlock&&(i.toBlock=xF(t.filter.toBlock)),t.filter.address&&(i.address=t.filter.address),t.filter.topics&&t.filter.topics.length>0&&(t.filter.topics.length>1&&Hc.throwError("unsupported topic count",xe.errors.UNSUPPORTED_OPERATION,{topics:t.filter.topics}),t.filter.topics.length===1)){const a=t.filter.topics[0];(typeof a!="string"||a.length!==66)&&Hc.throwError("unsupported topic format",xe.errors.UNSUPPORTED_OPERATION,{topic0:a}),i.topic0=a}const s=yield this.fetch("logs",i);let o={};for(let a=0;a{["contractAddress","to"].forEach(function(l){o[l]==""&&delete o[l]}),o.creates==null&&o.contractAddress!=null&&(o.creates=o.contractAddress);const a=this.formatter.transactionResponse(o);return o.timeStamp&&(a.timestamp=parseInt(o.timeStamp)),a})})}isCommunityResource(){return this.apiKey==null}}function YX(n){n=n.slice();for(let e=n.length-1;e>0;e--){const t=Math.floor(Math.random()*(e+1)),r=n[e];n[e]=n[t],n[t]=r}return n}var t_=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const ou=new xe(Ci);function W0(){return new Date().getTime()}function bF(n){let e=null;for(let t=0;te?null:(r+i)/2}function yh(n){if(n===null)return"null";if(typeof n=="number"||typeof n=="boolean")return JSON.stringify(n);if(typeof n=="string")return n;if(je.isBigNumber(n))return n.toString();if(Array.isArray(n))return JSON.stringify(n.map(e=>yh(e)));if(typeof n=="object"){const e=Object.keys(n);return e.sort(),"{"+e.map(t=>{let r=n[t];return typeof r=="function"?r="[function]":r=yh(r),JSON.stringify(t)+":"+r}).join(",")+"}"}throw new Error("unknown value type: "+typeof n)}let $X=1;function BF(n){let e=null,t=null,r=new Promise(o=>{e=function(){t&&(clearTimeout(t),t=null),o()},t=setTimeout(e,n)});const i=o=>(r=r.then(o),r);function s(){return r}return{cancel:e,getPromise:s,wait:i}}const ZX=[xe.errors.CALL_EXCEPTION,xe.errors.INSUFFICIENT_FUNDS,xe.errors.NONCE_EXPIRED,xe.errors.REPLACEMENT_UNDERPRICED,xe.errors.UNPREDICTABLE_GAS_LIMIT],JX=["address","args","errorArgs","errorSignature","method","transaction"];function K0(n,e){const t={weight:n.weight};return Object.defineProperty(t,"provider",{get:()=>n.provider}),n.start&&(t.start=n.start),e&&(t.duration=e-n.start),n.done&&(n.error?t.error=n.error:t.result=n.result||null),t}function qX(n,e){return function(t){const r={};t.forEach(s=>{const o=n(s.result);r[o]||(r[o]={count:0,result:s.result}),r[o].count++});const i=Object.keys(r);for(let s=0;s=e)return o.result}}}function eY(n,e,t){let r=yh;switch(e){case"getBlockNumber":return function(i){const s=i.map(a=>a.result);let o=EF(i.map(a=>a.result),2);if(o!=null)return o=Math.ceil(o),s.indexOf(o+1)>=0&&o++,o>=n._highestBlockNumber&&(n._highestBlockNumber=o),n._highestBlockNumber};case"getGasPrice":return function(i){const s=i.map(o=>o.result);return s.sort(),s[Math.floor(s.length/2)]};case"getEtherPrice":return function(i){return EF(i.map(s=>s.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":r=function(i){return i==null?null:(i=Qn(i),i.confirmations=-1,yh(i))};break;case"getBlock":t.includeTransactions?r=function(i){return i==null?null:(i=Qn(i),i.transactions=i.transactions.map(s=>(s=Qn(s),s.confirmations=-1,s)),yh(i))}:r=function(i){return i==null?null:yh(i)};break;default:throw new Error("unknown method: "+e)}return qX(r,n.quorum)}function yp(n,e){return t_(this,void 0,void 0,function*(){const t=n.provider;return t.blockNumber!=null&&t.blockNumber>=e||e===-1?t:vh(()=>new Promise((r,i)=>{setTimeout(function(){return t.blockNumber>=e?r(t):n.cancelled?r(null):r(void 0)},0)}),{oncePoll:t})})}function tY(n,e,t,r){return t_(this,void 0,void 0,function*(){let i=n.provider;switch(t){case"getBlockNumber":case"getGasPrice":return i[t]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return r.blockTag&&It(r.blockTag)&&(i=yield yp(n,e)),i[t](r.address,r.blockTag||"latest");case"getStorageAt":return r.blockTag&&It(r.blockTag)&&(i=yield yp(n,e)),i.getStorageAt(r.address,r.position,r.blockTag||"latest");case"getBlock":return r.blockTag&&It(r.blockTag)&&(i=yield yp(n,e)),i[r.includeTransactions?"getBlockWithTransactions":"getBlock"](r.blockTag||r.blockHash);case"call":case"estimateGas":return r.blockTag&&It(r.blockTag)&&(i=yield yp(n,e)),t==="call"&&r.blockTag?i[t](r.transaction,r.blockTag):i[t](r.transaction);case"getTransaction":case"getTransactionReceipt":return i[t](r.transactionHash);case"getLogs":{let s=r.filter;return(s.fromBlock&&It(s.fromBlock)||s.toBlock&&It(s.toBlock))&&(i=yield yp(n,e)),i.getLogs(s)}}return ou.throwError("unknown method error",xe.errors.UNKNOWN_ERROR,{method:t,params:r})})}class nY extends mI{constructor(e,t){e.length===0&&ou.throwArgumentError("missing providers","providers",e);const r=e.map((o,a)=>{if(l0.isProvider(o)){const A=lF(o)?2e3:750;return Object.freeze({provider:o,weight:1,stallTimeout:A,priority:1})}const l=Qn(o);l.priority==null&&(l.priority=1),l.stallTimeout==null&&(l.stallTimeout=lF(o)?2e3:750),l.weight==null&&(l.weight=1);const c=l.weight;return(c%1||c>512||c<1)&&ou.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${a}].weight`,c),Object.freeze(l)}),i=r.reduce((o,a)=>o+a.weight,0);t==null?t=i/2:t>i&&ou.throwArgumentError("quorum will always fail; larger than total weight","quorum",t);let s=bF(r.map(o=>o.provider.network));s==null&&(s=new Promise((o,a)=>{setTimeout(()=>{this.detectNetwork().then(o,a)},0)})),super(s),Ue(this,"providerConfigs",Object.freeze(r)),Ue(this,"quorum",t),this._highestBlockNumber=-1}detectNetwork(){return t_(this,void 0,void 0,function*(){const e=yield Promise.all(this.providerConfigs.map(t=>t.provider.getNetwork()));return bF(e)})}perform(e,t){return t_(this,void 0,void 0,function*(){if(e==="sendTransaction"){const l=yield Promise.all(this.providerConfigs.map(c=>c.provider.sendTransaction(t.signedTransaction).then(A=>A.hash,A=>A)));for(let c=0;cl.priority-c.priority);const s=this._highestBlockNumber;let o=0,a=!0;for(;;){const l=W0();let c=i.filter(h=>h.runner&&l-h.starth+d.weight,0);for(;c{h.staller=null}),h.runner=tY(h,s,e,t).then(m=>{h.done=!0,h.result=m,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:d,backend:K0(h,W0()),request:{method:e,params:Ps(t)},provider:this})},m=>{h.done=!0,h.error=m,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:d,backend:K0(h,W0()),request:{method:e,params:Ps(t)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:d,backend:K0(h,null),request:{method:e,params:Ps(t)},provider:this}),c+=h.weight}const A=[];i.forEach(h=>{h.done||!h.runner||(A.push(h.runner),h.staller&&A.push(h.staller.getPromise()))}),A.length&&(yield Promise.race(A));const u=i.filter(h=>h.done&&h.error==null);if(u.length>=this.quorum){const h=r(u);if(h!==void 0)return i.forEach(d=>{d.staller&&d.staller.cancel(),d.cancelled=!0}),h;a||(yield BF(100).getPromise()),a=!1}const f=i.reduce((h,d)=>{if(!d.done||d.error==null)return h;const m=d.error.code;return ZX.indexOf(m)>=0&&(h[m]||(h[m]={error:d.error,weight:0}),h[m].weight+=d.weight),h},{});if(Object.keys(f).forEach(h=>{const d=f[h];if(d.weight{p.staller&&p.staller.cancel(),p.cancelled=!0});const m=d.error,g={};JX.forEach(p=>{m[p]!=null&&(g[p]=m[p])}),ou.throwError(m.reason||m.message,h,g)}),i.filter(h=>!h.done).length===0)break}return i.forEach(l=>{l.staller&&l.staller.cancel(),l.cancelled=!0}),ou.throwError("failed to meet quorum",xe.errors.SERVER_ERROR,{method:e,params:t,results:i.map(l=>K0(l)),provider:this})})}}const rY=null,aw=new xe(Ci),pm="84842078b09946638c03157f83405213";class iY extends vI{constructor(e,t){const r=new rH(e,t),i=r.connection;i.password&&aw.throwError("INFURA WebSocket project secrets unsupported",xe.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const s=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(s,e),Ue(this,"apiKey",r.projectId),Ue(this,"projectId",r.projectId),Ue(this,"projectSecret",r.projectSecret)}isCommunityResource(){return this.projectId===pm}}class rH extends SA{static getWebSocketProvider(e,t){return new iY(e,t)}static getApiKey(e){const t={apiKey:pm,projectId:pm,projectSecret:null};return e==null||(typeof e=="string"?t.projectId=e:e.projectSecret!=null?(aw.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),aw.assertArgument(typeof e.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),t.projectId=e.projectId,t.projectSecret=e.projectSecret):e.projectId&&(t.projectId=e.projectId),t.apiKey=t.projectId),t}static getUrl(e,t){let r=null;switch(e?e.name:"unknown"){case"homestead":r="mainnet.infura.io";break;case"goerli":r="goerli.infura.io";break;case"sepolia":r="sepolia.infura.io";break;case"matic":r="polygon-mainnet.infura.io";break;case"maticmum":r="polygon-mumbai.infura.io";break;case"optimism":r="optimism-mainnet.infura.io";break;case"optimism-goerli":r="optimism-goerli.infura.io";break;case"arbitrum":r="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":r="arbitrum-goerli.infura.io";break;default:aw.throwError("unsupported network",xe.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+r+"/v3/"+t.projectId,throttleCallback:(s,o)=>(t.projectId===pm&&zx(),Promise.resolve(!0))};return t.projectSecret!=null&&(i.user="",i.password=t.projectSecret),i}isCommunityResource(){return this.projectId===pm}}const Fb=new xe(Ci),sY="ETHERS_JS_SHARED";class oY extends SA{static getApiKey(e){return e&&typeof e!="string"&&Fb.throwArgumentError("invalid apiKey","apiKey",e),e||sY}static getUrl(e,t){Fb.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let r=null;switch(e.name){case"homestead":r="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":r="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":r="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":r="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":r="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:Fb.throwArgumentError("unsupported network","network",arguments[0])}return r+"?apiKey="+t}}const MF=new xe(Ci),SF="62e1ad51b37b8e00394bda3b";class aY extends SA{static getApiKey(e){const t={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?t.applicationId=SF:typeof e=="string"?t.applicationId=e:e.applicationSecretKey!=null?(t.applicationId=e.applicationId,t.applicationSecretKey=e.applicationSecretKey):e.applicationId?t.applicationId=e.applicationId:MF.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),t}static getUrl(e,t){let r=null;switch(e?e.name:"unknown"){case"goerli":r="eth-goerli.gateway.pokt.network";break;case"homestead":r="eth-mainnet.gateway.pokt.network";break;case"kovan":r="poa-kovan.gateway.pokt.network";break;case"matic":r="poly-mainnet.gateway.pokt.network";break;case"maticmum":r="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":r="eth-rinkeby.gateway.pokt.network";break;case"ropsten":r="eth-ropsten.gateway.pokt.network";break;default:MF.throwError("unsupported network",xe.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i=`https://${r}/v1/lb/${t.applicationId}`,s={headers:{},url:i};return t.applicationSecretKey!=null&&(s.user="",s.password=t.applicationSecretKey),s}isCommunityResource(){return this.applicationId===SF}}const CF=new xe(Ci);let lY=1;function TF(n,e){const t="Web3LegacyFetcher";return function(r,i){const s={method:r,params:i,id:lY++,jsonrpc:"2.0"};return new Promise((o,a)=>{this.emit("debug",{action:"request",fetcher:t,request:Ps(s),provider:this}),e(s,(l,c)=>{if(l)return this.emit("debug",{action:"response",fetcher:t,error:l,request:s,provider:this}),a(l);if(this.emit("debug",{action:"response",fetcher:t,request:s,response:c,provider:this}),c.error){const A=new Error(c.error.message);return A.code=c.error.code,A.data=c.error.data,a(A)}o(c.result)})})}}function cY(n){return function(e,t){t==null&&(t=[]);const r={method:e,params:t};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:Ps(r),provider:this}),n.request(r).then(i=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,response:i,provider:this}),i),i=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,error:i,provider:this}),i})}}class yI extends fg{constructor(e,t){e==null&&CF.throwArgumentError("missing provider","provider",e);let r=null,i=null,s=null;typeof e=="function"?(r="unknown:",i=e):(r=e.host||e.path||"",!r&&e.isMetaMask&&(r="metamask"),s=e,e.request?(r===""&&(r="eip-1193:"),i=cY(e)):e.sendAsync?i=TF(e,e.sendAsync.bind(e)):e.send?i=TF(e,e.send.bind(e)):CF.throwArgumentError("unsupported provider","provider",e),r||(r="unknown:")),super(r,t),Ue(this,"jsonRpcFetchFunc",i),Ue(this,"provider",s)}send(e,t){return this.jsonRpcFetchFunc(e,t)}}const IF=new xe(Ci);function AY(n,e){if(n==null&&(n="homestead"),typeof n=="string"){const r=n.match(/^(ws|http)s?:/i);if(r)switch(r[1].toLowerCase()){case"http":case"https":return new fg(n);case"ws":case"wss":return new vI(n);default:IF.throwArgumentError("unsupported URL scheme","network",n)}}const t=tQ(n);return(!t||!t._defaultProvider)&&IF.throwError("unsupported getDefaultProvider network",xe.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:n}),t._defaultProvider({FallbackProvider:nY,AlchemyProvider:nH,AnkrProvider:VX,CloudflareProvider:WX,EtherscanProvider:XX,InfuraProvider:rH,JsonRpcProvider:fg,NodesmithProvider:oY,PocketProvider:aY,Web3Provider:yI,IpcProvider:rY},e)}var uY=!0,Pb="Invariant failed";function kl(n,e){if(!n){if(uY)throw new Error(Pb);var t=typeof e=="function"?e():e,r=t?"".concat(Pb,": ").concat(t):Pb;throw new Error(r)}}var Yo;(function(n){n.Update="Web3ReactUpdate",n.Error="Web3ReactError",n.Deactivate="Web3ReactDeactivate"})(Yo||(Yo={}));function hg(){return hg=Object.assign||function(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function lw(n,e,t){return fY()?lw=Reflect.construct:lw=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),c=new l;return o&&dg(c,o.prototype),c},lw.apply(null,arguments)}function hY(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function n_(n){var e=typeof Map=="function"?new Map:void 0;return n_=function(r){if(r===null||!hY(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return lw(r,arguments,OM(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),dg(i,r)},n_(n)}typeof Symbol<"u"&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")));typeof Symbol<"u"&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));function RF(n,e){try{var t=n()}catch(r){return e(r)}return t&&t.then?t.then(void 0,e):t}function sH(n){if(typeof n=="string"){n=n.replace(/^Ox/,"0x");var e=Number.parseInt(n,n.trim().substring(0,2)==="0x"?16:10);return Number.isNaN(e)&&kl(!1),e}else return Number.isInteger(n)||kl(!1),n}function oH(n){typeof n=="string"&&n.match(/^(0x)?[0-9a-fA-F]{40}$/)||kl(!1);for(var e=n.substring(0,2)==="0x"?n:"0x"+n,t=e.toLowerCase().substring(2).split(""),r=new Uint8Array(40),i=0;i<40;i++)r[i]=t[i].charCodeAt(0);for(var s=pt(Er(r)),o=0;o<40;o+=2)s[o>>1]>>4>=8&&(t[o]=t[o].toUpperCase()),(s[o>>1]&15)>=8&&(t[o+1]=t[o+1].toUpperCase());var a="0x"+t.join("");return e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==a&&kl(!1),a}var UF=function(e,t){try{var r=function(o){return Promise.resolve(Promise.all([t.chainId===void 0?e.getChainId():t.chainId,t.account===void 0?e.getAccount():t.account])).then(function(a){var l=a[0],c=a[1],A=sH(l);if(e.supportedChainIds&&!e.supportedChainIds.includes(A))throw new aH(A,e.supportedChainIds);var u=c===null?c:oH(c);return{provider:o,chainId:A,account:u}})},i=t.provider===void 0;return Promise.resolve(i?Promise.resolve(e.getProvider()).then(r):r(t.provider))}catch(s){return Promise.reject(s)}},X0=function(n){iH(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t}return e}(n_(Error)),aH=function(n){iH(e,n);function e(t,r){var i;return i=n.call(this)||this,i.name=i.constructor.name,i.message="Unsupported chain id: "+t+". Supported chain ids are: "+r+".",i}return e}(n_(Error)),zr;(function(n){n[n.ACTIVATE_CONNECTOR=0]="ACTIVATE_CONNECTOR",n[n.UPDATE=1]="UPDATE",n[n.UPDATE_FROM_ERROR=2]="UPDATE_FROM_ERROR",n[n.ERROR=3]="ERROR",n[n.ERROR_FROM_ACTIVATION=4]="ERROR_FROM_ACTIVATION",n[n.DEACTIVATE_CONNECTOR=5]="DEACTIVATE_CONNECTOR"})(zr||(zr={}));function dY(n,e){var t=e.type,r=e.payload;switch(t){case zr.ACTIVATE_CONNECTOR:{var i=r.connector,s=r.provider,o=r.chainId,a=r.account,l=r.onError;return{connector:i,provider:s,chainId:o,account:a,onError:l}}case zr.UPDATE:{var c=r.provider,A=r.chainId,u=r.account;return hg({},n,c===void 0?{}:{provider:c},A===void 0?{}:{chainId:A},u===void 0?{}:{account:u})}case zr.UPDATE_FROM_ERROR:{var f=r.provider,h=r.chainId,d=r.account;return hg({},n,f===void 0?{}:{provider:f},h===void 0?{}:{chainId:h},d===void 0?{}:{account:d},{error:void 0})}case zr.ERROR:{var m=r.error,g=n.connector,p=n.onError;return{connector:g,error:m,onError:p}}case zr.ERROR_FROM_ACTIVATION:{var v=r.connector,w=r.error;return{connector:v,error:w}}case zr.DEACTIVATE_CONNECTOR:return{}}}function pY(){var n=be.useReducer(dY,{}),e=n[0],t=n[1],r=e.connector,i=e.provider,s=e.chainId,o=e.account,a=e.onError,l=e.error,c=be.useRef(-1);c.current+=1;var A=be.useCallback(function(g,p,v){v===void 0&&(v=!1);try{var w=c.current,_=!1;return Promise.resolve(RF(function(){return Promise.resolve(g.activate().then(function(x){return _=!0,x})).then(function(x){return Promise.resolve(UF(g,x)).then(function(b){if(c.current>w)throw new X0;t({type:zr.ACTIVATE_CONNECTOR,payload:hg({connector:g},b,{onError:p})})})})},function(x){if(x instanceof X0)_&&g.deactivate();else{if(v)throw _&&g.deactivate(),x;p?(_&&g.deactivate(),p(x)):t({type:zr.ERROR_FROM_ACTIVATION,payload:{connector:g,error:x}})}}))}catch(x){return Promise.reject(x)}},[]),u=be.useCallback(function(g){t({type:zr.ERROR,payload:{error:g}})},[]),f=be.useCallback(function(){t({type:zr.DEACTIVATE_CONNECTOR})},[]),h=be.useCallback(function(g){try{if(!r)throw Error("This should never happen, it's just so Typescript stops complaining");var p=c.current;return Promise.resolve(function(){if(l)return RF(function(){return Promise.resolve(UF(r,g)).then(function(x){if(c.current>p)throw new X0;t({type:zr.UPDATE_FROM_ERROR,payload:x})})},function(x){x instanceof X0||(a?a(x):t({type:zr.ERROR,payload:{error:x}}))});var v=g.chainId===void 0?void 0:sH(g.chainId);if(v!==void 0&&r.supportedChainIds&&!r.supportedChainIds.includes(v)){var w=new aH(v,r.supportedChainIds);a?a(w):t({type:zr.ERROR,payload:{error:w}})}else{var _=typeof g.account=="string"?oH(g.account):g.account;t({type:zr.UPDATE,payload:{provider:g.provider,chainId:v,account:_}})}}())}catch(v){return Promise.reject(v)}},[r,l,a]),d=be.useCallback(function(g){a?a(g):t({type:zr.ERROR,payload:{error:g}})},[a]),m=be.useCallback(function(){t({type:zr.DEACTIVATE_CONNECTOR})},[]);return be.useEffect(function(){return function(){r&&r.deactivate()}},[r]),be.useEffect(function(){return r&&r.on(Yo.Update,h).on(Yo.Error,d).on(Yo.Deactivate,m),function(){r&&r.off(Yo.Update,h).off(Yo.Error,d).off(Yo.Deactivate,m)}},[r,h,d,m]),{connector:r,provider:i,chainId:s,account:o,activate:A,setError:u,deactivate:f,error:l}}var lH="primary",wh={};function mY(n){wh[n]&&kl(!1),wh[n]=be.createContext({activate:function(){try{return kl(!1),Promise.resolve()}catch(t){return Promise.reject(t)}},setError:function(){kl(!1)},deactivate:function(){kl(!1)},active:!1}),wh[n].displayName="Web3ReactContext - "+n;var e=wh[n].Provider;return function(r){var i=r.getLibrary,s=r.children,o=pY(),a=o.connector,l=o.provider,c=o.chainId,A=o.account,u=o.activate,f=o.setError,h=o.deactivate,d=o.error,m=a!==void 0&&c!==void 0&&A!==void 0&&!d,g=be.useMemo(function(){return m&&c!==void 0&&Number.isInteger(c)&&a?i(l,a):void 0},[m,i,l,a,c]),p={connector:a,library:g,chainId:c,account:A,activate:u,setError:f,deactivate:h,active:m,error:d};return Z.createElement(e,{value:p},s)}}var gY=mY(lH);function vY(n){return n===void 0&&(n=lH),Object.keys(wh).includes(n)||kl(!1),wh[n]}function yY(n){return be.useContext(vY(n))}var kM={},cH={exports:{}},js={},AH={exports:{}},uH={};/** * @license React * scheduler.production.min.js * @@ -29,7 +29,7 @@ var CW=Object.defineProperty;var TW=(n,e,t)=>e in n?CW(n,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(n){function e(O,z){var j=O.length;O.push(z);e:for(;0>>1,C=O[H];if(0>>1;Hi(P,j))rei(ue,P)?(O[H]=ue,O[re]=j,H=re):(O[H]=P,O[ee]=j,H=ee);else if(rei(ue,j))O[H]=ue,O[re]=j,H=re;else break e}}return z}function i(O,z){var j=O.sortIndex-z.sortIndex;return j!==0?j:O.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],c=[],A=1,u=null,f=3,h=!1,d=!1,m=!1,g=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(O){for(var z=t(c);z!==null;){if(z.callback===null)r(c);else if(z.startTime<=O)r(c),z.sortIndex=z.expirationTime,e(l,z);else break;z=t(c)}}function _(O){if(m=!1,w(O),!d)if(t(l)!==null)d=!0,R(x);else{var z=t(c);z!==null&&F(_,z.startTime-O)}}function x(O,z){d=!1,m&&(m=!1,p(M),M=-1),h=!0;var j=f;try{for(w(z),u=t(l);u!==null&&(!(u.expirationTime>z)||O&&!L());){var H=u.callback;if(typeof H=="function"){u.callback=null,f=u.priorityLevel;var C=H(u.expirationTime<=z);z=n.unstable_now(),typeof C=="function"?u.callback=C:u===t(l)&&r(l),w(z)}else r(l);u=t(l)}if(u!==null)var W=!0;else{var ee=t(c);ee!==null&&F(_,ee.startTime-z),W=!1}return W}finally{u=null,f=j,h=!1}}var b=!1,B=null,M=-1,I=5,S=-1;function L(){return!(n.unstable_now()-SO||125H?(O.sortIndex=j,e(c,O),t(l)===null&&O===t(c)&&(m?(p(M),M=-1):m=!0,F(_,j-H))):(O.sortIndex=C,e(l,O),d||h||(d=!0,R(x))),O},n.unstable_shouldYield=L,n.unstable_wrapCallback=function(O){var z=f;return function(){var j=f;f=z;try{return O.apply(this,arguments)}finally{f=j}}}})(AQ);cQ.exports=AQ;var yY=cQ.exports;/** + */(function(n){function e(O,z){var j=O.length;O.push(z);e:for(;0>>1,C=O[Q];if(0>>1;Qi(P,j))rei(ue,P)?(O[Q]=ue,O[re]=j,Q=re):(O[Q]=P,O[ee]=j,Q=ee);else if(rei(ue,j))O[Q]=ue,O[re]=j,Q=re;else break e}}return z}function i(O,z){var j=O.sortIndex-z.sortIndex;return j!==0?j:O.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],c=[],A=1,u=null,f=3,h=!1,d=!1,m=!1,g=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(O){for(var z=t(c);z!==null;){if(z.callback===null)r(c);else if(z.startTime<=O)r(c),z.sortIndex=z.expirationTime,e(l,z);else break;z=t(c)}}function _(O){if(m=!1,w(O),!d)if(t(l)!==null)d=!0,R(x);else{var z=t(c);z!==null&&F(_,z.startTime-O)}}function x(O,z){d=!1,m&&(m=!1,p(S),S=-1),h=!0;var j=f;try{for(w(z),u=t(l);u!==null&&(!(u.expirationTime>z)||O&&!L());){var Q=u.callback;if(typeof Q=="function"){u.callback=null,f=u.priorityLevel;var C=Q(u.expirationTime<=z);z=n.unstable_now(),typeof C=="function"?u.callback=C:u===t(l)&&r(l),w(z)}else r(l);u=t(l)}if(u!==null)var W=!0;else{var ee=t(c);ee!==null&&F(_,ee.startTime-z),W=!1}return W}finally{u=null,f=j,h=!1}}var b=!1,B=null,S=-1,I=5,M=-1;function L(){return!(n.unstable_now()-MO||125Q?(O.sortIndex=j,e(c,O),t(l)===null&&O===t(c)&&(m?(p(S),S=-1):m=!0,F(_,j-Q))):(O.sortIndex=C,e(l,O),d||h||(d=!0,R(x))),O},n.unstable_shouldYield=L,n.unstable_wrapCallback=function(O){var z=f;return function(){var j=f;f=z;try{return O.apply(this,arguments)}finally{f=j}}}})(uH);AH.exports=uH;var wY=AH.exports;/** * @license React * react-dom.production.min.js * @@ -37,14 +37,14 @@ var CW=Object.defineProperty;var TW=(n,e,t)=>e in n?CW(n,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var wY=be,ks=yY;function Ne(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;t"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),OS=Object.prototype.hasOwnProperty,_Y=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,UF={},FF={};function xY(n){return OS.call(FF,n)?!0:OS.call(UF,n)?!1:_Y.test(n)?FF[n]=!0:(UF[n]=!0,!1)}function bY(n,e,t,r){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function EY(n,e,t,r){if(e===null||typeof e>"u"||bY(n,e,t,r))return!0;if(r)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Qi(n,e,t,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var li={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){li[n]=new Qi(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];li[e]=new Qi(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){li[n]=new Qi(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){li[n]=new Qi(n,2,!1,n,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){li[n]=new Qi(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){li[n]=new Qi(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){li[n]=new Qi(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){li[n]=new Qi(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){li[n]=new Qi(n,5,!1,n.toLowerCase(),null,!1,!1)});var vI=/[\-:]([a-z])/g;function yI(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var e=n.replace(vI,yI);li[e]=new Qi(e,1,!1,n,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace(vI,yI);li[e]=new Qi(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace(vI,yI);li[e]=new Qi(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){li[n]=new Qi(n,1,!1,n.toLowerCase(),null,!1,!1)});li.xlinkHref=new Qi("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){li[n]=new Qi(n,1,!1,n.toLowerCase(),null,!0,!0)});function wI(n,e,t,r){var i=li.hasOwnProperty(e)?li[e]:null;(i!==null?i.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),QM=Object.prototype.hasOwnProperty,xY=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,FF={},PF={};function bY(n){return QM.call(PF,n)?!0:QM.call(FF,n)?!1:xY.test(n)?PF[n]=!0:(FF[n]=!0,!1)}function EY(n,e,t,r){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function BY(n,e,t,r){if(e===null||typeof e>"u"||EY(n,e,t,r))return!0;if(r)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Hi(n,e,t,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var li={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){li[n]=new Hi(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];li[e]=new Hi(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){li[n]=new Hi(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){li[n]=new Hi(n,2,!1,n,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){li[n]=new Hi(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){li[n]=new Hi(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){li[n]=new Hi(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){li[n]=new Hi(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){li[n]=new Hi(n,5,!1,n.toLowerCase(),null,!1,!1)});var wI=/[\-:]([a-z])/g;function _I(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var e=n.replace(wI,_I);li[e]=new Hi(e,1,!1,n,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace(wI,_I);li[e]=new Hi(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace(wI,_I);li[e]=new Hi(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){li[n]=new Hi(n,1,!1,n.toLowerCase(),null,!1,!1)});li.xlinkHref=new Hi("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){li[n]=new Hi(n,1,!1,n.toLowerCase(),null,!0,!0)});function xI(n,e,t,r){var i=li.hasOwnProperty(e)?li[e]:null;(i!==null?i.type!==0:r||!(2a||i[o]!==s[a]){var l=` -`+i[o].replace(" at new "," at ");return n.displayName&&l.includes("")&&(l=l.replace("",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{Pb=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?pm(n):""}function BY(n){switch(n.tag){case 5:return pm(n.type);case 16:return pm("Lazy");case 13:return pm("Suspense");case 19:return pm("SuspenseList");case 0:case 2:case 15:return n=Lb(n.type,!1),n;case 11:return n=Lb(n.type.render,!1),n;case 1:return n=Lb(n.type,!0),n;default:return""}}function zS(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case wh:return"Fragment";case yh:return"Portal";case kS:return"Profiler";case _I:return"StrictMode";case HS:return"Suspense";case QS:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case hQ:return(n.displayName||"Context")+".Consumer";case fQ:return(n._context.displayName||"Context")+".Provider";case xI:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case bI:return e=n.displayName||null,e!==null?e:zS(n.type)||"Memo";case Lc:e=n._payload,n=n._init;try{return zS(n(e))}catch{}}return null}function SY(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return zS(e);case 8:return e===_I?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function pA(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function pQ(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function MY(n){var e=pQ(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),r=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var i=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function Y0(n){n._valueTracker||(n._valueTracker=MY(n))}function mQ(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),r="";return n&&(r=pQ(n)?n.checked?"true":"false":n.value),n=r,n!==t?(e.setValue(n),!0):!1}function n_(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function GS(n,e){var t=e.checked;return Yn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function LF(n,e){var t=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;t=pA(e.value!=null?e.value:t),n._wrapperState={initialChecked:r,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function gQ(n,e){e=e.checked,e!=null&&wI(n,"checked",e,!1)}function VS(n,e){gQ(n,e);var t=pA(e.value),r=e.type;if(t!=null)r==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(r==="submit"||r==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?jS(n,e.type,t):e.hasOwnProperty("defaultValue")&&jS(n,e.type,pA(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function DF(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function jS(n,e,t){(e!=="number"||n_(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var mm=Array.isArray;function Kh(n,e,t,r){if(n=n.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=$0.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function pg(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var Hm={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},CY=["Webkit","ms","Moz","O"];Object.keys(Hm).forEach(function(n){CY.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),Hm[e]=Hm[n]})});function _Q(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||Hm.hasOwnProperty(n)&&Hm[n]?(""+e).trim():e+"px"}function xQ(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=_Q(t,e[t],r);t==="float"&&(t="cssFloat"),r?n.setProperty(t,i):n[t]=i}}var TY=Yn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function XS(n,e){if(e){if(TY[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Ne(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Ne(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Ne(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Ne(62))}}function YS(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var $S=null;function EI(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var ZS=null,Xh=null,Yh=null;function kF(n){if(n=h0(n)){if(typeof ZS!="function")throw Error(Ne(280));var e=n.stateNode;e&&(e=Wx(e),ZS(n.stateNode,n.type,e))}}function bQ(n){Xh?Yh?Yh.push(n):Yh=[n]:Xh=n}function EQ(){if(Xh){var n=Xh,e=Yh;if(Yh=Xh=null,kF(n),e)for(n=0;n>>=0,n===0?32:31-(HY(n)/QY|0)|0}var Z0=64,J0=4194304;function gm(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function o_(n,e){var t=n.pendingLanes;if(t===0)return 0;var r=0,i=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~i;a!==0?r=gm(a):(s&=o,s!==0&&(r=gm(s)))}else o=t&~i,o!==0?r=gm(o):s!==0&&(r=gm(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=r;0t;t++)e.push(n);return e}function u0(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-ta(e),n[e]=t}function jY(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var r=n.eventTimes;for(n=n.expirationTimes;0=zm),XF=String.fromCharCode(32),YF=!1;function VQ(n,e){switch(n){case"keyup":return y$.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jQ(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var _h=!1;function _$(n,e){switch(n){case"compositionend":return jQ(e);case"keypress":return e.which!==32?null:(YF=!0,XF);case"textInput":return n=e.data,n===XF&&YF?null:n;default:return null}}function x$(n,e){if(_h)return n==="compositionend"||!UI&&VQ(n,e)?(n=zQ(),cw=TI=Vc=null,_h=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:t,offset:e-n};n=r}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=qF(t)}}function YQ(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?YQ(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function $Q(){for(var n=window,e=n_();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=n_(n.document)}return e}function FI(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function R$(n){var e=$Q(),t=n.focusedElem,r=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&YQ(t.ownerDocument.documentElement,t)){if(r!==null&&FI(t)){if(e=r.start,n=r.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var i=t.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!n.extend&&s>r&&(i=r,r=s,s=i),i=eP(t,s);var o=eP(t,r);i&&o&&(n.rangeCount!==1||n.anchorNode!==i.node||n.anchorOffset!==i.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),n.removeAllRanges(),s>r?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t=document.documentMode,xh=null,rM=null,Vm=null,iM=!1;function tP(n,e,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;iM||xh==null||xh!==n_(r)||(r=xh,"selectionStart"in r&&FI(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Vm&&_g(Vm,r)||(Vm=r,r=c_(rM,"onSelect"),0Bh||(n.current=AM[Bh],AM[Bh]=null,Bh--)}function En(n,e){Bh++,AM[Bh]=n.current,n.current=e}var mA={},Mi=CA(mA),es=CA(!1),Mu=mA;function gd(n,e){var t=n.type.contextTypes;if(!t)return mA;var r=n.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in t)i[s]=e[s];return r&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=i),i}function ts(n){return n=n.childContextTypes,n!=null}function u_(){Rn(es),Rn(Mi)}function lP(n,e,t){if(Mi.current!==mA)throw Error(Ne(168));En(Mi,e),En(es,t)}function s5(n,e,t){var r=n.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return t;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(Ne(108,SY(n)||"Unknown",i));return Yn({},t,r)}function f_(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||mA,Mu=Mi.current,En(Mi,n),En(es,es.current),!0}function cP(n,e,t){var r=n.stateNode;if(!r)throw Error(Ne(169));t?(n=s5(n,e,Mu),r.__reactInternalMemoizedMergedChildContext=n,Rn(es),Rn(Mi),En(Mi,n)):Rn(es),En(es,t)}var Pl=null,Kx=!1,Yb=!1;function o5(n){Pl===null?Pl=[n]:Pl.push(n)}function G$(n){Kx=!0,o5(n)}function TA(){if(!Yb&&Pl!==null){Yb=!0;var n=0,e=pn;try{var t=Pl;for(pn=1;n>=o,i-=o,Hl=1<<32-ta(e)+i|t<M?(I=B,B=null):I=B.sibling;var S=f(p,B,w[M],_);if(S===null){B===null&&(B=I);break}n&&B&&S.alternate===null&&e(p,B),v=s(S,v,M),b===null?x=S:b.sibling=S,b=S,B=I}if(M===w.length)return t(p,B),On&&qA(p,M),x;if(B===null){for(;MM?(I=B,B=null):I=B.sibling;var L=f(p,B,S.value,_);if(L===null){B===null&&(B=I);break}n&&B&&L.alternate===null&&e(p,B),v=s(L,v,M),b===null?x=L:b.sibling=L,b=L,B=I}if(S.done)return t(p,B),On&&qA(p,M),x;if(B===null){for(;!S.done;M++,S=w.next())S=u(p,S.value,_),S!==null&&(v=s(S,v,M),b===null?x=S:b.sibling=S,b=S);return On&&qA(p,M),x}for(B=r(p,B);!S.done;M++,S=w.next())S=h(B,p,M,S.value,_),S!==null&&(n&&S.alternate!==null&&B.delete(S.key===null?M:S.key),v=s(S,v,M),b===null?x=S:b.sibling=S,b=S);return n&&B.forEach(function(D){return e(p,D)}),On&&qA(p,M),x}function g(p,v,w,_){if(typeof w=="object"&&w!==null&&w.type===wh&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case X0:e:{for(var x=w.key,b=v;b!==null;){if(b.key===x){if(x=w.type,x===wh){if(b.tag===7){t(p,b.sibling),v=i(b,w.props.children),v.return=p,p=v;break e}}else if(b.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===Lc&&fP(x)===b.type){t(p,b.sibling),v=i(b,w.props),v.ref=Ep(p,b,w),v.return=p,p=v;break e}t(p,b);break}else e(p,b);b=b.sibling}w.type===wh?(v=gu(w.props.children,p.mode,_,w.key),v.return=p,p=v):(_=gw(w.type,w.key,w.props,null,p.mode,_),_.ref=Ep(p,v,w),_.return=p,p=_)}return o(p);case yh:e:{for(b=w.key;v!==null;){if(v.key===b)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){t(p,v.sibling),v=i(v,w.children||[]),v.return=p,p=v;break e}else{t(p,v);break}else e(p,v);v=v.sibling}v=rE(w,p.mode,_),v.return=p,p=v}return o(p);case Lc:return b=w._init,g(p,v,b(w._payload),_)}if(mm(w))return d(p,v,w,_);if(yp(w))return m(p,v,w,_);sv(p,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,v!==null&&v.tag===6?(t(p,v.sibling),v=i(v,w),v.return=p,p=v):(t(p,v),v=nE(w,p.mode,_),v.return=p,p=v),o(p)):t(p,v)}return g}var yd=A5(!0),u5=A5(!1),p_=CA(null),m_=null,Ch=null,NI=null;function OI(){NI=Ch=m_=null}function kI(n){var e=p_.current;Rn(p_),n._currentValue=e}function hM(n,e,t){for(;n!==null;){var r=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),n===t)break;n=n.return}}function Zh(n,e){m_=n,NI=Ch=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(Ji=!0),n.firstContext=null)}function _o(n){var e=n._currentValue;if(NI!==n)if(n={context:n,memoizedValue:e,next:null},Ch===null){if(m_===null)throw Error(Ne(308));Ch=n,m_.dependencies={lanes:0,firstContext:n}}else Ch=Ch.next=n;return e}var Au=null;function HI(n){Au===null?Au=[n]:Au.push(n)}function f5(n,e,t,r){var i=e.interleaved;return i===null?(t.next=t,HI(e)):(t.next=i.next,i.next=t),e.interleaved=t,Jl(n,r)}function Jl(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var Dc=!1;function QI(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function h5(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Vl(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function sA(n,e,t){var r=n.updateQueue;if(r===null)return null;if(r=r.shared,Kt&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,Jl(n,t)}return i=r.interleaved,i===null?(e.next=e,HI(r)):(e.next=i.next,i.next=e),r.interleaved=e,Jl(n,t)}function uw(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,SI(n,t)}}function hP(n,e){var t=n.updateQueue,r=n.alternate;if(r!==null&&(r=r.updateQueue,t===r)){var i=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?i=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?i=s=e:s=s.next=e}else i=s=e;t={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function g_(n,e,t,r){var i=n.updateQueue;Dc=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var A=n.alternate;A!==null&&(A=A.updateQueue,a=A.lastBaseUpdate,a!==o&&(a===null?A.firstBaseUpdate=c:a.next=c,A.lastBaseUpdate=l))}if(s!==null){var u=i.baseState;o=0,A=c=l=null,a=s;do{var f=a.lane,h=a.eventTime;if((r&f)===f){A!==null&&(A=A.next={eventTime:h,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var d=n,m=a;switch(f=e,h=t,m.tag){case 1:if(d=m.payload,typeof d=="function"){u=d.call(h,u,f);break e}u=d;break e;case 3:d.flags=d.flags&-65537|128;case 0:if(d=m.payload,f=typeof d=="function"?d.call(h,u,f):d,f==null)break e;u=Yn({},u,f);break e;case 2:Dc=!0}}a.callback!==null&&a.lane!==0&&(n.flags|=64,f=i.effects,f===null?i.effects=[a]:f.push(a))}else h={eventTime:h,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},A===null?(c=A=h,l=u):A=A.next=h,o|=f;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;f=a,a=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(A===null&&(l=u),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=A,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);Iu|=o,n.lanes=o,n.memoizedState=u}}function dP(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;et?t:4,n(!0);var r=Zb.transition;Zb.transition={};try{n(!1),e()}finally{pn=t,Zb.transition=r}}function I5(){return xo().memoizedState}function K$(n,e,t){var r=aA(n);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},R5(n))U5(e,t);else if(t=f5(n,e,t,r),t!==null){var i=ki();na(t,n,r,i),F5(t,e,r)}}function X$(n,e,t){var r=aA(n),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(R5(n))U5(e,i);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,t);if(i.hasEagerState=!0,i.eagerState=a,aa(a,o)){var l=e.interleaved;l===null?(i.next=i,HI(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}t=f5(n,e,i,r),t!==null&&(i=ki(),na(t,n,r,i),F5(t,e,r))}}function R5(n){var e=n.alternate;return n===Xn||e!==null&&e===Xn}function U5(n,e){jm=y_=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function F5(n,e,t){if(t&4194240){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,SI(n,t)}}var w_={readContext:_o,useCallback:Ai,useContext:Ai,useEffect:Ai,useImperativeHandle:Ai,useInsertionEffect:Ai,useLayoutEffect:Ai,useMemo:Ai,useReducer:Ai,useRef:Ai,useState:Ai,useDebugValue:Ai,useDeferredValue:Ai,useTransition:Ai,useMutableSource:Ai,useSyncExternalStore:Ai,useId:Ai,unstable_isNewReconciler:!1},Y$={readContext:_o,useCallback:function(n,e){return Ea().memoizedState=[n,e===void 0?null:e],n},useContext:_o,useEffect:mP,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,hw(4194308,4,B5.bind(null,e,n),t)},useLayoutEffect:function(n,e){return hw(4194308,4,n,e)},useInsertionEffect:function(n,e){return hw(4,2,n,e)},useMemo:function(n,e){var t=Ea();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var r=Ea();return e=t!==void 0?t(e):e,r.memoizedState=r.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},r.queue=n,n=n.dispatch=K$.bind(null,Xn,n),[r.memoizedState,n]},useRef:function(n){var e=Ea();return n={current:n},e.memoizedState=n},useState:pP,useDebugValue:YI,useDeferredValue:function(n){return Ea().memoizedState=n},useTransition:function(){var n=pP(!1),e=n[0];return n=W$.bind(null,n[1]),Ea().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var r=Xn,i=Ea();if(On){if(t===void 0)throw Error(Ne(407));t=t()}else{if(t=e(),Xr===null)throw Error(Ne(349));Tu&30||g5(r,e,t)}i.memoizedState=t;var s={value:t,getSnapshot:e};return i.queue=s,mP(y5.bind(null,r,s,n),[n]),r.flags|=2048,Tg(9,v5.bind(null,r,s,t,e),void 0,null),t},useId:function(){var n=Ea(),e=Xr.identifierPrefix;if(On){var t=Ql,r=Hl;t=(r&~(1<<32-ta(r)-1)).toString(32)+t,e=":"+e+"R"+t,t=Mg++,0")&&(l=l.replace("",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{Db=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?mm(n):""}function MY(n){switch(n.tag){case 5:return mm(n.type);case 16:return mm("Lazy");case 13:return mm("Suspense");case 19:return mm("SuspenseList");case 0:case 2:case 15:return n=Nb(n.type,!1),n;case 11:return n=Nb(n.type.render,!1),n;case 1:return n=Nb(n.type,!0),n;default:return""}}function VM(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case xh:return"Fragment";case _h:return"Portal";case HM:return"Profiler";case bI:return"StrictMode";case zM:return"Suspense";case GM:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case dH:return(n.displayName||"Context")+".Consumer";case hH:return(n._context.displayName||"Context")+".Provider";case EI:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case BI:return e=n.displayName||null,e!==null?e:VM(n.type)||"Memo";case Dc:e=n._payload,n=n._init;try{return VM(n(e))}catch{}}return null}function SY(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return VM(e);case 8:return e===bI?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function mA(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function mH(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function CY(n){var e=mH(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),r=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var i=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function $0(n){n._valueTracker||(n._valueTracker=CY(n))}function gH(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),r="";return n&&(r=mH(n)?n.checked?"true":"false":n.value),n=r,n!==t?(e.setValue(n),!0):!1}function r_(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function jM(n,e){var t=e.checked;return Yn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function DF(n,e){var t=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;t=mA(e.value!=null?e.value:t),n._wrapperState={initialChecked:r,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function vH(n,e){e=e.checked,e!=null&&xI(n,"checked",e,!1)}function WM(n,e){vH(n,e);var t=mA(e.value),r=e.type;if(t!=null)r==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(r==="submit"||r==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?KM(n,e.type,t):e.hasOwnProperty("defaultValue")&&KM(n,e.type,mA(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function NF(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function KM(n,e,t){(e!=="number"||r_(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var gm=Array.isArray;function Xh(n,e,t,r){if(n=n.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Z0.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function mg(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var Hm={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},TY=["Webkit","ms","Moz","O"];Object.keys(Hm).forEach(function(n){TY.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),Hm[e]=Hm[n]})});function xH(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||Hm.hasOwnProperty(n)&&Hm[n]?(""+e).trim():e+"px"}function bH(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=xH(t,e[t],r);t==="float"&&(t="cssFloat"),r?n.setProperty(t,i):n[t]=i}}var IY=Yn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function $M(n,e){if(e){if(IY[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Oe(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Oe(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Oe(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Oe(62))}}function ZM(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var JM=null;function MI(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var qM=null,Yh=null,$h=null;function QF(n){if(n=d0(n)){if(typeof qM!="function")throw Error(Oe(280));var e=n.stateNode;e&&(e=Kx(e),qM(n.stateNode,n.type,e))}}function EH(n){Yh?$h?$h.push(n):$h=[n]:Yh=n}function BH(){if(Yh){var n=Yh,e=$h;if($h=Yh=null,QF(n),e)for(n=0;n>>=0,n===0?32:31-(HY(n)/zY|0)|0}var J0=64,q0=4194304;function vm(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function a_(n,e){var t=n.pendingLanes;if(t===0)return 0;var r=0,i=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~i;a!==0?r=vm(a):(s&=o,s!==0&&(r=vm(s)))}else o=t&~i,o!==0?r=vm(o):s!==0&&(r=vm(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=r;0t;t++)e.push(n);return e}function f0(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-na(e),n[e]=t}function WY(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var r=n.eventTimes;for(n=n.expirationTimes;0=Gm),YF=String.fromCharCode(32),$F=!1;function jH(n,e){switch(n){case"keyup":return w$.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function WH(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var bh=!1;function x$(n,e){switch(n){case"compositionend":return WH(e);case"keypress":return e.which!==32?null:($F=!0,YF);case"textInput":return n=e.data,n===YF&&$F?null:n;default:return null}}function b$(n,e){if(bh)return n==="compositionend"||!PI&&jH(n,e)?(n=GH(),Aw=RI=jc=null,bh=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:t,offset:e-n};n=r}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=eP(t)}}function $H(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?$H(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function ZH(){for(var n=window,e=r_();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=r_(n.document)}return e}function LI(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function U$(n){var e=ZH(),t=n.focusedElem,r=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&$H(t.ownerDocument.documentElement,t)){if(r!==null&&LI(t)){if(e=r.start,n=r.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var i=t.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!n.extend&&s>r&&(i=r,r=s,s=i),i=tP(t,s);var o=tP(t,r);i&&o&&(n.rangeCount!==1||n.anchorNode!==i.node||n.anchorOffset!==i.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),n.removeAllRanges(),s>r?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t=document.documentMode,Eh=null,sS=null,jm=null,oS=!1;function nP(n,e,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;oS||Eh==null||Eh!==r_(r)||(r=Eh,"selectionStart"in r&&LI(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),jm&&xg(jm,r)||(jm=r,r=A_(sS,"onSelect"),0Sh||(n.current=fS[Sh],fS[Sh]=null,Sh--)}function En(n,e){Sh++,fS[Sh]=n.current,n.current=e}var gA={},Si=TA(gA),es=TA(!1),Tu=gA;function vd(n,e){var t=n.type.contextTypes;if(!t)return gA;var r=n.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in t)i[s]=e[s];return r&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=i),i}function ts(n){return n=n.childContextTypes,n!=null}function f_(){Rn(es),Rn(Si)}function cP(n,e,t){if(Si.current!==gA)throw Error(Oe(168));En(Si,e),En(es,t)}function o5(n,e,t){var r=n.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return t;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(Oe(108,SY(n)||"Unknown",i));return Yn({},t,r)}function h_(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||gA,Tu=Si.current,En(Si,n),En(es,es.current),!0}function AP(n,e,t){var r=n.stateNode;if(!r)throw Error(Oe(169));t?(n=o5(n,e,Tu),r.__reactInternalMemoizedMergedChildContext=n,Rn(es),Rn(Si),En(Si,n)):Rn(es),En(es,t)}var Pl=null,Xx=!1,Zb=!1;function a5(n){Pl===null?Pl=[n]:Pl.push(n)}function V$(n){Xx=!0,a5(n)}function IA(){if(!Zb&&Pl!==null){Zb=!0;var n=0,e=pn;try{var t=Pl;for(pn=1;n>=o,i-=o,Ql=1<<32-na(e)+i|t<S?(I=B,B=null):I=B.sibling;var M=f(p,B,w[S],_);if(M===null){B===null&&(B=I);break}n&&B&&M.alternate===null&&e(p,B),v=s(M,v,S),b===null?x=M:b.sibling=M,b=M,B=I}if(S===w.length)return t(p,B),On&&eu(p,S),x;if(B===null){for(;SS?(I=B,B=null):I=B.sibling;var L=f(p,B,M.value,_);if(L===null){B===null&&(B=I);break}n&&B&&L.alternate===null&&e(p,B),v=s(L,v,S),b===null?x=L:b.sibling=L,b=L,B=I}if(M.done)return t(p,B),On&&eu(p,S),x;if(B===null){for(;!M.done;S++,M=w.next())M=u(p,M.value,_),M!==null&&(v=s(M,v,S),b===null?x=M:b.sibling=M,b=M);return On&&eu(p,S),x}for(B=r(p,B);!M.done;S++,M=w.next())M=h(B,p,S,M.value,_),M!==null&&(n&&M.alternate!==null&&B.delete(M.key===null?S:M.key),v=s(M,v,S),b===null?x=M:b.sibling=M,b=M);return n&&B.forEach(function(D){return e(p,D)}),On&&eu(p,S),x}function g(p,v,w,_){if(typeof w=="object"&&w!==null&&w.type===xh&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Y0:e:{for(var x=w.key,b=v;b!==null;){if(b.key===x){if(x=w.type,x===xh){if(b.tag===7){t(p,b.sibling),v=i(b,w.props.children),v.return=p,p=v;break e}}else if(b.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===Dc&&hP(x)===b.type){t(p,b.sibling),v=i(b,w.props),v.ref=Bp(p,b,w),v.return=p,p=v;break e}t(p,b);break}else e(p,b);b=b.sibling}w.type===xh?(v=yu(w.props.children,p.mode,_,w.key),v.return=p,p=v):(_=vw(w.type,w.key,w.props,null,p.mode,_),_.ref=Bp(p,v,w),_.return=p,p=_)}return o(p);case _h:e:{for(b=w.key;v!==null;){if(v.key===b)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){t(p,v.sibling),v=i(v,w.children||[]),v.return=p,p=v;break e}else{t(p,v);break}else e(p,v);v=v.sibling}v=sE(w,p.mode,_),v.return=p,p=v}return o(p);case Dc:return b=w._init,g(p,v,b(w._payload),_)}if(gm(w))return d(p,v,w,_);if(wp(w))return m(p,v,w,_);ov(p,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,v!==null&&v.tag===6?(t(p,v.sibling),v=i(v,w),v.return=p,p=v):(t(p,v),v=iE(w,p.mode,_),v.return=p,p=v),o(p)):t(p,v)}return g}var wd=u5(!0),f5=u5(!1),m_=TA(null),g_=null,Ih=null,kI=null;function QI(){kI=Ih=g_=null}function HI(n){var e=m_.current;Rn(m_),n._currentValue=e}function pS(n,e,t){for(;n!==null;){var r=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),n===t)break;n=n.return}}function Jh(n,e){g_=n,kI=Ih=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(Ji=!0),n.firstContext=null)}function _o(n){var e=n._currentValue;if(kI!==n)if(n={context:n,memoizedValue:e,next:null},Ih===null){if(g_===null)throw Error(Oe(308));Ih=n,g_.dependencies={lanes:0,firstContext:n}}else Ih=Ih.next=n;return e}var uu=null;function zI(n){uu===null?uu=[n]:uu.push(n)}function h5(n,e,t,r){var i=e.interleaved;return i===null?(t.next=t,zI(e)):(t.next=i.next,i.next=t),e.interleaved=t,Jl(n,r)}function Jl(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var Nc=!1;function GI(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function d5(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Vl(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function oA(n,e,t){var r=n.updateQueue;if(r===null)return null;if(r=r.shared,Kt&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,Jl(n,t)}return i=r.interleaved,i===null?(e.next=e,zI(r)):(e.next=i.next,i.next=e),r.interleaved=e,Jl(n,t)}function fw(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,CI(n,t)}}function dP(n,e){var t=n.updateQueue,r=n.alternate;if(r!==null&&(r=r.updateQueue,t===r)){var i=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?i=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?i=s=e:s=s.next=e}else i=s=e;t={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function v_(n,e,t,r){var i=n.updateQueue;Nc=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var A=n.alternate;A!==null&&(A=A.updateQueue,a=A.lastBaseUpdate,a!==o&&(a===null?A.firstBaseUpdate=c:a.next=c,A.lastBaseUpdate=l))}if(s!==null){var u=i.baseState;o=0,A=c=l=null,a=s;do{var f=a.lane,h=a.eventTime;if((r&f)===f){A!==null&&(A=A.next={eventTime:h,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var d=n,m=a;switch(f=e,h=t,m.tag){case 1:if(d=m.payload,typeof d=="function"){u=d.call(h,u,f);break e}u=d;break e;case 3:d.flags=d.flags&-65537|128;case 0:if(d=m.payload,f=typeof d=="function"?d.call(h,u,f):d,f==null)break e;u=Yn({},u,f);break e;case 2:Nc=!0}}a.callback!==null&&a.lane!==0&&(n.flags|=64,f=i.effects,f===null?i.effects=[a]:f.push(a))}else h={eventTime:h,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},A===null?(c=A=h,l=u):A=A.next=h,o|=f;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;f=a,a=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(A===null&&(l=u),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=A,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);Uu|=o,n.lanes=o,n.memoizedState=u}}function pP(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;et?t:4,n(!0);var r=qb.transition;qb.transition={};try{n(!1),e()}finally{pn=t,qb.transition=r}}function R5(){return xo().memoizedState}function X$(n,e,t){var r=lA(n);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},U5(n))F5(e,t);else if(t=h5(n,e,t,r),t!==null){var i=ki();ra(t,n,r,i),P5(t,e,r)}}function Y$(n,e,t){var r=lA(n),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(U5(n))F5(e,i);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,t);if(i.hasEagerState=!0,i.eagerState=a,la(a,o)){var l=e.interleaved;l===null?(i.next=i,zI(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}t=h5(n,e,i,r),t!==null&&(i=ki(),ra(t,n,r,i),P5(t,e,r))}}function U5(n){var e=n.alternate;return n===Xn||e!==null&&e===Xn}function F5(n,e){Wm=w_=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function P5(n,e,t){if(t&4194240){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,CI(n,t)}}var __={readContext:_o,useCallback:Ai,useContext:Ai,useEffect:Ai,useImperativeHandle:Ai,useInsertionEffect:Ai,useLayoutEffect:Ai,useMemo:Ai,useReducer:Ai,useRef:Ai,useState:Ai,useDebugValue:Ai,useDeferredValue:Ai,useTransition:Ai,useMutableSource:Ai,useSyncExternalStore:Ai,useId:Ai,unstable_isNewReconciler:!1},$$={readContext:_o,useCallback:function(n,e){return Ma().memoizedState=[n,e===void 0?null:e],n},useContext:_o,useEffect:gP,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,dw(4194308,4,M5.bind(null,e,n),t)},useLayoutEffect:function(n,e){return dw(4194308,4,n,e)},useInsertionEffect:function(n,e){return dw(4,2,n,e)},useMemo:function(n,e){var t=Ma();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var r=Ma();return e=t!==void 0?t(e):e,r.memoizedState=r.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},r.queue=n,n=n.dispatch=X$.bind(null,Xn,n),[r.memoizedState,n]},useRef:function(n){var e=Ma();return n={current:n},e.memoizedState=n},useState:mP,useDebugValue:ZI,useDeferredValue:function(n){return Ma().memoizedState=n},useTransition:function(){var n=mP(!1),e=n[0];return n=K$.bind(null,n[1]),Ma().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var r=Xn,i=Ma();if(On){if(t===void 0)throw Error(Oe(407));t=t()}else{if(t=e(),Yr===null)throw Error(Oe(349));Ru&30||v5(r,e,t)}i.memoizedState=t;var s={value:t,getSnapshot:e};return i.queue=s,gP(w5.bind(null,r,s,n),[n]),r.flags|=2048,Ig(9,y5.bind(null,r,s,t,e),void 0,null),t},useId:function(){var n=Ma(),e=Yr.identifierPrefix;if(On){var t=Hl,r=Ql;t=(r&~(1<<32-na(r)-1)).toString(32)+t,e=":"+e+"R"+t,t=Cg++,0<\/script>",n=n.removeChild(n.firstChild)):typeof r.is=="string"?n=o.createElement(t,{is:r.is}):(n=o.createElement(t),t==="select"&&(o=n,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):n=o.createElementNS(n,t),n[Ra]=e,n[Eg]=r,G5(n,e,!1,!1),e.stateNode=n;e:{switch(o=YS(t,r),t){case"dialog":Sn("cancel",n),Sn("close",n),i=r;break;case"iframe":case"object":case"embed":Sn("load",n),i=r;break;case"video":case"audio":for(i=0;ixd&&(e.flags|=128,r=!0,Bp(s,!1),e.lanes=4194304)}else{if(!r)if(n=v_(o),n!==null){if(e.flags|=128,r=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Bp(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!On)return ui(e),null}else 2*dr()-s.renderingStartTime>xd&&t!==1073741824&&(e.flags|=128,r=!0,Bp(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=dr(),e.sibling=null,t=Vn.current,En(Vn,r?t&1|2:t&1),e):(ui(e),null);case 22:case 23:return tR(),r=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?xs&1073741824&&(ui(e),e.subtreeFlags&6&&(e.flags|=8192)):ui(e),null;case 24:return null;case 25:return null}throw Error(Ne(156,e.tag))}function rZ(n,e){switch(LI(e),e.tag){case 1:return ts(e.type)&&u_(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return wd(),Rn(es),Rn(Mi),VI(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return GI(e),null;case 13:if(Rn(Vn),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Ne(340));vd()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return Rn(Vn),null;case 4:return wd(),null;case 10:return kI(e.type._context),null;case 22:case 23:return tR(),null;case 24:return null;default:return null}}var av=!1,yi=!1,iZ=typeof WeakSet=="function"?WeakSet:Set,Je=null;function Th(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){qn(n,e,r)}else t.current=null}function xM(n,e,t){try{t()}catch(r){qn(n,e,r)}}var MP=!1;function sZ(n,e){if(sM=a_,n=$Q(),FI(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var r=t.getSelection&&t.getSelection();if(r&&r.rangeCount!==0){t=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,c=0,A=0,u=n,f=null;t:for(;;){for(var h;u!==t||i!==0&&u.nodeType!==3||(a=o+i),u!==s||r!==0&&u.nodeType!==3||(l=o+r),u.nodeType===3&&(o+=u.nodeValue.length),(h=u.firstChild)!==null;)f=u,u=h;for(;;){if(u===n)break t;if(f===t&&++c===i&&(a=o),f===s&&++A===r&&(l=o),(h=u.nextSibling)!==null)break;u=f,f=u.parentNode}u=h}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(oM={focusedElem:n,selectionRange:t},a_=!1,Je=e;Je!==null;)if(e=Je,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,Je=n;else for(;Je!==null;){e=Je;try{var d=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(d!==null){var m=d.memoizedProps,g=d.memoizedState,p=e.stateNode,v=p.getSnapshotBeforeUpdate(e.elementType===e.type?m:Wo(e.type,m),g);p.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ne(163))}}catch(_){qn(e,e.return,_)}if(n=e.sibling,n!==null){n.return=e.return,Je=n;break}Je=e.return}return d=MP,MP=!1,d}function Wm(n,e,t){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&n)===n){var s=i.destroy;i.destroy=void 0,s!==void 0&&xM(e,t,s)}i=i.next}while(i!==r)}}function $x(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var r=t.create;t.destroy=r()}t=t.next}while(t!==e)}}function bM(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function W5(n){var e=n.alternate;e!==null&&(n.alternate=null,W5(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Ra],delete e[Eg],delete e[cM],delete e[Q$],delete e[z$])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function K5(n){return n.tag===5||n.tag===3||n.tag===4}function CP(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||K5(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function EM(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=A_));else if(r!==4&&(n=n.child,n!==null))for(EM(n,e,t),n=n.sibling;n!==null;)EM(n,e,t),n=n.sibling}function BM(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(r!==4&&(n=n.child,n!==null))for(BM(n,e,t),n=n.sibling;n!==null;)BM(n,e,t),n=n.sibling}var ti=null,Xo=!1;function vc(n,e,t){for(t=t.child;t!==null;)X5(n,e,t),t=t.sibling}function X5(n,e,t){if(ja&&typeof ja.onCommitFiberUnmount=="function")try{ja.onCommitFiberUnmount(zx,t)}catch{}switch(t.tag){case 5:yi||Th(t,e);case 6:var r=ti,i=Xo;ti=null,vc(n,e,t),ti=r,Xo=i,ti!==null&&(Xo?(n=ti,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):ti.removeChild(t.stateNode));break;case 18:ti!==null&&(Xo?(n=ti,t=t.stateNode,n.nodeType===8?Xb(n.parentNode,t):n.nodeType===1&&Xb(n,t),yg(n)):Xb(ti,t.stateNode));break;case 4:r=ti,i=Xo,ti=t.stateNode.containerInfo,Xo=!0,vc(n,e,t),ti=r,Xo=i;break;case 0:case 11:case 14:case 15:if(!yi&&(r=t.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&xM(t,e,o),i=i.next}while(i!==r)}vc(n,e,t);break;case 1:if(!yi&&(Th(t,e),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(a){qn(t,e,a)}vc(n,e,t);break;case 21:vc(n,e,t);break;case 22:t.mode&1?(yi=(r=yi)||t.memoizedState!==null,vc(n,e,t),yi=r):vc(n,e,t);break;default:vc(n,e,t)}}function TP(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new iZ),e.forEach(function(r){var i=dZ.bind(null,n,r);t.has(r)||(t.add(r),r.then(i,i))})}}function Po(n,e){var t=e.deletions;if(t!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=dr()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*aZ(r/1960))-r,10n?16:n,jc===null)var r=!1;else{if(n=jc,jc=null,b_=0,Kt&6)throw Error(Ne(331));var i=Kt;for(Kt|=4,Je=n.current;Je!==null;){var s=Je,o=s.child;if(Je.flags&16){var a=s.deletions;if(a!==null){for(var l=0;ldr()-qI?mu(n,0):JI|=t),ns(n,e)}function n6(n,e){e===0&&(n.mode&1?(e=J0,J0<<=1,!(J0&130023424)&&(J0=4194304)):e=1);var t=ki();n=Jl(n,e),n!==null&&(u0(n,e,t),ns(n,t))}function hZ(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),n6(n,t)}function dZ(n,e){var t=0;switch(n.tag){case 13:var r=n.stateNode,i=n.memoizedState;i!==null&&(t=i.retryLane);break;case 19:r=n.stateNode;break;default:throw Error(Ne(314))}r!==null&&r.delete(e),n6(n,t)}var r6;r6=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||es.current)Ji=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return Ji=!1,tZ(n,e,t);Ji=!!(n.flags&131072)}else Ji=!1,On&&e.flags&1048576&&a5(e,d_,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;dw(n,e),n=e.pendingProps;var i=gd(e,Mi.current);Zh(e,t),i=WI(null,e,r,n,i,t);var s=KI();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,ts(r)?(s=!0,f_(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,QI(e),i.updater=Yx,e.stateNode=i,i._reactInternals=e,pM(e,r,n,t),e=vM(null,e,r,!0,s,t)):(e.tag=0,On&&s&&PI(e),Pi(null,e,i,t),e=e.child),e;case 16:r=e.elementType;e:{switch(dw(n,e),n=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=mZ(r),n=Wo(r,n),i){case 0:e=gM(null,e,r,n,t);break e;case 1:e=EP(null,e,r,n,t);break e;case 11:e=xP(null,e,r,n,t);break e;case 14:e=bP(null,e,r,Wo(r.type,n),t);break e}throw Error(Ne(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Wo(r,i),gM(n,e,r,i,t);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Wo(r,i),EP(n,e,r,i,t);case 3:e:{if(H5(e),n===null)throw Error(Ne(387));r=e.pendingProps,s=e.memoizedState,i=s.element,h5(n,e),g_(e,r,null,t);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=_d(Error(Ne(423)),e),e=BP(n,e,r,t,i);break e}else if(r!==i){i=_d(Error(Ne(424)),e),e=BP(n,e,r,t,i);break e}else for(Ts=iA(e.stateNode.containerInfo.firstChild),Ls=e,On=!0,$o=null,t=u5(e,null,r,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(vd(),r===i){e=ql(n,e,t);break e}Pi(n,e,r,t)}e=e.child}return e;case 5:return d5(e),n===null&&fM(e),r=e.type,i=e.pendingProps,s=n!==null?n.memoizedProps:null,o=i.children,aM(r,i)?o=null:s!==null&&aM(r,s)&&(e.flags|=32),k5(n,e),Pi(n,e,o,t),e.child;case 6:return n===null&&fM(e),null;case 13:return Q5(n,e,t);case 4:return zI(e,e.stateNode.containerInfo),r=e.pendingProps,n===null?e.child=yd(e,null,r,t):Pi(n,e,r,t),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Wo(r,i),xP(n,e,r,i,t);case 7:return Pi(n,e,e.pendingProps,t),e.child;case 8:return Pi(n,e,e.pendingProps.children,t),e.child;case 12:return Pi(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,En(p_,r._currentValue),r._currentValue=o,s!==null)if(aa(s.value,o)){if(s.children===i.children&&!es.current){e=ql(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=Vl(-1,t&-t),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var A=c.pending;A===null?l.next=l:(l.next=A.next,A.next=l),c.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),hM(s.return,t,e),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Ne(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),hM(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Pi(n,e,i.children,t),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Zh(e,t),i=_o(i),r=r(i),e.flags|=1,Pi(n,e,r,t),e.child;case 14:return r=e.type,i=Wo(r,e.pendingProps),i=Wo(r.type,i),bP(n,e,r,i,t);case 15:return N5(n,e,e.type,e.pendingProps,t);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Wo(r,i),dw(n,e),e.tag=1,ts(r)?(n=!0,f_(e)):n=!1,Zh(e,t),P5(e,r,i),pM(e,r,i,t),vM(null,e,r,!0,n,t);case 19:return z5(n,e,t);case 22:return O5(n,e,t)}throw Error(Ne(156,e.tag))};function i6(n,e){return RQ(n,e)}function pZ(n,e,t,r){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function co(n,e,t,r){return new pZ(n,e,t,r)}function rR(n){return n=n.prototype,!(!n||!n.isReactComponent)}function mZ(n){if(typeof n=="function")return rR(n)?1:0;if(n!=null){if(n=n.$$typeof,n===xI)return 11;if(n===bI)return 14}return 2}function lA(n,e){var t=n.alternate;return t===null?(t=co(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function gw(n,e,t,r,i,s){var o=2;if(r=n,typeof n=="function")rR(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case wh:return gu(t.children,i,s,e);case _I:o=8,i|=8;break;case kS:return n=co(12,t,e,i|2),n.elementType=kS,n.lanes=s,n;case HS:return n=co(13,t,e,i),n.elementType=HS,n.lanes=s,n;case QS:return n=co(19,t,e,i),n.elementType=QS,n.lanes=s,n;case dQ:return Jx(t,i,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case fQ:o=10;break e;case hQ:o=9;break e;case xI:o=11;break e;case bI:o=14;break e;case Lc:o=16,r=null;break e}throw Error(Ne(130,n==null?n:typeof n,""))}return e=co(o,t,e,i),e.elementType=n,e.type=r,e.lanes=s,e}function gu(n,e,t,r){return n=co(7,n,r,e),n.lanes=t,n}function Jx(n,e,t,r){return n=co(22,n,r,e),n.elementType=dQ,n.lanes=t,n.stateNode={isHidden:!1},n}function nE(n,e,t){return n=co(6,n,null,e),n.lanes=t,n}function rE(n,e,t){return e=co(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function gZ(n,e,t,r,i){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Nb(0),this.expirationTimes=Nb(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nb(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function iR(n,e,t,r,i,s,o,a,l){return n=new gZ(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=co(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},QI(s),n}function vZ(n,e,t){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l6)}catch(n){console.error(n)}}l6(),lQ.exports=js;var bZ=lQ.exports,NP=bZ;NS.createRoot=NP.createRoot,NS.hydrateRoot=NP.hydrateRoot;const EZ="/assets/cc_bgm_balanced-f542698c.wav",Mo=be.createContext(),BZ=({children:n})=>{const[e,t]=be.useState(!1),r=J.useRef(null),i=()=>{t(!1);const o=r.current;o.src=EZ,o.loop=!0,o.volume=0,o.play();let a=0;const l=5,c=setInterval(()=>{a=Math.max(a+1/(10*l*60),1),a>=1&&clearInterval(c),o.volume=a},1e3/60)},s=()=>{t(!0),r.current.pause()};return k.jsxs(Mo.Provider,{value:{isMute:e,setMute:t,enableAudio:i,disableAudio:s},children:[k.jsx("audio",{ref:r}),n]})},SZ=be.createContext(),MZ=n=>{const[e,t]=be.useState(null),[r,i]=be.useState(null),[s,o]=be.useState(!1),[a,l]=be.useState([]);return k.jsx(SZ.Provider,{value:{walletAddress:e,setWalletAddress:t,ensName:r,setEnsName:i,connected:s,setConnected:o,OTTokens:a,setOTTokens:l},children:n.children})};function Rl(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function c6(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e}/*! +`+s.stack}return{value:n,source:e,stack:i,digest:null}}function nE(n,e,t){return{value:n,source:null,stack:t??null,digest:e??null}}function vS(n,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var q$=typeof WeakMap=="function"?WeakMap:Map;function D5(n,e,t){t=Vl(-1,t),t.tag=3,t.payload={element:null};var r=e.value;return t.callback=function(){b_||(b_=!0,CS=r),vS(n,e)},t}function N5(n,e,t){t=Vl(-1,t),t.tag=3;var r=n.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;t.payload=function(){return r(i)},t.callback=function(){vS(n,e)}}var s=n.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){vS(n,e),typeof r!="function"&&(aA===null?aA=new Set([this]):aA.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),t}function wP(n,e,t){var r=n.pingCache;if(r===null){r=n.pingCache=new q$;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(t)||(i.add(t),n=hZ.bind(null,n,e,t),e.then(n,n))}function _P(n){do{var e;if((e=n.tag===13)&&(e=n.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return n;n=n.return}while(n!==null);return null}function xP(n,e,t,r,i){return n.mode&1?(n.flags|=65536,n.lanes=i,n):(n===e?n.flags|=65536:(n.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(e=Vl(-1,1),e.tag=2,oA(t,e,1))),t.lanes|=1),n)}var eZ=lc.ReactCurrentOwner,Ji=!1;function Pi(n,e,t,r){e.child=n===null?f5(e,null,t,r):wd(e,n.child,t,r)}function bP(n,e,t,r,i){t=t.render;var s=e.ref;return Jh(e,i),r=XI(n,e,t,r,s,i),t=YI(),n!==null&&!Ji?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~i,ql(n,e,i)):(On&&t&&DI(e),e.flags|=1,Pi(n,e,r,i),e.child)}function EP(n,e,t,r,i){if(n===null){var s=t.type;return typeof s=="function"&&!sR(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=s,O5(n,e,s,r,i)):(n=vw(t.type,null,r,e,e.mode,i),n.ref=e.ref,n.return=e,e.child=n)}if(s=n.child,!(n.lanes&i)){var o=s.memoizedProps;if(t=t.compare,t=t!==null?t:xg,t(o,r)&&n.ref===e.ref)return ql(n,e,i)}return e.flags|=1,n=cA(s,r),n.ref=e.ref,n.return=e,e.child=n}function O5(n,e,t,r,i){if(n!==null){var s=n.memoizedProps;if(xg(s,r)&&n.ref===e.ref)if(Ji=!1,e.pendingProps=r=s,(n.lanes&i)!==0)n.flags&131072&&(Ji=!0);else return e.lanes=n.lanes,ql(n,e,i)}return yS(n,e,t,r,i)}function k5(n,e,t){var r=e.pendingProps,i=r.children,s=n!==null?n.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},En(Uh,xs),xs|=t;else{if(!(t&1073741824))return n=s!==null?s.baseLanes|t:t,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:n,cachePool:null,transitions:null},e.updateQueue=null,En(Uh,xs),xs|=n,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:t,En(Uh,xs),xs|=r}else s!==null?(r=s.baseLanes|t,e.memoizedState=null):r=t,En(Uh,xs),xs|=r;return Pi(n,e,i,t),e.child}function Q5(n,e){var t=e.ref;(n===null&&t!==null||n!==null&&n.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function yS(n,e,t,r,i){var s=ts(t)?Tu:Si.current;return s=vd(e,s),Jh(e,i),t=XI(n,e,t,r,s,i),r=YI(),n!==null&&!Ji?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~i,ql(n,e,i)):(On&&r&&DI(e),e.flags|=1,Pi(n,e,t,i),e.child)}function BP(n,e,t,r,i){if(ts(t)){var s=!0;h_(e)}else s=!1;if(Jh(e,i),e.stateNode===null)pw(n,e),L5(e,t,r),gS(e,t,r,i),r=!0;else if(n===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,c=t.contextType;typeof c=="object"&&c!==null?c=_o(c):(c=ts(t)?Tu:Si.current,c=vd(e,c));var A=t.getDerivedStateFromProps,u=typeof A=="function"||typeof o.getSnapshotBeforeUpdate=="function";u||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==c)&&yP(e,o,r,c),Nc=!1;var f=e.memoizedState;o.state=f,v_(e,r,o,i),l=e.memoizedState,a!==r||f!==l||es.current||Nc?(typeof A=="function"&&(mS(e,t,A,r),l=e.memoizedState),(a=Nc||vP(e,t,a,r,f,l,c))?(u||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),o.props=r,o.state=l,o.context=c,r=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,d5(n,e),a=e.memoizedProps,c=e.type===e.elementType?a:Wo(e.type,a),o.props=c,u=e.pendingProps,f=o.context,l=t.contextType,typeof l=="object"&&l!==null?l=_o(l):(l=ts(t)?Tu:Si.current,l=vd(e,l));var h=t.getDerivedStateFromProps;(A=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==u||f!==l)&&yP(e,o,r,l),Nc=!1,f=e.memoizedState,o.state=f,v_(e,r,o,i);var d=e.memoizedState;a!==u||f!==d||es.current||Nc?(typeof h=="function"&&(mS(e,t,h,r),d=e.memoizedState),(c=Nc||vP(e,t,c,r,f,d,l)||!1)?(A||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,d,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,d,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&f===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&f===n.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=d),o.props=r,o.state=d,o.context=l,r=c):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&f===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&f===n.memoizedState||(e.flags|=1024),r=!1)}return wS(n,e,t,r,s,i)}function wS(n,e,t,r,i,s){Q5(n,e);var o=(e.flags&128)!==0;if(!r&&!o)return i&&AP(e,t,!1),ql(n,e,s);r=e.stateNode,eZ.current=e;var a=o&&typeof t.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,n!==null&&o?(e.child=wd(e,n.child,null,s),e.child=wd(e,null,a,s)):Pi(n,e,a,s),e.memoizedState=r.state,i&&AP(e,t,!0),e.child}function H5(n){var e=n.stateNode;e.pendingContext?cP(n,e.pendingContext,e.pendingContext!==e.context):e.context&&cP(n,e.context,!1),VI(n,e.containerInfo)}function MP(n,e,t,r,i){return yd(),OI(i),e.flags|=256,Pi(n,e,t,r),e.child}var _S={dehydrated:null,treeContext:null,retryLane:0};function xS(n){return{baseLanes:n,cachePool:null,transitions:null}}function z5(n,e,t){var r=e.pendingProps,i=Vn.current,s=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=n!==null&&n.memoizedState===null?!1:(i&2)!==0),a?(s=!0,e.flags&=-129):(n===null||n.memoizedState!==null)&&(i|=1),En(Vn,i&1),n===null)return dS(e),n=e.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?(e.mode&1?n.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,n=r.fallback,s?(r=e.mode,s=e.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=qx(o,r,0,null),n=yu(n,r,t,null),s.return=e,n.return=e,s.sibling=n,e.child=s,e.child.memoizedState=xS(t),e.memoizedState=_S,n):JI(e,o));if(i=n.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return tZ(n,e,o,r,a,i,t);if(s){s=r.fallback,o=e.mode,i=n.child,a=i.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=cA(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=cA(a,s):(s=yu(s,o,t,null),s.flags|=2),s.return=e,r.return=e,r.sibling=s,e.child=r,r=s,s=e.child,o=n.child.memoizedState,o=o===null?xS(t):{baseLanes:o.baseLanes|t,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=n.childLanes&~t,e.memoizedState=_S,r}return s=n.child,n=s.sibling,r=cA(s,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=t),r.return=e,r.sibling=null,n!==null&&(t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)),e.child=r,e.memoizedState=null,r}function JI(n,e){return e=qx({mode:"visible",children:e},n.mode,0,null),e.return=n,n.child=e}function av(n,e,t,r){return r!==null&&OI(r),wd(e,n.child,null,t),n=JI(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function tZ(n,e,t,r,i,s,o){if(t)return e.flags&256?(e.flags&=-257,r=nE(Error(Oe(422))),av(n,e,o,r)):e.memoizedState!==null?(e.child=n.child,e.flags|=128,null):(s=r.fallback,i=e.mode,r=qx({mode:"visible",children:r.children},i,0,null),s=yu(s,i,o,null),s.flags|=2,r.return=e,s.return=e,r.sibling=s,e.child=r,e.mode&1&&wd(e,n.child,null,o),e.child.memoizedState=xS(o),e.memoizedState=_S,s);if(!(e.mode&1))return av(n,e,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(Oe(419)),r=nE(s,r,void 0),av(n,e,o,r)}if(a=(o&n.childLanes)!==0,Ji||a){if(r=Yr,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,Jl(n,i),ra(r,n,i,-1))}return iR(),r=nE(Error(Oe(421))),av(n,e,o,r)}return i.data==="$?"?(e.flags|=128,e.child=n.child,e=dZ.bind(null,n),i._reactRetry=e,null):(n=s.treeContext,Ts=sA(i.nextSibling),Ls=e,On=!0,$o=null,n!==null&&(io[so++]=Ql,io[so++]=Hl,io[so++]=Iu,Ql=n.id,Hl=n.overflow,Iu=e),e=JI(e,r.children),e.flags|=4096,e)}function SP(n,e,t){n.lanes|=e;var r=n.alternate;r!==null&&(r.lanes|=e),pS(n.return,e,t)}function rE(n,e,t,r,i){var s=n.memoizedState;s===null?n.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:t,tailMode:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=t,s.tailMode=i)}function G5(n,e,t){var r=e.pendingProps,i=r.revealOrder,s=r.tail;if(Pi(n,e,r.children,t),r=Vn.current,r&2)r=r&1|2,e.flags|=128;else{if(n!==null&&n.flags&128)e:for(n=e.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&SP(n,t,e);else if(n.tag===19)SP(n,t,e);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}r&=1}if(En(Vn,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(t=e.child,i=null;t!==null;)n=t.alternate,n!==null&&y_(n)===null&&(i=t),t=t.sibling;t=i,t===null?(i=e.child,e.child=null):(i=t.sibling,t.sibling=null),rE(e,!1,i,t,s);break;case"backwards":for(t=null,i=e.child,e.child=null;i!==null;){if(n=i.alternate,n!==null&&y_(n)===null){e.child=i;break}n=i.sibling,i.sibling=t,t=i,i=n}rE(e,!0,t,null,s);break;case"together":rE(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function pw(n,e){!(e.mode&1)&&n!==null&&(n.alternate=null,e.alternate=null,e.flags|=2)}function ql(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),Uu|=e.lanes,!(t&e.childLanes))return null;if(n!==null&&e.child!==n.child)throw Error(Oe(153));if(e.child!==null){for(n=e.child,t=cA(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=cA(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function nZ(n,e,t){switch(e.tag){case 3:H5(e),yd();break;case 5:p5(e);break;case 1:ts(e.type)&&h_(e);break;case 4:VI(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;En(m_,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(En(Vn,Vn.current&1),e.flags|=128,null):t&e.child.childLanes?z5(n,e,t):(En(Vn,Vn.current&1),n=ql(n,e,t),n!==null?n.sibling:null);En(Vn,Vn.current&1);break;case 19:if(r=(t&e.childLanes)!==0,n.flags&128){if(r)return G5(n,e,t);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),En(Vn,Vn.current),r)break;return null;case 22:case 23:return e.lanes=0,k5(n,e,t)}return ql(n,e,t)}var V5,bS,j5,W5;V5=function(n,e){for(var t=e.child;t!==null;){if(t.tag===5||t.tag===6)n.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}};bS=function(){};j5=function(n,e,t,r){var i=n.memoizedProps;if(i!==r){n=e.stateNode,fu(Ka.current);var s=null;switch(t){case"input":i=jM(n,i),r=jM(n,r),s=[];break;case"select":i=Yn({},i,{value:void 0}),r=Yn({},r,{value:void 0}),s=[];break;case"textarea":i=XM(n,i),r=XM(n,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(n.onclick=u_)}$M(t,r);var o;t=null;for(c in i)if(!r.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var a=i[c];for(o in a)a.hasOwnProperty(o)&&(t||(t={}),t[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(pg.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in r){var l=r[c];if(a=i!=null?i[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(t||(t={}),t[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(t||(t={}),t[o]=l[o])}else t||(s||(s=[]),s.push(c,t)),t=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(pg.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Mn("scroll",n),s||a===l||(s=[])):(s=s||[]).push(c,l))}t&&(s=s||[]).push("style",t);var c=s;(e.updateQueue=c)&&(e.flags|=4)}};W5=function(n,e,t,r){t!==r&&(e.flags|=4)};function Mp(n,e){if(!On)switch(n.tailMode){case"hidden":e=n.tail;for(var t=null;e!==null;)e.alternate!==null&&(t=e),e=e.sibling;t===null?n.tail=null:t.sibling=null;break;case"collapsed":t=n.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e||n.tail===null?n.tail=null:n.tail.sibling=null:r.sibling=null}}function ui(n){var e=n.alternate!==null&&n.alternate.child===n.child,t=0,r=0;if(e)for(var i=n.child;i!==null;)t|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=n,i=i.sibling;else for(i=n.child;i!==null;)t|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=n,i=i.sibling;return n.subtreeFlags|=r,n.childLanes=t,e}function rZ(n,e,t){var r=e.pendingProps;switch(NI(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ui(e),null;case 1:return ts(e.type)&&f_(),ui(e),null;case 3:return r=e.stateNode,_d(),Rn(es),Rn(Si),WI(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(n===null||n.child===null)&&(sv(e)?e.flags|=4:n===null||n.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,$o!==null&&(RS($o),$o=null))),bS(n,e),ui(e),null;case 5:jI(e);var i=fu(Sg.current);if(t=e.type,n!==null&&e.stateNode!=null)j5(n,e,t,r,i),n.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(Oe(166));return ui(e),null}if(n=fu(Ka.current),sv(e)){r=e.stateNode,t=e.type;var s=e.memoizedProps;switch(r[Fa]=e,r[Bg]=s,n=(e.mode&1)!==0,t){case"dialog":Mn("cancel",r),Mn("close",r);break;case"iframe":case"object":case"embed":Mn("load",r);break;case"video":case"audio":for(i=0;i<\/script>",n=n.removeChild(n.firstChild)):typeof r.is=="string"?n=o.createElement(t,{is:r.is}):(n=o.createElement(t),t==="select"&&(o=n,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):n=o.createElementNS(n,t),n[Fa]=e,n[Bg]=r,V5(n,e,!1,!1),e.stateNode=n;e:{switch(o=ZM(t,r),t){case"dialog":Mn("cancel",n),Mn("close",n),i=r;break;case"iframe":case"object":case"embed":Mn("load",n),i=r;break;case"video":case"audio":for(i=0;ibd&&(e.flags|=128,r=!0,Mp(s,!1),e.lanes=4194304)}else{if(!r)if(n=y_(o),n!==null){if(e.flags|=128,r=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Mp(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!On)return ui(e),null}else 2*dr()-s.renderingStartTime>bd&&t!==1073741824&&(e.flags|=128,r=!0,Mp(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=dr(),e.sibling=null,t=Vn.current,En(Vn,r?t&1|2:t&1),e):(ui(e),null);case 22:case 23:return rR(),r=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?xs&1073741824&&(ui(e),e.subtreeFlags&6&&(e.flags|=8192)):ui(e),null;case 24:return null;case 25:return null}throw Error(Oe(156,e.tag))}function iZ(n,e){switch(NI(e),e.tag){case 1:return ts(e.type)&&f_(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return _d(),Rn(es),Rn(Si),WI(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return jI(e),null;case 13:if(Rn(Vn),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Oe(340));yd()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return Rn(Vn),null;case 4:return _d(),null;case 10:return HI(e.type._context),null;case 22:case 23:return rR(),null;case 24:return null;default:return null}}var lv=!1,yi=!1,sZ=typeof WeakSet=="function"?WeakSet:Set,Je=null;function Rh(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){er(n,e,r)}else t.current=null}function ES(n,e,t){try{t()}catch(r){er(n,e,r)}}var CP=!1;function oZ(n,e){if(aS=l_,n=ZH(),LI(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var r=t.getSelection&&t.getSelection();if(r&&r.rangeCount!==0){t=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,c=0,A=0,u=n,f=null;t:for(;;){for(var h;u!==t||i!==0&&u.nodeType!==3||(a=o+i),u!==s||r!==0&&u.nodeType!==3||(l=o+r),u.nodeType===3&&(o+=u.nodeValue.length),(h=u.firstChild)!==null;)f=u,u=h;for(;;){if(u===n)break t;if(f===t&&++c===i&&(a=o),f===s&&++A===r&&(l=o),(h=u.nextSibling)!==null)break;u=f,f=u.parentNode}u=h}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(lS={focusedElem:n,selectionRange:t},l_=!1,Je=e;Je!==null;)if(e=Je,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,Je=n;else for(;Je!==null;){e=Je;try{var d=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(d!==null){var m=d.memoizedProps,g=d.memoizedState,p=e.stateNode,v=p.getSnapshotBeforeUpdate(e.elementType===e.type?m:Wo(e.type,m),g);p.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Oe(163))}}catch(_){er(e,e.return,_)}if(n=e.sibling,n!==null){n.return=e.return,Je=n;break}Je=e.return}return d=CP,CP=!1,d}function Km(n,e,t){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&n)===n){var s=i.destroy;i.destroy=void 0,s!==void 0&&ES(e,t,s)}i=i.next}while(i!==r)}}function Zx(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var r=t.create;t.destroy=r()}t=t.next}while(t!==e)}}function BS(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function K5(n){var e=n.alternate;e!==null&&(n.alternate=null,K5(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Fa],delete e[Bg],delete e[uS],delete e[z$],delete e[G$])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function X5(n){return n.tag===5||n.tag===3||n.tag===4}function TP(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||X5(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function MS(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=u_));else if(r!==4&&(n=n.child,n!==null))for(MS(n,e,t),n=n.sibling;n!==null;)MS(n,e,t),n=n.sibling}function SS(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(r!==4&&(n=n.child,n!==null))for(SS(n,e,t),n=n.sibling;n!==null;)SS(n,e,t),n=n.sibling}var ni=null,Xo=!1;function vc(n,e,t){for(t=t.child;t!==null;)Y5(n,e,t),t=t.sibling}function Y5(n,e,t){if(Wa&&typeof Wa.onCommitFiberUnmount=="function")try{Wa.onCommitFiberUnmount(Gx,t)}catch{}switch(t.tag){case 5:yi||Rh(t,e);case 6:var r=ni,i=Xo;ni=null,vc(n,e,t),ni=r,Xo=i,ni!==null&&(Xo?(n=ni,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):ni.removeChild(t.stateNode));break;case 18:ni!==null&&(Xo?(n=ni,t=t.stateNode,n.nodeType===8?$b(n.parentNode,t):n.nodeType===1&&$b(n,t),wg(n)):$b(ni,t.stateNode));break;case 4:r=ni,i=Xo,ni=t.stateNode.containerInfo,Xo=!0,vc(n,e,t),ni=r,Xo=i;break;case 0:case 11:case 14:case 15:if(!yi&&(r=t.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&ES(t,e,o),i=i.next}while(i!==r)}vc(n,e,t);break;case 1:if(!yi&&(Rh(t,e),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(a){er(t,e,a)}vc(n,e,t);break;case 21:vc(n,e,t);break;case 22:t.mode&1?(yi=(r=yi)||t.memoizedState!==null,vc(n,e,t),yi=r):vc(n,e,t);break;default:vc(n,e,t)}}function IP(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new sZ),e.forEach(function(r){var i=pZ.bind(null,n,r);t.has(r)||(t.add(r),r.then(i,i))})}}function Po(n,e){var t=e.deletions;if(t!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=dr()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*lZ(r/1960))-r,10n?16:n,Wc===null)var r=!1;else{if(n=Wc,Wc=null,E_=0,Kt&6)throw Error(Oe(331));var i=Kt;for(Kt|=4,Je=n.current;Je!==null;){var s=Je,o=s.child;if(Je.flags&16){var a=s.deletions;if(a!==null){for(var l=0;ldr()-tR?vu(n,0):eR|=t),ns(n,e)}function r6(n,e){e===0&&(n.mode&1?(e=q0,q0<<=1,!(q0&130023424)&&(q0=4194304)):e=1);var t=ki();n=Jl(n,e),n!==null&&(f0(n,e,t),ns(n,t))}function dZ(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),r6(n,t)}function pZ(n,e){var t=0;switch(n.tag){case 13:var r=n.stateNode,i=n.memoizedState;i!==null&&(t=i.retryLane);break;case 19:r=n.stateNode;break;default:throw Error(Oe(314))}r!==null&&r.delete(e),r6(n,t)}var i6;i6=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||es.current)Ji=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return Ji=!1,nZ(n,e,t);Ji=!!(n.flags&131072)}else Ji=!1,On&&e.flags&1048576&&l5(e,p_,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;pw(n,e),n=e.pendingProps;var i=vd(e,Si.current);Jh(e,t),i=XI(null,e,r,n,i,t);var s=YI();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,ts(r)?(s=!0,h_(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,GI(e),i.updater=$x,e.stateNode=i,i._reactInternals=e,gS(e,r,n,t),e=wS(null,e,r,!0,s,t)):(e.tag=0,On&&s&&DI(e),Pi(null,e,i,t),e=e.child),e;case 16:r=e.elementType;e:{switch(pw(n,e),n=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=gZ(r),n=Wo(r,n),i){case 0:e=yS(null,e,r,n,t);break e;case 1:e=BP(null,e,r,n,t);break e;case 11:e=bP(null,e,r,n,t);break e;case 14:e=EP(null,e,r,Wo(r.type,n),t);break e}throw Error(Oe(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Wo(r,i),yS(n,e,r,i,t);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Wo(r,i),BP(n,e,r,i,t);case 3:e:{if(H5(e),n===null)throw Error(Oe(387));r=e.pendingProps,s=e.memoizedState,i=s.element,d5(n,e),v_(e,r,null,t);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=xd(Error(Oe(423)),e),e=MP(n,e,r,t,i);break e}else if(r!==i){i=xd(Error(Oe(424)),e),e=MP(n,e,r,t,i);break e}else for(Ts=sA(e.stateNode.containerInfo.firstChild),Ls=e,On=!0,$o=null,t=f5(e,null,r,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(yd(),r===i){e=ql(n,e,t);break e}Pi(n,e,r,t)}e=e.child}return e;case 5:return p5(e),n===null&&dS(e),r=e.type,i=e.pendingProps,s=n!==null?n.memoizedProps:null,o=i.children,cS(r,i)?o=null:s!==null&&cS(r,s)&&(e.flags|=32),Q5(n,e),Pi(n,e,o,t),e.child;case 6:return n===null&&dS(e),null;case 13:return z5(n,e,t);case 4:return VI(e,e.stateNode.containerInfo),r=e.pendingProps,n===null?e.child=wd(e,null,r,t):Pi(n,e,r,t),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Wo(r,i),bP(n,e,r,i,t);case 7:return Pi(n,e,e.pendingProps,t),e.child;case 8:return Pi(n,e,e.pendingProps.children,t),e.child;case 12:return Pi(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,En(m_,r._currentValue),r._currentValue=o,s!==null)if(la(s.value,o)){if(s.children===i.children&&!es.current){e=ql(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=Vl(-1,t&-t),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var A=c.pending;A===null?l.next=l:(l.next=A.next,A.next=l),c.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),pS(s.return,t,e),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Oe(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),pS(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Pi(n,e,i.children,t),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Jh(e,t),i=_o(i),r=r(i),e.flags|=1,Pi(n,e,r,t),e.child;case 14:return r=e.type,i=Wo(r,e.pendingProps),i=Wo(r.type,i),EP(n,e,r,i,t);case 15:return O5(n,e,e.type,e.pendingProps,t);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Wo(r,i),pw(n,e),e.tag=1,ts(r)?(n=!0,h_(e)):n=!1,Jh(e,t),L5(e,r,i),gS(e,r,i,t),wS(null,e,r,!0,n,t);case 19:return G5(n,e,t);case 22:return k5(n,e,t)}throw Error(Oe(156,e.tag))};function s6(n,e){return UH(n,e)}function mZ(n,e,t,r){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function co(n,e,t,r){return new mZ(n,e,t,r)}function sR(n){return n=n.prototype,!(!n||!n.isReactComponent)}function gZ(n){if(typeof n=="function")return sR(n)?1:0;if(n!=null){if(n=n.$$typeof,n===EI)return 11;if(n===BI)return 14}return 2}function cA(n,e){var t=n.alternate;return t===null?(t=co(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function vw(n,e,t,r,i,s){var o=2;if(r=n,typeof n=="function")sR(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case xh:return yu(t.children,i,s,e);case bI:o=8,i|=8;break;case HM:return n=co(12,t,e,i|2),n.elementType=HM,n.lanes=s,n;case zM:return n=co(13,t,e,i),n.elementType=zM,n.lanes=s,n;case GM:return n=co(19,t,e,i),n.elementType=GM,n.lanes=s,n;case pH:return qx(t,i,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case hH:o=10;break e;case dH:o=9;break e;case EI:o=11;break e;case BI:o=14;break e;case Dc:o=16,r=null;break e}throw Error(Oe(130,n==null?n:typeof n,""))}return e=co(o,t,e,i),e.elementType=n,e.type=r,e.lanes=s,e}function yu(n,e,t,r){return n=co(7,n,r,e),n.lanes=t,n}function qx(n,e,t,r){return n=co(22,n,r,e),n.elementType=pH,n.lanes=t,n.stateNode={isHidden:!1},n}function iE(n,e,t){return n=co(6,n,null,e),n.lanes=t,n}function sE(n,e,t){return e=co(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function vZ(n,e,t,r,i){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=kb(0),this.expirationTimes=kb(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=kb(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function oR(n,e,t,r,i,s,o,a,l){return n=new vZ(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=co(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},GI(s),n}function yZ(n,e,t){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(c6)}catch(n){console.error(n)}}c6(),cH.exports=js;var EZ=cH.exports,OP=EZ;kM.createRoot=OP.createRoot,kM.hydrateRoot=OP.hydrateRoot;const BZ="/assets/cc_bgm_balanced-f542698c.wav",So=be.createContext(),MZ=({children:n})=>{const[e,t]=be.useState(!1),r=Z.useRef(null),i=()=>{t(!1);const o=r.current;o.src=BZ,o.loop=!0,o.volume=0,o.play();let a=0;const l=5,c=setInterval(()=>{a=Math.max(a+1/(10*l*60),1),a>=1&&clearInterval(c),o.volume=a},1e3/60)},s=()=>{t(!0),r.current.pause()};return k.jsxs(So.Provider,{value:{isMute:e,setMute:t,enableAudio:i,disableAudio:s},children:[k.jsx("audio",{ref:r}),n]})},SZ=be.createContext(),CZ=n=>{const[e,t]=be.useState(null),[r,i]=be.useState(null),[s,o]=be.useState(!1),[a,l]=be.useState([]);return k.jsx(SZ.Provider,{value:{walletAddress:e,setWalletAddress:t,ensName:r,setEnsName:i,connected:s,setConnected:o,OTTokens:a,setOTTokens:l},children:n.children})};function Rl(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function A6(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e}/*! * GSAP 3.12.5 * https://gsap.com * @@ -52,7 +52,7 @@ Error generating stack: `+s.message+` * Subject to the terms at https://gsap.com/standard-license or for * Club GSAP members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com -*/var Ds={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},bd={duration:.5,overwrite:!1,delay:0},lR,Ei,kn,Ao=1e8,_n=1/Ao,IM=Math.PI*2,CZ=IM/4,TZ=0,A6=Math.sqrt,IZ=Math.cos,RZ=Math.sin,Yr=function(e){return typeof e=="string"},nr=function(e){return typeof e=="function"},ec=function(e){return typeof e=="number"},cR=function(e){return typeof e>"u"},qa=function(e){return typeof e=="object"},rs=function(e){return e!==!1},AR=function(){return typeof window<"u"},Av=function(e){return nr(e)||Yr(e)},u6=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},Bi=Array.isArray,RM=/(?:-?\.?\d|\.)+/gi,f6=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Rh=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,iE=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,h6=/[+-]=-?[.\d]+/,d6=/[^,'"\[\]\s]+/gi,UZ=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,jn,Ma,UM,uR,Hs={},S_={},p6,m6=function(e){return(S_=Uu(e,Hs))&&As},fR=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},Rg=function(e,t){return!t&&console.warn(e)},g6=function(e,t){return e&&(Hs[e]=t)&&S_&&(S_[e]=t)||Hs},Ug=function(){return 0},FZ={suppressEvents:!0,isStart:!0,kill:!1},vw={suppressEvents:!0,kill:!1},PZ={suppressEvents:!0},hR={},cA=[],FM={},v6,Bs={},sE={},OP=30,yw=[],dR="",pR=function(e){var t=e[0],r,i;if(qa(t)||nr(t)||(e=[e]),!(r=(t._gsap||{}).harness)){for(i=yw.length;i--&&!yw[i].targetTest(t););r=yw[i]}for(i=e.length;i--;)e[i]&&(e[i]._gsap||(e[i]._gsap=new z6(e[i],r)))||e.splice(i,1);return e},vu=function(e){return e._gsap||pR(uo(e))[0]._gsap},y6=function(e,t,r){return(r=e[t])&&nr(r)?e[t]():cR(r)&&e.getAttribute&&e.getAttribute(t)||r},is=function(e,t){return(e=e.split(",")).forEach(t)||e},hr=function(e){return Math.round(e*1e5)/1e5||0},jr=function(e){return Math.round(e*1e7)/1e7||0},qh=function(e,t){var r=t.charAt(0),i=parseFloat(t.substr(2));return e=parseFloat(e),r==="+"?e+i:r==="-"?e-i:r==="*"?e*i:e/i},LZ=function(e,t){for(var r=t.length,i=0;e.indexOf(t[i])<0&&++ia;)o=o._prev;return o?(t._next=o._next,o._next=t):(t._next=e[r],e[r]=t),t._next?t._next._prev=t:e[i]=t,t._prev=o,t.parent=t._dp=e,t},r1=function(e,t,r,i){r===void 0&&(r="_first"),i===void 0&&(i="_last");var s=t._prev,o=t._next;s?s._next=o:e[r]===t&&(e[r]=o),o?o._prev=s:e[i]===t&&(e[i]=s),t._next=t._prev=t.parent=null},gA=function(e,t){e.parent&&(!t||e.parent.autoRemoveChildren)&&e.parent.remove&&e.parent.remove(e),e._act=0},yu=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var r=e;r;)r._dirty=1,r=r.parent;return e},OZ=function(e){for(var t=e.parent;t&&t.parent;)t._dirty=1,t.totalDuration(),t=t.parent;return e},PM=function(e,t,r,i){return e._startAt&&(Ei?e._startAt.revert(vw):e.vars.immediateRender&&!e.vars.autoRevert||e._startAt.render(t,!0,i))},kZ=function n(e){return!e||e._ts&&n(e.parent)},HP=function(e){return e._repeat?Ed(e._tTime,e=e.duration()+e._rDelay)*e:0},Ed=function(e,t){var r=Math.floor(e/=t);return e&&r===e?r-1:r},T_=function(e,t){return(e-t._start)*t._ts+(t._ts>=0?0:t._dirty?t.totalDuration():t._tDur)},i1=function(e){return e._end=jr(e._start+(e._tDur/Math.abs(e._ts||e._rts||_n)||0))},s1=function(e,t){var r=e._dp;return r&&r.smoothChildTiming&&e._ts&&(e._start=jr(r._time-(e._ts>0?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),i1(e),r._dirty||yu(r,e)),e},E6=function(e,t){var r;if((t._time||!t._dur&&t._initted||t._start_n)&&t.render(r,!0)),yu(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur=0&&r.totalTime(r._tTime),r=r._dp;e._zTime=-_n}},Ua=function(e,t,r,i){return t.parent&&gA(t),t._start=jr((ec(r)?r:r||e!==jn?eo(e,r,t):e._time)+t._delay),t._end=jr(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),b6(e,t,"_first","_last",e._sort?"_start":0),LM(t)||(e._recent=t),i||E6(e,t),e._ts<0&&s1(e,e._tTime),e},B6=function(e,t){return(Hs.ScrollTrigger||fR("scrollTrigger",t))&&Hs.ScrollTrigger.create(t,e)},S6=function(e,t,r,i,s){if(gR(e,t,s),!e._initted)return 1;if(!r&&e._pt&&!Ei&&(e._dur&&e.vars.lazy!==!1||!e._dur&&e.vars.lazy)&&v6!==Ss.frame)return cA.push(e),e._lazy=[s,i],1},HZ=function n(e){var t=e.parent;return t&&t._ts&&t._initted&&!t._lock&&(t.rawTime()<0||n(t))},LM=function(e){var t=e.data;return t==="isFromStart"||t==="isStart"},QZ=function(e,t,r,i){var s=e.ratio,o=t<0||!t&&(!e._start&&HZ(e)&&!(!e._initted&&LM(e))||(e._ts<0||e._dp._ts<0)&&!LM(e))?0:1,a=e._rDelay,l=0,c,A,u;if(a&&e._repeat&&(l=p0(0,e._tDur,t),A=Ed(l,a),e._yoyo&&A&1&&(o=1-o),A!==Ed(e._tTime,a)&&(s=1-o,e.vars.repeatRefresh&&e._initted&&e.invalidate())),o!==s||Ei||i||e._zTime===_n||!t&&e._zTime){if(!e._initted&&S6(e,t,i,r,l))return;for(u=e._zTime,e._zTime=t||(r?_n:0),r||(r=t&&!u),e.ratio=o,e._from&&(o=1-o),e._time=0,e._tTime=l,c=e._pt;c;)c.r(o,c.d),c=c._next;t<0&&PM(e,t,r,!0),e._onUpdate&&!r&&Is(e,"onUpdate"),l&&e._repeat&&!r&&e.parent&&Is(e,"onRepeat"),(t>=e._tDur||t<0)&&e.ratio===o&&(o&&gA(e,1),!r&&!Ei&&(Is(e,o?"onComplete":"onReverseComplete",!0),e._prom&&e._prom()))}else e._zTime||(e._zTime=t)},zZ=function(e,t,r){var i;if(r>t)for(i=e._first;i&&i._start<=r;){if(i.data==="isPause"&&i._start>t)return i;i=i._next}else for(i=e._last;i&&i._start>=r;){if(i.data==="isPause"&&i._start0&&!i&&s1(e,e._tTime=e._tDur*a),e.parent&&i1(e),r||yu(e.parent,e),e},QP=function(e){return e instanceof Ni?yu(e):Bd(e,e._dur)},GZ={_start:0,endTime:Ug,totalDuration:Ug},eo=function n(e,t,r){var i=e.labels,s=e._recent||GZ,o=e.duration()>=Ao?s.endTime(!1):e._dur,a,l,c;return Yr(t)&&(isNaN(t)||t in i)?(l=t.charAt(0),c=t.substr(-1)==="%",a=t.indexOf("="),l==="<"||l===">"?(a>=0&&(t=t.replace(/=/,"")),(l==="<"?s._start:s.endTime(s._repeat>=0))+(parseFloat(t.substr(1))||0)*(c?(a<0?s:r).totalDuration()/100:1)):a<0?(t in i||(i[t]=o),i[t]):(l=parseFloat(t.charAt(a-1)+t.substr(a+1)),c&&r&&(l=l/100*(Bi(r)?r[0]:r).totalDuration()),a>1?n(e,t.substr(0,a-1),r)+l:o+l)):t==null?o:+t},$m=function(e,t,r){var i=ec(t[1]),s=(i?2:1)+(e<2?0:1),o=t[s],a,l;if(i&&(o.duration=t[1]),o.parent=r,e){for(a=o,l=r;l&&!("immediateRender"in a);)a=l.vars.defaults||{},l=rs(l.vars.inherit)&&l.parent;o.immediateRender=rs(a.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new xr(t[0],o,t[s+1])},IA=function(e,t){return e||e===0?t(e):t},p0=function(e,t,r){return rt?t:r},wi=function(e,t){return!Yr(e)||!(t=UZ.exec(e))?"":t[1]},VZ=function(e,t,r){return IA(r,function(i){return p0(e,t,i)})},DM=[].slice,M6=function(e,t){return e&&qa(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&qa(e[0]))&&!e.nodeType&&e!==Ma},jZ=function(e,t,r){return r===void 0&&(r=[]),e.forEach(function(i){var s;return Yr(i)&&!t||M6(i,1)?(s=r).push.apply(s,uo(i)):r.push(i)})||r},uo=function(e,t,r){return kn&&!t&&kn.selector?kn.selector(e):Yr(e)&&!r&&(UM||!Sd())?DM.call((t||uR).querySelectorAll(e),0):Bi(e)?jZ(e,r):M6(e)?DM.call(e,0):e?[e]:[]},NM=function(e){return e=uo(e)[0]||Rg("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return uo(t,r.querySelectorAll?r:r===e?Rg("Invalid scope")||uR.createElement("div"):e)}},C6=function(e){return e.sort(function(){return .5-Math.random()})},T6=function(e){if(nr(e))return e;var t=qa(e)?e:{each:e},r=wu(t.ease),i=t.from||0,s=parseFloat(t.base)||0,o={},a=i>0&&i<1,l=isNaN(i)||a,c=t.axis,A=i,u=i;return Yr(i)?A=u={center:.5,edges:.5,end:1}[i]||0:!a&&l&&(A=i[0],u=i[1]),function(f,h,d){var m=(d||t).length,g=o[m],p,v,w,_,x,b,B,M,I;if(!g){if(I=t.grid==="auto"?0:(t.grid||[1,Ao])[1],!I){for(B=-Ao;B<(B=d[I++].getBoundingClientRect().left)&&IB&&(B=x),xm?m-1:c?c==="y"?m/I:I:Math.max(I,m/I))||0)*(i==="edges"?-1:1),g.b=m<0?s-m:s,g.u=wi(t.amount||t.each)||0,r=r&&m<0?k6(r):r}return m=(g[f]-g.min)/g.max||0,jr(g.b+(r?r(m):m)*g.v)+g.u}},OM=function(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(r){var i=jr(Math.round(parseFloat(r)/e)*e*t);return(i-i%1)/t+(ec(r)?0:wi(r))}},I6=function(e,t){var r=Bi(e),i,s;return!r&&qa(e)&&(i=r=e.radius||Ao,e.values?(e=uo(e.values),(s=!ec(e[0]))&&(i*=i)):e=OM(e.increment)),IA(t,r?nr(e)?function(o){return s=e(o),Math.abs(s-o)<=i?s:o}:function(o){for(var a=parseFloat(s?o.x:o),l=parseFloat(s?o.y:0),c=Ao,A=0,u=e.length,f,h;u--;)s?(f=e[u].x-a,h=e[u].y-l,f=f*f+h*h):f=Math.abs(e[u]-a),fi?s-o:o)})},Fg=function(e){for(var t=0,r="",i,s,o,a;~(i=e.indexOf("random(",t));)o=e.indexOf(")",i),a=e.charAt(i+7)==="[",s=e.substr(i+7,o-i-7).match(a?d6:RM),r+=e.substr(t,i-t)+R6(a?s:+s[0],a?0:+s[1],+s[2]||1e-5),t=o+1;return r+e.substr(t,e.length-t)},F6=function(e,t,r,i,s){var o=t-e,a=i-r;return IA(s,function(l){return r+((l-e)/o*a||0)})},ZZ=function n(e,t,r,i){var s=isNaN(e+t)?0:function(h){return(1-h)*e+h*t};if(!s){var o=Yr(e),a={},l,c,A,u,f;if(r===!0&&(i=1)&&(r=null),o)e={p:e},t={p:t};else if(Bi(e)&&!Bi(t)){for(A=[],u=e.length,f=u-2,c=1;c(a=Math.abs(a))&&(l=o,s=a);return l},Is=function(e,t,r){var i=e.vars,s=i[t],o=kn,a=e._ctx,l,c,A;if(s)return l=i[t+"Params"],c=i.callbackScope||e,r&&cA.length&&M_(),a&&(kn=a),A=l?s.apply(c,l):s.call(c),kn=o,A},ym=function(e){return gA(e),e.scrollTrigger&&e.scrollTrigger.kill(!!Ei),e.progress()<1&&Is(e,"onInterrupt"),e},Uh,P6=[],L6=function(e){if(e)if(e=!e.name&&e.default||e,AR()||e.headless){var t=e.name,r=nr(e),i=t&&!r&&e.init?function(){this._props=[]}:e,s={init:Ug,render:wR,add:mR,kill:hJ,modifier:fJ,rawVars:0},o={targetTest:0,get:0,getSetter:yR,aliases:{},register:0};if(Sd(),e!==i){if(Bs[t])return;bo(i,bo(C_(e,s),o)),Uu(i.prototype,Uu(s,C_(e,o))),Bs[i.prop=t]=i,e.targetTest&&(yw.push(i),hR[t]=1),t=(t==="css"?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}g6(t,i),e.register&&e.register(As,i,ss)}else P6.push(e)},vn=255,wm={aqua:[0,vn,vn],lime:[0,vn,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,vn],navy:[0,0,128],white:[vn,vn,vn],olive:[128,128,0],yellow:[vn,vn,0],orange:[vn,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[vn,0,0],pink:[vn,192,203],cyan:[0,vn,vn],transparent:[vn,vn,vn,0]},oE=function(e,t,r){return e+=e<0?1:e>1?-1:0,(e*6<1?t+(r-t)*e*6:e<.5?r:e*3<2?t+(r-t)*(2/3-e)*6:t)*vn+.5|0},D6=function(e,t,r){var i=e?ec(e)?[e>>16,e>>8&vn,e&vn]:0:wm.black,s,o,a,l,c,A,u,f,h,d;if(!i){if(e.substr(-1)===","&&(e=e.substr(0,e.length-1)),wm[e])i=wm[e];else if(e.charAt(0)==="#"){if(e.length<6&&(s=e.charAt(1),o=e.charAt(2),a=e.charAt(3),e="#"+s+s+o+o+a+a+(e.length===5?e.charAt(4)+e.charAt(4):"")),e.length===9)return i=parseInt(e.substr(1,6),16),[i>>16,i>>8&vn,i&vn,parseInt(e.substr(7),16)/255];e=parseInt(e.substr(1),16),i=[e>>16,e>>8&vn,e&vn]}else if(e.substr(0,3)==="hsl"){if(i=d=e.match(RM),!t)l=+i[0]%360/360,c=+i[1]/100,A=+i[2]/100,o=A<=.5?A*(c+1):A+c-A*c,s=A*2-o,i.length>3&&(i[3]*=1),i[0]=oE(l+1/3,s,o),i[1]=oE(l,s,o),i[2]=oE(l-1/3,s,o);else if(~e.indexOf("="))return i=e.match(f6),r&&i.length<4&&(i[3]=1),i}else i=e.match(RM)||wm.transparent;i=i.map(Number)}return t&&!d&&(s=i[0]/vn,o=i[1]/vn,a=i[2]/vn,u=Math.max(s,o,a),f=Math.min(s,o,a),A=(u+f)/2,u===f?l=c=0:(h=u-f,c=A>.5?h/(2-u-f):h/(u+f),l=u===s?(o-a)/h+(oe||p<0)&&(r+=p-t),i+=p,x=i-r,w=x-o,(w>0||v)&&(b=++u.frame,f=x-u.time*1e3,u.time=x=x/1e3,o+=w+(w>=s?4:s-w),_=1),v||(l=c(m)),_)for(h=0;h=p&&h--},_listeners:a},u}(),Sd=function(){return!Pg&&Ss.wake()},Gt={},qZ=/^[\d.\-M][\d.\-,\s]/,eJ=/["']/g,tJ=function(e){for(var t={},r=e.substr(1,e.length-3).split(":"),i=r[0],s=1,o=r.length,a,l,c;s1&&r.config?r.config.apply(null,~e.indexOf("{")?[tJ(t[1])]:nJ(e).split(",").map(_6)):Gt._CE&&qZ.test(e)?Gt._CE("",e):r},k6=function(e){return function(t){return 1-e(1-t)}},H6=function n(e,t){for(var r=e._first,i;r;)r instanceof Ni?n(r,t):r.vars.yoyoEase&&(!r._yoyo||!r._repeat)&&r._yoyo!==t&&(r.timeline?n(r.timeline,t):(i=r._ease,r._ease=r._yEase,r._yEase=i,r._yoyo=t)),r=r._next},wu=function(e,t){return e&&(nr(e)?e:Gt[e]||rJ(e))||t},Ku=function(e,t,r,i){r===void 0&&(r=function(l){return 1-t(1-l)}),i===void 0&&(i=function(l){return l<.5?t(l*2)/2:1-t((1-l)*2)/2});var s={easeIn:t,easeOut:r,easeInOut:i},o;return is(e,function(a){Gt[a]=Hs[a]=s,Gt[o=a.toLowerCase()]=r;for(var l in s)Gt[o+(l==="easeIn"?".in":l==="easeOut"?".out":".inOut")]=Gt[a+"."+l]=s[l]}),s},Q6=function(e){return function(t){return t<.5?(1-e(1-t*2))/2:.5+e((t-.5)*2)/2}},aE=function n(e,t,r){var i=t>=1?t:1,s=(r||(e?.3:.45))/(t<1?t:1),o=s/IM*(Math.asin(1/i)||0),a=function(A){return A===1?1:i*Math.pow(2,-10*A)*RZ((A-o)*s)+1},l=e==="out"?a:e==="in"?function(c){return 1-a(1-c)}:Q6(a);return s=IM/s,l.config=function(c,A){return n(e,c,A)},l},lE=function n(e,t){t===void 0&&(t=1.70158);var r=function(o){return o?--o*o*((t+1)*o+t)+1:0},i=e==="out"?r:e==="in"?function(s){return 1-r(1-s)}:Q6(r);return i.config=function(s){return n(e,s)},i};is("Linear,Quad,Cubic,Quart,Quint,Strong",function(n,e){var t=e<5?e+1:e;Ku(n+",Power"+(t-1),e?function(r){return Math.pow(r,t)}:function(r){return r},function(r){return 1-Math.pow(1-r,t)},function(r){return r<.5?Math.pow(r*2,t)/2:1-Math.pow((1-r)*2,t)/2})});Gt.Linear.easeNone=Gt.none=Gt.Linear.easeIn;Ku("Elastic",aE("in"),aE("out"),aE());(function(n,e){var t=1/e,r=2*t,i=2.5*t,s=function(a){return a0?r+(r+this._rDelay)*this._repeat:r):this.totalDuration()&&this._dur},e.totalDuration=function(r){return arguments.length?(this._dirty=0,Bd(this,this._repeat<0?r:(r-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(r,i){if(Sd(),!arguments.length)return this._tTime;var s=this._dp;if(s&&s.smoothChildTiming&&this._ts){for(s1(this,r),!s._dp||s.parent||E6(s,this);s&&s.parent;)s.parent._time!==s._start+(s._ts>=0?s._tTime/s._ts:(s.totalDuration()-s._tTime)/-s._ts)&&s.totalTime(s._tTime,!0),s=s.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&r0||!this._tDur&&!r)&&Ua(this._dp,this,this._start-this._delay)}return(this._tTime!==r||!this._dur&&!i||this._initted&&Math.abs(this._zTime)===_n||!r&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=r),w6(this,r,i)),this},e.time=function(r,i){return arguments.length?this.totalTime(Math.min(this.totalDuration(),r+HP(this))%(this._dur+this._rDelay)||(r?this._dur:0),i):this._time},e.totalProgress=function(r,i){return arguments.length?this.totalTime(this.totalDuration()*r,i):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>0?1:0},e.progress=function(r,i){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-r:r)+HP(this),i):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},e.iteration=function(r,i){var s=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(r-1)*s,i):this._repeat?Ed(this._tTime,s)+1:1},e.timeScale=function(r,i){if(!arguments.length)return this._rts===-_n?0:this._rts;if(this._rts===r)return this;var s=this.parent&&this._ts?T_(this.parent._time,this):this._tTime;return this._rts=+r||0,this._ts=this._ps||r===-_n?0:this._rts,this.totalTime(p0(-Math.abs(this._delay),this._tDur,s),i!==!1),i1(this),OZ(this)},e.paused=function(r){return arguments.length?(this._ps!==r&&(this._ps=r,r?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Sd(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==_n&&(this._tTime-=_n)))),this):this._ps},e.startTime=function(r){if(arguments.length){this._start=r;var i=this.parent||this._dp;return i&&(i._sort||!this.parent)&&Ua(i,this,r-this._delay),this}return this._start},e.endTime=function(r){return this._start+(rs(r)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},e.rawTime=function(r){var i=this.parent||this._dp;return i?r&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?T_(i.rawTime(r),this):this._tTime:this._tTime},e.revert=function(r){r===void 0&&(r=PZ);var i=Ei;return Ei=r,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(r),this.totalTime(-.01,r.suppressEvents)),this.data!=="nested"&&r.kill!==!1&&this.kill(),Ei=i,this},e.globalTime=function(r){for(var i=this,s=arguments.length?r:i.rawTime();i;)s=i._start+s/(Math.abs(i._ts)||1),i=i._dp;return!this.parent&&this._sat?this._sat.globalTime(r):s},e.repeat=function(r){return arguments.length?(this._repeat=r===1/0?-2:r,QP(this)):this._repeat===-2?1/0:this._repeat},e.repeatDelay=function(r){if(arguments.length){var i=this._time;return this._rDelay=r,QP(this),i?this.time(i):this}return this._rDelay},e.yoyo=function(r){return arguments.length?(this._yoyo=r,this):this._yoyo},e.seek=function(r,i){return this.totalTime(eo(this,r),rs(i))},e.restart=function(r,i){return this.play().totalTime(r?-this._delay:0,rs(i))},e.play=function(r,i){return r!=null&&this.seek(r,i),this.reversed(!1).paused(!1)},e.reverse=function(r,i){return r!=null&&this.seek(r||this.totalDuration(),i),this.reversed(!0).paused(!1)},e.pause=function(r,i){return r!=null&&this.seek(r,i),this.paused(!0)},e.resume=function(){return this.paused(!1)},e.reversed=function(r){return arguments.length?(!!r!==this.reversed()&&this.timeScale(-this._rts||(r?-_n:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-_n,this},e.isActive=function(){var r=this.parent||this._dp,i=this._start,s;return!!(!r||this._ts&&this._initted&&r.isActive()&&(s=r.rawTime(!0))>=i&&s1?(i?(o[r]=i,s&&(o[r+"Params"]=s),r==="onUpdate"&&(this._onUpdate=i)):delete o[r],this):o[r]},e.then=function(r){var i=this;return new Promise(function(s){var o=nr(r)?r:x6,a=function(){var c=i.then;i.then=null,nr(o)&&(o=o(i))&&(o.then||o===i)&&(i.then=c),s(o),i.then=c};i._initted&&i.totalProgress()===1&&i._ts>=0||!i._tTime&&i._ts<0?a():i._prom=a})},e.kill=function(){ym(this)},n}();bo(Lg.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-_n,_prom:0,_ps:!1,_rts:1});var Ni=function(n){c6(e,n);function e(r,i){var s;return r===void 0&&(r={}),s=n.call(this,r)||this,s.labels={},s.smoothChildTiming=!!r.smoothChildTiming,s.autoRemoveChildren=!!r.autoRemoveChildren,s._sort=rs(r.sortChildren),jn&&Ua(r.parent||jn,Rl(s),i),r.reversed&&s.reverse(),r.paused&&s.paused(!0),r.scrollTrigger&&B6(Rl(s),r.scrollTrigger),s}var t=e.prototype;return t.to=function(i,s,o){return $m(0,arguments,this),this},t.from=function(i,s,o){return $m(1,arguments,this),this},t.fromTo=function(i,s,o,a){return $m(2,arguments,this),this},t.set=function(i,s,o){return s.duration=0,s.parent=this,Ym(s).repeatDelay||(s.repeat=0),s.immediateRender=!!s.immediateRender,new xr(i,s,eo(this,o),1),this},t.call=function(i,s,o){return Ua(this,xr.delayedCall(0,i,s),o)},t.staggerTo=function(i,s,o,a,l,c,A){return o.duration=s,o.stagger=o.stagger||a,o.onComplete=c,o.onCompleteParams=A,o.parent=this,new xr(i,o,eo(this,l)),this},t.staggerFrom=function(i,s,o,a,l,c,A){return o.runBackwards=1,Ym(o).immediateRender=rs(o.immediateRender),this.staggerTo(i,s,o,a,l,c,A)},t.staggerFromTo=function(i,s,o,a,l,c,A,u){return a.startAt=o,Ym(a).immediateRender=rs(a.immediateRender),this.staggerTo(i,s,a,l,c,A,u)},t.render=function(i,s,o){var a=this._time,l=this._dirty?this.totalDuration():this._tDur,c=this._dur,A=i<=0?0:jr(i),u=this._zTime<0!=i<0&&(this._initted||!c),f,h,d,m,g,p,v,w,_,x,b,B;if(this!==jn&&A>l&&i>=0&&(A=l),A!==this._tTime||o||u){if(a!==this._time&&c&&(A+=this._time-a,i+=this._time-a),f=A,_=this._start,w=this._ts,p=!w,u&&(c||(a=this._zTime),(i||!s)&&(this._zTime=i)),this._repeat){if(b=this._yoyo,g=c+this._rDelay,this._repeat<-1&&i<0)return this.totalTime(g*100+i,s,o);if(f=jr(A%g),A===l?(m=this._repeat,f=c):(m=~~(A/g),m&&m===A/g&&(f=c,m--),f>c&&(f=c)),x=Ed(this._tTime,g),!a&&this._tTime&&x!==m&&this._tTime-x*g-this._dur<=0&&(x=m),b&&m&1&&(f=c-f,B=1),m!==x&&!this._lock){var M=b&&x&1,I=M===(b&&m&1);if(m=a&&i>=0)for(h=this._first;h;){if(d=h._next,(h._act||f>=h._start)&&h._ts&&v!==h){if(h.parent!==this)return this.render(i,s,o);if(h.render(h._ts>0?(f-h._start)*h._ts:(h._dirty?h.totalDuration():h._tDur)+(f-h._start)*h._ts,s,o),f!==this._time||!this._ts&&!p){v=0,d&&(A+=this._zTime=-_n);break}}h=d}else{h=this._last;for(var S=i<0?i:f;h;){if(d=h._prev,(h._act||S<=h._end)&&h._ts&&v!==h){if(h.parent!==this)return this.render(i,s,o);if(h.render(h._ts>0?(S-h._start)*h._ts:(h._dirty?h.totalDuration():h._tDur)+(S-h._start)*h._ts,s,o||Ei&&(h._initted||h._startAt)),f!==this._time||!this._ts&&!p){v=0,d&&(A+=this._zTime=S?-_n:_n);break}}h=d}}if(v&&!s&&(this.pause(),v.render(f>=a?0:-_n)._zTime=f>=a?1:-1,this._ts))return this._start=_,i1(this),this.render(i,s,o);this._onUpdate&&!s&&Is(this,"onUpdate",!0),(A===l&&this._tTime>=this.totalDuration()||!A&&a)&&(_===this._start||Math.abs(w)!==Math.abs(this._ts))&&(this._lock||((i||!c)&&(A===l&&this._ts>0||!A&&this._ts<0)&&gA(this,1),!s&&!(i<0&&!a)&&(A||a||!l)&&(Is(this,A===l&&i>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(A0)&&this._prom())))}return this},t.add=function(i,s){var o=this;if(ec(s)||(s=eo(this,s,i)),!(i instanceof Lg)){if(Bi(i))return i.forEach(function(a){return o.add(a,s)}),this;if(Yr(i))return this.addLabel(i,s);if(nr(i))i=xr.delayedCall(0,i);else return this}return this!==i?Ua(this,i,s):this},t.getChildren=function(i,s,o,a){i===void 0&&(i=!0),s===void 0&&(s=!0),o===void 0&&(o=!0),a===void 0&&(a=-Ao);for(var l=[],c=this._first;c;)c._start>=a&&(c instanceof xr?s&&l.push(c):(o&&l.push(c),i&&l.push.apply(l,c.getChildren(!0,s,o)))),c=c._next;return l},t.getById=function(i){for(var s=this.getChildren(1,1,1),o=s.length;o--;)if(s[o].vars.id===i)return s[o]},t.remove=function(i){return Yr(i)?this.removeLabel(i):nr(i)?this.killTweensOf(i):(r1(this,i),i===this._recent&&(this._recent=this._last),yu(this))},t.totalTime=function(i,s){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=jr(Ss.time-(this._ts>0?i/this._ts:(this.totalDuration()-i)/-this._ts))),n.prototype.totalTime.call(this,i,s),this._forcing=0,this):this._tTime},t.addLabel=function(i,s){return this.labels[i]=eo(this,s),this},t.removeLabel=function(i){return delete this.labels[i],this},t.addPause=function(i,s,o){var a=xr.delayedCall(0,s||Ug,o);return a.data="isPause",this._hasPause=1,Ua(this,a,eo(this,i))},t.removePause=function(i){var s=this._first;for(i=eo(this,i);s;)s._start===i&&s.data==="isPause"&&gA(s),s=s._next},t.killTweensOf=function(i,s,o){for(var a=this.getTweensOf(i,o),l=a.length;l--;)Wc!==a[l]&&a[l].kill(i,s);return this},t.getTweensOf=function(i,s){for(var o=[],a=uo(i),l=this._first,c=ec(s),A;l;)l instanceof xr?LZ(l._targets,a)&&(c?(!Wc||l._initted&&l._ts)&&l.globalTime(0)<=s&&l.globalTime(l.totalDuration())>s:!s||l.isActive())&&o.push(l):(A=l.getTweensOf(a,s)).length&&o.push.apply(o,A),l=l._next;return o},t.tweenTo=function(i,s){s=s||{};var o=this,a=eo(o,i),l=s,c=l.startAt,A=l.onStart,u=l.onStartParams,f=l.immediateRender,h,d=xr.to(o,bo({ease:s.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:s.duration||Math.abs((a-(c&&"time"in c?c.time:o._time))/o.timeScale())||_n,onStart:function(){if(o.pause(),!h){var g=s.duration||Math.abs((a-(c&&"time"in c?c.time:o._time))/o.timeScale());d._dur!==g&&Bd(d,g,0,1).render(d._time,!0,!0),h=1}A&&A.apply(d,u||[])}},s));return f?d.render(0):d},t.tweenFromTo=function(i,s,o){return this.tweenTo(s,bo({startAt:{time:eo(this,i)}},o))},t.recent=function(){return this._recent},t.nextLabel=function(i){return i===void 0&&(i=this._time),zP(this,eo(this,i))},t.previousLabel=function(i){return i===void 0&&(i=this._time),zP(this,eo(this,i),1)},t.currentLabel=function(i){return arguments.length?this.seek(i,!0):this.previousLabel(this._time+_n)},t.shiftChildren=function(i,s,o){o===void 0&&(o=0);for(var a=this._first,l=this.labels,c;a;)a._start>=o&&(a._start+=i,a._end+=i),a=a._next;if(s)for(c in l)l[c]>=o&&(l[c]+=i);return yu(this)},t.invalidate=function(i){var s=this._first;for(this._lock=0;s;)s.invalidate(i),s=s._next;return n.prototype.invalidate.call(this,i)},t.clear=function(i){i===void 0&&(i=!0);for(var s=this._first,o;s;)o=s._next,this.remove(s),s=o;return this._dp&&(this._time=this._tTime=this._pTime=0),i&&(this.labels={}),yu(this)},t.totalDuration=function(i){var s=0,o=this,a=o._last,l=Ao,c,A,u;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-i:i));if(o._dirty){for(u=o.parent;a;)c=a._prev,a._dirty&&a.totalDuration(),A=a._start,A>l&&o._sort&&a._ts&&!o._lock?(o._lock=1,Ua(o,a,A-a._delay,1)._lock=0):l=A,A<0&&a._ts&&(s-=A,(!u&&!o._dp||u&&u.smoothChildTiming)&&(o._start+=A/o._ts,o._time-=A,o._tTime-=A),o.shiftChildren(-A,!1,-1/0),l=0),a._end>s&&a._ts&&(s=a._end),a=c;Bd(o,o===jn&&o._time>s?o._time:s,1,1),o._dirty=0}return o._tDur},e.updateRoot=function(i){if(jn._ts&&(w6(jn,T_(i,jn)),v6=Ss.frame),Ss.frame>=OP){OP+=Ds.autoSleep||120;var s=jn._first;if((!s||!s._ts)&&Ds.autoSleep&&Ss._listeners.length<2){for(;s&&!s._ts;)s=s._next;s||Ss.sleep()}}},e}(Lg);bo(Ni.prototype,{_lock:0,_hasPause:0,_forcing:0});var iJ=function(e,t,r,i,s,o,a){var l=new ss(this._pt,e,t,0,1,X6,null,s),c=0,A=0,u,f,h,d,m,g,p,v;for(l.b=r,l.e=i,r+="",i+="",(p=~i.indexOf("random("))&&(i=Fg(i)),o&&(v=[r,i],o(v,e,t),r=v[0],i=v[1]),f=r.match(iE)||[];u=iE.exec(i);)d=u[0],m=i.substring(c,u.index),h?h=(h+1)%5:m.substr(-5)==="rgba("&&(h=1),d!==f[A++]&&(g=parseFloat(f[A-1])||0,l._pt={_next:l._pt,p:m||A===1?m:",",s:g,c:d.charAt(1)==="="?qh(g,d)-g:parseFloat(d)-g,m:h&&h<4?Math.round:0},c=iE.lastIndex);return l.c=c")}),_.duration();else{b={};for(M in d)M==="ease"||M==="easeEach"||lJ(M,d[M],b,d.easeEach);for(M in b)for(T=b[M].sort(function(R,F){return R.t-F.t}),D=0,x=0;xl-_n&&!A?l:i<_n?0:i,f,h,d,m,g,p,v,w,_;if(!c)QZ(this,i,s,o);else if(u!==this._tTime||!i||o||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==A){if(f=u,w=this.timeline,this._repeat){if(m=c+this._rDelay,this._repeat<-1&&A)return this.totalTime(m*100+i,s,o);if(f=jr(u%m),u===l?(d=this._repeat,f=c):(d=~~(u/m),d&&d===jr(u/m)&&(f=c,d--),f>c&&(f=c)),p=this._yoyo&&d&1,p&&(_=this._yEase,f=c-f),g=Ed(this._tTime,m),f===a&&!o&&this._initted&&d===g)return this._tTime=u,this;d!==g&&(w&&this._yEase&&H6(w,p),this.vars.repeatRefresh&&!p&&!this._lock&&this._time!==m&&this._initted&&(this._lock=o=1,this.render(jr(m*d),!0).invalidate()._lock=0))}if(!this._initted){if(S6(this,A?i:f,o,s,u))return this._tTime=0,this;if(a!==this._time&&!(o&&this.vars.repeatRefresh&&d!==g))return this;if(c!==this._dur)return this.render(i,s,o)}if(this._tTime=u,this._time=f,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=v=(_||this._ease)(f/c),this._from&&(this.ratio=v=1-v),f&&!a&&!s&&!d&&(Is(this,"onStart"),this._tTime!==u))return this;for(h=this._pt;h;)h.r(v,h.d),h=h._next;w&&w.render(i<0?i:w._dur*w._ease(f/this._dur),s,o)||this._startAt&&(this._zTime=i),this._onUpdate&&!s&&(A&&PM(this,i,s,o),Is(this,"onUpdate")),this._repeat&&d!==g&&this.vars.onRepeat&&!s&&this.parent&&Is(this,"onRepeat"),(u===this._tDur||!u)&&this._tTime===u&&(A&&!this._onUpdate&&PM(this,i,!0,!0),(i||!c)&&(u===this._tDur&&this._ts>0||!u&&this._ts<0)&&gA(this,1),!s&&!(A&&!a)&&(u||a||p)&&(Is(this,u===l?"onComplete":"onReverseComplete",!0),this._prom&&!(u0)&&this._prom()))}return this},t.targets=function(){return this._targets},t.invalidate=function(i){return(!i||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(i),n.prototype.invalidate.call(this,i)},t.resetTo=function(i,s,o,a,l){Pg||Ss.wake(),this._ts||this.play();var c=Math.min(this._dur,(this._dp._time-this._start)*this._ts),A;return this._initted||gR(this,c),A=this._ease(c/this._dur),oJ(this,i,s,o,a,A,c,l)?this.resetTo(i,s,o,a,1):(s1(this,0),this.parent||b6(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},t.kill=function(i,s){if(s===void 0&&(s="all"),!i&&(!s||s==="all"))return this._lazy=this._pt=0,this.parent?ym(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(i,s,Wc&&Wc.vars.overwrite!==!0)._first||ym(this),this.parent&&o!==this.timeline.totalDuration()&&Bd(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,l=i?uo(i):a,c=this._ptLookup,A=this._pt,u,f,h,d,m,g,p;if((!s||s==="all")&&NZ(a,l))return s==="all"&&(this._pt=0),ym(this);for(u=this._op=this._op||[],s!=="all"&&(Yr(s)&&(m={},is(s,function(v){return m[v]=1}),s=m),s=aJ(a,s)),p=a.length;p--;)if(~l.indexOf(a[p])){f=c[p],s==="all"?(u[p]=s,d=f,h={}):(h=u[p]=u[p]||{},d=s);for(m in d)g=f&&f[m],g&&((!("kill"in g.d)||g.d.kill(m)===!0)&&r1(this,g,"_pt"),delete f[m]),h!=="all"&&(h[m]=1)}return this._initted&&!this._pt&&A&&ym(this),this},e.to=function(i,s){return new e(i,s,arguments[2])},e.from=function(i,s){return $m(1,arguments)},e.delayedCall=function(i,s,o,a){return new e(s,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:i,onComplete:s,onReverseComplete:s,onCompleteParams:o,onReverseCompleteParams:o,callbackScope:a})},e.fromTo=function(i,s,o){return $m(2,arguments)},e.set=function(i,s){return s.duration=0,s.repeatDelay||(s.repeat=0),new e(i,s)},e.killTweensOf=function(i,s,o){return jn.killTweensOf(i,s,o)},e}(Lg);bo(xr.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});is("staggerTo,staggerFrom,staggerFromTo",function(n){xr[n]=function(){var e=new Ni,t=DM.call(arguments,0);return t.splice(n==="staggerFromTo"?5:4,0,0),e[n].apply(e,t)}});var vR=function(e,t,r){return e[t]=r},W6=function(e,t,r){return e[t](r)},cJ=function(e,t,r,i){return e[t](i.fp,r)},AJ=function(e,t,r){return e.setAttribute(t,r)},yR=function(e,t){return nr(e[t])?W6:cR(e[t])&&e.setAttribute?AJ:vR},K6=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e6)/1e6,t)},uJ=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},X6=function(e,t){var r=t._pt,i="";if(!e&&t.b)i=t.b;else if(e===1&&t.e)i=t.e;else{for(;r;)i=r.p+(r.m?r.m(r.s+r.c*e):Math.round((r.s+r.c*e)*1e4)/1e4)+i,r=r._next;i+=t.c}t.set(t.t,t.p,i,t)},wR=function(e,t){for(var r=t._pt;r;)r.r(e,r.d),r=r._next},fJ=function(e,t,r,i){for(var s=this._pt,o;s;)o=s._next,s.p===i&&s.modifier(e,t,r),s=o},hJ=function(e){for(var t=this._pt,r,i;t;)i=t._next,t.p===e&&!t.op||t.op===e?r1(this,t,"_pt"):t.dep||(r=1),t=i;return!r},dJ=function(e,t,r,i){i.mSet(e,t,i.m.call(i.tween,r,i.mt),i)},Y6=function(e){for(var t=e._pt,r,i,s,o;t;){for(r=t._next,i=s;i&&i.pr>t.pr;)i=i._next;(t._prev=i?i._prev:o)?t._prev._next=t:s=t,(t._next=i)?i._prev=t:o=t,t=r}e._pt=s},ss=function(){function n(t,r,i,s,o,a,l,c,A){this.t=r,this.s=s,this.c=o,this.p=i,this.r=a||K6,this.d=l||this,this.set=c||vR,this.pr=A||0,this._next=t,t&&(t._prev=this)}var e=n.prototype;return e.modifier=function(r,i,s){this.mSet=this.mSet||this.set,this.set=dJ,this.m=r,this.mt=s,this.tween=i},n}();is(dR+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(n){return hR[n]=1});Hs.TweenMax=Hs.TweenLite=xr;Hs.TimelineLite=Hs.TimelineMax=Ni;jn=new Ni({sortChildren:!1,defaults:bd,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});Ds.stringFilter=O6;var _u=[],ww={},pJ=[],VP=0,mJ=0,cE=function(e){return(ww[e]||pJ).map(function(t){return t()})},HM=function(){var e=Date.now(),t=[];e-VP>2&&(cE("matchMediaInit"),_u.forEach(function(r){var i=r.queries,s=r.conditions,o,a,l,c;for(a in i)o=Ma.matchMedia(i[a]).matches,o&&(l=1),o!==s[a]&&(s[a]=o,c=1);c&&(r.revert(),l&&t.push(r))}),cE("matchMediaRevert"),t.forEach(function(r){return r.onMatch(r,function(i){return r.add(null,i)})}),VP=e,cE("matchMedia"))},$6=function(){function n(t,r){this.selector=r&&NM(r),this.data=[],this._r=[],this.isReverted=!1,this.id=mJ++,t&&this.add(t)}var e=n.prototype;return e.add=function(r,i,s){nr(r)&&(s=i,i=r,r=nr);var o=this,a=function(){var c=kn,A=o.selector,u;return c&&c!==o&&c.data.push(o),s&&(o.selector=NM(s)),kn=o,u=i.apply(o,arguments),nr(u)&&o._r.push(u),kn=c,o.selector=A,o.isReverted=!1,u};return o.last=a,r===nr?a(o,function(l){return o.add(null,l)}):r?o[r]=a:a},e.ignore=function(r){var i=kn;kn=null,r(this),kn=i},e.getTweens=function(){var r=[];return this.data.forEach(function(i){return i instanceof n?r.push.apply(r,i.getTweens()):i instanceof xr&&!(i.parent&&i.parent.data==="nested")&&r.push(i)}),r},e.clear=function(){this._r.length=this.data.length=0},e.kill=function(r,i){var s=this;if(r?function(){for(var a=s.getTweens(),l=s.data.length,c;l--;)c=s.data[l],c.data==="isFlip"&&(c.revert(),c.getChildren(!0,!0,!1).forEach(function(A){return a.splice(a.indexOf(A),1)}));for(a.map(function(A){return{g:A._dur||A._delay||A._sat&&!A._sat.vars.immediateRender?A.globalTime(0):-1/0,t:A}}).sort(function(A,u){return u.g-A.g||-1/0}).forEach(function(A){return A.t.revert(r)}),l=s.data.length;l--;)c=s.data[l],c instanceof Ni?c.data!=="nested"&&(c.scrollTrigger&&c.scrollTrigger.revert(),c.kill()):!(c instanceof xr)&&c.revert&&c.revert(r);s._r.forEach(function(A){return A(r,s)}),s.isReverted=!0}():this.data.forEach(function(a){return a.kill&&a.kill()}),this.clear(),i)for(var o=_u.length;o--;)_u[o].id===this.id&&_u.splice(o,1)},e.revert=function(r){this.kill(r||{})},n}(),gJ=function(){function n(t){this.contexts=[],this.scope=t,kn&&kn.data.push(this)}var e=n.prototype;return e.add=function(r,i,s){qa(r)||(r={matches:r});var o=new $6(0,s||this.scope),a=o.conditions={},l,c,A;kn&&!o.selector&&(o.selector=kn.selector),this.contexts.push(o),i=o.add("onMatch",i),o.queries=r;for(c in r)c==="all"?A=1:(l=Ma.matchMedia(r[c]),l&&(_u.indexOf(o)<0&&_u.push(o),(a[c]=l.matches)&&(A=1),l.addListener?l.addListener(HM):l.addEventListener("change",HM)));return A&&i(o,function(u){return o.add(null,u)}),this},e.revert=function(r){this.kill(r||{})},e.kill=function(r){this.contexts.forEach(function(i){return i.kill(r,!0)})},n}(),I_={registerPlugin:function(){for(var e=arguments.length,t=new Array(e),r=0;r1){var i=e.map(function(A){return As.quickSetter(A,t,r)}),s=i.length;return function(A){for(var u=s;u--;)i[u](A)}}e=e[0]||{};var o=Bs[t],a=vu(e),l=a.harness&&(a.harness.aliases||{})[t]||t,c=o?function(A){var u=new o;Uh._pt=0,u.init(e,r?A+r:A,Uh,0,[e]),u.render(1,u),Uh._pt&&wR(1,Uh)}:a.set(e,l);return o?c:function(A){return c(e,l,r?A+r:A,a,1)}},quickTo:function(e,t,r){var i,s=As.to(e,Uu((i={},i[t]="+=0.1",i.paused=!0,i),r||{})),o=function(l,c,A){return s.resetTo(t,l,c,A)};return o.tween=s,o},isTweening:function(e){return jn.getTweensOf(e,!0).length>0},defaults:function(e){return e&&e.ease&&(e.ease=wu(e.ease,bd.ease)),kP(bd,e||{})},config:function(e){return kP(Ds,e||{})},registerEffect:function(e){var t=e.name,r=e.effect,i=e.plugins,s=e.defaults,o=e.extendTimeline;(i||"").split(",").forEach(function(a){return a&&!Bs[a]&&!Hs[a]&&Rg(t+" effect requires "+a+" plugin.")}),sE[t]=function(a,l,c){return r(uo(a),bo(l||{},s),c)},o&&(Ni.prototype[t]=function(a,l,c){return this.add(sE[t](a,qa(l)?l:(c=l)&&{},this),c)})},registerEase:function(e,t){Gt[e]=wu(t)},parseEase:function(e,t){return arguments.length?wu(e,t):Gt},getById:function(e){return jn.getById(e)},exportRoot:function(e,t){e===void 0&&(e={});var r=new Ni(e),i,s;for(r.smoothChildTiming=rs(e.smoothChildTiming),jn.remove(r),r._dp=0,r._time=r._tTime=jn._time,i=jn._first;i;)s=i._next,(t||!(!i._dur&&i instanceof xr&&i.vars.onComplete===i._targets[0]))&&Ua(r,i,i._start-i._delay),i=s;return Ua(jn,r,0),r},context:function(e,t){return e?new $6(e,t):kn},matchMedia:function(e){return new gJ(e)},matchMediaRefresh:function(){return _u.forEach(function(e){var t=e.conditions,r,i;for(i in t)t[i]&&(t[i]=!1,r=1);r&&e.revert()})||HM()},addEventListener:function(e,t){var r=ww[e]||(ww[e]=[]);~r.indexOf(t)||r.push(t)},removeEventListener:function(e,t){var r=ww[e],i=r&&r.indexOf(t);i>=0&&r.splice(i,1)},utils:{wrap:YZ,wrapYoyo:$Z,distribute:T6,random:R6,snap:I6,normalize:XZ,getUnit:wi,clamp:VZ,splitColor:D6,toArray:uo,selector:NM,mapRange:F6,pipe:WZ,unitize:KZ,interpolate:ZZ,shuffle:C6},install:m6,effects:sE,ticker:Ss,updateRoot:Ni.updateRoot,plugins:Bs,globalTimeline:jn,core:{PropTween:ss,globals:g6,Tween:xr,Timeline:Ni,Animation:Lg,getCache:vu,_removeLinkedListItem:r1,reverting:function(){return Ei},context:function(e){return e&&kn&&(kn.data.push(e),e._ctx=kn),kn},suppressOverwrites:function(e){return lR=e}}};is("to,from,fromTo,delayedCall,set,killTweensOf",function(n){return I_[n]=xr[n]});Ss.add(Ni.updateRoot);Uh=I_.to({},{duration:0});var vJ=function(e,t){for(var r=e._pt;r&&r.p!==t&&r.op!==t&&r.fp!==t;)r=r._next;return r},yJ=function(e,t){var r=e._targets,i,s,o;for(i in t)for(s=r.length;s--;)o=e._ptLookup[s][i],o&&(o=o.d)&&(o._pt&&(o=vJ(o,i)),o&&o.modifier&&o.modifier(t[i],e,r[s],i))},AE=function(e,t){return{name:e,rawVars:1,init:function(i,s,o){o._onInit=function(a){var l,c;if(Yr(s)&&(l={},is(s,function(A){return l[A]=1}),s=l),t){l={};for(c in s)l[c]=t(s[c]);s=l}yJ(a,s)}}}},As=I_.registerPlugin({name:"attr",init:function(e,t,r,i,s){var o,a,l;this.tween=r;for(o in t)l=e.getAttribute(o)||"",a=this.add(e,"setAttribute",(l||0)+"",t[o],i,s,0,0,o),a.op=o,a.b=l,this._props.push(o)},render:function(e,t){for(var r=t._pt;r;)Ei?r.set(r.t,r.p,r.b,r):r.r(e,r.d),r=r._next}},{name:"endArray",init:function(e,t){for(var r=t.length;r--;)this.add(e,r,e[r]||0,t[r],0,0,0,0,0,1)}},AE("roundProps",OM),AE("modifiers"),AE("snap",I6))||I_;xr.version=Ni.version=As.version="3.12.5";p6=1;AR()&&Sd();Gt.Power0;Gt.Power1;Gt.Power2;Gt.Power3;Gt.Power4;Gt.Linear;Gt.Quad;Gt.Cubic;Gt.Quart;Gt.Quint;Gt.Strong;Gt.Elastic;Gt.Back;Gt.SteppedEase;Gt.Bounce;Gt.Sine;Gt.Expo;Gt.Circ;/*! +*/var Ds={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Ed={duration:.5,overwrite:!1,delay:0},AR,Ei,kn,Ao=1e8,_n=1/Ao,US=Math.PI*2,TZ=US/4,IZ=0,u6=Math.sqrt,RZ=Math.cos,UZ=Math.sin,$r=function(e){return typeof e=="string"},rr=function(e){return typeof e=="function"},ec=function(e){return typeof e=="number"},uR=function(e){return typeof e>"u"},el=function(e){return typeof e=="object"},rs=function(e){return e!==!1},fR=function(){return typeof window<"u"},uv=function(e){return rr(e)||$r(e)},f6=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},Bi=Array.isArray,FS=/(?:-?\.?\d|\.)+/gi,h6=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Fh=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,oE=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,d6=/[+-]=-?[.\d]+/,p6=/[^,'"\[\]\s]+/gi,FZ=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,jn,Ta,PS,hR,Qs={},S_={},m6,g6=function(e){return(S_=Pu(e,Qs))&&As},dR=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},Ug=function(e,t){return!t&&console.warn(e)},v6=function(e,t){return e&&(Qs[e]=t)&&S_&&(S_[e]=t)||Qs},Fg=function(){return 0},PZ={suppressEvents:!0,isStart:!0,kill:!1},yw={suppressEvents:!0,kill:!1},LZ={suppressEvents:!0},pR={},AA=[],LS={},y6,Bs={},aE={},kP=30,ww=[],mR="",gR=function(e){var t=e[0],r,i;if(el(t)||rr(t)||(e=[e]),!(r=(t._gsap||{}).harness)){for(i=ww.length;i--&&!ww[i].targetTest(t););r=ww[i]}for(i=e.length;i--;)e[i]&&(e[i]._gsap||(e[i]._gsap=new G6(e[i],r)))||e.splice(i,1);return e},wu=function(e){return e._gsap||gR(uo(e))[0]._gsap},w6=function(e,t,r){return(r=e[t])&&rr(r)?e[t]():uR(r)&&e.getAttribute&&e.getAttribute(t)||r},is=function(e,t){return(e=e.split(",")).forEach(t)||e},hr=function(e){return Math.round(e*1e5)/1e5||0},jr=function(e){return Math.round(e*1e7)/1e7||0},ed=function(e,t){var r=t.charAt(0),i=parseFloat(t.substr(2));return e=parseFloat(e),r==="+"?e+i:r==="-"?e-i:r==="*"?e*i:e/i},DZ=function(e,t){for(var r=t.length,i=0;e.indexOf(t[i])<0&&++ia;)o=o._prev;return o?(t._next=o._next,o._next=t):(t._next=e[r],e[r]=t),t._next?t._next._prev=t:e[i]=t,t._prev=o,t.parent=t._dp=e,t},i1=function(e,t,r,i){r===void 0&&(r="_first"),i===void 0&&(i="_last");var s=t._prev,o=t._next;s?s._next=o:e[r]===t&&(e[r]=o),o?o._prev=s:e[i]===t&&(e[i]=s),t._next=t._prev=t.parent=null},vA=function(e,t){e.parent&&(!t||e.parent.autoRemoveChildren)&&e.parent.remove&&e.parent.remove(e),e._act=0},_u=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var r=e;r;)r._dirty=1,r=r.parent;return e},kZ=function(e){for(var t=e.parent;t&&t.parent;)t._dirty=1,t.totalDuration(),t=t.parent;return e},DS=function(e,t,r,i){return e._startAt&&(Ei?e._startAt.revert(yw):e.vars.immediateRender&&!e.vars.autoRevert||e._startAt.render(t,!0,i))},QZ=function n(e){return!e||e._ts&&n(e.parent)},HP=function(e){return e._repeat?Bd(e._tTime,e=e.duration()+e._rDelay)*e:0},Bd=function(e,t){var r=Math.floor(e/=t);return e&&r===e?r-1:r},I_=function(e,t){return(e-t._start)*t._ts+(t._ts>=0?0:t._dirty?t.totalDuration():t._tDur)},s1=function(e){return e._end=jr(e._start+(e._tDur/Math.abs(e._ts||e._rts||_n)||0))},o1=function(e,t){var r=e._dp;return r&&r.smoothChildTiming&&e._ts&&(e._start=jr(r._time-(e._ts>0?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),s1(e),r._dirty||_u(r,e)),e},B6=function(e,t){var r;if((t._time||!t._dur&&t._initted||t._start_n)&&t.render(r,!0)),_u(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur=0&&r.totalTime(r._tTime),r=r._dp;e._zTime=-_n}},Pa=function(e,t,r,i){return t.parent&&vA(t),t._start=jr((ec(r)?r:r||e!==jn?eo(e,r,t):e._time)+t._delay),t._end=jr(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),E6(e,t,"_first","_last",e._sort?"_start":0),NS(t)||(e._recent=t),i||B6(e,t),e._ts<0&&o1(e,e._tTime),e},M6=function(e,t){return(Qs.ScrollTrigger||dR("scrollTrigger",t))&&Qs.ScrollTrigger.create(t,e)},S6=function(e,t,r,i,s){if(yR(e,t,s),!e._initted)return 1;if(!r&&e._pt&&!Ei&&(e._dur&&e.vars.lazy!==!1||!e._dur&&e.vars.lazy)&&y6!==Ms.frame)return AA.push(e),e._lazy=[s,i],1},HZ=function n(e){var t=e.parent;return t&&t._ts&&t._initted&&!t._lock&&(t.rawTime()<0||n(t))},NS=function(e){var t=e.data;return t==="isFromStart"||t==="isStart"},zZ=function(e,t,r,i){var s=e.ratio,o=t<0||!t&&(!e._start&&HZ(e)&&!(!e._initted&&NS(e))||(e._ts<0||e._dp._ts<0)&&!NS(e))?0:1,a=e._rDelay,l=0,c,A,u;if(a&&e._repeat&&(l=m0(0,e._tDur,t),A=Bd(l,a),e._yoyo&&A&1&&(o=1-o),A!==Bd(e._tTime,a)&&(s=1-o,e.vars.repeatRefresh&&e._initted&&e.invalidate())),o!==s||Ei||i||e._zTime===_n||!t&&e._zTime){if(!e._initted&&S6(e,t,i,r,l))return;for(u=e._zTime,e._zTime=t||(r?_n:0),r||(r=t&&!u),e.ratio=o,e._from&&(o=1-o),e._time=0,e._tTime=l,c=e._pt;c;)c.r(o,c.d),c=c._next;t<0&&DS(e,t,r,!0),e._onUpdate&&!r&&Is(e,"onUpdate"),l&&e._repeat&&!r&&e.parent&&Is(e,"onRepeat"),(t>=e._tDur||t<0)&&e.ratio===o&&(o&&vA(e,1),!r&&!Ei&&(Is(e,o?"onComplete":"onReverseComplete",!0),e._prom&&e._prom()))}else e._zTime||(e._zTime=t)},GZ=function(e,t,r){var i;if(r>t)for(i=e._first;i&&i._start<=r;){if(i.data==="isPause"&&i._start>t)return i;i=i._next}else for(i=e._last;i&&i._start>=r;){if(i.data==="isPause"&&i._start0&&!i&&o1(e,e._tTime=e._tDur*a),e.parent&&s1(e),r||_u(e.parent,e),e},zP=function(e){return e instanceof Ni?_u(e):Md(e,e._dur)},VZ={_start:0,endTime:Fg,totalDuration:Fg},eo=function n(e,t,r){var i=e.labels,s=e._recent||VZ,o=e.duration()>=Ao?s.endTime(!1):e._dur,a,l,c;return $r(t)&&(isNaN(t)||t in i)?(l=t.charAt(0),c=t.substr(-1)==="%",a=t.indexOf("="),l==="<"||l===">"?(a>=0&&(t=t.replace(/=/,"")),(l==="<"?s._start:s.endTime(s._repeat>=0))+(parseFloat(t.substr(1))||0)*(c?(a<0?s:r).totalDuration()/100:1)):a<0?(t in i||(i[t]=o),i[t]):(l=parseFloat(t.charAt(a-1)+t.substr(a+1)),c&&r&&(l=l/100*(Bi(r)?r[0]:r).totalDuration()),a>1?n(e,t.substr(0,a-1),r)+l:o+l)):t==null?o:+t},Zm=function(e,t,r){var i=ec(t[1]),s=(i?2:1)+(e<2?0:1),o=t[s],a,l;if(i&&(o.duration=t[1]),o.parent=r,e){for(a=o,l=r;l&&!("immediateRender"in a);)a=l.vars.defaults||{},l=rs(l.vars.inherit)&&l.parent;o.immediateRender=rs(a.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new xr(t[0],o,t[s+1])},RA=function(e,t){return e||e===0?t(e):t},m0=function(e,t,r){return rt?t:r},wi=function(e,t){return!$r(e)||!(t=FZ.exec(e))?"":t[1]},jZ=function(e,t,r){return RA(r,function(i){return m0(e,t,i)})},OS=[].slice,C6=function(e,t){return e&&el(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&el(e[0]))&&!e.nodeType&&e!==Ta},WZ=function(e,t,r){return r===void 0&&(r=[]),e.forEach(function(i){var s;return $r(i)&&!t||C6(i,1)?(s=r).push.apply(s,uo(i)):r.push(i)})||r},uo=function(e,t,r){return kn&&!t&&kn.selector?kn.selector(e):$r(e)&&!r&&(PS||!Sd())?OS.call((t||hR).querySelectorAll(e),0):Bi(e)?WZ(e,r):C6(e)?OS.call(e,0):e?[e]:[]},kS=function(e){return e=uo(e)[0]||Ug("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return uo(t,r.querySelectorAll?r:r===e?Ug("Invalid scope")||hR.createElement("div"):e)}},T6=function(e){return e.sort(function(){return .5-Math.random()})},I6=function(e){if(rr(e))return e;var t=el(e)?e:{each:e},r=xu(t.ease),i=t.from||0,s=parseFloat(t.base)||0,o={},a=i>0&&i<1,l=isNaN(i)||a,c=t.axis,A=i,u=i;return $r(i)?A=u={center:.5,edges:.5,end:1}[i]||0:!a&&l&&(A=i[0],u=i[1]),function(f,h,d){var m=(d||t).length,g=o[m],p,v,w,_,x,b,B,S,I;if(!g){if(I=t.grid==="auto"?0:(t.grid||[1,Ao])[1],!I){for(B=-Ao;B<(B=d[I++].getBoundingClientRect().left)&&IB&&(B=x),xm?m-1:c?c==="y"?m/I:I:Math.max(I,m/I))||0)*(i==="edges"?-1:1),g.b=m<0?s-m:s,g.u=wi(t.amount||t.each)||0,r=r&&m<0?Q6(r):r}return m=(g[f]-g.min)/g.max||0,jr(g.b+(r?r(m):m)*g.v)+g.u}},QS=function(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(r){var i=jr(Math.round(parseFloat(r)/e)*e*t);return(i-i%1)/t+(ec(r)?0:wi(r))}},R6=function(e,t){var r=Bi(e),i,s;return!r&&el(e)&&(i=r=e.radius||Ao,e.values?(e=uo(e.values),(s=!ec(e[0]))&&(i*=i)):e=QS(e.increment)),RA(t,r?rr(e)?function(o){return s=e(o),Math.abs(s-o)<=i?s:o}:function(o){for(var a=parseFloat(s?o.x:o),l=parseFloat(s?o.y:0),c=Ao,A=0,u=e.length,f,h;u--;)s?(f=e[u].x-a,h=e[u].y-l,f=f*f+h*h):f=Math.abs(e[u]-a),fi?s-o:o)})},Pg=function(e){for(var t=0,r="",i,s,o,a;~(i=e.indexOf("random(",t));)o=e.indexOf(")",i),a=e.charAt(i+7)==="[",s=e.substr(i+7,o-i-7).match(a?p6:FS),r+=e.substr(t,i-t)+U6(a?s:+s[0],a?0:+s[1],+s[2]||1e-5),t=o+1;return r+e.substr(t,e.length-t)},P6=function(e,t,r,i,s){var o=t-e,a=i-r;return RA(s,function(l){return r+((l-e)/o*a||0)})},JZ=function n(e,t,r,i){var s=isNaN(e+t)?0:function(h){return(1-h)*e+h*t};if(!s){var o=$r(e),a={},l,c,A,u,f;if(r===!0&&(i=1)&&(r=null),o)e={p:e},t={p:t};else if(Bi(e)&&!Bi(t)){for(A=[],u=e.length,f=u-2,c=1;c(a=Math.abs(a))&&(l=o,s=a);return l},Is=function(e,t,r){var i=e.vars,s=i[t],o=kn,a=e._ctx,l,c,A;if(s)return l=i[t+"Params"],c=i.callbackScope||e,r&&AA.length&&C_(),a&&(kn=a),A=l?s.apply(c,l):s.call(c),kn=o,A},wm=function(e){return vA(e),e.scrollTrigger&&e.scrollTrigger.kill(!!Ei),e.progress()<1&&Is(e,"onInterrupt"),e},Ph,L6=[],D6=function(e){if(e)if(e=!e.name&&e.default||e,fR()||e.headless){var t=e.name,r=rr(e),i=t&&!r&&e.init?function(){this._props=[]}:e,s={init:Fg,render:xR,add:vR,kill:dJ,modifier:hJ,rawVars:0},o={targetTest:0,get:0,getSetter:_R,aliases:{},register:0};if(Sd(),e!==i){if(Bs[t])return;bo(i,bo(T_(e,s),o)),Pu(i.prototype,Pu(s,T_(e,o))),Bs[i.prop=t]=i,e.targetTest&&(ww.push(i),pR[t]=1),t=(t==="css"?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}v6(t,i),e.register&&e.register(As,i,ss)}else L6.push(e)},vn=255,_m={aqua:[0,vn,vn],lime:[0,vn,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,vn],navy:[0,0,128],white:[vn,vn,vn],olive:[128,128,0],yellow:[vn,vn,0],orange:[vn,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[vn,0,0],pink:[vn,192,203],cyan:[0,vn,vn],transparent:[vn,vn,vn,0]},lE=function(e,t,r){return e+=e<0?1:e>1?-1:0,(e*6<1?t+(r-t)*e*6:e<.5?r:e*3<2?t+(r-t)*(2/3-e)*6:t)*vn+.5|0},N6=function(e,t,r){var i=e?ec(e)?[e>>16,e>>8&vn,e&vn]:0:_m.black,s,o,a,l,c,A,u,f,h,d;if(!i){if(e.substr(-1)===","&&(e=e.substr(0,e.length-1)),_m[e])i=_m[e];else if(e.charAt(0)==="#"){if(e.length<6&&(s=e.charAt(1),o=e.charAt(2),a=e.charAt(3),e="#"+s+s+o+o+a+a+(e.length===5?e.charAt(4)+e.charAt(4):"")),e.length===9)return i=parseInt(e.substr(1,6),16),[i>>16,i>>8&vn,i&vn,parseInt(e.substr(7),16)/255];e=parseInt(e.substr(1),16),i=[e>>16,e>>8&vn,e&vn]}else if(e.substr(0,3)==="hsl"){if(i=d=e.match(FS),!t)l=+i[0]%360/360,c=+i[1]/100,A=+i[2]/100,o=A<=.5?A*(c+1):A+c-A*c,s=A*2-o,i.length>3&&(i[3]*=1),i[0]=lE(l+1/3,s,o),i[1]=lE(l,s,o),i[2]=lE(l-1/3,s,o);else if(~e.indexOf("="))return i=e.match(h6),r&&i.length<4&&(i[3]=1),i}else i=e.match(FS)||_m.transparent;i=i.map(Number)}return t&&!d&&(s=i[0]/vn,o=i[1]/vn,a=i[2]/vn,u=Math.max(s,o,a),f=Math.min(s,o,a),A=(u+f)/2,u===f?l=c=0:(h=u-f,c=A>.5?h/(2-u-f):h/(u+f),l=u===s?(o-a)/h+(oe||p<0)&&(r+=p-t),i+=p,x=i-r,w=x-o,(w>0||v)&&(b=++u.frame,f=x-u.time*1e3,u.time=x=x/1e3,o+=w+(w>=s?4:s-w),_=1),v||(l=c(m)),_)for(h=0;h=p&&h--},_listeners:a},u}(),Sd=function(){return!Lg&&Ms.wake()},Gt={},eJ=/^[\d.\-M][\d.\-,\s]/,tJ=/["']/g,nJ=function(e){for(var t={},r=e.substr(1,e.length-3).split(":"),i=r[0],s=1,o=r.length,a,l,c;s1&&r.config?r.config.apply(null,~e.indexOf("{")?[nJ(t[1])]:rJ(e).split(",").map(x6)):Gt._CE&&eJ.test(e)?Gt._CE("",e):r},Q6=function(e){return function(t){return 1-e(1-t)}},H6=function n(e,t){for(var r=e._first,i;r;)r instanceof Ni?n(r,t):r.vars.yoyoEase&&(!r._yoyo||!r._repeat)&&r._yoyo!==t&&(r.timeline?n(r.timeline,t):(i=r._ease,r._ease=r._yEase,r._yEase=i,r._yoyo=t)),r=r._next},xu=function(e,t){return e&&(rr(e)?e:Gt[e]||iJ(e))||t},Yu=function(e,t,r,i){r===void 0&&(r=function(l){return 1-t(1-l)}),i===void 0&&(i=function(l){return l<.5?t(l*2)/2:1-t((1-l)*2)/2});var s={easeIn:t,easeOut:r,easeInOut:i},o;return is(e,function(a){Gt[a]=Qs[a]=s,Gt[o=a.toLowerCase()]=r;for(var l in s)Gt[o+(l==="easeIn"?".in":l==="easeOut"?".out":".inOut")]=Gt[a+"."+l]=s[l]}),s},z6=function(e){return function(t){return t<.5?(1-e(1-t*2))/2:.5+e((t-.5)*2)/2}},cE=function n(e,t,r){var i=t>=1?t:1,s=(r||(e?.3:.45))/(t<1?t:1),o=s/US*(Math.asin(1/i)||0),a=function(A){return A===1?1:i*Math.pow(2,-10*A)*UZ((A-o)*s)+1},l=e==="out"?a:e==="in"?function(c){return 1-a(1-c)}:z6(a);return s=US/s,l.config=function(c,A){return n(e,c,A)},l},AE=function n(e,t){t===void 0&&(t=1.70158);var r=function(o){return o?--o*o*((t+1)*o+t)+1:0},i=e==="out"?r:e==="in"?function(s){return 1-r(1-s)}:z6(r);return i.config=function(s){return n(e,s)},i};is("Linear,Quad,Cubic,Quart,Quint,Strong",function(n,e){var t=e<5?e+1:e;Yu(n+",Power"+(t-1),e?function(r){return Math.pow(r,t)}:function(r){return r},function(r){return 1-Math.pow(1-r,t)},function(r){return r<.5?Math.pow(r*2,t)/2:1-Math.pow((1-r)*2,t)/2})});Gt.Linear.easeNone=Gt.none=Gt.Linear.easeIn;Yu("Elastic",cE("in"),cE("out"),cE());(function(n,e){var t=1/e,r=2*t,i=2.5*t,s=function(a){return a0?r+(r+this._rDelay)*this._repeat:r):this.totalDuration()&&this._dur},e.totalDuration=function(r){return arguments.length?(this._dirty=0,Md(this,this._repeat<0?r:(r-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(r,i){if(Sd(),!arguments.length)return this._tTime;var s=this._dp;if(s&&s.smoothChildTiming&&this._ts){for(o1(this,r),!s._dp||s.parent||B6(s,this);s&&s.parent;)s.parent._time!==s._start+(s._ts>=0?s._tTime/s._ts:(s.totalDuration()-s._tTime)/-s._ts)&&s.totalTime(s._tTime,!0),s=s.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&r0||!this._tDur&&!r)&&Pa(this._dp,this,this._start-this._delay)}return(this._tTime!==r||!this._dur&&!i||this._initted&&Math.abs(this._zTime)===_n||!r&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=r),_6(this,r,i)),this},e.time=function(r,i){return arguments.length?this.totalTime(Math.min(this.totalDuration(),r+HP(this))%(this._dur+this._rDelay)||(r?this._dur:0),i):this._time},e.totalProgress=function(r,i){return arguments.length?this.totalTime(this.totalDuration()*r,i):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>0?1:0},e.progress=function(r,i){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-r:r)+HP(this),i):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},e.iteration=function(r,i){var s=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(r-1)*s,i):this._repeat?Bd(this._tTime,s)+1:1},e.timeScale=function(r,i){if(!arguments.length)return this._rts===-_n?0:this._rts;if(this._rts===r)return this;var s=this.parent&&this._ts?I_(this.parent._time,this):this._tTime;return this._rts=+r||0,this._ts=this._ps||r===-_n?0:this._rts,this.totalTime(m0(-Math.abs(this._delay),this._tDur,s),i!==!1),s1(this),kZ(this)},e.paused=function(r){return arguments.length?(this._ps!==r&&(this._ps=r,r?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Sd(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==_n&&(this._tTime-=_n)))),this):this._ps},e.startTime=function(r){if(arguments.length){this._start=r;var i=this.parent||this._dp;return i&&(i._sort||!this.parent)&&Pa(i,this,r-this._delay),this}return this._start},e.endTime=function(r){return this._start+(rs(r)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},e.rawTime=function(r){var i=this.parent||this._dp;return i?r&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?I_(i.rawTime(r),this):this._tTime:this._tTime},e.revert=function(r){r===void 0&&(r=LZ);var i=Ei;return Ei=r,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(r),this.totalTime(-.01,r.suppressEvents)),this.data!=="nested"&&r.kill!==!1&&this.kill(),Ei=i,this},e.globalTime=function(r){for(var i=this,s=arguments.length?r:i.rawTime();i;)s=i._start+s/(Math.abs(i._ts)||1),i=i._dp;return!this.parent&&this._sat?this._sat.globalTime(r):s},e.repeat=function(r){return arguments.length?(this._repeat=r===1/0?-2:r,zP(this)):this._repeat===-2?1/0:this._repeat},e.repeatDelay=function(r){if(arguments.length){var i=this._time;return this._rDelay=r,zP(this),i?this.time(i):this}return this._rDelay},e.yoyo=function(r){return arguments.length?(this._yoyo=r,this):this._yoyo},e.seek=function(r,i){return this.totalTime(eo(this,r),rs(i))},e.restart=function(r,i){return this.play().totalTime(r?-this._delay:0,rs(i))},e.play=function(r,i){return r!=null&&this.seek(r,i),this.reversed(!1).paused(!1)},e.reverse=function(r,i){return r!=null&&this.seek(r||this.totalDuration(),i),this.reversed(!0).paused(!1)},e.pause=function(r,i){return r!=null&&this.seek(r,i),this.paused(!0)},e.resume=function(){return this.paused(!1)},e.reversed=function(r){return arguments.length?(!!r!==this.reversed()&&this.timeScale(-this._rts||(r?-_n:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-_n,this},e.isActive=function(){var r=this.parent||this._dp,i=this._start,s;return!!(!r||this._ts&&this._initted&&r.isActive()&&(s=r.rawTime(!0))>=i&&s1?(i?(o[r]=i,s&&(o[r+"Params"]=s),r==="onUpdate"&&(this._onUpdate=i)):delete o[r],this):o[r]},e.then=function(r){var i=this;return new Promise(function(s){var o=rr(r)?r:b6,a=function(){var c=i.then;i.then=null,rr(o)&&(o=o(i))&&(o.then||o===i)&&(i.then=c),s(o),i.then=c};i._initted&&i.totalProgress()===1&&i._ts>=0||!i._tTime&&i._ts<0?a():i._prom=a})},e.kill=function(){wm(this)},n}();bo(Dg.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-_n,_prom:0,_ps:!1,_rts:1});var Ni=function(n){A6(e,n);function e(r,i){var s;return r===void 0&&(r={}),s=n.call(this,r)||this,s.labels={},s.smoothChildTiming=!!r.smoothChildTiming,s.autoRemoveChildren=!!r.autoRemoveChildren,s._sort=rs(r.sortChildren),jn&&Pa(r.parent||jn,Rl(s),i),r.reversed&&s.reverse(),r.paused&&s.paused(!0),r.scrollTrigger&&M6(Rl(s),r.scrollTrigger),s}var t=e.prototype;return t.to=function(i,s,o){return Zm(0,arguments,this),this},t.from=function(i,s,o){return Zm(1,arguments,this),this},t.fromTo=function(i,s,o,a){return Zm(2,arguments,this),this},t.set=function(i,s,o){return s.duration=0,s.parent=this,$m(s).repeatDelay||(s.repeat=0),s.immediateRender=!!s.immediateRender,new xr(i,s,eo(this,o),1),this},t.call=function(i,s,o){return Pa(this,xr.delayedCall(0,i,s),o)},t.staggerTo=function(i,s,o,a,l,c,A){return o.duration=s,o.stagger=o.stagger||a,o.onComplete=c,o.onCompleteParams=A,o.parent=this,new xr(i,o,eo(this,l)),this},t.staggerFrom=function(i,s,o,a,l,c,A){return o.runBackwards=1,$m(o).immediateRender=rs(o.immediateRender),this.staggerTo(i,s,o,a,l,c,A)},t.staggerFromTo=function(i,s,o,a,l,c,A,u){return a.startAt=o,$m(a).immediateRender=rs(a.immediateRender),this.staggerTo(i,s,a,l,c,A,u)},t.render=function(i,s,o){var a=this._time,l=this._dirty?this.totalDuration():this._tDur,c=this._dur,A=i<=0?0:jr(i),u=this._zTime<0!=i<0&&(this._initted||!c),f,h,d,m,g,p,v,w,_,x,b,B;if(this!==jn&&A>l&&i>=0&&(A=l),A!==this._tTime||o||u){if(a!==this._time&&c&&(A+=this._time-a,i+=this._time-a),f=A,_=this._start,w=this._ts,p=!w,u&&(c||(a=this._zTime),(i||!s)&&(this._zTime=i)),this._repeat){if(b=this._yoyo,g=c+this._rDelay,this._repeat<-1&&i<0)return this.totalTime(g*100+i,s,o);if(f=jr(A%g),A===l?(m=this._repeat,f=c):(m=~~(A/g),m&&m===A/g&&(f=c,m--),f>c&&(f=c)),x=Bd(this._tTime,g),!a&&this._tTime&&x!==m&&this._tTime-x*g-this._dur<=0&&(x=m),b&&m&1&&(f=c-f,B=1),m!==x&&!this._lock){var S=b&&x&1,I=S===(b&&m&1);if(m=a&&i>=0)for(h=this._first;h;){if(d=h._next,(h._act||f>=h._start)&&h._ts&&v!==h){if(h.parent!==this)return this.render(i,s,o);if(h.render(h._ts>0?(f-h._start)*h._ts:(h._dirty?h.totalDuration():h._tDur)+(f-h._start)*h._ts,s,o),f!==this._time||!this._ts&&!p){v=0,d&&(A+=this._zTime=-_n);break}}h=d}else{h=this._last;for(var M=i<0?i:f;h;){if(d=h._prev,(h._act||M<=h._end)&&h._ts&&v!==h){if(h.parent!==this)return this.render(i,s,o);if(h.render(h._ts>0?(M-h._start)*h._ts:(h._dirty?h.totalDuration():h._tDur)+(M-h._start)*h._ts,s,o||Ei&&(h._initted||h._startAt)),f!==this._time||!this._ts&&!p){v=0,d&&(A+=this._zTime=M?-_n:_n);break}}h=d}}if(v&&!s&&(this.pause(),v.render(f>=a?0:-_n)._zTime=f>=a?1:-1,this._ts))return this._start=_,s1(this),this.render(i,s,o);this._onUpdate&&!s&&Is(this,"onUpdate",!0),(A===l&&this._tTime>=this.totalDuration()||!A&&a)&&(_===this._start||Math.abs(w)!==Math.abs(this._ts))&&(this._lock||((i||!c)&&(A===l&&this._ts>0||!A&&this._ts<0)&&vA(this,1),!s&&!(i<0&&!a)&&(A||a||!l)&&(Is(this,A===l&&i>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(A0)&&this._prom())))}return this},t.add=function(i,s){var o=this;if(ec(s)||(s=eo(this,s,i)),!(i instanceof Dg)){if(Bi(i))return i.forEach(function(a){return o.add(a,s)}),this;if($r(i))return this.addLabel(i,s);if(rr(i))i=xr.delayedCall(0,i);else return this}return this!==i?Pa(this,i,s):this},t.getChildren=function(i,s,o,a){i===void 0&&(i=!0),s===void 0&&(s=!0),o===void 0&&(o=!0),a===void 0&&(a=-Ao);for(var l=[],c=this._first;c;)c._start>=a&&(c instanceof xr?s&&l.push(c):(o&&l.push(c),i&&l.push.apply(l,c.getChildren(!0,s,o)))),c=c._next;return l},t.getById=function(i){for(var s=this.getChildren(1,1,1),o=s.length;o--;)if(s[o].vars.id===i)return s[o]},t.remove=function(i){return $r(i)?this.removeLabel(i):rr(i)?this.killTweensOf(i):(i1(this,i),i===this._recent&&(this._recent=this._last),_u(this))},t.totalTime=function(i,s){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=jr(Ms.time-(this._ts>0?i/this._ts:(this.totalDuration()-i)/-this._ts))),n.prototype.totalTime.call(this,i,s),this._forcing=0,this):this._tTime},t.addLabel=function(i,s){return this.labels[i]=eo(this,s),this},t.removeLabel=function(i){return delete this.labels[i],this},t.addPause=function(i,s,o){var a=xr.delayedCall(0,s||Fg,o);return a.data="isPause",this._hasPause=1,Pa(this,a,eo(this,i))},t.removePause=function(i){var s=this._first;for(i=eo(this,i);s;)s._start===i&&s.data==="isPause"&&vA(s),s=s._next},t.killTweensOf=function(i,s,o){for(var a=this.getTweensOf(i,o),l=a.length;l--;)Kc!==a[l]&&a[l].kill(i,s);return this},t.getTweensOf=function(i,s){for(var o=[],a=uo(i),l=this._first,c=ec(s),A;l;)l instanceof xr?DZ(l._targets,a)&&(c?(!Kc||l._initted&&l._ts)&&l.globalTime(0)<=s&&l.globalTime(l.totalDuration())>s:!s||l.isActive())&&o.push(l):(A=l.getTweensOf(a,s)).length&&o.push.apply(o,A),l=l._next;return o},t.tweenTo=function(i,s){s=s||{};var o=this,a=eo(o,i),l=s,c=l.startAt,A=l.onStart,u=l.onStartParams,f=l.immediateRender,h,d=xr.to(o,bo({ease:s.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:s.duration||Math.abs((a-(c&&"time"in c?c.time:o._time))/o.timeScale())||_n,onStart:function(){if(o.pause(),!h){var g=s.duration||Math.abs((a-(c&&"time"in c?c.time:o._time))/o.timeScale());d._dur!==g&&Md(d,g,0,1).render(d._time,!0,!0),h=1}A&&A.apply(d,u||[])}},s));return f?d.render(0):d},t.tweenFromTo=function(i,s,o){return this.tweenTo(s,bo({startAt:{time:eo(this,i)}},o))},t.recent=function(){return this._recent},t.nextLabel=function(i){return i===void 0&&(i=this._time),GP(this,eo(this,i))},t.previousLabel=function(i){return i===void 0&&(i=this._time),GP(this,eo(this,i),1)},t.currentLabel=function(i){return arguments.length?this.seek(i,!0):this.previousLabel(this._time+_n)},t.shiftChildren=function(i,s,o){o===void 0&&(o=0);for(var a=this._first,l=this.labels,c;a;)a._start>=o&&(a._start+=i,a._end+=i),a=a._next;if(s)for(c in l)l[c]>=o&&(l[c]+=i);return _u(this)},t.invalidate=function(i){var s=this._first;for(this._lock=0;s;)s.invalidate(i),s=s._next;return n.prototype.invalidate.call(this,i)},t.clear=function(i){i===void 0&&(i=!0);for(var s=this._first,o;s;)o=s._next,this.remove(s),s=o;return this._dp&&(this._time=this._tTime=this._pTime=0),i&&(this.labels={}),_u(this)},t.totalDuration=function(i){var s=0,o=this,a=o._last,l=Ao,c,A,u;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-i:i));if(o._dirty){for(u=o.parent;a;)c=a._prev,a._dirty&&a.totalDuration(),A=a._start,A>l&&o._sort&&a._ts&&!o._lock?(o._lock=1,Pa(o,a,A-a._delay,1)._lock=0):l=A,A<0&&a._ts&&(s-=A,(!u&&!o._dp||u&&u.smoothChildTiming)&&(o._start+=A/o._ts,o._time-=A,o._tTime-=A),o.shiftChildren(-A,!1,-1/0),l=0),a._end>s&&a._ts&&(s=a._end),a=c;Md(o,o===jn&&o._time>s?o._time:s,1,1),o._dirty=0}return o._tDur},e.updateRoot=function(i){if(jn._ts&&(_6(jn,I_(i,jn)),y6=Ms.frame),Ms.frame>=kP){kP+=Ds.autoSleep||120;var s=jn._first;if((!s||!s._ts)&&Ds.autoSleep&&Ms._listeners.length<2){for(;s&&!s._ts;)s=s._next;s||Ms.sleep()}}},e}(Dg);bo(Ni.prototype,{_lock:0,_hasPause:0,_forcing:0});var sJ=function(e,t,r,i,s,o,a){var l=new ss(this._pt,e,t,0,1,Y6,null,s),c=0,A=0,u,f,h,d,m,g,p,v;for(l.b=r,l.e=i,r+="",i+="",(p=~i.indexOf("random("))&&(i=Pg(i)),o&&(v=[r,i],o(v,e,t),r=v[0],i=v[1]),f=r.match(oE)||[];u=oE.exec(i);)d=u[0],m=i.substring(c,u.index),h?h=(h+1)%5:m.substr(-5)==="rgba("&&(h=1),d!==f[A++]&&(g=parseFloat(f[A-1])||0,l._pt={_next:l._pt,p:m||A===1?m:",",s:g,c:d.charAt(1)==="="?ed(g,d)-g:parseFloat(d)-g,m:h&&h<4?Math.round:0},c=oE.lastIndex);return l.c=c")}),_.duration();else{b={};for(S in d)S==="ease"||S==="easeEach"||cJ(S,d[S],b,d.easeEach);for(S in b)for(T=b[S].sort(function(R,F){return R.t-F.t}),D=0,x=0;xl-_n&&!A?l:i<_n?0:i,f,h,d,m,g,p,v,w,_;if(!c)zZ(this,i,s,o);else if(u!==this._tTime||!i||o||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==A){if(f=u,w=this.timeline,this._repeat){if(m=c+this._rDelay,this._repeat<-1&&A)return this.totalTime(m*100+i,s,o);if(f=jr(u%m),u===l?(d=this._repeat,f=c):(d=~~(u/m),d&&d===jr(u/m)&&(f=c,d--),f>c&&(f=c)),p=this._yoyo&&d&1,p&&(_=this._yEase,f=c-f),g=Bd(this._tTime,m),f===a&&!o&&this._initted&&d===g)return this._tTime=u,this;d!==g&&(w&&this._yEase&&H6(w,p),this.vars.repeatRefresh&&!p&&!this._lock&&this._time!==m&&this._initted&&(this._lock=o=1,this.render(jr(m*d),!0).invalidate()._lock=0))}if(!this._initted){if(S6(this,A?i:f,o,s,u))return this._tTime=0,this;if(a!==this._time&&!(o&&this.vars.repeatRefresh&&d!==g))return this;if(c!==this._dur)return this.render(i,s,o)}if(this._tTime=u,this._time=f,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=v=(_||this._ease)(f/c),this._from&&(this.ratio=v=1-v),f&&!a&&!s&&!d&&(Is(this,"onStart"),this._tTime!==u))return this;for(h=this._pt;h;)h.r(v,h.d),h=h._next;w&&w.render(i<0?i:w._dur*w._ease(f/this._dur),s,o)||this._startAt&&(this._zTime=i),this._onUpdate&&!s&&(A&&DS(this,i,s,o),Is(this,"onUpdate")),this._repeat&&d!==g&&this.vars.onRepeat&&!s&&this.parent&&Is(this,"onRepeat"),(u===this._tDur||!u)&&this._tTime===u&&(A&&!this._onUpdate&&DS(this,i,!0,!0),(i||!c)&&(u===this._tDur&&this._ts>0||!u&&this._ts<0)&&vA(this,1),!s&&!(A&&!a)&&(u||a||p)&&(Is(this,u===l?"onComplete":"onReverseComplete",!0),this._prom&&!(u0)&&this._prom()))}return this},t.targets=function(){return this._targets},t.invalidate=function(i){return(!i||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(i),n.prototype.invalidate.call(this,i)},t.resetTo=function(i,s,o,a,l){Lg||Ms.wake(),this._ts||this.play();var c=Math.min(this._dur,(this._dp._time-this._start)*this._ts),A;return this._initted||yR(this,c),A=this._ease(c/this._dur),aJ(this,i,s,o,a,A,c,l)?this.resetTo(i,s,o,a,1):(o1(this,0),this.parent||E6(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},t.kill=function(i,s){if(s===void 0&&(s="all"),!i&&(!s||s==="all"))return this._lazy=this._pt=0,this.parent?wm(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(i,s,Kc&&Kc.vars.overwrite!==!0)._first||wm(this),this.parent&&o!==this.timeline.totalDuration()&&Md(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,l=i?uo(i):a,c=this._ptLookup,A=this._pt,u,f,h,d,m,g,p;if((!s||s==="all")&&OZ(a,l))return s==="all"&&(this._pt=0),wm(this);for(u=this._op=this._op||[],s!=="all"&&($r(s)&&(m={},is(s,function(v){return m[v]=1}),s=m),s=lJ(a,s)),p=a.length;p--;)if(~l.indexOf(a[p])){f=c[p],s==="all"?(u[p]=s,d=f,h={}):(h=u[p]=u[p]||{},d=s);for(m in d)g=f&&f[m],g&&((!("kill"in g.d)||g.d.kill(m)===!0)&&i1(this,g,"_pt"),delete f[m]),h!=="all"&&(h[m]=1)}return this._initted&&!this._pt&&A&&wm(this),this},e.to=function(i,s){return new e(i,s,arguments[2])},e.from=function(i,s){return Zm(1,arguments)},e.delayedCall=function(i,s,o,a){return new e(s,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:i,onComplete:s,onReverseComplete:s,onCompleteParams:o,onReverseCompleteParams:o,callbackScope:a})},e.fromTo=function(i,s,o){return Zm(2,arguments)},e.set=function(i,s){return s.duration=0,s.repeatDelay||(s.repeat=0),new e(i,s)},e.killTweensOf=function(i,s,o){return jn.killTweensOf(i,s,o)},e}(Dg);bo(xr.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});is("staggerTo,staggerFrom,staggerFromTo",function(n){xr[n]=function(){var e=new Ni,t=OS.call(arguments,0);return t.splice(n==="staggerFromTo"?5:4,0,0),e[n].apply(e,t)}});var wR=function(e,t,r){return e[t]=r},K6=function(e,t,r){return e[t](r)},AJ=function(e,t,r,i){return e[t](i.fp,r)},uJ=function(e,t,r){return e.setAttribute(t,r)},_R=function(e,t){return rr(e[t])?K6:uR(e[t])&&e.setAttribute?uJ:wR},X6=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e6)/1e6,t)},fJ=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},Y6=function(e,t){var r=t._pt,i="";if(!e&&t.b)i=t.b;else if(e===1&&t.e)i=t.e;else{for(;r;)i=r.p+(r.m?r.m(r.s+r.c*e):Math.round((r.s+r.c*e)*1e4)/1e4)+i,r=r._next;i+=t.c}t.set(t.t,t.p,i,t)},xR=function(e,t){for(var r=t._pt;r;)r.r(e,r.d),r=r._next},hJ=function(e,t,r,i){for(var s=this._pt,o;s;)o=s._next,s.p===i&&s.modifier(e,t,r),s=o},dJ=function(e){for(var t=this._pt,r,i;t;)i=t._next,t.p===e&&!t.op||t.op===e?i1(this,t,"_pt"):t.dep||(r=1),t=i;return!r},pJ=function(e,t,r,i){i.mSet(e,t,i.m.call(i.tween,r,i.mt),i)},$6=function(e){for(var t=e._pt,r,i,s,o;t;){for(r=t._next,i=s;i&&i.pr>t.pr;)i=i._next;(t._prev=i?i._prev:o)?t._prev._next=t:s=t,(t._next=i)?i._prev=t:o=t,t=r}e._pt=s},ss=function(){function n(t,r,i,s,o,a,l,c,A){this.t=r,this.s=s,this.c=o,this.p=i,this.r=a||X6,this.d=l||this,this.set=c||wR,this.pr=A||0,this._next=t,t&&(t._prev=this)}var e=n.prototype;return e.modifier=function(r,i,s){this.mSet=this.mSet||this.set,this.set=pJ,this.m=r,this.mt=s,this.tween=i},n}();is(mR+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(n){return pR[n]=1});Qs.TweenMax=Qs.TweenLite=xr;Qs.TimelineLite=Qs.TimelineMax=Ni;jn=new Ni({sortChildren:!1,defaults:Ed,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});Ds.stringFilter=k6;var bu=[],_w={},mJ=[],jP=0,gJ=0,uE=function(e){return(_w[e]||mJ).map(function(t){return t()})},zS=function(){var e=Date.now(),t=[];e-jP>2&&(uE("matchMediaInit"),bu.forEach(function(r){var i=r.queries,s=r.conditions,o,a,l,c;for(a in i)o=Ta.matchMedia(i[a]).matches,o&&(l=1),o!==s[a]&&(s[a]=o,c=1);c&&(r.revert(),l&&t.push(r))}),uE("matchMediaRevert"),t.forEach(function(r){return r.onMatch(r,function(i){return r.add(null,i)})}),jP=e,uE("matchMedia"))},Z6=function(){function n(t,r){this.selector=r&&kS(r),this.data=[],this._r=[],this.isReverted=!1,this.id=gJ++,t&&this.add(t)}var e=n.prototype;return e.add=function(r,i,s){rr(r)&&(s=i,i=r,r=rr);var o=this,a=function(){var c=kn,A=o.selector,u;return c&&c!==o&&c.data.push(o),s&&(o.selector=kS(s)),kn=o,u=i.apply(o,arguments),rr(u)&&o._r.push(u),kn=c,o.selector=A,o.isReverted=!1,u};return o.last=a,r===rr?a(o,function(l){return o.add(null,l)}):r?o[r]=a:a},e.ignore=function(r){var i=kn;kn=null,r(this),kn=i},e.getTweens=function(){var r=[];return this.data.forEach(function(i){return i instanceof n?r.push.apply(r,i.getTweens()):i instanceof xr&&!(i.parent&&i.parent.data==="nested")&&r.push(i)}),r},e.clear=function(){this._r.length=this.data.length=0},e.kill=function(r,i){var s=this;if(r?function(){for(var a=s.getTweens(),l=s.data.length,c;l--;)c=s.data[l],c.data==="isFlip"&&(c.revert(),c.getChildren(!0,!0,!1).forEach(function(A){return a.splice(a.indexOf(A),1)}));for(a.map(function(A){return{g:A._dur||A._delay||A._sat&&!A._sat.vars.immediateRender?A.globalTime(0):-1/0,t:A}}).sort(function(A,u){return u.g-A.g||-1/0}).forEach(function(A){return A.t.revert(r)}),l=s.data.length;l--;)c=s.data[l],c instanceof Ni?c.data!=="nested"&&(c.scrollTrigger&&c.scrollTrigger.revert(),c.kill()):!(c instanceof xr)&&c.revert&&c.revert(r);s._r.forEach(function(A){return A(r,s)}),s.isReverted=!0}():this.data.forEach(function(a){return a.kill&&a.kill()}),this.clear(),i)for(var o=bu.length;o--;)bu[o].id===this.id&&bu.splice(o,1)},e.revert=function(r){this.kill(r||{})},n}(),vJ=function(){function n(t){this.contexts=[],this.scope=t,kn&&kn.data.push(this)}var e=n.prototype;return e.add=function(r,i,s){el(r)||(r={matches:r});var o=new Z6(0,s||this.scope),a=o.conditions={},l,c,A;kn&&!o.selector&&(o.selector=kn.selector),this.contexts.push(o),i=o.add("onMatch",i),o.queries=r;for(c in r)c==="all"?A=1:(l=Ta.matchMedia(r[c]),l&&(bu.indexOf(o)<0&&bu.push(o),(a[c]=l.matches)&&(A=1),l.addListener?l.addListener(zS):l.addEventListener("change",zS)));return A&&i(o,function(u){return o.add(null,u)}),this},e.revert=function(r){this.kill(r||{})},e.kill=function(r){this.contexts.forEach(function(i){return i.kill(r,!0)})},n}(),R_={registerPlugin:function(){for(var e=arguments.length,t=new Array(e),r=0;r1){var i=e.map(function(A){return As.quickSetter(A,t,r)}),s=i.length;return function(A){for(var u=s;u--;)i[u](A)}}e=e[0]||{};var o=Bs[t],a=wu(e),l=a.harness&&(a.harness.aliases||{})[t]||t,c=o?function(A){var u=new o;Ph._pt=0,u.init(e,r?A+r:A,Ph,0,[e]),u.render(1,u),Ph._pt&&xR(1,Ph)}:a.set(e,l);return o?c:function(A){return c(e,l,r?A+r:A,a,1)}},quickTo:function(e,t,r){var i,s=As.to(e,Pu((i={},i[t]="+=0.1",i.paused=!0,i),r||{})),o=function(l,c,A){return s.resetTo(t,l,c,A)};return o.tween=s,o},isTweening:function(e){return jn.getTweensOf(e,!0).length>0},defaults:function(e){return e&&e.ease&&(e.ease=xu(e.ease,Ed.ease)),QP(Ed,e||{})},config:function(e){return QP(Ds,e||{})},registerEffect:function(e){var t=e.name,r=e.effect,i=e.plugins,s=e.defaults,o=e.extendTimeline;(i||"").split(",").forEach(function(a){return a&&!Bs[a]&&!Qs[a]&&Ug(t+" effect requires "+a+" plugin.")}),aE[t]=function(a,l,c){return r(uo(a),bo(l||{},s),c)},o&&(Ni.prototype[t]=function(a,l,c){return this.add(aE[t](a,el(l)?l:(c=l)&&{},this),c)})},registerEase:function(e,t){Gt[e]=xu(t)},parseEase:function(e,t){return arguments.length?xu(e,t):Gt},getById:function(e){return jn.getById(e)},exportRoot:function(e,t){e===void 0&&(e={});var r=new Ni(e),i,s;for(r.smoothChildTiming=rs(e.smoothChildTiming),jn.remove(r),r._dp=0,r._time=r._tTime=jn._time,i=jn._first;i;)s=i._next,(t||!(!i._dur&&i instanceof xr&&i.vars.onComplete===i._targets[0]))&&Pa(r,i,i._start-i._delay),i=s;return Pa(jn,r,0),r},context:function(e,t){return e?new Z6(e,t):kn},matchMedia:function(e){return new vJ(e)},matchMediaRefresh:function(){return bu.forEach(function(e){var t=e.conditions,r,i;for(i in t)t[i]&&(t[i]=!1,r=1);r&&e.revert()})||zS()},addEventListener:function(e,t){var r=_w[e]||(_w[e]=[]);~r.indexOf(t)||r.push(t)},removeEventListener:function(e,t){var r=_w[e],i=r&&r.indexOf(t);i>=0&&r.splice(i,1)},utils:{wrap:$Z,wrapYoyo:ZZ,distribute:I6,random:U6,snap:R6,normalize:YZ,getUnit:wi,clamp:jZ,splitColor:N6,toArray:uo,selector:kS,mapRange:P6,pipe:KZ,unitize:XZ,interpolate:JZ,shuffle:T6},install:g6,effects:aE,ticker:Ms,updateRoot:Ni.updateRoot,plugins:Bs,globalTimeline:jn,core:{PropTween:ss,globals:v6,Tween:xr,Timeline:Ni,Animation:Dg,getCache:wu,_removeLinkedListItem:i1,reverting:function(){return Ei},context:function(e){return e&&kn&&(kn.data.push(e),e._ctx=kn),kn},suppressOverwrites:function(e){return AR=e}}};is("to,from,fromTo,delayedCall,set,killTweensOf",function(n){return R_[n]=xr[n]});Ms.add(Ni.updateRoot);Ph=R_.to({},{duration:0});var yJ=function(e,t){for(var r=e._pt;r&&r.p!==t&&r.op!==t&&r.fp!==t;)r=r._next;return r},wJ=function(e,t){var r=e._targets,i,s,o;for(i in t)for(s=r.length;s--;)o=e._ptLookup[s][i],o&&(o=o.d)&&(o._pt&&(o=yJ(o,i)),o&&o.modifier&&o.modifier(t[i],e,r[s],i))},fE=function(e,t){return{name:e,rawVars:1,init:function(i,s,o){o._onInit=function(a){var l,c;if($r(s)&&(l={},is(s,function(A){return l[A]=1}),s=l),t){l={};for(c in s)l[c]=t(s[c]);s=l}wJ(a,s)}}}},As=R_.registerPlugin({name:"attr",init:function(e,t,r,i,s){var o,a,l;this.tween=r;for(o in t)l=e.getAttribute(o)||"",a=this.add(e,"setAttribute",(l||0)+"",t[o],i,s,0,0,o),a.op=o,a.b=l,this._props.push(o)},render:function(e,t){for(var r=t._pt;r;)Ei?r.set(r.t,r.p,r.b,r):r.r(e,r.d),r=r._next}},{name:"endArray",init:function(e,t){for(var r=t.length;r--;)this.add(e,r,e[r]||0,t[r],0,0,0,0,0,1)}},fE("roundProps",QS),fE("modifiers"),fE("snap",R6))||R_;xr.version=Ni.version=As.version="3.12.5";m6=1;fR()&&Sd();Gt.Power0;Gt.Power1;Gt.Power2;Gt.Power3;Gt.Power4;Gt.Linear;Gt.Quad;Gt.Cubic;Gt.Quart;Gt.Quint;Gt.Strong;Gt.Elastic;Gt.Back;Gt.SteppedEase;Gt.Bounce;Gt.Sine;Gt.Expo;Gt.Circ;/*! * CSSPlugin 3.12.5 * https://gsap.com * @@ -60,15 +60,15 @@ Error generating stack: `+s.message+` * Subject to the terms at https://gsap.com/standard-license or for * Club GSAP members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com -*/var jP,Kc,ed,_R,fu,WP,xR,wJ=function(){return typeof window<"u"},tc={},tu=180/Math.PI,td=Math.PI/180,of=Math.atan2,KP=1e8,bR=/([A-Z])/g,_J=/(left|right|width|margin|padding|x)/i,xJ=/[\s,\(]\S/,Oa={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},QM=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},bJ=function(e,t){return t.set(t.t,t.p,e===1?t.e:Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},EJ=function(e,t){return t.set(t.t,t.p,e?Math.round((t.s+t.c*e)*1e4)/1e4+t.u:t.b,t)},BJ=function(e,t){var r=t.s+t.c*e;t.set(t.t,t.p,~~(r+(r<0?-.5:.5))+t.u,t)},Z6=function(e,t){return t.set(t.t,t.p,e?t.e:t.b,t)},J6=function(e,t){return t.set(t.t,t.p,e!==1?t.b:t.e,t)},SJ=function(e,t,r){return e.style[t]=r},MJ=function(e,t,r){return e.style.setProperty(t,r)},CJ=function(e,t,r){return e._gsap[t]=r},TJ=function(e,t,r){return e._gsap.scaleX=e._gsap.scaleY=r},IJ=function(e,t,r,i,s){var o=e._gsap;o.scaleX=o.scaleY=r,o.renderTransform(s,o)},RJ=function(e,t,r,i,s){var o=e._gsap;o[t]=r,o.renderTransform(s,o)},Wn="transform",os=Wn+"Origin",UJ=function n(e,t){var r=this,i=this.target,s=i.style,o=i._gsap;if(e in tc&&s){if(this.tfm=this.tfm||{},e!=="transform")e=Oa[e]||e,~e.indexOf(",")?e.split(",").forEach(function(a){return r.tfm[a]=Ll(i,a)}):this.tfm[e]=o.x?o[e]:Ll(i,e),e===os&&(this.tfm.zOrigin=o.zOrigin);else return Oa.transform.split(",").forEach(function(a){return n.call(r,a,t)});if(this.props.indexOf(Wn)>=0)return;o.svg&&(this.svgo=i.getAttribute("data-svg-origin"),this.props.push(os,t,"")),e=Wn}(s||t)&&this.props.push(e,t,s[e])},q6=function(e){e.translate&&(e.removeProperty("translate"),e.removeProperty("scale"),e.removeProperty("rotate"))},FJ=function(){var e=this.props,t=this.target,r=t.style,i=t._gsap,s,o;for(s=0;s=0?XP[o]:"")+e},GM=function(){wJ()&&window.document&&(jP=window,Kc=jP.document,ed=Kc.documentElement,fu=zM("div")||{style:{}},zM("div"),Wn=Md(Wn),os=Wn+"Origin",fu.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",tz=!!Md("perspective"),xR=As.core.reverting,_R=1)},uE=function n(e){var t=zM("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),r=this.parentNode,i=this.nextSibling,s=this.style.cssText,o;if(ed.appendChild(t),t.appendChild(this),this.style.display="block",e)try{o=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=n}catch{}else this._gsapBBox&&(o=this._gsapBBox());return r&&(i?r.insertBefore(this,i):r.appendChild(this)),ed.removeChild(t),this.style.cssText=s,o},YP=function(e,t){for(var r=t.length;r--;)if(e.hasAttribute(t[r]))return e.getAttribute(t[r])},nz=function(e){var t;try{t=e.getBBox()}catch{t=uE.call(e,!0)}return t&&(t.width||t.height)||e.getBBox===uE||(t=uE.call(e,!0)),t&&!t.width&&!t.x&&!t.y?{x:+YP(e,["x","cx","x1"])||0,y:+YP(e,["y","cy","y1"])||0,width:0,height:0}:t},rz=function(e){return!!(e.getCTM&&(!e.parentNode||e.ownerSVGElement)&&nz(e))},Fu=function(e,t){if(t){var r=e.style,i;t in tc&&t!==os&&(t=Wn),r.removeProperty?(i=t.substr(0,2),(i==="ms"||t.substr(0,6)==="webkit")&&(t="-"+t),r.removeProperty(i==="--"?t:t.replace(bR,"-$1").toLowerCase())):r.removeAttribute(t)}},Xc=function(e,t,r,i,s,o){var a=new ss(e._pt,t,r,0,1,o?J6:Z6);return e._pt=a,a.b=i,a.e=s,e._props.push(r),a},$P={deg:1,rad:1,turn:1},PJ={grid:1,flex:1},vA=function n(e,t,r,i){var s=parseFloat(r)||0,o=(r+"").trim().substr((s+"").length)||"px",a=fu.style,l=_J.test(t),c=e.tagName.toLowerCase()==="svg",A=(c?"client":"offset")+(l?"Width":"Height"),u=100,f=i==="px",h=i==="%",d,m,g,p;if(i===o||!s||$P[i]||$P[o])return s;if(o!=="px"&&!f&&(s=n(e,t,r,"px")),p=e.getCTM&&rz(e),(h||o==="%")&&(tc[t]||~t.indexOf("adius")))return d=p?e.getBBox()[l?"width":"height"]:e[A],hr(h?s/d*u:s/100*d);if(a[l?"width":"height"]=u+(f?o:i),m=~t.indexOf("adius")||i==="em"&&e.appendChild&&!c?e:e.parentNode,p&&(m=(e.ownerSVGElement||{}).parentNode),(!m||m===Kc||!m.appendChild)&&(m=Kc.body),g=m._gsap,g&&h&&g.width&&l&&g.time===Ss.time&&!g.uncache)return hr(s/g.width*u);if(h&&(t==="height"||t==="width")){var v=e.style[t];e.style[t]=u+i,d=e[A],v?e.style[t]=v:Fu(e,t)}else(h||o==="%")&&!PJ[Ka(m,"display")]&&(a.position=Ka(e,"position")),m===e&&(a.position="static"),m.appendChild(fu),d=fu[A],m.removeChild(fu),a.position="absolute";return l&&h&&(g=vu(m),g.time=Ss.time,g.width=m[A]),hr(f?d*s/u:d&&s?u/d*s:0)},Ll=function(e,t,r,i){var s;return _R||GM(),t in Oa&&t!=="transform"&&(t=Oa[t],~t.indexOf(",")&&(t=t.split(",")[0])),tc[t]&&t!=="transform"?(s=Ng(e,i),s=t!=="transformOrigin"?s[t]:s.svg?s.origin:U_(Ka(e,os))+" "+s.zOrigin+"px"):(s=e.style[t],(!s||s==="auto"||i||~(s+"").indexOf("calc("))&&(s=R_[t]&&R_[t](e,t,r)||Ka(e,t)||y6(e,t)||(t==="opacity"?1:0))),r&&!~(s+"").trim().indexOf(" ")?vA(e,t,s,r)+r:s},LJ=function(e,t,r,i){if(!r||r==="none"){var s=Md(t,e,1),o=s&&Ka(e,s,1);o&&o!==r?(t=s,r=o):t==="borderColor"&&(r=Ka(e,"borderTopColor"))}var a=new ss(this._pt,e.style,t,0,1,X6),l=0,c=0,A,u,f,h,d,m,g,p,v,w,_,x;if(a.b=r,a.e=i,r+="",i+="",i==="auto"&&(m=e.style[t],e.style[t]=i,i=Ka(e,t)||i,m?e.style[t]=m:Fu(e,t)),A=[r,i],O6(A),r=A[0],i=A[1],f=r.match(Rh)||[],x=i.match(Rh)||[],x.length){for(;u=Rh.exec(i);)g=u[0],v=i.substring(l,u.index),d?d=(d+1)%5:(v.substr(-5)==="rgba("||v.substr(-5)==="hsla(")&&(d=1),g!==(m=f[c++]||"")&&(h=parseFloat(m)||0,_=m.substr((h+"").length),g.charAt(1)==="="&&(g=qh(h,g)+_),p=parseFloat(g),w=g.substr((p+"").length),l=Rh.lastIndex-w.length,w||(w=w||Ds.units[t]||_,l===i.length&&(i+=w,a.e+=w)),_!==w&&(h=vA(e,t,m,w)||0),a._pt={_next:a._pt,p:v||c===1?v:",",s:h,c:p-h,m:d&&d<4||t==="zIndex"?Math.round:0});a.c=l-1;)a=s[c],tc[a]&&(l=1,a=a==="transformOrigin"?os:Wn),Fu(r,a);l&&(Fu(r,Wn),o&&(o.svg&&r.removeAttribute("transform"),Ng(r,1),o.uncache=1,q6(i)))}},R_={clearProps:function(e,t,r,i,s){if(s.data!=="isFromStart"){var o=e._pt=new ss(e._pt,t,r,0,0,NJ);return o.u=i,o.pr=-10,o.tween=s,e._props.push(r),1}}},Dg=[1,0,0,1,0,0],iz={},sz=function(e){return e==="matrix(1, 0, 0, 1, 0, 0)"||e==="none"||!e},JP=function(e){var t=Ka(e,Wn);return sz(t)?Dg:t.substr(7).match(f6).map(hr)},ER=function(e,t){var r=e._gsap||vu(e),i=e.style,s=JP(e),o,a,l,c;return r.svg&&e.getAttribute("transform")?(l=e.transform.baseVal.consolidate().matrix,s=[l.a,l.b,l.c,l.d,l.e,l.f],s.join(",")==="1,0,0,1,0,0"?Dg:s):(s===Dg&&!e.offsetParent&&e!==ed&&!r.svg&&(l=i.display,i.display="block",o=e.parentNode,(!o||!e.offsetParent)&&(c=1,a=e.nextElementSibling,ed.appendChild(e)),s=JP(e),l?i.display=l:Fu(e,"display"),c&&(a?o.insertBefore(e,a):o?o.appendChild(e):ed.removeChild(e))),t&&s.length>6?[s[0],s[1],s[4],s[5],s[12],s[13]]:s)},VM=function(e,t,r,i,s,o){var a=e._gsap,l=s||ER(e,!0),c=a.xOrigin||0,A=a.yOrigin||0,u=a.xOffset||0,f=a.yOffset||0,h=l[0],d=l[1],m=l[2],g=l[3],p=l[4],v=l[5],w=t.split(" "),_=parseFloat(w[0])||0,x=parseFloat(w[1])||0,b,B,M,I;r?l!==Dg&&(B=h*g-d*m)&&(M=_*(g/B)+x*(-m/B)+(m*v-g*p)/B,I=_*(-d/B)+x*(h/B)-(h*v-d*p)/B,_=M,x=I):(b=nz(e),_=b.x+(~w[0].indexOf("%")?_/100*b.width:_),x=b.y+(~(w[1]||w[0]).indexOf("%")?x/100*b.height:x)),i||i!==!1&&a.smooth?(p=_-c,v=x-A,a.xOffset=u+(p*h+v*m)-p,a.yOffset=f+(p*d+v*g)-v):a.xOffset=a.yOffset=0,a.xOrigin=_,a.yOrigin=x,a.smooth=!!i,a.origin=t,a.originIsAbsolute=!!r,e.style[os]="0px 0px",o&&(Xc(o,a,"xOrigin",c,_),Xc(o,a,"yOrigin",A,x),Xc(o,a,"xOffset",u,a.xOffset),Xc(o,a,"yOffset",f,a.yOffset)),e.setAttribute("data-svg-origin",_+" "+x)},Ng=function(e,t){var r=e._gsap||new z6(e);if("x"in r&&!t&&!r.uncache)return r;var i=e.style,s=r.scaleX<0,o="px",a="deg",l=getComputedStyle(e),c=Ka(e,os)||"0",A,u,f,h,d,m,g,p,v,w,_,x,b,B,M,I,S,L,D,T,y,E,R,F,O,z,j,H,C,W,ee,P;return A=u=f=m=g=p=v=w=_=0,h=d=1,r.svg=!!(e.getCTM&&rz(e)),l.translate&&((l.translate!=="none"||l.scale!=="none"||l.rotate!=="none")&&(i[Wn]=(l.translate!=="none"?"translate3d("+(l.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(l.rotate!=="none"?"rotate("+l.rotate+") ":"")+(l.scale!=="none"?"scale("+l.scale.split(" ").join(",")+") ":"")+(l[Wn]!=="none"?l[Wn]:"")),i.scale=i.rotate=i.translate="none"),B=ER(e,r.svg),r.svg&&(r.uncache?(O=e.getBBox(),c=r.xOrigin-O.x+"px "+(r.yOrigin-O.y)+"px",F=""):F=!t&&e.getAttribute("data-svg-origin"),VM(e,F||c,!!F||r.originIsAbsolute,r.smooth!==!1,B)),x=r.xOrigin||0,b=r.yOrigin||0,B!==Dg&&(L=B[0],D=B[1],T=B[2],y=B[3],A=E=B[4],u=R=B[5],B.length===6?(h=Math.sqrt(L*L+D*D),d=Math.sqrt(y*y+T*T),m=L||D?of(D,L)*tu:0,v=T||y?of(T,y)*tu+m:0,v&&(d*=Math.abs(Math.cos(v*td))),r.svg&&(A-=x-(x*L+b*T),u-=b-(x*D+b*y))):(P=B[6],W=B[7],j=B[8],H=B[9],C=B[10],ee=B[11],A=B[12],u=B[13],f=B[14],M=of(P,C),g=M*tu,M&&(I=Math.cos(-M),S=Math.sin(-M),F=E*I+j*S,O=R*I+H*S,z=P*I+C*S,j=E*-S+j*I,H=R*-S+H*I,C=P*-S+C*I,ee=W*-S+ee*I,E=F,R=O,P=z),M=of(-T,C),p=M*tu,M&&(I=Math.cos(-M),S=Math.sin(-M),F=L*I-j*S,O=D*I-H*S,z=T*I-C*S,ee=y*S+ee*I,L=F,D=O,T=z),M=of(D,L),m=M*tu,M&&(I=Math.cos(M),S=Math.sin(M),F=L*I+D*S,O=E*I+R*S,D=D*I-L*S,R=R*I-E*S,L=F,E=O),g&&Math.abs(g)+Math.abs(m)>359.9&&(g=m=0,p=180-p),h=hr(Math.sqrt(L*L+D*D+T*T)),d=hr(Math.sqrt(R*R+P*P)),M=of(E,R),v=Math.abs(M)>2e-4?M*tu:0,_=ee?1/(ee<0?-ee:ee):0),r.svg&&(F=e.getAttribute("transform"),r.forceCSS=e.setAttribute("transform","")||!sz(Ka(e,Wn)),F&&e.setAttribute("transform",F))),Math.abs(v)>90&&Math.abs(v)<270&&(s?(h*=-1,v+=m<=0?180:-180,m+=m<=0?180:-180):(d*=-1,v+=v<=0?180:-180)),t=t||r.uncache,r.x=A-((r.xPercent=A&&(!t&&r.xPercent||(Math.round(e.offsetWidth/2)===Math.round(-A)?-50:0)))?e.offsetWidth*r.xPercent/100:0)+o,r.y=u-((r.yPercent=u&&(!t&&r.yPercent||(Math.round(e.offsetHeight/2)===Math.round(-u)?-50:0)))?e.offsetHeight*r.yPercent/100:0)+o,r.z=f+o,r.scaleX=hr(h),r.scaleY=hr(d),r.rotation=hr(m)+a,r.rotationX=hr(g)+a,r.rotationY=hr(p)+a,r.skewX=v+a,r.skewY=w+a,r.transformPerspective=_+o,(r.zOrigin=parseFloat(c.split(" ")[2])||!t&&r.zOrigin||0)&&(i[os]=U_(c)),r.xOffset=r.yOffset=0,r.force3D=Ds.force3D,r.renderTransform=r.svg?kJ:tz?oz:OJ,r.uncache=0,r},U_=function(e){return(e=e.split(" "))[0]+" "+e[1]},fE=function(e,t,r){var i=wi(t);return hr(parseFloat(t)+parseFloat(vA(e,"x",r+"px",i)))+i},OJ=function(e,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,oz(e,t)},LA="0deg",Mp="0px",DA=") ",oz=function(e,t){var r=t||this,i=r.xPercent,s=r.yPercent,o=r.x,a=r.y,l=r.z,c=r.rotation,A=r.rotationY,u=r.rotationX,f=r.skewX,h=r.skewY,d=r.scaleX,m=r.scaleY,g=r.transformPerspective,p=r.force3D,v=r.target,w=r.zOrigin,_="",x=p==="auto"&&e&&e!==1||p===!0;if(w&&(u!==LA||A!==LA)){var b=parseFloat(A)*td,B=Math.sin(b),M=Math.cos(b),I;b=parseFloat(u)*td,I=Math.cos(b),o=fE(v,o,B*I*-w),a=fE(v,a,-Math.sin(b)*-w),l=fE(v,l,M*I*-w+w)}g!==Mp&&(_+="perspective("+g+DA),(i||s)&&(_+="translate("+i+"%, "+s+"%) "),(x||o!==Mp||a!==Mp||l!==Mp)&&(_+=l!==Mp||x?"translate3d("+o+", "+a+", "+l+") ":"translate("+o+", "+a+DA),c!==LA&&(_+="rotate("+c+DA),A!==LA&&(_+="rotateY("+A+DA),u!==LA&&(_+="rotateX("+u+DA),(f!==LA||h!==LA)&&(_+="skew("+f+", "+h+DA),(d!==1||m!==1)&&(_+="scale("+d+", "+m+DA),v.style[Wn]=_||"translate(0, 0)"},kJ=function(e,t){var r=t||this,i=r.xPercent,s=r.yPercent,o=r.x,a=r.y,l=r.rotation,c=r.skewX,A=r.skewY,u=r.scaleX,f=r.scaleY,h=r.target,d=r.xOrigin,m=r.yOrigin,g=r.xOffset,p=r.yOffset,v=r.forceCSS,w=parseFloat(o),_=parseFloat(a),x,b,B,M,I;l=parseFloat(l),c=parseFloat(c),A=parseFloat(A),A&&(A=parseFloat(A),c+=A,l+=A),l||c?(l*=td,c*=td,x=Math.cos(l)*u,b=Math.sin(l)*u,B=Math.sin(l-c)*-f,M=Math.cos(l-c)*f,c&&(A*=td,I=Math.tan(c-A),I=Math.sqrt(1+I*I),B*=I,M*=I,A&&(I=Math.tan(A),I=Math.sqrt(1+I*I),x*=I,b*=I)),x=hr(x),b=hr(b),B=hr(B),M=hr(M)):(x=u,M=f,b=B=0),(w&&!~(o+"").indexOf("px")||_&&!~(a+"").indexOf("px"))&&(w=vA(h,"x",o,"px"),_=vA(h,"y",a,"px")),(d||m||g||p)&&(w=hr(w+d-(d*x+m*B)+g),_=hr(_+m-(d*b+m*M)+p)),(i||s)&&(I=h.getBBox(),w=hr(w+i/100*I.width),_=hr(_+s/100*I.height)),I="matrix("+x+","+b+","+B+","+M+","+w+","+_+")",h.setAttribute("transform",I),v&&(h.style[Wn]=I)},HJ=function(e,t,r,i,s){var o=360,a=Yr(s),l=parseFloat(s)*(a&&~s.indexOf("rad")?tu:1),c=l-i,A=i+c+"deg",u,f;return a&&(u=s.split("_")[1],u==="short"&&(c%=o,c!==c%(o/2)&&(c+=c<0?o:-o)),u==="cw"&&c<0?c=(c+o*KP)%o-~~(c/o)*o:u==="ccw"&&c>0&&(c=(c-o*KP)%o-~~(c/o)*o)),e._pt=f=new ss(e._pt,t,r,i,c,bJ),f.e=A,f.u="deg",e._props.push(r),f},qP=function(e,t){for(var r in t)e[r]=t[r];return e},QJ=function(e,t,r){var i=qP({},r._gsap),s="perspective,force3D,transformOrigin,svgOrigin",o=r.style,a,l,c,A,u,f,h,d;i.svg?(c=r.getAttribute("transform"),r.setAttribute("transform",""),o[Wn]=t,a=Ng(r,1),Fu(r,Wn),r.setAttribute("transform",c)):(c=getComputedStyle(r)[Wn],o[Wn]=t,a=Ng(r,1),o[Wn]=c);for(l in tc)c=i[l],A=a[l],c!==A&&s.indexOf(l)<0&&(h=wi(c),d=wi(A),u=h!==d?vA(r,l,c,d):parseFloat(c),f=parseFloat(A),e._pt=new ss(e._pt,a,l,u,f-u,QM),e._pt.u=d||0,e._props.push(l));qP(a,i)};is("padding,margin,Width,Radius",function(n,e){var t="Top",r="Right",i="Bottom",s="Left",o=(e<3?[t,r,i,s]:[t+s,t+r,i+r,i+s]).map(function(a){return e<2?n+a:"border"+a+n});R_[e>1?"border"+n:n]=function(a,l,c,A,u){var f,h;if(arguments.length<4)return f=o.map(function(d){return Ll(a,d,c)}),h=f.join(" "),h.split(f[0]).length===5?f[0]:h;f=(A+"").split(" "),h={},o.forEach(function(d,m){return h[d]=f[m]=f[m]||f[(m-1)/2|0]}),a.init(l,h,u)}});var az={name:"css",register:GM,targetTest:function(e){return e.style&&e.nodeType},init:function(e,t,r,i,s){var o=this._props,a=e.style,l=r.vars.startAt,c,A,u,f,h,d,m,g,p,v,w,_,x,b,B,M;_R||GM(),this.styles=this.styles||ez(e),M=this.styles.props,this.tween=r;for(m in t)if(m!=="autoRound"&&(A=t[m],!(Bs[m]&&G6(m,t,r,i,e,s)))){if(h=typeof A,d=R_[m],h==="function"&&(A=A.call(r,i,e,s),h=typeof A),h==="string"&&~A.indexOf("random(")&&(A=Fg(A)),d)d(this,e,m,A,r)&&(B=1);else if(m.substr(0,2)==="--")c=(getComputedStyle(e).getPropertyValue(m)+"").trim(),A+="",AA.lastIndex=0,AA.test(c)||(g=wi(c),p=wi(A)),p?g!==p&&(c=vA(e,m,c,p)+p):g&&(A+=g),this.add(a,"setProperty",c,A,i,s,0,0,m),o.push(m),M.push(m,0,a[m]);else if(h!=="undefined"){if(l&&m in l?(c=typeof l[m]=="function"?l[m].call(r,i,e,s):l[m],Yr(c)&&~c.indexOf("random(")&&(c=Fg(c)),wi(c+"")||c==="auto"||(c+=Ds.units[m]||wi(Ll(e,m))||""),(c+"").charAt(1)==="="&&(c=Ll(e,m))):c=Ll(e,m),f=parseFloat(c),v=h==="string"&&A.charAt(1)==="="&&A.substr(0,2),v&&(A=A.substr(2)),u=parseFloat(A),m in Oa&&(m==="autoAlpha"&&(f===1&&Ll(e,"visibility")==="hidden"&&u&&(f=0),M.push("visibility",0,a.visibility),Xc(this,a,"visibility",f?"inherit":"hidden",u?"inherit":"hidden",!u)),m!=="scale"&&m!=="transform"&&(m=Oa[m],~m.indexOf(",")&&(m=m.split(",")[0]))),w=m in tc,w){if(this.styles.save(m),_||(x=e._gsap,x.renderTransform&&!t.parseTransform||Ng(e,t.parseTransform),b=t.smoothOrigin!==!1&&x.smooth,_=this._pt=new ss(this._pt,a,Wn,0,1,x.renderTransform,x,0,-1),_.dep=1),m==="scale")this._pt=new ss(this._pt,x,"scaleY",x.scaleY,(v?qh(x.scaleY,v+u):u)-x.scaleY||0,QM),this._pt.u=0,o.push("scaleY",m),m+="X";else if(m==="transformOrigin"){M.push(os,0,a[os]),A=DJ(A),x.svg?VM(e,A,0,b,0,this):(p=parseFloat(A.split(" ")[2])||0,p!==x.zOrigin&&Xc(this,x,"zOrigin",x.zOrigin,p),Xc(this,a,m,U_(c),U_(A)));continue}else if(m==="svgOrigin"){VM(e,A,1,b,0,this);continue}else if(m in iz){HJ(this,x,m,f,v?qh(f,v+A):A);continue}else if(m==="smoothOrigin"){Xc(this,x,"smooth",x.smooth,A);continue}else if(m==="force3D"){x[m]=A;continue}else if(m==="transform"){QJ(this,A,e);continue}}else m in a||(m=Md(m)||m);if(w||(u||u===0)&&(f||f===0)&&!xJ.test(A)&&m in a)g=(c+"").substr((f+"").length),u||(u=0),p=wi(A)||(m in Ds.units?Ds.units[m]:g),g!==p&&(f=vA(e,m,c,p)),this._pt=new ss(this._pt,w?x:a,m,f,(v?qh(f,v+u):u)-f,!w&&(p==="px"||m==="zIndex")&&t.autoRound!==!1?BJ:QM),this._pt.u=p||0,g!==p&&p!=="%"&&(this._pt.b=c,this._pt.r=EJ);else if(m in a)LJ.call(this,e,m,c,v?v+A:A);else if(m in e)this.add(e,m,c||e[m],v?v+A:A,i,s);else if(m!=="parseTransform"){fR(m,A);continue}w||(m in a?M.push(m,0,a[m]):M.push(m,1,c||e[m])),o.push(m)}}B&&Y6(this)},render:function(e,t){if(t.tween._time||!xR())for(var r=t._pt;r;)r.r(e,r.d),r=r._next;else t.styles.revert()},get:Ll,aliases:Oa,getSetter:function(e,t,r){var i=Oa[t];return i&&i.indexOf(",")<0&&(t=i),t in tc&&t!==os&&(e._gsap.x||Ll(e,"x"))?r&&WP===r?t==="scale"?TJ:CJ:(WP=r||{})&&(t==="scale"?IJ:RJ):e.style&&!cR(e.style[t])?SJ:~t.indexOf("-")?MJ:yR(e,t)},core:{_removeProperty:Fu,_getMatrix:ER}};As.utils.checkPrefix=Md;As.core.getStyleSaver=ez;(function(n,e,t,r){var i=is(n+","+e+","+t,function(s){tc[s]=1});is(e,function(s){Ds.units[s]="deg",iz[s]=1}),Oa[i[13]]=n+","+e,is(r,function(s){var o=s.split(":");Oa[o[1]]=i[o[0]]})})("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY");is("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(n){Ds.units[n]="px"});As.registerPlugin(az);var jM=As.registerPlugin(az)||As;jM.core.Tween;function Wd(){localStorage&&Object.keys(localStorage).map(n=>{this.setItem(n,localStorage[n],!1)}),Object.defineProperty(this,"length",{get:function(){return Object.keys(this).length},enumerable:!1})}Wd.prototype.key=function(n){return Object.keys(this)[n]};Wd.prototype.getItem=function(n){try{return JSON.parse(this[n])}catch{}return this[n]};Wd.prototype.setItem=function(n,e,t=!0){const r=typeof e=="string"?e:JSON.stringify(e);return t&&localStorage.setItem(n,r),this[n]=r};Wd.prototype.removeItem=function(n){delete this[n]};Wd.prototype.clear=function(){Object.keys(this).forEach(n=>delete this[n])};let zJ=new Wd;const GJ=n=>({get(e,t){return n.getItem(String(t))},set(e,t,r){return n.setItem(String(t),r),!0}}),VJ=(n=zJ)=>new Proxy({},GJ(n)),Qe=VJ();/** +*/var WP,Xc,td,bR,hu,KP,ER,_J=function(){return typeof window<"u"},tc={},nu=180/Math.PI,nd=Math.PI/180,lf=Math.atan2,XP=1e8,BR=/([A-Z])/g,xJ=/(left|right|width|margin|padding|x)/i,bJ=/[\s,\(]\S/,Qa={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},GS=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},EJ=function(e,t){return t.set(t.t,t.p,e===1?t.e:Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},BJ=function(e,t){return t.set(t.t,t.p,e?Math.round((t.s+t.c*e)*1e4)/1e4+t.u:t.b,t)},MJ=function(e,t){var r=t.s+t.c*e;t.set(t.t,t.p,~~(r+(r<0?-.5:.5))+t.u,t)},J6=function(e,t){return t.set(t.t,t.p,e?t.e:t.b,t)},q6=function(e,t){return t.set(t.t,t.p,e!==1?t.b:t.e,t)},SJ=function(e,t,r){return e.style[t]=r},CJ=function(e,t,r){return e.style.setProperty(t,r)},TJ=function(e,t,r){return e._gsap[t]=r},IJ=function(e,t,r){return e._gsap.scaleX=e._gsap.scaleY=r},RJ=function(e,t,r,i,s){var o=e._gsap;o.scaleX=o.scaleY=r,o.renderTransform(s,o)},UJ=function(e,t,r,i,s){var o=e._gsap;o[t]=r,o.renderTransform(s,o)},Wn="transform",os=Wn+"Origin",FJ=function n(e,t){var r=this,i=this.target,s=i.style,o=i._gsap;if(e in tc&&s){if(this.tfm=this.tfm||{},e!=="transform")e=Qa[e]||e,~e.indexOf(",")?e.split(",").forEach(function(a){return r.tfm[a]=Ll(i,a)}):this.tfm[e]=o.x?o[e]:Ll(i,e),e===os&&(this.tfm.zOrigin=o.zOrigin);else return Qa.transform.split(",").forEach(function(a){return n.call(r,a,t)});if(this.props.indexOf(Wn)>=0)return;o.svg&&(this.svgo=i.getAttribute("data-svg-origin"),this.props.push(os,t,"")),e=Wn}(s||t)&&this.props.push(e,t,s[e])},ez=function(e){e.translate&&(e.removeProperty("translate"),e.removeProperty("scale"),e.removeProperty("rotate"))},PJ=function(){var e=this.props,t=this.target,r=t.style,i=t._gsap,s,o;for(s=0;s=0?YP[o]:"")+e},jS=function(){_J()&&window.document&&(WP=window,Xc=WP.document,td=Xc.documentElement,hu=VS("div")||{style:{}},VS("div"),Wn=Cd(Wn),os=Wn+"Origin",hu.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",nz=!!Cd("perspective"),ER=As.core.reverting,bR=1)},hE=function n(e){var t=VS("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),r=this.parentNode,i=this.nextSibling,s=this.style.cssText,o;if(td.appendChild(t),t.appendChild(this),this.style.display="block",e)try{o=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=n}catch{}else this._gsapBBox&&(o=this._gsapBBox());return r&&(i?r.insertBefore(this,i):r.appendChild(this)),td.removeChild(t),this.style.cssText=s,o},$P=function(e,t){for(var r=t.length;r--;)if(e.hasAttribute(t[r]))return e.getAttribute(t[r])},rz=function(e){var t;try{t=e.getBBox()}catch{t=hE.call(e,!0)}return t&&(t.width||t.height)||e.getBBox===hE||(t=hE.call(e,!0)),t&&!t.width&&!t.x&&!t.y?{x:+$P(e,["x","cx","x1"])||0,y:+$P(e,["y","cy","y1"])||0,width:0,height:0}:t},iz=function(e){return!!(e.getCTM&&(!e.parentNode||e.ownerSVGElement)&&rz(e))},Lu=function(e,t){if(t){var r=e.style,i;t in tc&&t!==os&&(t=Wn),r.removeProperty?(i=t.substr(0,2),(i==="ms"||t.substr(0,6)==="webkit")&&(t="-"+t),r.removeProperty(i==="--"?t:t.replace(BR,"-$1").toLowerCase())):r.removeAttribute(t)}},Yc=function(e,t,r,i,s,o){var a=new ss(e._pt,t,r,0,1,o?q6:J6);return e._pt=a,a.b=i,a.e=s,e._props.push(r),a},ZP={deg:1,rad:1,turn:1},LJ={grid:1,flex:1},yA=function n(e,t,r,i){var s=parseFloat(r)||0,o=(r+"").trim().substr((s+"").length)||"px",a=hu.style,l=xJ.test(t),c=e.tagName.toLowerCase()==="svg",A=(c?"client":"offset")+(l?"Width":"Height"),u=100,f=i==="px",h=i==="%",d,m,g,p;if(i===o||!s||ZP[i]||ZP[o])return s;if(o!=="px"&&!f&&(s=n(e,t,r,"px")),p=e.getCTM&&iz(e),(h||o==="%")&&(tc[t]||~t.indexOf("adius")))return d=p?e.getBBox()[l?"width":"height"]:e[A],hr(h?s/d*u:s/100*d);if(a[l?"width":"height"]=u+(f?o:i),m=~t.indexOf("adius")||i==="em"&&e.appendChild&&!c?e:e.parentNode,p&&(m=(e.ownerSVGElement||{}).parentNode),(!m||m===Xc||!m.appendChild)&&(m=Xc.body),g=m._gsap,g&&h&&g.width&&l&&g.time===Ms.time&&!g.uncache)return hr(s/g.width*u);if(h&&(t==="height"||t==="width")){var v=e.style[t];e.style[t]=u+i,d=e[A],v?e.style[t]=v:Lu(e,t)}else(h||o==="%")&&!LJ[Xa(m,"display")]&&(a.position=Xa(e,"position")),m===e&&(a.position="static"),m.appendChild(hu),d=hu[A],m.removeChild(hu),a.position="absolute";return l&&h&&(g=wu(m),g.time=Ms.time,g.width=m[A]),hr(f?d*s/u:d&&s?u/d*s:0)},Ll=function(e,t,r,i){var s;return bR||jS(),t in Qa&&t!=="transform"&&(t=Qa[t],~t.indexOf(",")&&(t=t.split(",")[0])),tc[t]&&t!=="transform"?(s=Og(e,i),s=t!=="transformOrigin"?s[t]:s.svg?s.origin:F_(Xa(e,os))+" "+s.zOrigin+"px"):(s=e.style[t],(!s||s==="auto"||i||~(s+"").indexOf("calc("))&&(s=U_[t]&&U_[t](e,t,r)||Xa(e,t)||w6(e,t)||(t==="opacity"?1:0))),r&&!~(s+"").trim().indexOf(" ")?yA(e,t,s,r)+r:s},DJ=function(e,t,r,i){if(!r||r==="none"){var s=Cd(t,e,1),o=s&&Xa(e,s,1);o&&o!==r?(t=s,r=o):t==="borderColor"&&(r=Xa(e,"borderTopColor"))}var a=new ss(this._pt,e.style,t,0,1,Y6),l=0,c=0,A,u,f,h,d,m,g,p,v,w,_,x;if(a.b=r,a.e=i,r+="",i+="",i==="auto"&&(m=e.style[t],e.style[t]=i,i=Xa(e,t)||i,m?e.style[t]=m:Lu(e,t)),A=[r,i],k6(A),r=A[0],i=A[1],f=r.match(Fh)||[],x=i.match(Fh)||[],x.length){for(;u=Fh.exec(i);)g=u[0],v=i.substring(l,u.index),d?d=(d+1)%5:(v.substr(-5)==="rgba("||v.substr(-5)==="hsla(")&&(d=1),g!==(m=f[c++]||"")&&(h=parseFloat(m)||0,_=m.substr((h+"").length),g.charAt(1)==="="&&(g=ed(h,g)+_),p=parseFloat(g),w=g.substr((p+"").length),l=Fh.lastIndex-w.length,w||(w=w||Ds.units[t]||_,l===i.length&&(i+=w,a.e+=w)),_!==w&&(h=yA(e,t,m,w)||0),a._pt={_next:a._pt,p:v||c===1?v:",",s:h,c:p-h,m:d&&d<4||t==="zIndex"?Math.round:0});a.c=l-1;)a=s[c],tc[a]&&(l=1,a=a==="transformOrigin"?os:Wn),Lu(r,a);l&&(Lu(r,Wn),o&&(o.svg&&r.removeAttribute("transform"),Og(r,1),o.uncache=1,ez(i)))}},U_={clearProps:function(e,t,r,i,s){if(s.data!=="isFromStart"){var o=e._pt=new ss(e._pt,t,r,0,0,OJ);return o.u=i,o.pr=-10,o.tween=s,e._props.push(r),1}}},Ng=[1,0,0,1,0,0],sz={},oz=function(e){return e==="matrix(1, 0, 0, 1, 0, 0)"||e==="none"||!e},qP=function(e){var t=Xa(e,Wn);return oz(t)?Ng:t.substr(7).match(h6).map(hr)},MR=function(e,t){var r=e._gsap||wu(e),i=e.style,s=qP(e),o,a,l,c;return r.svg&&e.getAttribute("transform")?(l=e.transform.baseVal.consolidate().matrix,s=[l.a,l.b,l.c,l.d,l.e,l.f],s.join(",")==="1,0,0,1,0,0"?Ng:s):(s===Ng&&!e.offsetParent&&e!==td&&!r.svg&&(l=i.display,i.display="block",o=e.parentNode,(!o||!e.offsetParent)&&(c=1,a=e.nextElementSibling,td.appendChild(e)),s=qP(e),l?i.display=l:Lu(e,"display"),c&&(a?o.insertBefore(e,a):o?o.appendChild(e):td.removeChild(e))),t&&s.length>6?[s[0],s[1],s[4],s[5],s[12],s[13]]:s)},WS=function(e,t,r,i,s,o){var a=e._gsap,l=s||MR(e,!0),c=a.xOrigin||0,A=a.yOrigin||0,u=a.xOffset||0,f=a.yOffset||0,h=l[0],d=l[1],m=l[2],g=l[3],p=l[4],v=l[5],w=t.split(" "),_=parseFloat(w[0])||0,x=parseFloat(w[1])||0,b,B,S,I;r?l!==Ng&&(B=h*g-d*m)&&(S=_*(g/B)+x*(-m/B)+(m*v-g*p)/B,I=_*(-d/B)+x*(h/B)-(h*v-d*p)/B,_=S,x=I):(b=rz(e),_=b.x+(~w[0].indexOf("%")?_/100*b.width:_),x=b.y+(~(w[1]||w[0]).indexOf("%")?x/100*b.height:x)),i||i!==!1&&a.smooth?(p=_-c,v=x-A,a.xOffset=u+(p*h+v*m)-p,a.yOffset=f+(p*d+v*g)-v):a.xOffset=a.yOffset=0,a.xOrigin=_,a.yOrigin=x,a.smooth=!!i,a.origin=t,a.originIsAbsolute=!!r,e.style[os]="0px 0px",o&&(Yc(o,a,"xOrigin",c,_),Yc(o,a,"yOrigin",A,x),Yc(o,a,"xOffset",u,a.xOffset),Yc(o,a,"yOffset",f,a.yOffset)),e.setAttribute("data-svg-origin",_+" "+x)},Og=function(e,t){var r=e._gsap||new G6(e);if("x"in r&&!t&&!r.uncache)return r;var i=e.style,s=r.scaleX<0,o="px",a="deg",l=getComputedStyle(e),c=Xa(e,os)||"0",A,u,f,h,d,m,g,p,v,w,_,x,b,B,S,I,M,L,D,T,y,E,R,F,O,z,j,Q,C,W,ee,P;return A=u=f=m=g=p=v=w=_=0,h=d=1,r.svg=!!(e.getCTM&&iz(e)),l.translate&&((l.translate!=="none"||l.scale!=="none"||l.rotate!=="none")&&(i[Wn]=(l.translate!=="none"?"translate3d("+(l.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(l.rotate!=="none"?"rotate("+l.rotate+") ":"")+(l.scale!=="none"?"scale("+l.scale.split(" ").join(",")+") ":"")+(l[Wn]!=="none"?l[Wn]:"")),i.scale=i.rotate=i.translate="none"),B=MR(e,r.svg),r.svg&&(r.uncache?(O=e.getBBox(),c=r.xOrigin-O.x+"px "+(r.yOrigin-O.y)+"px",F=""):F=!t&&e.getAttribute("data-svg-origin"),WS(e,F||c,!!F||r.originIsAbsolute,r.smooth!==!1,B)),x=r.xOrigin||0,b=r.yOrigin||0,B!==Ng&&(L=B[0],D=B[1],T=B[2],y=B[3],A=E=B[4],u=R=B[5],B.length===6?(h=Math.sqrt(L*L+D*D),d=Math.sqrt(y*y+T*T),m=L||D?lf(D,L)*nu:0,v=T||y?lf(T,y)*nu+m:0,v&&(d*=Math.abs(Math.cos(v*nd))),r.svg&&(A-=x-(x*L+b*T),u-=b-(x*D+b*y))):(P=B[6],W=B[7],j=B[8],Q=B[9],C=B[10],ee=B[11],A=B[12],u=B[13],f=B[14],S=lf(P,C),g=S*nu,S&&(I=Math.cos(-S),M=Math.sin(-S),F=E*I+j*M,O=R*I+Q*M,z=P*I+C*M,j=E*-M+j*I,Q=R*-M+Q*I,C=P*-M+C*I,ee=W*-M+ee*I,E=F,R=O,P=z),S=lf(-T,C),p=S*nu,S&&(I=Math.cos(-S),M=Math.sin(-S),F=L*I-j*M,O=D*I-Q*M,z=T*I-C*M,ee=y*M+ee*I,L=F,D=O,T=z),S=lf(D,L),m=S*nu,S&&(I=Math.cos(S),M=Math.sin(S),F=L*I+D*M,O=E*I+R*M,D=D*I-L*M,R=R*I-E*M,L=F,E=O),g&&Math.abs(g)+Math.abs(m)>359.9&&(g=m=0,p=180-p),h=hr(Math.sqrt(L*L+D*D+T*T)),d=hr(Math.sqrt(R*R+P*P)),S=lf(E,R),v=Math.abs(S)>2e-4?S*nu:0,_=ee?1/(ee<0?-ee:ee):0),r.svg&&(F=e.getAttribute("transform"),r.forceCSS=e.setAttribute("transform","")||!oz(Xa(e,Wn)),F&&e.setAttribute("transform",F))),Math.abs(v)>90&&Math.abs(v)<270&&(s?(h*=-1,v+=m<=0?180:-180,m+=m<=0?180:-180):(d*=-1,v+=v<=0?180:-180)),t=t||r.uncache,r.x=A-((r.xPercent=A&&(!t&&r.xPercent||(Math.round(e.offsetWidth/2)===Math.round(-A)?-50:0)))?e.offsetWidth*r.xPercent/100:0)+o,r.y=u-((r.yPercent=u&&(!t&&r.yPercent||(Math.round(e.offsetHeight/2)===Math.round(-u)?-50:0)))?e.offsetHeight*r.yPercent/100:0)+o,r.z=f+o,r.scaleX=hr(h),r.scaleY=hr(d),r.rotation=hr(m)+a,r.rotationX=hr(g)+a,r.rotationY=hr(p)+a,r.skewX=v+a,r.skewY=w+a,r.transformPerspective=_+o,(r.zOrigin=parseFloat(c.split(" ")[2])||!t&&r.zOrigin||0)&&(i[os]=F_(c)),r.xOffset=r.yOffset=0,r.force3D=Ds.force3D,r.renderTransform=r.svg?QJ:nz?az:kJ,r.uncache=0,r},F_=function(e){return(e=e.split(" "))[0]+" "+e[1]},dE=function(e,t,r){var i=wi(t);return hr(parseFloat(t)+parseFloat(yA(e,"x",r+"px",i)))+i},kJ=function(e,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,az(e,t)},DA="0deg",Cp="0px",NA=") ",az=function(e,t){var r=t||this,i=r.xPercent,s=r.yPercent,o=r.x,a=r.y,l=r.z,c=r.rotation,A=r.rotationY,u=r.rotationX,f=r.skewX,h=r.skewY,d=r.scaleX,m=r.scaleY,g=r.transformPerspective,p=r.force3D,v=r.target,w=r.zOrigin,_="",x=p==="auto"&&e&&e!==1||p===!0;if(w&&(u!==DA||A!==DA)){var b=parseFloat(A)*nd,B=Math.sin(b),S=Math.cos(b),I;b=parseFloat(u)*nd,I=Math.cos(b),o=dE(v,o,B*I*-w),a=dE(v,a,-Math.sin(b)*-w),l=dE(v,l,S*I*-w+w)}g!==Cp&&(_+="perspective("+g+NA),(i||s)&&(_+="translate("+i+"%, "+s+"%) "),(x||o!==Cp||a!==Cp||l!==Cp)&&(_+=l!==Cp||x?"translate3d("+o+", "+a+", "+l+") ":"translate("+o+", "+a+NA),c!==DA&&(_+="rotate("+c+NA),A!==DA&&(_+="rotateY("+A+NA),u!==DA&&(_+="rotateX("+u+NA),(f!==DA||h!==DA)&&(_+="skew("+f+", "+h+NA),(d!==1||m!==1)&&(_+="scale("+d+", "+m+NA),v.style[Wn]=_||"translate(0, 0)"},QJ=function(e,t){var r=t||this,i=r.xPercent,s=r.yPercent,o=r.x,a=r.y,l=r.rotation,c=r.skewX,A=r.skewY,u=r.scaleX,f=r.scaleY,h=r.target,d=r.xOrigin,m=r.yOrigin,g=r.xOffset,p=r.yOffset,v=r.forceCSS,w=parseFloat(o),_=parseFloat(a),x,b,B,S,I;l=parseFloat(l),c=parseFloat(c),A=parseFloat(A),A&&(A=parseFloat(A),c+=A,l+=A),l||c?(l*=nd,c*=nd,x=Math.cos(l)*u,b=Math.sin(l)*u,B=Math.sin(l-c)*-f,S=Math.cos(l-c)*f,c&&(A*=nd,I=Math.tan(c-A),I=Math.sqrt(1+I*I),B*=I,S*=I,A&&(I=Math.tan(A),I=Math.sqrt(1+I*I),x*=I,b*=I)),x=hr(x),b=hr(b),B=hr(B),S=hr(S)):(x=u,S=f,b=B=0),(w&&!~(o+"").indexOf("px")||_&&!~(a+"").indexOf("px"))&&(w=yA(h,"x",o,"px"),_=yA(h,"y",a,"px")),(d||m||g||p)&&(w=hr(w+d-(d*x+m*B)+g),_=hr(_+m-(d*b+m*S)+p)),(i||s)&&(I=h.getBBox(),w=hr(w+i/100*I.width),_=hr(_+s/100*I.height)),I="matrix("+x+","+b+","+B+","+S+","+w+","+_+")",h.setAttribute("transform",I),v&&(h.style[Wn]=I)},HJ=function(e,t,r,i,s){var o=360,a=$r(s),l=parseFloat(s)*(a&&~s.indexOf("rad")?nu:1),c=l-i,A=i+c+"deg",u,f;return a&&(u=s.split("_")[1],u==="short"&&(c%=o,c!==c%(o/2)&&(c+=c<0?o:-o)),u==="cw"&&c<0?c=(c+o*XP)%o-~~(c/o)*o:u==="ccw"&&c>0&&(c=(c-o*XP)%o-~~(c/o)*o)),e._pt=f=new ss(e._pt,t,r,i,c,EJ),f.e=A,f.u="deg",e._props.push(r),f},eL=function(e,t){for(var r in t)e[r]=t[r];return e},zJ=function(e,t,r){var i=eL({},r._gsap),s="perspective,force3D,transformOrigin,svgOrigin",o=r.style,a,l,c,A,u,f,h,d;i.svg?(c=r.getAttribute("transform"),r.setAttribute("transform",""),o[Wn]=t,a=Og(r,1),Lu(r,Wn),r.setAttribute("transform",c)):(c=getComputedStyle(r)[Wn],o[Wn]=t,a=Og(r,1),o[Wn]=c);for(l in tc)c=i[l],A=a[l],c!==A&&s.indexOf(l)<0&&(h=wi(c),d=wi(A),u=h!==d?yA(r,l,c,d):parseFloat(c),f=parseFloat(A),e._pt=new ss(e._pt,a,l,u,f-u,GS),e._pt.u=d||0,e._props.push(l));eL(a,i)};is("padding,margin,Width,Radius",function(n,e){var t="Top",r="Right",i="Bottom",s="Left",o=(e<3?[t,r,i,s]:[t+s,t+r,i+r,i+s]).map(function(a){return e<2?n+a:"border"+a+n});U_[e>1?"border"+n:n]=function(a,l,c,A,u){var f,h;if(arguments.length<4)return f=o.map(function(d){return Ll(a,d,c)}),h=f.join(" "),h.split(f[0]).length===5?f[0]:h;f=(A+"").split(" "),h={},o.forEach(function(d,m){return h[d]=f[m]=f[m]||f[(m-1)/2|0]}),a.init(l,h,u)}});var lz={name:"css",register:jS,targetTest:function(e){return e.style&&e.nodeType},init:function(e,t,r,i,s){var o=this._props,a=e.style,l=r.vars.startAt,c,A,u,f,h,d,m,g,p,v,w,_,x,b,B,S;bR||jS(),this.styles=this.styles||tz(e),S=this.styles.props,this.tween=r;for(m in t)if(m!=="autoRound"&&(A=t[m],!(Bs[m]&&V6(m,t,r,i,e,s)))){if(h=typeof A,d=U_[m],h==="function"&&(A=A.call(r,i,e,s),h=typeof A),h==="string"&&~A.indexOf("random(")&&(A=Pg(A)),d)d(this,e,m,A,r)&&(B=1);else if(m.substr(0,2)==="--")c=(getComputedStyle(e).getPropertyValue(m)+"").trim(),A+="",uA.lastIndex=0,uA.test(c)||(g=wi(c),p=wi(A)),p?g!==p&&(c=yA(e,m,c,p)+p):g&&(A+=g),this.add(a,"setProperty",c,A,i,s,0,0,m),o.push(m),S.push(m,0,a[m]);else if(h!=="undefined"){if(l&&m in l?(c=typeof l[m]=="function"?l[m].call(r,i,e,s):l[m],$r(c)&&~c.indexOf("random(")&&(c=Pg(c)),wi(c+"")||c==="auto"||(c+=Ds.units[m]||wi(Ll(e,m))||""),(c+"").charAt(1)==="="&&(c=Ll(e,m))):c=Ll(e,m),f=parseFloat(c),v=h==="string"&&A.charAt(1)==="="&&A.substr(0,2),v&&(A=A.substr(2)),u=parseFloat(A),m in Qa&&(m==="autoAlpha"&&(f===1&&Ll(e,"visibility")==="hidden"&&u&&(f=0),S.push("visibility",0,a.visibility),Yc(this,a,"visibility",f?"inherit":"hidden",u?"inherit":"hidden",!u)),m!=="scale"&&m!=="transform"&&(m=Qa[m],~m.indexOf(",")&&(m=m.split(",")[0]))),w=m in tc,w){if(this.styles.save(m),_||(x=e._gsap,x.renderTransform&&!t.parseTransform||Og(e,t.parseTransform),b=t.smoothOrigin!==!1&&x.smooth,_=this._pt=new ss(this._pt,a,Wn,0,1,x.renderTransform,x,0,-1),_.dep=1),m==="scale")this._pt=new ss(this._pt,x,"scaleY",x.scaleY,(v?ed(x.scaleY,v+u):u)-x.scaleY||0,GS),this._pt.u=0,o.push("scaleY",m),m+="X";else if(m==="transformOrigin"){S.push(os,0,a[os]),A=NJ(A),x.svg?WS(e,A,0,b,0,this):(p=parseFloat(A.split(" ")[2])||0,p!==x.zOrigin&&Yc(this,x,"zOrigin",x.zOrigin,p),Yc(this,a,m,F_(c),F_(A)));continue}else if(m==="svgOrigin"){WS(e,A,1,b,0,this);continue}else if(m in sz){HJ(this,x,m,f,v?ed(f,v+A):A);continue}else if(m==="smoothOrigin"){Yc(this,x,"smooth",x.smooth,A);continue}else if(m==="force3D"){x[m]=A;continue}else if(m==="transform"){zJ(this,A,e);continue}}else m in a||(m=Cd(m)||m);if(w||(u||u===0)&&(f||f===0)&&!bJ.test(A)&&m in a)g=(c+"").substr((f+"").length),u||(u=0),p=wi(A)||(m in Ds.units?Ds.units[m]:g),g!==p&&(f=yA(e,m,c,p)),this._pt=new ss(this._pt,w?x:a,m,f,(v?ed(f,v+u):u)-f,!w&&(p==="px"||m==="zIndex")&&t.autoRound!==!1?MJ:GS),this._pt.u=p||0,g!==p&&p!=="%"&&(this._pt.b=c,this._pt.r=BJ);else if(m in a)DJ.call(this,e,m,c,v?v+A:A);else if(m in e)this.add(e,m,c||e[m],v?v+A:A,i,s);else if(m!=="parseTransform"){dR(m,A);continue}w||(m in a?S.push(m,0,a[m]):S.push(m,1,c||e[m])),o.push(m)}}B&&$6(this)},render:function(e,t){if(t.tween._time||!ER())for(var r=t._pt;r;)r.r(e,r.d),r=r._next;else t.styles.revert()},get:Ll,aliases:Qa,getSetter:function(e,t,r){var i=Qa[t];return i&&i.indexOf(",")<0&&(t=i),t in tc&&t!==os&&(e._gsap.x||Ll(e,"x"))?r&&KP===r?t==="scale"?IJ:TJ:(KP=r||{})&&(t==="scale"?RJ:UJ):e.style&&!uR(e.style[t])?SJ:~t.indexOf("-")?CJ:_R(e,t)},core:{_removeProperty:Lu,_getMatrix:MR}};As.utils.checkPrefix=Cd;As.core.getStyleSaver=tz;(function(n,e,t,r){var i=is(n+","+e+","+t,function(s){tc[s]=1});is(e,function(s){Ds.units[s]="deg",sz[s]=1}),Qa[i[13]]=n+","+e,is(r,function(s){var o=s.split(":");Qa[o[1]]=i[o[0]]})})("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY");is("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(n){Ds.units[n]="px"});As.registerPlugin(lz);var KS=As.registerPlugin(lz)||As;KS.core.Tween;/** * @license * Copyright 2010-2024 Three.js Authors * SPDX-License-Identifier: MIT - */const nc="169",nd={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Fh={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},jJ=0,eL=1,WJ=2,lz=1,KJ=2,Bl=3,Qs=0,oi=1,_i=2,jl=0,rd=1,Pu=2,tL=3,nL=4,XJ=5,ou=100,YJ=101,$J=102,ZJ=103,JJ=104,qJ=200,eq=201,tq=202,nq=203,WM=204,KM=205,rq=206,iq=207,sq=208,oq=209,aq=210,lq=211,cq=212,Aq=213,uq=214,XM=0,YM=1,$M=2,Cd=3,ZM=4,JM=5,qM=6,eC=7,o1=0,fq=1,hq=2,uA=0,dq=1,pq=2,mq=3,gq=4,vq=5,yq=6,wq=7,rL="attached",_q="detached",cz=300,Td=301,Id=302,Og=303,tC=304,a1=306,zs=1e3,Rs=1001,kg=1002,Kr=1003,BR=1004,Ph=1005,Lr=1006,Jm=1007,qo=1008,rc=1009,Az=1010,uz=1011,Hg=1012,SR=1013,yA=1014,xi=1015,ka=1016,MR=1017,CR=1018,Rd=1020,fz=35902,hz=1021,dz=1022,Nr=1023,pz=1024,mz=1025,id=1026,Ud=1027,TR=1028,l1=1029,gz=1030,IR=1031,RR=1033,_w=33776,xw=33777,bw=33778,Ew=33779,nC=35840,rC=35841,iC=35842,sC=35843,oC=36196,aC=37492,lC=37496,cC=37808,AC=37809,uC=37810,fC=37811,hC=37812,dC=37813,pC=37814,mC=37815,gC=37816,vC=37817,yC=37818,wC=37819,_C=37820,xC=37821,Bw=36492,bC=36494,EC=36495,vz=36283,BC=36284,SC=36285,MC=36286,xq=2200,bq=2201,Eq=2202,Fd=2300,Pd=2301,hE=2302,Lh=2400,Dh=2401,F_=2402,UR=2500,Bq=2501,Sq=0,yz=1,CC=2,Mq=3200,Cq=3201,Kd=0,Tq=1,Fa="",Ut="srgb",Mr="srgb-linear",FR="display-p3",c1="display-p3-linear",P_="linear",Mn="srgb",L_="rec709",D_="p3",af=7680,iL=519,Iq=512,Rq=513,Uq=514,wz=515,Fq=516,Pq=517,Lq=518,Dq=519,TC=35044,Nq=35048,sL="300 es",zl=2e3,N_=2001;class RA{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;s>8&255]+fi[n>>16&255]+fi[n>>24&255]+"-"+fi[e&255]+fi[e>>8&255]+"-"+fi[e>>16&15|64]+fi[e>>24&255]+"-"+fi[t&63|128]+fi[t>>8&255]+"-"+fi[t>>16&255]+fi[t>>24&255]+fi[r&255]+fi[r>>8&255]+fi[r>>16&255]+fi[r>>24&255]).toLowerCase()}function pr(n,e,t){return Math.max(e,Math.min(t,n))}function PR(n,e){return(n%e+e)%e}function Oq(n,e,t,r,i){return r+(n-e)*(i-r)/(t-e)}function kq(n,e,t){return n!==e?(t-n)/(e-n):0}function eg(n,e,t){return(1-t)*n+t*e}function Hq(n,e,t,r){return eg(n,e,1-Math.exp(-t*r))}function Qq(n,e=1){return e-Math.abs(PR(n,e*2)-e)}function zq(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function Gq(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function Vq(n,e){return n+Math.floor(Math.random()*(e-n+1))}function jq(n,e){return n+Math.random()*(e-n)}function Wq(n){return n*(.5-Math.random())}function Kq(n){n!==void 0&&(oL=n);let e=oL+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Xq(n){return n*qm}function Yq(n){return n*Ld}function $q(n){return(n&n-1)===0&&n!==0}function Zq(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Jq(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function qq(n,e,t,r,i){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+r)/2),A=o((e+r)/2),u=s((e-r)/2),f=o((e-r)/2),h=s((r-e)/2),d=o((r-e)/2);switch(i){case"XYX":n.set(a*A,l*u,l*f,a*c);break;case"YZY":n.set(l*f,a*A,l*u,a*c);break;case"ZXZ":n.set(l*u,l*f,a*A,a*c);break;case"XZX":n.set(a*A,l*d,l*h,a*c);break;case"YXY":n.set(l*h,a*A,l*d,a*c);break;case"ZYZ":n.set(l*d,l*h,a*A,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Zo(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function hn(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const Bt={DEG2RAD:qm,RAD2DEG:Ld,generateUUID:ra,clamp:pr,euclideanModulo:PR,mapLinear:Oq,inverseLerp:kq,lerp:eg,damp:Hq,pingpong:Qq,smoothstep:zq,smootherstep:Gq,randInt:Vq,randFloat:jq,randFloatSpread:Wq,seededRandom:Kq,degToRad:Xq,radToDeg:Yq,isPowerOfTwo:$q,ceilPowerOfTwo:Zq,floorPowerOfTwo:Jq,setQuaternionFromProperEuler:qq,normalize:hn,denormalize:Zo};class je{constructor(e=0,t=0){je.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,r=this.y,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6],this.y=i[1]*t+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(pr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y;return t*t+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const r=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*i+e.x,this.y=s*i+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class dt{constructor(e,t,r,i,s,o,a,l,c){dt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,r,i,s,o,a,l,c)}set(e,t,r,i,s,o,a,l,c){const A=this.elements;return A[0]=e,A[1]=i,A[2]=a,A[3]=t,A[4]=s,A[5]=l,A[6]=r,A[7]=o,A[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[3],l=r[6],c=r[1],A=r[4],u=r[7],f=r[2],h=r[5],d=r[8],m=i[0],g=i[3],p=i[6],v=i[1],w=i[4],_=i[7],x=i[2],b=i[5],B=i[8];return s[0]=o*m+a*v+l*x,s[3]=o*g+a*w+l*b,s[6]=o*p+a*_+l*B,s[1]=c*m+A*v+u*x,s[4]=c*g+A*w+u*b,s[7]=c*p+A*_+u*B,s[2]=f*m+h*v+d*x,s[5]=f*g+h*w+d*b,s[8]=f*p+h*_+d*B,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],A=e[8];return t*o*A-t*a*c-r*s*A+r*a*l+i*s*c-i*o*l}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],A=e[8],u=A*o-a*c,f=a*l-A*s,h=c*s-o*l,d=t*u+r*f+i*h;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/d;return e[0]=u*m,e[1]=(i*c-A*r)*m,e[2]=(a*r-i*o)*m,e[3]=f*m,e[4]=(A*t-i*l)*m,e[5]=(i*s-a*t)*m,e[6]=h*m,e[7]=(r*l-c*t)*m,e[8]=(o*t-r*s)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,r,i,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(dE.makeScale(e,t)),this}rotate(e){return this.premultiply(dE.makeRotation(-e)),this}translate(e,t){return this.premultiply(dE.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,r,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,r=e.elements;for(let i=0;i<9;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const dE=new dt;function _z(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Qg(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function eee(){const n=Qg("canvas");return n.style.display="block",n}const aL={};function Sw(n){n in aL||(aL[n]=!0,console.warn(n))}function tee(n,e,t){return new Promise(function(r,i){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:i();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:r()}}setTimeout(s,t)})}function nee(n){const e=n.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function ree(n){const e=n.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const lL=new dt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),cL=new dt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Cp={[Mr]:{transfer:P_,primaries:L_,luminanceCoefficients:[.2126,.7152,.0722],toReference:n=>n,fromReference:n=>n},[Ut]:{transfer:Mn,primaries:L_,luminanceCoefficients:[.2126,.7152,.0722],toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[c1]:{transfer:P_,primaries:D_,luminanceCoefficients:[.2289,.6917,.0793],toReference:n=>n.applyMatrix3(cL),fromReference:n=>n.applyMatrix3(lL)},[FR]:{transfer:Mn,primaries:D_,luminanceCoefficients:[.2289,.6917,.0793],toReference:n=>n.convertSRGBToLinear().applyMatrix3(cL),fromReference:n=>n.applyMatrix3(lL).convertLinearToSRGB()}},iee=new Set([Mr,c1]),Et={enabled:!0,_workingColorSpace:Mr,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!iee.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const r=Cp[e].toReference,i=Cp[t].fromReference;return i(r(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return Cp[n].primaries},getTransfer:function(n){return n===Fa?P_:Cp[n].transfer},getLuminanceCoefficients:function(n,e=this._workingColorSpace){return n.fromArray(Cp[e].luminanceCoefficients)}};function sd(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function pE(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let lf;class see{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{lf===void 0&&(lf=Qg("canvas")),lf.width=e.width,lf.height=e.height;const r=lf.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=lf}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Qg("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o0&&(r.userData=this.userData),t||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==cz)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case zs:e.x=e.x-Math.floor(e.x);break;case Rs:e.x=e.x<0?0:1;break;case kg:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case zs:e.y=e.y-Math.floor(e.y);break;case Rs:e.y=e.y<0?0:1;break;case kg:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Un.DEFAULT_IMAGE=null;Un.DEFAULT_MAPPING=cz;Un.DEFAULT_ANISOTROPY=1;class Pt{constructor(e=0,t=0,r=0,i=1){Pt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*r+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*r+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*r+o[11]*i+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,r,i,s;const l=e.elements,c=l[0],A=l[4],u=l[8],f=l[1],h=l[5],d=l[9],m=l[2],g=l[6],p=l[10];if(Math.abs(A-f)<.01&&Math.abs(u-m)<.01&&Math.abs(d-g)<.01){if(Math.abs(A+f)<.1&&Math.abs(u+m)<.1&&Math.abs(d+g)<.1&&Math.abs(c+h+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const w=(c+1)/2,_=(h+1)/2,x=(p+1)/2,b=(A+f)/4,B=(u+m)/4,M=(d+g)/4;return w>_&&w>x?w<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(w),i=b/r,s=B/r):_>x?_<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(_),r=b/i,s=M/i):x<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(x),r=B/s,i=M/s),this.set(r,i,s,t),this}let v=Math.sqrt((g-d)*(g-d)+(u-m)*(u-m)+(f-A)*(f-A));return Math.abs(v)<.001&&(v=1),this.x=(g-d)/v,this.y=(u-m)/v,this.z=(f-A)/v,this.w=Math.acos((c+h+p-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class lee extends RA{constructor(e=1,t=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Pt(0,0,e,t),this.scissorTest=!1,this.viewport=new Pt(0,0,e,t);const i={width:e,height:t,depth:1};r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Lr,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},r);const s=new Un(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace);s.flipY=!1,s.generateMipmaps=r.generateMipmaps,s.internalFormat=r.internalFormat,this.textures=[];const o=r.count;for(let a=0;a=0?1:-1,w=1-p*p;if(w>Number.EPSILON){const x=Math.sqrt(w),b=Math.atan2(x,p*v);g=Math.sin(g*b)/x,a=Math.sin(a*b)/x}const _=a*v;if(l=l*g+f*_,c=c*g+h*_,A=A*g+d*_,u=u*g+m*_,g===1-a){const x=1/Math.sqrt(l*l+c*c+A*A+u*u);l*=x,c*=x,A*=x,u*=x}}e[t]=l,e[t+1]=c,e[t+2]=A,e[t+3]=u}static multiplyQuaternionsFlat(e,t,r,i,s,o){const a=r[i],l=r[i+1],c=r[i+2],A=r[i+3],u=s[o],f=s[o+1],h=s[o+2],d=s[o+3];return e[t]=a*d+A*u+l*h-c*f,e[t+1]=l*d+A*f+c*u-a*h,e[t+2]=c*d+A*h+a*f-l*u,e[t+3]=A*d-a*u-l*f-c*h,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const r=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(r/2),A=a(i/2),u=a(s/2),f=l(r/2),h=l(i/2),d=l(s/2);switch(o){case"XYZ":this._x=f*A*u+c*h*d,this._y=c*h*u-f*A*d,this._z=c*A*d+f*h*u,this._w=c*A*u-f*h*d;break;case"YXZ":this._x=f*A*u+c*h*d,this._y=c*h*u-f*A*d,this._z=c*A*d-f*h*u,this._w=c*A*u+f*h*d;break;case"ZXY":this._x=f*A*u-c*h*d,this._y=c*h*u+f*A*d,this._z=c*A*d+f*h*u,this._w=c*A*u-f*h*d;break;case"ZYX":this._x=f*A*u-c*h*d,this._y=c*h*u+f*A*d,this._z=c*A*d-f*h*u,this._w=c*A*u+f*h*d;break;case"YZX":this._x=f*A*u+c*h*d,this._y=c*h*u+f*A*d,this._z=c*A*d-f*h*u,this._w=c*A*u-f*h*d;break;case"XZY":this._x=f*A*u-c*h*d,this._y=c*h*u-f*A*d,this._z=c*A*d+f*h*u,this._w=c*A*u+f*h*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,r=t[0],i=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],A=t[6],u=t[10],f=r+a+u;if(f>0){const h=.5/Math.sqrt(f+1);this._w=.25/h,this._x=(A-l)*h,this._y=(s-c)*h,this._z=(o-i)*h}else if(r>a&&r>u){const h=2*Math.sqrt(1+r-a-u);this._w=(A-l)/h,this._x=.25*h,this._y=(i+o)/h,this._z=(s+c)/h}else if(a>u){const h=2*Math.sqrt(1+a-r-u);this._w=(s-c)/h,this._x=(i+o)/h,this._y=.25*h,this._z=(l+A)/h}else{const h=2*Math.sqrt(1+u-r-a);this._w=(o-i)/h,this._x=(s+c)/h,this._y=(l+A)/h,this._z=.25*h}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return rMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(pr(this.dot(e),-1,1)))}rotateTowards(e,t){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,t/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const r=e._x,i=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,A=t._w;return this._x=r*A+o*a+i*c-s*l,this._y=i*A+o*l+s*a-r*c,this._z=s*A+o*c+r*l-i*a,this._w=o*A-r*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const r=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+r*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const h=1-t;return this._w=h*o+t*this._w,this._x=h*r+t*this._x,this._y=h*i+t*this._y,this._z=h*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),A=Math.atan2(c,a),u=Math.sin((1-t)*A)/c,f=Math.sin(t*A)/c;return this._w=o*u+this._w*f,this._x=r*u+this._x*f,this._y=i*u+this._y*f,this._z=s*u+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class ${constructor(e=0,t=0,r=0){$.prototype.isVector3=!0,this.x=e,this.y=t,this.z=r}set(e,t,r){return r===void 0&&(r=this.z),this.x=e,this.y=t,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(AL.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(AL.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*r+s[6]*i,this.y=s[1]*t+s[4]*r+s[7]*i,this.z=s[2]*t+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*r+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*r+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,r=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*i-a*r),A=2*(a*t-s*i),u=2*(s*r-o*t);return this.x=t+l*c+o*u-a*A,this.y=r+l*A+a*c-s*u,this.z=i+l*u+s*A-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*r+s[8]*i,this.y=s[1]*t+s[5]*r+s[9]*i,this.z=s[2]*t+s[6]*r+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const r=e.x,i=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return gE.copy(this).projectOnVector(e),this.sub(gE)}reflect(e){return this.sub(gE.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(pr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){const i=Math.sin(t)*e;return this.x=i*Math.sin(r),this.y=Math.cos(t)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,r=Math.sqrt(1-t*t);return this.x=r*Math.cos(e),this.y=t,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const gE=new $,AL=new nt;class Qn{constructor(e=new $(1/0,1/0,1/0),t=new $(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,r=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Lo),Lo.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Tp),fv.subVectors(this.max,Tp),cf.subVectors(e.a,Tp),Af.subVectors(e.b,Tp),uf.subVectors(e.c,Tp),yc.subVectors(Af,cf),wc.subVectors(uf,Af),NA.subVectors(cf,uf);let t=[0,-yc.z,yc.y,0,-wc.z,wc.y,0,-NA.z,NA.y,yc.z,0,-yc.x,wc.z,0,-wc.x,NA.z,0,-NA.x,-yc.y,yc.x,0,-wc.y,wc.x,0,-NA.y,NA.x,0];return!vE(t,cf,Af,uf,fv)||(t=[1,0,0,0,1,0,0,0,1],!vE(t,cf,Af,uf,fv))?!1:(hv.crossVectors(yc,wc),t=[hv.x,hv.y,hv.z],vE(t,cf,Af,uf,fv))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Lo).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Lo).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(fl[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),fl[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),fl[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),fl[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),fl[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),fl[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),fl[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),fl[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(fl),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const fl=[new $,new $,new $,new $,new $,new $,new $,new $],Lo=new $,uv=new Qn,cf=new $,Af=new $,uf=new $,yc=new $,wc=new $,NA=new $,Tp=new $,fv=new $,hv=new $,OA=new $;function vE(n,e,t,r,i){for(let s=0,o=n.length-3;s<=o;s+=3){OA.fromArray(n,s);const a=i.x*Math.abs(OA.x)+i.y*Math.abs(OA.y)+i.z*Math.abs(OA.z),l=e.dot(OA),c=t.dot(OA),A=r.dot(OA);if(Math.max(-Math.max(l,c,A),Math.min(l,c,A))>a)return!1}return!0}const Aee=new Qn,Ip=new $,yE=new $;class Si{constructor(e=new $,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const r=this.center;t!==void 0?r.copy(t):Aee.setFromPoints(e).getCenter(r);let i=0;for(let s=0,o=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ip.subVectors(e,this.center);const t=Ip.lengthSq();if(t>this.radius*this.radius){const r=Math.sqrt(t),i=(r-this.radius)*.5;this.center.addScaledVector(Ip,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(yE.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ip.copy(e.center).add(yE)),this.expandByPoint(Ip.copy(e.center).sub(yE))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const hl=new $,wE=new $,dv=new $,_c=new $,_E=new $,pv=new $,xE=new $;class Xu{constructor(e=new $,t=new $(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,hl)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=hl.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(hl.copy(this.origin).addScaledVector(this.direction,t),hl.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){wE.copy(e).add(t).multiplyScalar(.5),dv.copy(t).sub(e).normalize(),_c.copy(this.origin).sub(wE);const s=e.distanceTo(t)*.5,o=-this.direction.dot(dv),a=_c.dot(this.direction),l=-_c.dot(dv),c=_c.lengthSq(),A=Math.abs(1-o*o);let u,f,h,d;if(A>0)if(u=o*l-a,f=o*a-l,d=s*A,u>=0)if(f>=-d)if(f<=d){const m=1/A;u*=m,f*=m,h=u*(u+o*f+2*a)+f*(o*u+f+2*l)+c}else f=s,u=Math.max(0,-(o*f+a)),h=-u*u+f*(f+2*l)+c;else f=-s,u=Math.max(0,-(o*f+a)),h=-u*u+f*(f+2*l)+c;else f<=-d?(u=Math.max(0,-(-o*s+a)),f=u>0?-s:Math.min(Math.max(-s,-l),s),h=-u*u+f*(f+2*l)+c):f<=d?(u=0,f=Math.min(Math.max(-s,-l),s),h=f*(f+2*l)+c):(u=Math.max(0,-(o*s+a)),f=u>0?s:Math.min(Math.max(-s,-l),s),h=-u*u+f*(f+2*l)+c);else f=o>0?-s:s,u=Math.max(0,-(o*f+a)),h=-u*u+f*(f+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(wE).addScaledVector(dv,f),h}intersectSphere(e,t){hl.subVectors(e.center,this.origin);const r=hl.dot(this.direction),i=hl.dot(hl)-r*r,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=r-o,l=r+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){const r=this.distanceToPlane(e);return r===null?null:this.at(r,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let r,i,s,o,a,l;const c=1/this.direction.x,A=1/this.direction.y,u=1/this.direction.z,f=this.origin;return c>=0?(r=(e.min.x-f.x)*c,i=(e.max.x-f.x)*c):(r=(e.max.x-f.x)*c,i=(e.min.x-f.x)*c),A>=0?(s=(e.min.y-f.y)*A,o=(e.max.y-f.y)*A):(s=(e.max.y-f.y)*A,o=(e.min.y-f.y)*A),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o=0?(a=(e.min.z-f.z)*u,l=(e.max.z-f.z)*u):(a=(e.max.z-f.z)*u,l=(e.min.z-f.z)*u),r>l||a>i)||((a>r||r!==r)&&(r=a),(l=0?r:i,t)}intersectsBox(e){return this.intersectBox(e,hl)!==null}intersectTriangle(e,t,r,i,s){_E.subVectors(t,e),pv.subVectors(r,e),xE.crossVectors(_E,pv);let o=this.direction.dot(xE),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;_c.subVectors(this.origin,e);const l=a*this.direction.dot(pv.crossVectors(_c,pv));if(l<0)return null;const c=a*this.direction.dot(_E.cross(_c));if(c<0||l+c>o)return null;const A=-a*_c.dot(xE);return A<0?null:this.at(A/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class He{constructor(e,t,r,i,s,o,a,l,c,A,u,f,h,d,m,g){He.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,r,i,s,o,a,l,c,A,u,f,h,d,m,g)}set(e,t,r,i,s,o,a,l,c,A,u,f,h,d,m,g){const p=this.elements;return p[0]=e,p[4]=t,p[8]=r,p[12]=i,p[1]=s,p[5]=o,p[9]=a,p[13]=l,p[2]=c,p[6]=A,p[10]=u,p[14]=f,p[3]=h,p[7]=d,p[11]=m,p[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new He().fromArray(this.elements)}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){const t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,r=e.elements,i=1/ff.setFromMatrixColumn(e,0).length(),s=1/ff.setFromMatrixColumn(e,1).length(),o=1/ff.setFromMatrixColumn(e,2).length();return t[0]=r[0]*i,t[1]=r[1]*i,t[2]=r[2]*i,t[3]=0,t[4]=r[4]*s,t[5]=r[5]*s,t[6]=r[6]*s,t[7]=0,t[8]=r[8]*o,t[9]=r[9]*o,t[10]=r[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,r=e.x,i=e.y,s=e.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(i),c=Math.sin(i),A=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const f=o*A,h=o*u,d=a*A,m=a*u;t[0]=l*A,t[4]=-l*u,t[8]=c,t[1]=h+d*c,t[5]=f-m*c,t[9]=-a*l,t[2]=m-f*c,t[6]=d+h*c,t[10]=o*l}else if(e.order==="YXZ"){const f=l*A,h=l*u,d=c*A,m=c*u;t[0]=f+m*a,t[4]=d*a-h,t[8]=o*c,t[1]=o*u,t[5]=o*A,t[9]=-a,t[2]=h*a-d,t[6]=m+f*a,t[10]=o*l}else if(e.order==="ZXY"){const f=l*A,h=l*u,d=c*A,m=c*u;t[0]=f-m*a,t[4]=-o*u,t[8]=d+h*a,t[1]=h+d*a,t[5]=o*A,t[9]=m-f*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const f=o*A,h=o*u,d=a*A,m=a*u;t[0]=l*A,t[4]=d*c-h,t[8]=f*c+m,t[1]=l*u,t[5]=m*c+f,t[9]=h*c-d,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const f=o*l,h=o*c,d=a*l,m=a*c;t[0]=l*A,t[4]=m-f*u,t[8]=d*u+h,t[1]=u,t[5]=o*A,t[9]=-a*A,t[2]=-c*A,t[6]=h*u+d,t[10]=f-m*u}else if(e.order==="XZY"){const f=o*l,h=o*c,d=a*l,m=a*c;t[0]=l*A,t[4]=-u,t[8]=c*A,t[1]=f*u+m,t[5]=o*A,t[9]=h*u-d,t[2]=d*u-h,t[6]=a*A,t[10]=m*u+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(uee,e,fee)}lookAt(e,t,r){const i=this.elements;return ps.subVectors(e,t),ps.lengthSq()===0&&(ps.z=1),ps.normalize(),xc.crossVectors(r,ps),xc.lengthSq()===0&&(Math.abs(r.z)===1?ps.x+=1e-4:ps.z+=1e-4,ps.normalize(),xc.crossVectors(r,ps)),xc.normalize(),mv.crossVectors(ps,xc),i[0]=xc.x,i[4]=mv.x,i[8]=ps.x,i[1]=xc.y,i[5]=mv.y,i[9]=ps.y,i[2]=xc.z,i[6]=mv.z,i[10]=ps.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[4],l=r[8],c=r[12],A=r[1],u=r[5],f=r[9],h=r[13],d=r[2],m=r[6],g=r[10],p=r[14],v=r[3],w=r[7],_=r[11],x=r[15],b=i[0],B=i[4],M=i[8],I=i[12],S=i[1],L=i[5],D=i[9],T=i[13],y=i[2],E=i[6],R=i[10],F=i[14],O=i[3],z=i[7],j=i[11],H=i[15];return s[0]=o*b+a*S+l*y+c*O,s[4]=o*B+a*L+l*E+c*z,s[8]=o*M+a*D+l*R+c*j,s[12]=o*I+a*T+l*F+c*H,s[1]=A*b+u*S+f*y+h*O,s[5]=A*B+u*L+f*E+h*z,s[9]=A*M+u*D+f*R+h*j,s[13]=A*I+u*T+f*F+h*H,s[2]=d*b+m*S+g*y+p*O,s[6]=d*B+m*L+g*E+p*z,s[10]=d*M+m*D+g*R+p*j,s[14]=d*I+m*T+g*F+p*H,s[3]=v*b+w*S+_*y+x*O,s[7]=v*B+w*L+_*E+x*z,s[11]=v*M+w*D+_*R+x*j,s[15]=v*I+w*T+_*F+x*H,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],A=e[2],u=e[6],f=e[10],h=e[14],d=e[3],m=e[7],g=e[11],p=e[15];return d*(+s*l*u-i*c*u-s*a*f+r*c*f+i*a*h-r*l*h)+m*(+t*l*h-t*c*f+s*o*f-i*o*h+i*c*A-s*l*A)+g*(+t*c*u-t*a*h-s*o*u+r*o*h+s*a*A-r*c*A)+p*(-i*a*A-t*l*u+t*a*f+i*o*u-r*o*f+r*l*A)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=r),this}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],A=e[8],u=e[9],f=e[10],h=e[11],d=e[12],m=e[13],g=e[14],p=e[15],v=u*g*c-m*f*c+m*l*h-a*g*h-u*l*p+a*f*p,w=d*f*c-A*g*c-d*l*h+o*g*h+A*l*p-o*f*p,_=A*m*c-d*u*c+d*a*h-o*m*h-A*a*p+o*u*p,x=d*u*l-A*m*l-d*a*f+o*m*f+A*a*g-o*u*g,b=t*v+r*w+i*_+s*x;if(b===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const B=1/b;return e[0]=v*B,e[1]=(m*f*s-u*g*s-m*i*h+r*g*h+u*i*p-r*f*p)*B,e[2]=(a*g*s-m*l*s+m*i*c-r*g*c-a*i*p+r*l*p)*B,e[3]=(u*l*s-a*f*s-u*i*c+r*f*c+a*i*h-r*l*h)*B,e[4]=w*B,e[5]=(A*g*s-d*f*s+d*i*h-t*g*h-A*i*p+t*f*p)*B,e[6]=(d*l*s-o*g*s-d*i*c+t*g*c+o*i*p-t*l*p)*B,e[7]=(o*f*s-A*l*s+A*i*c-t*f*c-o*i*h+t*l*h)*B,e[8]=_*B,e[9]=(d*u*s-A*m*s-d*r*h+t*m*h+A*r*p-t*u*p)*B,e[10]=(o*m*s-d*a*s+d*r*c-t*m*c-o*r*p+t*a*p)*B,e[11]=(A*a*s-o*u*s-A*r*c+t*u*c+o*r*h-t*a*h)*B,e[12]=x*B,e[13]=(A*m*i-d*u*i+d*r*f-t*m*f-A*r*g+t*u*g)*B,e[14]=(d*a*i-o*m*i-d*r*l+t*m*l+o*r*g-t*a*g)*B,e[15]=(o*u*i-A*a*i+A*r*l-t*u*l-o*r*f+t*a*f)*B,this}scale(e){const t=this.elements,r=e.x,i=e.y,s=e.z;return t[0]*=r,t[4]*=i,t[8]*=s,t[1]*=r,t[5]*=i,t[9]*=s,t[2]*=r,t[6]*=i,t[10]*=s,t[3]*=r,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,i))}makeTranslation(e,t,r){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const r=Math.cos(t),i=Math.sin(t),s=1-r,o=e.x,a=e.y,l=e.z,c=s*o,A=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,A*a+r,A*l-i*o,0,c*l-i*a,A*l+i*o,s*l*l+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,i,s,o){return this.set(1,r,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,r){const i=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,A=o+o,u=a+a,f=s*c,h=s*A,d=s*u,m=o*A,g=o*u,p=a*u,v=l*c,w=l*A,_=l*u,x=r.x,b=r.y,B=r.z;return i[0]=(1-(m+p))*x,i[1]=(h+_)*x,i[2]=(d-w)*x,i[3]=0,i[4]=(h-_)*b,i[5]=(1-(f+p))*b,i[6]=(g+v)*b,i[7]=0,i[8]=(d+w)*B,i[9]=(g-v)*B,i[10]=(1-(f+m))*B,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,r){const i=this.elements;let s=ff.set(i[0],i[1],i[2]).length();const o=ff.set(i[4],i[5],i[6]).length(),a=ff.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Do.copy(this);const c=1/s,A=1/o,u=1/a;return Do.elements[0]*=c,Do.elements[1]*=c,Do.elements[2]*=c,Do.elements[4]*=A,Do.elements[5]*=A,Do.elements[6]*=A,Do.elements[8]*=u,Do.elements[9]*=u,Do.elements[10]*=u,t.setFromRotationMatrix(Do),r.x=s,r.y=o,r.z=a,this}makePerspective(e,t,r,i,s,o,a=zl){const l=this.elements,c=2*s/(t-e),A=2*s/(r-i),u=(t+e)/(t-e),f=(r+i)/(r-i);let h,d;if(a===zl)h=-(o+s)/(o-s),d=-2*o*s/(o-s);else if(a===N_)h=-o/(o-s),d=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=A,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=h,l[14]=d,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,r,i,s,o,a=zl){const l=this.elements,c=1/(t-e),A=1/(r-i),u=1/(o-s),f=(t+e)*c,h=(r+i)*A;let d,m;if(a===zl)d=(o+s)*u,m=-2*u;else if(a===N_)d=s*u,m=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*A,l[9]=0,l[13]=-h,l[2]=0,l[6]=0,l[10]=m,l[14]=-d,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,r=e.elements;for(let i=0;i<16;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<16;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}}const ff=new $,Do=new He,uee=new $(0,0,0),fee=new $(1,1,1),xc=new $,mv=new $,ps=new $,uL=new He,fL=new nt;class tr{constructor(e=0,t=0,r=0,i=tr.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,r,i=this._order){return this._x=e,this._y=t,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,r=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],A=i[9],u=i[2],f=i[6],h=i[10];switch(t){case"XYZ":this._y=Math.asin(pr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-A,h),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-pr(A,-1,1)),Math.abs(A)<.9999999?(this._y=Math.atan2(a,h),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(pr(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-u,h),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-pr(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(f,h),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(pr(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-A,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,h));break;case"XZY":this._z=Math.asin(-pr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-A,h),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return uL.makeRotationFromQuaternion(e),this.setFromRotationMatrix(uL,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return fL.setFromEuler(this),this.setFromQuaternion(fL,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}tr.DEFAULT_ORDER="XYZ";class DR{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let r=0;r0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,A=l.length;c0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),A.length>0&&(r.images=A),u.length>0&&(r.shapes=u),f.length>0&&(r.skeletons=f),h.length>0&&(r.animations=h),d.length>0&&(r.nodes=d)}return r.object=i,r;function o(a){const l=[];for(const c in a){const A=a[c];delete A.metadata,l.push(A)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let r=0;r0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,r,i,s){No.subVectors(i,t),pl.subVectors(r,t),EE.subVectors(e,t);const o=No.dot(No),a=No.dot(pl),l=No.dot(EE),c=pl.dot(pl),A=pl.dot(EE),u=o*c-a*a;if(u===0)return s.set(0,0,0),null;const f=1/u,h=(c*l-a*A)*f,d=(o*A-a*l)*f;return s.set(1-h-d,d,h)}static containsPoint(e,t,r,i){return this.getBarycoord(e,t,r,i,ml)===null?!1:ml.x>=0&&ml.y>=0&&ml.x+ml.y<=1}static getInterpolation(e,t,r,i,s,o,a,l){return this.getBarycoord(e,t,r,i,ml)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,ml.x),l.addScaledVector(o,ml.y),l.addScaledVector(a,ml.z),l)}static getInterpolatedAttribute(e,t,r,i,s,o){return CE.setScalar(0),TE.setScalar(0),IE.setScalar(0),CE.fromBufferAttribute(e,t),TE.fromBufferAttribute(e,r),IE.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(CE,s.x),o.addScaledVector(TE,s.y),o.addScaledVector(IE,s.z),o}static isFrontFacing(e,t,r,i){return No.subVectors(r,t),pl.subVectors(e,t),No.cross(pl).dot(i)<0}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,r,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return No.subVectors(this.c,this.b),pl.subVectors(this.a,this.b),No.cross(pl).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Wr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Wr.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,r,i,s){return Wr.getInterpolation(e,this.a,this.b,this.c,t,r,i,s)}containsPoint(e){return Wr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Wr.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const r=this.a,i=this.b,s=this.c;let o,a;pf.subVectors(i,r),mf.subVectors(s,r),BE.subVectors(e,r);const l=pf.dot(BE),c=mf.dot(BE);if(l<=0&&c<=0)return t.copy(r);SE.subVectors(e,i);const A=pf.dot(SE),u=mf.dot(SE);if(A>=0&&u<=A)return t.copy(i);const f=l*u-A*c;if(f<=0&&l>=0&&A<=0)return o=l/(l-A),t.copy(r).addScaledVector(pf,o);ME.subVectors(e,s);const h=pf.dot(ME),d=mf.dot(ME);if(d>=0&&h<=d)return t.copy(s);const m=h*c-l*d;if(m<=0&&c>=0&&d<=0)return a=c/(c-d),t.copy(r).addScaledVector(mf,a);const g=A*d-h*u;if(g<=0&&u-A>=0&&h-d>=0)return vL.subVectors(s,i),a=(u-A)/(u-A+(h-d)),t.copy(i).addScaledVector(vL,a);const p=1/(g+m+f);return o=m*p,a=f*p,t.copy(r).addScaledVector(pf,o).addScaledVector(mf,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const bz={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},bc={h:0,s:0,l:0},vv={h:0,s:0,l:0};function RE(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class ke{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,r)}set(e,t,r){if(t===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ut){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Et.toWorkingColorSpace(this,t),this}setRGB(e,t,r,i=Et.workingColorSpace){return this.r=e,this.g=t,this.b=r,Et.toWorkingColorSpace(this,i),this}setHSL(e,t,r,i=Et.workingColorSpace){if(e=PR(e,1),t=pr(t,0,1),r=pr(r,0,1),t===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+t):r+t-r*t,o=2*r-s;this.r=RE(o,s,e+1/3),this.g=RE(o,s,e),this.b=RE(o,s,e-1/3)}return Et.toWorkingColorSpace(this,i),this}setStyle(e,t=Ut){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ut){const r=bz[e.toLowerCase()];return r!==void 0?this.setHex(r,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=sd(e.r),this.g=sd(e.g),this.b=sd(e.b),this}copyLinearToSRGB(e){return this.r=pE(e.r),this.g=pE(e.g),this.b=pE(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ut){return Et.fromWorkingColorSpace(hi.copy(this),e),Math.round(pr(hi.r*255,0,255))*65536+Math.round(pr(hi.g*255,0,255))*256+Math.round(pr(hi.b*255,0,255))}getHexString(e=Ut){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Et.workingColorSpace){Et.fromWorkingColorSpace(hi.copy(this),t);const r=hi.r,i=hi.g,s=hi.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,c;const A=(a+o)/2;if(a===o)l=0,c=0;else{const u=o-a;switch(c=A<=.5?u/(o+a):u/(2-o-a),o){case r:l=(i-s)/u+(i0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const r=e[t];if(r===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[t]=r}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const r={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==rd&&(r.blending=this.blending),this.side!==Qs&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==WM&&(r.blendSrc=this.blendSrc),this.blendDst!==KM&&(r.blendDst=this.blendDst),this.blendEquation!==ou&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==Cd&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==iL&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==af&&(r.stencilFail=this.stencilFail),this.stencilZFail!==af&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==af&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let r=null;if(t!==null){const i=t.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=t[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}};class qi extends as{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ke(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new tr,this.combine=o1,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Dl=vee();function vee(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),r=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(r[l]=0,r[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(r[l]=1024>>-c-14,r[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(r[l]=c+15<<10,r[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(r[l]=31744,r[l|256]=64512,i[l]=24,i[l|256]=24):(r[l]=31744,r[l|256]=64512,i[l]=13,i[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,A=0;for(;!(c&8388608);)c<<=1,A-=8388608;c&=-8388609,A+=947912704,s[l]=c|A}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:a}}function yee(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=pr(n,-65504,65504),Dl.floatView[0]=n;const e=Dl.uint32View[0],t=e>>23&511;return Dl.baseTable[t]+((e&8388607)>>Dl.shiftTable[t])}function wee(n){const e=n>>10;return Dl.uint32View[0]=Dl.mantissaTable[Dl.offsetTable[e]+(n&1023)]+Dl.exponentTable[e],Dl.floatView[0]}const yv={toHalfFloat:yee,fromHalfFloat:wee},gr=new $,wv=new je;class ct{constructor(e,t,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=r,this.usage=TC,this.updateRanges=[],this.gpuType=xi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,r){e*=this.itemSize,r*=t.itemSize;for(let i=0,s=this.itemSize;i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const r=this.attributes;for(const l in r){const c=r[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],A=[];for(let u=0,f=c.length;u0&&(i[l]=A,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone(t));const i=e.attributes;for(const c in i){const A=i[c];this.setAttribute(c,A.clone(t))}const s=e.morphAttributes;for(const c in s){const A=[],u=s[c];for(let f=0,h=u.length;f0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s(e.far-e.near)**2))&&(yL.copy(s).invert(),kA.copy(e.ray).applyMatrix4(yL),!(r.boundingBox!==null&&kA.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,t,kA)))}_computeIntersections(e,t,r){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,A=s.attributes.uv1,u=s.attributes.normal,f=s.groups,h=s.drawRange;if(a!==null)if(Array.isArray(o))for(let d=0,m=f.length;dt.far?null:{distance:c,point:Sv.clone(),object:n}}function Mv(n,e,t,r,i,s,o,a,l,c){n.getVertexPosition(a,xv),n.getVertexPosition(l,bv),n.getVertexPosition(c,Ev);const A=xee(n,e,t,r,xv,bv,Ev,_L);if(A){const u=new $;Wr.getBarycoord(_L,xv,bv,Ev,u),i&&(A.uv=Wr.getInterpolatedAttribute(i,a,l,c,u,new je)),s&&(A.uv1=Wr.getInterpolatedAttribute(s,a,l,c,u,new je)),o&&(A.normal=Wr.getInterpolatedAttribute(o,a,l,c,u,new $),A.normal.dot(r.direction)>0&&A.normal.multiplyScalar(-1));const f={a,b:l,c,normal:new $,materialIndex:0};Wr.getNormal(xv,bv,Ev,f.normal),A.face=f,A.barycoord=u}return A}class m0 extends Jt{constructor(e=1,t=1,r=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],A=[],u=[];let f=0,h=0;d("z","y","x",-1,-1,r,t,e,o,s,0),d("z","y","x",1,-1,r,t,-e,o,s,1),d("x","z","y",1,1,e,r,t,i,o,2),d("x","z","y",1,-1,e,r,-t,i,o,3),d("x","y","z",1,-1,e,t,r,i,s,4),d("x","y","z",-1,-1,e,t,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new xn(c,3)),this.setAttribute("normal",new xn(A,3)),this.setAttribute("uv",new xn(u,2));function d(m,g,p,v,w,_,x,b,B,M,I){const S=_/B,L=x/M,D=_/2,T=x/2,y=b/2,E=B+1,R=M+1;let F=0,O=0;const z=new $;for(let j=0;j0?1:-1,A.push(z.x,z.y,z.z),u.push(C/B),u.push(1-j/M),F+=1}}for(let j=0;j>8&255]+fi[n>>16&255]+fi[n>>24&255]+"-"+fi[e&255]+fi[e>>8&255]+"-"+fi[e>>16&15|64]+fi[e>>24&255]+"-"+fi[t&63|128]+fi[t>>8&255]+"-"+fi[t>>16&255]+fi[t>>24&255]+fi[r&255]+fi[r>>8&255]+fi[r>>16&255]+fi[r>>24&255]).toLowerCase()}function pr(n,e,t){return Math.max(e,Math.min(t,n))}function DR(n,e){return(n%e+e)%e}function Dq(n,e,t,r,i){return r+(n-e)*(i-r)/(t-e)}function Nq(n,e,t){return n!==e?(t-n)/(e-n):0}function tg(n,e,t){return(1-t)*n+t*e}function Oq(n,e,t,r){return tg(n,e,1-Math.exp(-t*r))}function kq(n,e=1){return e-Math.abs(DR(n,e*2)-e)}function Qq(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function Hq(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function zq(n,e){return n+Math.floor(Math.random()*(e-n+1))}function Gq(n,e){return n+Math.random()*(e-n)}function Vq(n){return n*(.5-Math.random())}function jq(n){n!==void 0&&(aL=n);let e=aL+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Wq(n){return n*eg}function Kq(n){return n*Dd}function Xq(n){return(n&n-1)===0&&n!==0}function Yq(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function $q(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Zq(n,e,t,r,i){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+r)/2),A=o((e+r)/2),u=s((e-r)/2),f=o((e-r)/2),h=s((r-e)/2),d=o((r-e)/2);switch(i){case"XYX":n.set(a*A,l*u,l*f,a*c);break;case"YZY":n.set(l*f,a*A,l*u,a*c);break;case"ZXZ":n.set(l*u,l*f,a*A,a*c);break;case"XZX":n.set(a*A,l*d,l*h,a*c);break;case"YXY":n.set(l*h,a*A,l*d,a*c);break;case"ZYZ":n.set(l*d,l*h,a*A,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Zo(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function hn(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const Bt={DEG2RAD:eg,RAD2DEG:Dd,generateUUID:ia,clamp:pr,euclideanModulo:DR,mapLinear:Dq,inverseLerp:Nq,lerp:tg,damp:Oq,pingpong:kq,smoothstep:Qq,smootherstep:Hq,randInt:zq,randFloat:Gq,randFloatSpread:Vq,seededRandom:jq,degToRad:Wq,radToDeg:Kq,isPowerOfTwo:Xq,ceilPowerOfTwo:Yq,floorPowerOfTwo:$q,setQuaternionFromProperEuler:Zq,normalize:hn,denormalize:Zo};class We{constructor(e=0,t=0){We.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,r=this.y,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6],this.y=i[1]*t+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(pr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y;return t*t+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const r=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*i+e.x,this.y=s*i+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class dt{constructor(e,t,r,i,s,o,a,l,c){dt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,r,i,s,o,a,l,c)}set(e,t,r,i,s,o,a,l,c){const A=this.elements;return A[0]=e,A[1]=i,A[2]=a,A[3]=t,A[4]=s,A[5]=l,A[6]=r,A[7]=o,A[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[3],l=r[6],c=r[1],A=r[4],u=r[7],f=r[2],h=r[5],d=r[8],m=i[0],g=i[3],p=i[6],v=i[1],w=i[4],_=i[7],x=i[2],b=i[5],B=i[8];return s[0]=o*m+a*v+l*x,s[3]=o*g+a*w+l*b,s[6]=o*p+a*_+l*B,s[1]=c*m+A*v+u*x,s[4]=c*g+A*w+u*b,s[7]=c*p+A*_+u*B,s[2]=f*m+h*v+d*x,s[5]=f*g+h*w+d*b,s[8]=f*p+h*_+d*B,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],A=e[8];return t*o*A-t*a*c-r*s*A+r*a*l+i*s*c-i*o*l}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],A=e[8],u=A*o-a*c,f=a*l-A*s,h=c*s-o*l,d=t*u+r*f+i*h;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/d;return e[0]=u*m,e[1]=(i*c-A*r)*m,e[2]=(a*r-i*o)*m,e[3]=f*m,e[4]=(A*t-i*l)*m,e[5]=(i*s-a*t)*m,e[6]=h*m,e[7]=(r*l-c*t)*m,e[8]=(o*t-r*s)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,r,i,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(mE.makeScale(e,t)),this}rotate(e){return this.premultiply(mE.makeRotation(-e)),this}translate(e,t){return this.premultiply(mE.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,r,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,r=e.elements;for(let i=0;i<9;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const mE=new dt;function xz(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function zg(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Jq(){const n=zg("canvas");return n.style.display="block",n}const lL={};function Sw(n){n in lL||(lL[n]=!0,console.warn(n))}function qq(n,e,t){return new Promise(function(r,i){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:i();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:r()}}setTimeout(s,t)})}function eee(n){const e=n.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function tee(n){const e=n.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const cL=new dt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),AL=new dt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Tp={[Sr]:{transfer:L_,primaries:D_,luminanceCoefficients:[.2126,.7152,.0722],toReference:n=>n,fromReference:n=>n},[Ut]:{transfer:Sn,primaries:D_,luminanceCoefficients:[.2126,.7152,.0722],toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[A1]:{transfer:L_,primaries:N_,luminanceCoefficients:[.2289,.6917,.0793],toReference:n=>n.applyMatrix3(AL),fromReference:n=>n.applyMatrix3(cL)},[LR]:{transfer:Sn,primaries:N_,luminanceCoefficients:[.2289,.6917,.0793],toReference:n=>n.convertSRGBToLinear().applyMatrix3(AL),fromReference:n=>n.applyMatrix3(cL).convertLinearToSRGB()}},nee=new Set([Sr,A1]),Et={enabled:!0,_workingColorSpace:Sr,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!nee.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const r=Tp[e].toReference,i=Tp[t].fromReference;return i(r(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return Tp[n].primaries},getTransfer:function(n){return n===La?L_:Tp[n].transfer},getLuminanceCoefficients:function(n,e=this._workingColorSpace){return n.fromArray(Tp[e].luminanceCoefficients)}};function od(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function gE(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Af;class ree{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Af===void 0&&(Af=zg("canvas")),Af.width=e.width,Af.height=e.height;const r=Af.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=Af}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=zg("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o0&&(r.userData=this.userData),t||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Az)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case zs:e.x=e.x-Math.floor(e.x);break;case Rs:e.x=e.x<0?0:1;break;case Qg:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case zs:e.y=e.y-Math.floor(e.y);break;case Rs:e.y=e.y<0?0:1;break;case Qg:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Un.DEFAULT_IMAGE=null;Un.DEFAULT_MAPPING=Az;Un.DEFAULT_ANISOTROPY=1;class Pt{constructor(e=0,t=0,r=0,i=1){Pt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*r+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*r+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*r+o[11]*i+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,r,i,s;const l=e.elements,c=l[0],A=l[4],u=l[8],f=l[1],h=l[5],d=l[9],m=l[2],g=l[6],p=l[10];if(Math.abs(A-f)<.01&&Math.abs(u-m)<.01&&Math.abs(d-g)<.01){if(Math.abs(A+f)<.1&&Math.abs(u+m)<.1&&Math.abs(d+g)<.1&&Math.abs(c+h+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const w=(c+1)/2,_=(h+1)/2,x=(p+1)/2,b=(A+f)/4,B=(u+m)/4,S=(d+g)/4;return w>_&&w>x?w<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(w),i=b/r,s=B/r):_>x?_<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(_),r=b/i,s=S/i):x<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(x),r=B/s,i=S/s),this.set(r,i,s,t),this}let v=Math.sqrt((g-d)*(g-d)+(u-m)*(u-m)+(f-A)*(f-A));return Math.abs(v)<.001&&(v=1),this.x=(g-d)/v,this.y=(u-m)/v,this.z=(f-A)/v,this.w=Math.acos((c+h+p-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class oee extends UA{constructor(e=1,t=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Pt(0,0,e,t),this.scissorTest=!1,this.viewport=new Pt(0,0,e,t);const i={width:e,height:t,depth:1};r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Lr,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},r);const s=new Un(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace);s.flipY=!1,s.generateMipmaps=r.generateMipmaps,s.internalFormat=r.internalFormat,this.textures=[];const o=r.count;for(let a=0;a=0?1:-1,w=1-p*p;if(w>Number.EPSILON){const x=Math.sqrt(w),b=Math.atan2(x,p*v);g=Math.sin(g*b)/x,a=Math.sin(a*b)/x}const _=a*v;if(l=l*g+f*_,c=c*g+h*_,A=A*g+d*_,u=u*g+m*_,g===1-a){const x=1/Math.sqrt(l*l+c*c+A*A+u*u);l*=x,c*=x,A*=x,u*=x}}e[t]=l,e[t+1]=c,e[t+2]=A,e[t+3]=u}static multiplyQuaternionsFlat(e,t,r,i,s,o){const a=r[i],l=r[i+1],c=r[i+2],A=r[i+3],u=s[o],f=s[o+1],h=s[o+2],d=s[o+3];return e[t]=a*d+A*u+l*h-c*f,e[t+1]=l*d+A*f+c*u-a*h,e[t+2]=c*d+A*h+a*f-l*u,e[t+3]=A*d-a*u-l*f-c*h,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const r=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(r/2),A=a(i/2),u=a(s/2),f=l(r/2),h=l(i/2),d=l(s/2);switch(o){case"XYZ":this._x=f*A*u+c*h*d,this._y=c*h*u-f*A*d,this._z=c*A*d+f*h*u,this._w=c*A*u-f*h*d;break;case"YXZ":this._x=f*A*u+c*h*d,this._y=c*h*u-f*A*d,this._z=c*A*d-f*h*u,this._w=c*A*u+f*h*d;break;case"ZXY":this._x=f*A*u-c*h*d,this._y=c*h*u+f*A*d,this._z=c*A*d+f*h*u,this._w=c*A*u-f*h*d;break;case"ZYX":this._x=f*A*u-c*h*d,this._y=c*h*u+f*A*d,this._z=c*A*d-f*h*u,this._w=c*A*u+f*h*d;break;case"YZX":this._x=f*A*u+c*h*d,this._y=c*h*u+f*A*d,this._z=c*A*d-f*h*u,this._w=c*A*u-f*h*d;break;case"XZY":this._x=f*A*u-c*h*d,this._y=c*h*u-f*A*d,this._z=c*A*d+f*h*u,this._w=c*A*u+f*h*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,r=t[0],i=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],A=t[6],u=t[10],f=r+a+u;if(f>0){const h=.5/Math.sqrt(f+1);this._w=.25/h,this._x=(A-l)*h,this._y=(s-c)*h,this._z=(o-i)*h}else if(r>a&&r>u){const h=2*Math.sqrt(1+r-a-u);this._w=(A-l)/h,this._x=.25*h,this._y=(i+o)/h,this._z=(s+c)/h}else if(a>u){const h=2*Math.sqrt(1+a-r-u);this._w=(s-c)/h,this._x=(i+o)/h,this._y=.25*h,this._z=(l+A)/h}else{const h=2*Math.sqrt(1+u-r-a);this._w=(o-i)/h,this._x=(s+c)/h,this._y=(l+A)/h,this._z=.25*h}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return rMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(pr(this.dot(e),-1,1)))}rotateTowards(e,t){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,t/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const r=e._x,i=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,A=t._w;return this._x=r*A+o*a+i*c-s*l,this._y=i*A+o*l+s*a-r*c,this._z=s*A+o*c+r*l-i*a,this._w=o*A-r*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const r=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+r*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const h=1-t;return this._w=h*o+t*this._w,this._x=h*r+t*this._x,this._y=h*i+t*this._y,this._z=h*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),A=Math.atan2(c,a),u=Math.sin((1-t)*A)/c,f=Math.sin(t*A)/c;return this._w=o*u+this._w*f,this._x=r*u+this._x*f,this._y=i*u+this._y*f,this._z=s*u+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class ${constructor(e=0,t=0,r=0){$.prototype.isVector3=!0,this.x=e,this.y=t,this.z=r}set(e,t,r){return r===void 0&&(r=this.z),this.x=e,this.y=t,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(uL.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(uL.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*r+s[6]*i,this.y=s[1]*t+s[4]*r+s[7]*i,this.z=s[2]*t+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*r+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*r+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,r=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*i-a*r),A=2*(a*t-s*i),u=2*(s*r-o*t);return this.x=t+l*c+o*u-a*A,this.y=r+l*A+a*c-s*u,this.z=i+l*u+s*A-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*r+s[8]*i,this.y=s[1]*t+s[5]*r+s[9]*i,this.z=s[2]*t+s[6]*r+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const r=e.x,i=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return yE.copy(this).projectOnVector(e),this.sub(yE)}reflect(e){return this.sub(yE.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(pr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){const i=Math.sin(t)*e;return this.x=i*Math.sin(r),this.y=Math.cos(t)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,r=Math.sqrt(1-t*t);return this.x=r*Math.cos(e),this.y=t,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const yE=new $,uL=new nt;class Hn{constructor(e=new $(1/0,1/0,1/0),t=new $(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,r=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Lo),Lo.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ip),hv.subVectors(this.max,Ip),uf.subVectors(e.a,Ip),ff.subVectors(e.b,Ip),hf.subVectors(e.c,Ip),yc.subVectors(ff,uf),wc.subVectors(hf,ff),OA.subVectors(uf,hf);let t=[0,-yc.z,yc.y,0,-wc.z,wc.y,0,-OA.z,OA.y,yc.z,0,-yc.x,wc.z,0,-wc.x,OA.z,0,-OA.x,-yc.y,yc.x,0,-wc.y,wc.x,0,-OA.y,OA.x,0];return!wE(t,uf,ff,hf,hv)||(t=[1,0,0,0,1,0,0,0,1],!wE(t,uf,ff,hf,hv))?!1:(dv.crossVectors(yc,wc),t=[dv.x,dv.y,dv.z],wE(t,uf,ff,hf,hv))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Lo).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Lo).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(fl[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),fl[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),fl[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),fl[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),fl[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),fl[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),fl[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),fl[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(fl),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const fl=[new $,new $,new $,new $,new $,new $,new $,new $],Lo=new $,fv=new Hn,uf=new $,ff=new $,hf=new $,yc=new $,wc=new $,OA=new $,Ip=new $,hv=new $,dv=new $,kA=new $;function wE(n,e,t,r,i){for(let s=0,o=n.length-3;s<=o;s+=3){kA.fromArray(n,s);const a=i.x*Math.abs(kA.x)+i.y*Math.abs(kA.y)+i.z*Math.abs(kA.z),l=e.dot(kA),c=t.dot(kA),A=r.dot(kA);if(Math.max(-Math.max(l,c,A),Math.min(l,c,A))>a)return!1}return!0}const lee=new Hn,Rp=new $,_E=new $;class Mi{constructor(e=new $,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const r=this.center;t!==void 0?r.copy(t):lee.setFromPoints(e).getCenter(r);let i=0;for(let s=0,o=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Rp.subVectors(e,this.center);const t=Rp.lengthSq();if(t>this.radius*this.radius){const r=Math.sqrt(t),i=(r-this.radius)*.5;this.center.addScaledVector(Rp,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(_E.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Rp.copy(e.center).add(_E)),this.expandByPoint(Rp.copy(e.center).sub(_E))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const hl=new $,xE=new $,pv=new $,_c=new $,bE=new $,mv=new $,EE=new $;class $u{constructor(e=new $,t=new $(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,hl)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=hl.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(hl.copy(this.origin).addScaledVector(this.direction,t),hl.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){xE.copy(e).add(t).multiplyScalar(.5),pv.copy(t).sub(e).normalize(),_c.copy(this.origin).sub(xE);const s=e.distanceTo(t)*.5,o=-this.direction.dot(pv),a=_c.dot(this.direction),l=-_c.dot(pv),c=_c.lengthSq(),A=Math.abs(1-o*o);let u,f,h,d;if(A>0)if(u=o*l-a,f=o*a-l,d=s*A,u>=0)if(f>=-d)if(f<=d){const m=1/A;u*=m,f*=m,h=u*(u+o*f+2*a)+f*(o*u+f+2*l)+c}else f=s,u=Math.max(0,-(o*f+a)),h=-u*u+f*(f+2*l)+c;else f=-s,u=Math.max(0,-(o*f+a)),h=-u*u+f*(f+2*l)+c;else f<=-d?(u=Math.max(0,-(-o*s+a)),f=u>0?-s:Math.min(Math.max(-s,-l),s),h=-u*u+f*(f+2*l)+c):f<=d?(u=0,f=Math.min(Math.max(-s,-l),s),h=f*(f+2*l)+c):(u=Math.max(0,-(o*s+a)),f=u>0?s:Math.min(Math.max(-s,-l),s),h=-u*u+f*(f+2*l)+c);else f=o>0?-s:s,u=Math.max(0,-(o*f+a)),h=-u*u+f*(f+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(xE).addScaledVector(pv,f),h}intersectSphere(e,t){hl.subVectors(e.center,this.origin);const r=hl.dot(this.direction),i=hl.dot(hl)-r*r,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=r-o,l=r+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){const r=this.distanceToPlane(e);return r===null?null:this.at(r,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let r,i,s,o,a,l;const c=1/this.direction.x,A=1/this.direction.y,u=1/this.direction.z,f=this.origin;return c>=0?(r=(e.min.x-f.x)*c,i=(e.max.x-f.x)*c):(r=(e.max.x-f.x)*c,i=(e.min.x-f.x)*c),A>=0?(s=(e.min.y-f.y)*A,o=(e.max.y-f.y)*A):(s=(e.max.y-f.y)*A,o=(e.min.y-f.y)*A),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o=0?(a=(e.min.z-f.z)*u,l=(e.max.z-f.z)*u):(a=(e.max.z-f.z)*u,l=(e.min.z-f.z)*u),r>l||a>i)||((a>r||r!==r)&&(r=a),(l=0?r:i,t)}intersectsBox(e){return this.intersectBox(e,hl)!==null}intersectTriangle(e,t,r,i,s){bE.subVectors(t,e),mv.subVectors(r,e),EE.crossVectors(bE,mv);let o=this.direction.dot(EE),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;_c.subVectors(this.origin,e);const l=a*this.direction.dot(mv.crossVectors(_c,mv));if(l<0)return null;const c=a*this.direction.dot(bE.cross(_c));if(c<0||l+c>o)return null;const A=-a*_c.dot(EE);return A<0?null:this.at(A/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class He{constructor(e,t,r,i,s,o,a,l,c,A,u,f,h,d,m,g){He.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,r,i,s,o,a,l,c,A,u,f,h,d,m,g)}set(e,t,r,i,s,o,a,l,c,A,u,f,h,d,m,g){const p=this.elements;return p[0]=e,p[4]=t,p[8]=r,p[12]=i,p[1]=s,p[5]=o,p[9]=a,p[13]=l,p[2]=c,p[6]=A,p[10]=u,p[14]=f,p[3]=h,p[7]=d,p[11]=m,p[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new He().fromArray(this.elements)}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){const t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,r=e.elements,i=1/df.setFromMatrixColumn(e,0).length(),s=1/df.setFromMatrixColumn(e,1).length(),o=1/df.setFromMatrixColumn(e,2).length();return t[0]=r[0]*i,t[1]=r[1]*i,t[2]=r[2]*i,t[3]=0,t[4]=r[4]*s,t[5]=r[5]*s,t[6]=r[6]*s,t[7]=0,t[8]=r[8]*o,t[9]=r[9]*o,t[10]=r[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,r=e.x,i=e.y,s=e.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(i),c=Math.sin(i),A=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const f=o*A,h=o*u,d=a*A,m=a*u;t[0]=l*A,t[4]=-l*u,t[8]=c,t[1]=h+d*c,t[5]=f-m*c,t[9]=-a*l,t[2]=m-f*c,t[6]=d+h*c,t[10]=o*l}else if(e.order==="YXZ"){const f=l*A,h=l*u,d=c*A,m=c*u;t[0]=f+m*a,t[4]=d*a-h,t[8]=o*c,t[1]=o*u,t[5]=o*A,t[9]=-a,t[2]=h*a-d,t[6]=m+f*a,t[10]=o*l}else if(e.order==="ZXY"){const f=l*A,h=l*u,d=c*A,m=c*u;t[0]=f-m*a,t[4]=-o*u,t[8]=d+h*a,t[1]=h+d*a,t[5]=o*A,t[9]=m-f*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const f=o*A,h=o*u,d=a*A,m=a*u;t[0]=l*A,t[4]=d*c-h,t[8]=f*c+m,t[1]=l*u,t[5]=m*c+f,t[9]=h*c-d,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const f=o*l,h=o*c,d=a*l,m=a*c;t[0]=l*A,t[4]=m-f*u,t[8]=d*u+h,t[1]=u,t[5]=o*A,t[9]=-a*A,t[2]=-c*A,t[6]=h*u+d,t[10]=f-m*u}else if(e.order==="XZY"){const f=o*l,h=o*c,d=a*l,m=a*c;t[0]=l*A,t[4]=-u,t[8]=c*A,t[1]=f*u+m,t[5]=o*A,t[9]=h*u-d,t[2]=d*u-h,t[6]=a*A,t[10]=m*u+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(cee,e,Aee)}lookAt(e,t,r){const i=this.elements;return ps.subVectors(e,t),ps.lengthSq()===0&&(ps.z=1),ps.normalize(),xc.crossVectors(r,ps),xc.lengthSq()===0&&(Math.abs(r.z)===1?ps.x+=1e-4:ps.z+=1e-4,ps.normalize(),xc.crossVectors(r,ps)),xc.normalize(),gv.crossVectors(ps,xc),i[0]=xc.x,i[4]=gv.x,i[8]=ps.x,i[1]=xc.y,i[5]=gv.y,i[9]=ps.y,i[2]=xc.z,i[6]=gv.z,i[10]=ps.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[4],l=r[8],c=r[12],A=r[1],u=r[5],f=r[9],h=r[13],d=r[2],m=r[6],g=r[10],p=r[14],v=r[3],w=r[7],_=r[11],x=r[15],b=i[0],B=i[4],S=i[8],I=i[12],M=i[1],L=i[5],D=i[9],T=i[13],y=i[2],E=i[6],R=i[10],F=i[14],O=i[3],z=i[7],j=i[11],Q=i[15];return s[0]=o*b+a*M+l*y+c*O,s[4]=o*B+a*L+l*E+c*z,s[8]=o*S+a*D+l*R+c*j,s[12]=o*I+a*T+l*F+c*Q,s[1]=A*b+u*M+f*y+h*O,s[5]=A*B+u*L+f*E+h*z,s[9]=A*S+u*D+f*R+h*j,s[13]=A*I+u*T+f*F+h*Q,s[2]=d*b+m*M+g*y+p*O,s[6]=d*B+m*L+g*E+p*z,s[10]=d*S+m*D+g*R+p*j,s[14]=d*I+m*T+g*F+p*Q,s[3]=v*b+w*M+_*y+x*O,s[7]=v*B+w*L+_*E+x*z,s[11]=v*S+w*D+_*R+x*j,s[15]=v*I+w*T+_*F+x*Q,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],A=e[2],u=e[6],f=e[10],h=e[14],d=e[3],m=e[7],g=e[11],p=e[15];return d*(+s*l*u-i*c*u-s*a*f+r*c*f+i*a*h-r*l*h)+m*(+t*l*h-t*c*f+s*o*f-i*o*h+i*c*A-s*l*A)+g*(+t*c*u-t*a*h-s*o*u+r*o*h+s*a*A-r*c*A)+p*(-i*a*A-t*l*u+t*a*f+i*o*u-r*o*f+r*l*A)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=r),this}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],A=e[8],u=e[9],f=e[10],h=e[11],d=e[12],m=e[13],g=e[14],p=e[15],v=u*g*c-m*f*c+m*l*h-a*g*h-u*l*p+a*f*p,w=d*f*c-A*g*c-d*l*h+o*g*h+A*l*p-o*f*p,_=A*m*c-d*u*c+d*a*h-o*m*h-A*a*p+o*u*p,x=d*u*l-A*m*l-d*a*f+o*m*f+A*a*g-o*u*g,b=t*v+r*w+i*_+s*x;if(b===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const B=1/b;return e[0]=v*B,e[1]=(m*f*s-u*g*s-m*i*h+r*g*h+u*i*p-r*f*p)*B,e[2]=(a*g*s-m*l*s+m*i*c-r*g*c-a*i*p+r*l*p)*B,e[3]=(u*l*s-a*f*s-u*i*c+r*f*c+a*i*h-r*l*h)*B,e[4]=w*B,e[5]=(A*g*s-d*f*s+d*i*h-t*g*h-A*i*p+t*f*p)*B,e[6]=(d*l*s-o*g*s-d*i*c+t*g*c+o*i*p-t*l*p)*B,e[7]=(o*f*s-A*l*s+A*i*c-t*f*c-o*i*h+t*l*h)*B,e[8]=_*B,e[9]=(d*u*s-A*m*s-d*r*h+t*m*h+A*r*p-t*u*p)*B,e[10]=(o*m*s-d*a*s+d*r*c-t*m*c-o*r*p+t*a*p)*B,e[11]=(A*a*s-o*u*s-A*r*c+t*u*c+o*r*h-t*a*h)*B,e[12]=x*B,e[13]=(A*m*i-d*u*i+d*r*f-t*m*f-A*r*g+t*u*g)*B,e[14]=(d*a*i-o*m*i-d*r*l+t*m*l+o*r*g-t*a*g)*B,e[15]=(o*u*i-A*a*i+A*r*l-t*u*l-o*r*f+t*a*f)*B,this}scale(e){const t=this.elements,r=e.x,i=e.y,s=e.z;return t[0]*=r,t[4]*=i,t[8]*=s,t[1]*=r,t[5]*=i,t[9]*=s,t[2]*=r,t[6]*=i,t[10]*=s,t[3]*=r,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,i))}makeTranslation(e,t,r){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const r=Math.cos(t),i=Math.sin(t),s=1-r,o=e.x,a=e.y,l=e.z,c=s*o,A=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,A*a+r,A*l-i*o,0,c*l-i*a,A*l+i*o,s*l*l+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,i,s,o){return this.set(1,r,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,r){const i=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,A=o+o,u=a+a,f=s*c,h=s*A,d=s*u,m=o*A,g=o*u,p=a*u,v=l*c,w=l*A,_=l*u,x=r.x,b=r.y,B=r.z;return i[0]=(1-(m+p))*x,i[1]=(h+_)*x,i[2]=(d-w)*x,i[3]=0,i[4]=(h-_)*b,i[5]=(1-(f+p))*b,i[6]=(g+v)*b,i[7]=0,i[8]=(d+w)*B,i[9]=(g-v)*B,i[10]=(1-(f+m))*B,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,r){const i=this.elements;let s=df.set(i[0],i[1],i[2]).length();const o=df.set(i[4],i[5],i[6]).length(),a=df.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Do.copy(this);const c=1/s,A=1/o,u=1/a;return Do.elements[0]*=c,Do.elements[1]*=c,Do.elements[2]*=c,Do.elements[4]*=A,Do.elements[5]*=A,Do.elements[6]*=A,Do.elements[8]*=u,Do.elements[9]*=u,Do.elements[10]*=u,t.setFromRotationMatrix(Do),r.x=s,r.y=o,r.z=a,this}makePerspective(e,t,r,i,s,o,a=zl){const l=this.elements,c=2*s/(t-e),A=2*s/(r-i),u=(t+e)/(t-e),f=(r+i)/(r-i);let h,d;if(a===zl)h=-(o+s)/(o-s),d=-2*o*s/(o-s);else if(a===O_)h=-o/(o-s),d=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=A,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=h,l[14]=d,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,r,i,s,o,a=zl){const l=this.elements,c=1/(t-e),A=1/(r-i),u=1/(o-s),f=(t+e)*c,h=(r+i)*A;let d,m;if(a===zl)d=(o+s)*u,m=-2*u;else if(a===O_)d=s*u,m=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*A,l[9]=0,l[13]=-h,l[2]=0,l[6]=0,l[10]=m,l[14]=-d,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,r=e.elements;for(let i=0;i<16;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<16;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}}const df=new $,Do=new He,cee=new $(0,0,0),Aee=new $(1,1,1),xc=new $,gv=new $,ps=new $,fL=new He,hL=new nt;class nr{constructor(e=0,t=0,r=0,i=nr.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,r,i=this._order){return this._x=e,this._y=t,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,r=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],A=i[9],u=i[2],f=i[6],h=i[10];switch(t){case"XYZ":this._y=Math.asin(pr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-A,h),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-pr(A,-1,1)),Math.abs(A)<.9999999?(this._y=Math.atan2(a,h),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(pr(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-u,h),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-pr(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(f,h),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(pr(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-A,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,h));break;case"XZY":this._z=Math.asin(-pr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-A,h),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return fL.makeRotationFromQuaternion(e),this.setFromRotationMatrix(fL,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return hL.setFromEuler(this),this.setFromQuaternion(hL,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}nr.DEFAULT_ORDER="XYZ";class OR{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let r=0;r0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,A=l.length;c0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),A.length>0&&(r.images=A),u.length>0&&(r.shapes=u),f.length>0&&(r.skeletons=f),h.length>0&&(r.animations=h),d.length>0&&(r.nodes=d)}return r.object=i,r;function o(a){const l=[];for(const c in a){const A=a[c];delete A.metadata,l.push(A)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let r=0;r0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,r,i,s){No.subVectors(i,t),pl.subVectors(r,t),ME.subVectors(e,t);const o=No.dot(No),a=No.dot(pl),l=No.dot(ME),c=pl.dot(pl),A=pl.dot(ME),u=o*c-a*a;if(u===0)return s.set(0,0,0),null;const f=1/u,h=(c*l-a*A)*f,d=(o*A-a*l)*f;return s.set(1-h-d,d,h)}static containsPoint(e,t,r,i){return this.getBarycoord(e,t,r,i,ml)===null?!1:ml.x>=0&&ml.y>=0&&ml.x+ml.y<=1}static getInterpolation(e,t,r,i,s,o,a,l){return this.getBarycoord(e,t,r,i,ml)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,ml.x),l.addScaledVector(o,ml.y),l.addScaledVector(a,ml.z),l)}static getInterpolatedAttribute(e,t,r,i,s,o){return IE.setScalar(0),RE.setScalar(0),UE.setScalar(0),IE.fromBufferAttribute(e,t),RE.fromBufferAttribute(e,r),UE.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(IE,s.x),o.addScaledVector(RE,s.y),o.addScaledVector(UE,s.z),o}static isFrontFacing(e,t,r,i){return No.subVectors(r,t),pl.subVectors(e,t),No.cross(pl).dot(i)<0}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,r,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return No.subVectors(this.c,this.b),pl.subVectors(this.a,this.b),No.cross(pl).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Kr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Kr.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,r,i,s){return Kr.getInterpolation(e,this.a,this.b,this.c,t,r,i,s)}containsPoint(e){return Kr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Kr.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const r=this.a,i=this.b,s=this.c;let o,a;gf.subVectors(i,r),vf.subVectors(s,r),SE.subVectors(e,r);const l=gf.dot(SE),c=vf.dot(SE);if(l<=0&&c<=0)return t.copy(r);CE.subVectors(e,i);const A=gf.dot(CE),u=vf.dot(CE);if(A>=0&&u<=A)return t.copy(i);const f=l*u-A*c;if(f<=0&&l>=0&&A<=0)return o=l/(l-A),t.copy(r).addScaledVector(gf,o);TE.subVectors(e,s);const h=gf.dot(TE),d=vf.dot(TE);if(d>=0&&h<=d)return t.copy(s);const m=h*c-l*d;if(m<=0&&c>=0&&d<=0)return a=c/(c-d),t.copy(r).addScaledVector(vf,a);const g=A*d-h*u;if(g<=0&&u-A>=0&&h-d>=0)return yL.subVectors(s,i),a=(u-A)/(u-A+(h-d)),t.copy(i).addScaledVector(yL,a);const p=1/(g+m+f);return o=m*p,a=f*p,t.copy(r).addScaledVector(gf,o).addScaledVector(vf,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Ez={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},bc={h:0,s:0,l:0},yv={h:0,s:0,l:0};function FE(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class Qe{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,r)}set(e,t,r){if(t===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ut){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Et.toWorkingColorSpace(this,t),this}setRGB(e,t,r,i=Et.workingColorSpace){return this.r=e,this.g=t,this.b=r,Et.toWorkingColorSpace(this,i),this}setHSL(e,t,r,i=Et.workingColorSpace){if(e=DR(e,1),t=pr(t,0,1),r=pr(r,0,1),t===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+t):r+t-r*t,o=2*r-s;this.r=FE(o,s,e+1/3),this.g=FE(o,s,e),this.b=FE(o,s,e-1/3)}return Et.toWorkingColorSpace(this,i),this}setStyle(e,t=Ut){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ut){const r=Ez[e.toLowerCase()];return r!==void 0?this.setHex(r,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=od(e.r),this.g=od(e.g),this.b=od(e.b),this}copyLinearToSRGB(e){return this.r=gE(e.r),this.g=gE(e.g),this.b=gE(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ut){return Et.fromWorkingColorSpace(hi.copy(this),e),Math.round(pr(hi.r*255,0,255))*65536+Math.round(pr(hi.g*255,0,255))*256+Math.round(pr(hi.b*255,0,255))}getHexString(e=Ut){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Et.workingColorSpace){Et.fromWorkingColorSpace(hi.copy(this),t);const r=hi.r,i=hi.g,s=hi.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,c;const A=(a+o)/2;if(a===o)l=0,c=0;else{const u=o-a;switch(c=A<=.5?u/(o+a):u/(2-o-a),o){case r:l=(i-s)/u+(i0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const r=e[t];if(r===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[t]=r}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const r={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==id&&(r.blending=this.blending),this.side!==Hs&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==XS&&(r.blendSrc=this.blendSrc),this.blendDst!==YS&&(r.blendDst=this.blendDst),this.blendEquation!==au&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==Td&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==sL&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==cf&&(r.stencilFail=this.stencilFail),this.stencilZFail!==cf&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==cf&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let r=null;if(t!==null){const i=t.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=t[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}};class qi extends as{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Qe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new nr,this.combine=a1,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Dl=mee();function mee(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),r=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(r[l]=0,r[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(r[l]=1024>>-c-14,r[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(r[l]=c+15<<10,r[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(r[l]=31744,r[l|256]=64512,i[l]=24,i[l|256]=24):(r[l]=31744,r[l|256]=64512,i[l]=13,i[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,A=0;for(;!(c&8388608);)c<<=1,A-=8388608;c&=-8388609,A+=947912704,s[l]=c|A}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:a}}function gee(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=pr(n,-65504,65504),Dl.floatView[0]=n;const e=Dl.uint32View[0],t=e>>23&511;return Dl.baseTable[t]+((e&8388607)>>Dl.shiftTable[t])}function vee(n){const e=n>>10;return Dl.uint32View[0]=Dl.mantissaTable[Dl.offsetTable[e]+(n&1023)]+Dl.exponentTable[e],Dl.floatView[0]}const wv={toHalfFloat:gee,fromHalfFloat:vee},gr=new $,_v=new We;class ct{constructor(e,t,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=r,this.usage=RC,this.updateRanges=[],this.gpuType=xi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,r){e*=this.itemSize,r*=t.itemSize;for(let i=0,s=this.itemSize;i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const r=this.attributes;for(const l in r){const c=r[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],A=[];for(let u=0,f=c.length;u0&&(i[l]=A,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone(t));const i=e.attributes;for(const c in i){const A=i[c];this.setAttribute(c,A.clone(t))}const s=e.morphAttributes;for(const c in s){const A=[],u=s[c];for(let f=0,h=u.length;f0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s(e.far-e.near)**2))&&(wL.copy(s).invert(),QA.copy(e.ray).applyMatrix4(wL),!(r.boundingBox!==null&&QA.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,t,QA)))}_computeIntersections(e,t,r){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,A=s.attributes.uv1,u=s.attributes.normal,f=s.groups,h=s.drawRange;if(a!==null)if(Array.isArray(o))for(let d=0,m=f.length;dt.far?null:{distance:c,point:Sv.clone(),object:n}}function Cv(n,e,t,r,i,s,o,a,l,c){n.getVertexPosition(a,bv),n.getVertexPosition(l,Ev),n.getVertexPosition(c,Bv);const A=wee(n,e,t,r,bv,Ev,Bv,xL);if(A){const u=new $;Kr.getBarycoord(xL,bv,Ev,Bv,u),i&&(A.uv=Kr.getInterpolatedAttribute(i,a,l,c,u,new We)),s&&(A.uv1=Kr.getInterpolatedAttribute(s,a,l,c,u,new We)),o&&(A.normal=Kr.getInterpolatedAttribute(o,a,l,c,u,new $),A.normal.dot(r.direction)>0&&A.normal.multiplyScalar(-1));const f={a,b:l,c,normal:new $,materialIndex:0};Kr.getNormal(bv,Ev,Bv,f.normal),A.face=f,A.barycoord=u}return A}class g0 extends Jt{constructor(e=1,t=1,r=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],A=[],u=[];let f=0,h=0;d("z","y","x",-1,-1,r,t,e,o,s,0),d("z","y","x",1,-1,r,t,-e,o,s,1),d("x","z","y",1,1,e,r,t,i,o,2),d("x","z","y",1,-1,e,r,-t,i,o,3),d("x","y","z",1,-1,e,t,r,i,s,4),d("x","y","z",-1,-1,e,t,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new xn(c,3)),this.setAttribute("normal",new xn(A,3)),this.setAttribute("uv",new xn(u,2));function d(m,g,p,v,w,_,x,b,B,S,I){const M=_/B,L=x/S,D=_/2,T=x/2,y=b/2,E=B+1,R=S+1;let F=0,O=0;const z=new $;for(let j=0;j0?1:-1,A.push(z.x,z.y,z.z),u.push(C/B),u.push(1-j/S),F+=1}}for(let j=0;j0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(t.extensions=r),t}}class Sz extends Lt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new He,this.projectionMatrix=new He,this.projectionMatrixInverse=new He,this.coordinateSystem=zl}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Ec=new $,xL=new je,bL=new je;class Fr extends Sz{constructor(e=50,t=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Ld*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(qm*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ld*2*Math.atan(Math.tan(qm*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,r){Ec.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Ec.x,Ec.y).multiplyScalar(-e/Ec.z),Ec.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(Ec.x,Ec.y).multiplyScalar(-e/Ec.z)}getViewSize(e,t){return this.getViewBounds(e,xL,bL),t.subVectors(bL,xL)}setViewOffset(e,t,r,i,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(qm*.5*this.fov)/this.zoom,r=2*t,i=this.aspect*r,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,t-=o.offsetY*r/c,i*=o.width/l,r*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-r,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const vf=-90,yf=1;class See extends Lt{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Fr(vf,yf,e,t);i.layers=this.layers,this.add(i);const s=new Fr(vf,yf,e,t);s.layers=this.layers,this.add(s);const o=new Fr(vf,yf,e,t);o.layers=this.layers,this.add(o);const a=new Fr(vf,yf,e,t);a.layers=this.layers,this.add(a);const l=new Fr(vf,yf,e,t);l.layers=this.layers,this.add(l);const c=new Fr(vf,yf,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[r,i,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===zl)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===N_)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,A]=this.children,u=e.getRenderTarget(),f=e.getActiveCubeFace(),h=e.getActiveMipmapLevel(),d=e.xr.enabled;e.xr.enabled=!1;const m=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0,i),e.render(t,s),e.setRenderTarget(r,1,i),e.render(t,o),e.setRenderTarget(r,2,i),e.render(t,a),e.setRenderTarget(r,3,i),e.render(t,l),e.setRenderTarget(r,4,i),e.render(t,c),r.texture.generateMipmaps=m,e.setRenderTarget(r,5,i),e.render(t,A),e.setRenderTarget(u,f,h),e.xr.enabled=d,r.texture.needsPMREMUpdate=!0}}class Mz extends Un{constructor(e,t,r,i,s,o,a,l,c,A){e=e!==void 0?e:[],t=t!==void 0?t:Td,super(e,t,r,i,s,o,a,l,c,A),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Mee extends el{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];this.texture=new Mz(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Lr}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const r={uniforms:{tEquirect:{value:null}},vertexShader:` +}`;class mr extends as{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=xee,this.fragmentShader=bee,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Nd(e.uniforms),this.uniformsGroups=_ee(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const o=this.uniforms[i].value;o&&o.isTexture?t.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[i]={type:"m4",value:o.toArray()}:t.uniforms[i]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(t.extensions=r),t}}class Sz extends Lt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new He,this.projectionMatrix=new He,this.projectionMatrixInverse=new He,this.coordinateSystem=zl}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Ec=new $,bL=new We,EL=new We;class Fr extends Sz{constructor(e=50,t=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Dd*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(eg*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Dd*2*Math.atan(Math.tan(eg*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,r){Ec.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Ec.x,Ec.y).multiplyScalar(-e/Ec.z),Ec.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(Ec.x,Ec.y).multiplyScalar(-e/Ec.z)}getViewSize(e,t){return this.getViewBounds(e,bL,EL),t.subVectors(EL,bL)}setViewOffset(e,t,r,i,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(eg*.5*this.fov)/this.zoom,r=2*t,i=this.aspect*r,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,t-=o.offsetY*r/c,i*=o.width/l,r*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-r,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const wf=-90,_f=1;class Eee extends Lt{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Fr(wf,_f,e,t);i.layers=this.layers,this.add(i);const s=new Fr(wf,_f,e,t);s.layers=this.layers,this.add(s);const o=new Fr(wf,_f,e,t);o.layers=this.layers,this.add(o);const a=new Fr(wf,_f,e,t);a.layers=this.layers,this.add(a);const l=new Fr(wf,_f,e,t);l.layers=this.layers,this.add(l);const c=new Fr(wf,_f,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[r,i,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===zl)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===O_)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,A]=this.children,u=e.getRenderTarget(),f=e.getActiveCubeFace(),h=e.getActiveMipmapLevel(),d=e.xr.enabled;e.xr.enabled=!1;const m=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0,i),e.render(t,s),e.setRenderTarget(r,1,i),e.render(t,o),e.setRenderTarget(r,2,i),e.render(t,a),e.setRenderTarget(r,3,i),e.render(t,l),e.setRenderTarget(r,4,i),e.render(t,c),r.texture.generateMipmaps=m,e.setRenderTarget(r,5,i),e.render(t,A),e.setRenderTarget(u,f,h),e.xr.enabled=d,r.texture.needsPMREMUpdate=!0}}class Cz extends Un{constructor(e,t,r,i,s,o,a,l,c,A){e=e!==void 0?e:[],t=t!==void 0?t:Id,super(e,t,r,i,s,o,a,l,c,A),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Bee extends tl{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];this.texture=new Cz(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Lr}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const r={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; @@ -103,9 +103,9 @@ Error generating stack: `+s.message+` gl_FragColor = texture2D( tEquirect, sampleUV ); } - `},i=new m0(5,5,5),s=new mr({name:"CubemapFromEquirect",uniforms:Dd(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:oi,blending:jl});s.uniforms.tEquirect.value=t;const o=new dn(i,s),a=t.minFilter;return t.minFilter===qo&&(t.minFilter=Lr),new See(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,r,i){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,r,i);e.setRenderTarget(s)}}const PE=new $,Cee=new $,Tee=new dt;class Ta{constructor(e=new $(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,r,i){return this.normal.set(e,t,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,r){const i=PE.subVectors(r,t).cross(Cee.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const r=e.delta(PE),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const r=t||Tee.getNormalMatrix(e),i=this.coplanarPoint(PE).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const HA=new Si,Cv=new $;class u1{constructor(e=new Ta,t=new Ta,r=new Ta,i=new Ta,s=new Ta,o=new Ta){this.planes=[e,t,r,i,s,o]}set(e,t,r,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(r),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let r=0;r<6;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,t=zl){const r=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],A=i[5],u=i[6],f=i[7],h=i[8],d=i[9],m=i[10],g=i[11],p=i[12],v=i[13],w=i[14],_=i[15];if(r[0].setComponents(l-s,f-c,g-h,_-p).normalize(),r[1].setComponents(l+s,f+c,g+h,_+p).normalize(),r[2].setComponents(l+o,f+A,g+d,_+v).normalize(),r[3].setComponents(l-o,f-A,g-d,_-v).normalize(),r[4].setComponents(l-a,f-u,g-m,_-w).normalize(),t===zl)r[5].setComponents(l+a,f+u,g+m,_+w).normalize();else if(t===N_)r[5].setComponents(a,u,m,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),HA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),HA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(HA)}intersectsSprite(e){return HA.center.set(0,0,0),HA.radius=.7071067811865476,HA.applyMatrix4(e.matrixWorld),this.intersectsSphere(HA)}intersectsSphere(e){const t=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(r)0?e.max.x:e.min.x,Cv.y=i.normal.y>0?e.max.y:e.min.y,Cv.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Cv)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let r=0;r<6;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function Cz(){let n=null,e=!1,t=null,r=null;function i(s,o){t(s,o),r=n.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(r=n.requestAnimationFrame(i),e=!0)},stop:function(){n.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function Iee(n){const e=new WeakMap;function t(a,l){const c=a.array,A=a.usage,u=c.byteLength,f=n.createBuffer();n.bindBuffer(l,f),n.bufferData(l,c,A),a.onUploadCallback();let h;if(c instanceof Float32Array)h=n.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?h=n.HALF_FLOAT:h=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)h=n.SHORT;else if(c instanceof Uint32Array)h=n.UNSIGNED_INT;else if(c instanceof Int32Array)h=n.INT;else if(c instanceof Int8Array)h=n.BYTE;else if(c instanceof Uint8Array)h=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)h=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:f,type:h,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:u}}function r(a,l,c){const A=l.array,u=l.updateRanges;if(n.bindBuffer(c,a),u.length===0)n.bufferSubData(c,0,A);else{u.sort((h,d)=>h.start-d.start);let f=0;for(let h=1;h1?null:t.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const r=t||See.getNormalMatrix(e),i=this.coplanarPoint(DE).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const HA=new Mi,Tv=new $;class f1{constructor(e=new Ra,t=new Ra,r=new Ra,i=new Ra,s=new Ra,o=new Ra){this.planes=[e,t,r,i,s,o]}set(e,t,r,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(r),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let r=0;r<6;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,t=zl){const r=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],A=i[5],u=i[6],f=i[7],h=i[8],d=i[9],m=i[10],g=i[11],p=i[12],v=i[13],w=i[14],_=i[15];if(r[0].setComponents(l-s,f-c,g-h,_-p).normalize(),r[1].setComponents(l+s,f+c,g+h,_+p).normalize(),r[2].setComponents(l+o,f+A,g+d,_+v).normalize(),r[3].setComponents(l-o,f-A,g-d,_-v).normalize(),r[4].setComponents(l-a,f-u,g-m,_-w).normalize(),t===zl)r[5].setComponents(l+a,f+u,g+m,_+w).normalize();else if(t===O_)r[5].setComponents(a,u,m,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),HA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),HA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(HA)}intersectsSprite(e){return HA.center.set(0,0,0),HA.radius=.7071067811865476,HA.applyMatrix4(e.matrixWorld),this.intersectsSphere(HA)}intersectsSphere(e){const t=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(r)0?e.max.x:e.min.x,Tv.y=i.normal.y>0?e.max.y:e.min.y,Tv.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Tv)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let r=0;r<6;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function Tz(){let n=null,e=!1,t=null,r=null;function i(s,o){t(s,o),r=n.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(r=n.requestAnimationFrame(i),e=!0)},stop:function(){n.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function Cee(n){const e=new WeakMap;function t(a,l){const c=a.array,A=a.usage,u=c.byteLength,f=n.createBuffer();n.bindBuffer(l,f),n.bufferData(l,c,A),a.onUploadCallback();let h;if(c instanceof Float32Array)h=n.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?h=n.HALF_FLOAT:h=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)h=n.SHORT;else if(c instanceof Uint32Array)h=n.UNSIGNED_INT;else if(c instanceof Int32Array)h=n.INT;else if(c instanceof Int8Array)h=n.BYTE;else if(c instanceof Uint8Array)h=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)h=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:f,type:h,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:u}}function r(a,l,c){const A=l.array,u=l.updateRanges;if(n.bindBuffer(c,a),u.length===0)n.bufferSubData(c,0,A);else{u.sort((h,d)=>h.start-d.start);let f=0;for(let h=1;h 0 +#endif`,Vee=`#if NUM_CLIPPING_PLANES > 0 vec4 plane; #ifdef ALPHA_TO_COVERAGE float distanceToPlane, distanceGradient; @@ -355,26 +355,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve if ( clipped ) discard; #endif #endif -#endif`,Kee=`#if NUM_CLIPPING_PLANES > 0 +#endif`,jee=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,Xee=`#if NUM_CLIPPING_PLANES > 0 +#endif`,Wee=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; -#endif`,Yee=`#if NUM_CLIPPING_PLANES > 0 +#endif`,Kee=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; -#endif`,$ee=`#if defined( USE_COLOR_ALPHA ) +#endif`,Xee=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; -#endif`,Zee=`#if defined( USE_COLOR_ALPHA ) +#endif`,Yee=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; -#endif`,Jee=`#if defined( USE_COLOR_ALPHA ) +#endif`,$ee=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) varying vec3 vColor; -#endif`,qee=`#if defined( USE_COLOR_ALPHA ) +#endif`,Zee=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) vColor = vec3( 1.0 ); @@ -388,7 +388,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve #ifdef USE_BATCHING_COLOR vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); vColor.xyz *= batchingColor.xyz; -#endif`,ete=`#define PI 3.141592653589793 +#endif`,Jee=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 @@ -462,7 +462,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} // validated`,tte=`#ifdef ENVMAP_TYPE_CUBE_UV +} // validated`,qee=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { @@ -555,7 +555,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { return vec4( mix( color0, color1, mipF ), 1.0 ); } } -#endif`,nte=`vec3 transformedNormal = objectNormal; +#endif`,ete=`vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT vec3 transformedTangent = objectTangent; #endif @@ -584,18 +584,18 @@ transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif -#endif`,rte=`#ifdef USE_DISPLACEMENTMAP +#endif`,tte=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; -#endif`,ite=`#ifdef USE_DISPLACEMENTMAP +#endif`,nte=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,ste=`#ifdef USE_EMISSIVEMAP +#endif`,rte=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,ote=`#ifdef USE_EMISSIVEMAP +#endif`,ite=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; -#endif`,ate="gl_FragColor = linearToOutputTexel( gl_FragColor );",lte=` +#endif`,ste="gl_FragColor = linearToOutputTexel( gl_FragColor );",ote=` const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( vec3( 0.8224621, 0.177538, 0.0 ), vec3( 0.0331941, 0.9668058, 0.0 ), @@ -617,7 +617,7 @@ vec4 LinearTransferOETF( in vec4 value ) { } vec4 sRGBTransferOETF( in vec4 value ) { return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); -}`,cte=`#ifdef USE_ENVMAP +}`,ate=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { @@ -646,7 +646,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif -#endif`,Ate=`#ifdef USE_ENVMAP +#endif`,lte=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; uniform mat3 envMapRotation; @@ -656,7 +656,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { uniform sampler2D envMap; #endif -#endif`,ute=`#ifdef USE_ENVMAP +#endif`,cte=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS @@ -667,7 +667,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { #else varying vec3 vReflect; #endif -#endif`,fte=`#ifdef USE_ENVMAP +#endif`,Ate=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif @@ -678,7 +678,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { varying vec3 vReflect; uniform float refractionRatio; #endif -#endif`,hte=`#ifdef USE_ENVMAP +#endif`,ute=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else @@ -695,18 +695,18 @@ vec4 sRGBTransferOETF( in vec4 value ) { vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif -#endif`,dte=`#ifdef USE_FOG +#endif`,fte=`#ifdef USE_FOG vFogDepth = - mvPosition.z; -#endif`,pte=`#ifdef USE_FOG +#endif`,hte=`#ifdef USE_FOG varying float vFogDepth; -#endif`,mte=`#ifdef USE_FOG +#endif`,dte=`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); -#endif`,gte=`#ifdef USE_FOG +#endif`,pte=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 @@ -715,7 +715,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { uniform float fogNear; uniform float fogFar; #endif -#endif`,vte=`#ifdef USE_GRADIENTMAP +#endif`,mte=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { @@ -727,12 +727,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { vec2 fw = fwidth( coord ) * 0.5; return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); #endif -}`,yte=`#ifdef USE_LIGHTMAP +}`,gte=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; -#endif`,wte=`LambertMaterial material; +#endif`,vte=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,_te=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,yte=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; @@ -746,7 +746,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert -#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,xte=`uniform bool receiveShadow; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,wte=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; @@ -862,7 +862,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } -#endif`,bte=`#ifdef USE_ENVMAP +#endif`,_te=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); @@ -895,8 +895,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi #endif } #endif -#endif`,Ete=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,Bte=`varying vec3 vViewPosition; +#endif`,xte=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,bte=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; @@ -908,11 +908,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Ste=`BlinnPhongMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Ete=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; -material.specularStrength = specularStrength;`,Mte=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,Bte=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; @@ -929,7 +929,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Cte=`PhysicalMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Mte=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); @@ -1015,7 +1015,7 @@ material.roughness = min( material.roughness, 1.0 ); material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; -#endif`,Tte=`struct PhysicalMaterial { +#endif`,Ste=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; @@ -1316,7 +1316,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); -}`,Ite=` +}`,Cte=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); @@ -1431,7 +1431,7 @@ IncidentLight directLight; #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,Rte=`#if defined( RE_IndirectDiffuse ) +#endif`,Tte=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; @@ -1450,33 +1450,33 @@ IncidentLight directLight; #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif -#endif`,Ute=`#if defined( RE_IndirectDiffuse ) +#endif`,Ite=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif`,Fte=`#if defined( USE_LOGDEPTHBUF ) +#endif`,Rte=`#if defined( USE_LOGDEPTHBUF ) gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,Pte=`#if defined( USE_LOGDEPTHBUF ) +#endif`,Ute=`#if defined( USE_LOGDEPTHBUF ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; -#endif`,Lte=`#ifdef USE_LOGDEPTHBUF +#endif`,Fte=`#ifdef USE_LOGDEPTHBUF varying float vFragDepth; varying float vIsPerspective; -#endif`,Dte=`#ifdef USE_LOGDEPTHBUF +#endif`,Pte=`#ifdef USE_LOGDEPTHBUF vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); -#endif`,Nte=`#ifdef USE_MAP +#endif`,Lte=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); #endif diffuseColor *= sampledDiffuseColor; -#endif`,Ote=`#ifdef USE_MAP +#endif`,Dte=`#ifdef USE_MAP uniform sampler2D map; -#endif`,kte=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) +#endif`,Nte=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else @@ -1488,7 +1488,7 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,Hte=`#if defined( USE_POINTS_UV ) +#endif`,Ote=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) @@ -1500,19 +1500,19 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; -#endif`,Qte=`float metalnessFactor = metalness; +#endif`,kte=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; -#endif`,zte=`#ifdef USE_METALNESSMAP +#endif`,Qte=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; -#endif`,Gte=`#ifdef USE_INSTANCING_MORPH +#endif`,Hte=`#ifdef USE_INSTANCING_MORPH float morphTargetInfluences[ MORPHTARGETS_COUNT ]; float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; } -#endif`,Vte=`#if defined( USE_MORPHCOLORS ) +#endif`,zte=`#if defined( USE_MORPHCOLORS ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) @@ -1521,12 +1521,12 @@ IncidentLight directLight; if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } -#endif`,jte=`#ifdef USE_MORPHNORMALS +#endif`,Gte=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; } -#endif`,Wte=`#ifdef USE_MORPHTARGETS +#endif`,Vte=`#ifdef USE_MORPHTARGETS #ifndef USE_INSTANCING_MORPH uniform float morphTargetBaseInfluence; uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; @@ -1540,12 +1540,12 @@ IncidentLight directLight; ivec3 morphUV = ivec3( x, y, morphTargetIndex ); return texelFetch( morphTargetsTexture, morphUV, 0 ); } -#endif`,Kte=`#ifdef USE_MORPHTARGETS +#endif`,jte=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; } -#endif`,Xte=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#endif`,Wte=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); @@ -1586,7 +1586,7 @@ IncidentLight directLight; tbn2[1] *= faceDirection; #endif #endif -vec3 nonPerturbedNormal = normal;`,Yte=`#ifdef USE_NORMALMAP_OBJECTSPACE +vec3 nonPerturbedNormal = normal;`,Kte=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; @@ -1601,25 +1601,25 @@ vec3 nonPerturbedNormal = normal;`,Yte=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,$te=`#ifndef FLAT_SHADED +#endif`,Xte=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,Zte=`#ifndef FLAT_SHADED +#endif`,Yte=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,Jte=`#ifndef FLAT_SHADED +#endif`,$te=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif -#endif`,qte=`#ifdef USE_NORMALMAP +#endif`,Zte=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif @@ -1641,13 +1641,13 @@ vec3 nonPerturbedNormal = normal;`,Yte=`#ifdef USE_NORMALMAP_OBJECTSPACE float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } -#endif`,ene=`#ifdef USE_CLEARCOAT +#endif`,Jte=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; -#endif`,tne=`#ifdef USE_CLEARCOAT_NORMALMAP +#endif`,qte=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,nne=`#ifdef USE_CLEARCOATMAP +#endif`,ene=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP @@ -1656,18 +1656,18 @@ vec3 nonPerturbedNormal = normal;`,Yte=`#ifdef USE_NORMALMAP_OBJECTSPACE #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; -#endif`,rne=`#ifdef USE_IRIDESCENCEMAP +#endif`,tne=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; -#endif`,ine=`#ifdef OPAQUE +#endif`,nne=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,sne=`vec3 packNormalToRGB( const in vec3 normal ) { +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,rne=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { @@ -1736,9 +1736,9 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const } float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * depth - far ); -}`,one=`#ifdef PREMULTIPLIED_ALPHA +}`,ine=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; -#endif`,ane=`vec4 mvPosition = vec4( transformed, 1.0 ); +#endif`,sne=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING mvPosition = batchingMatrix * mvPosition; #endif @@ -1746,22 +1746,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,lne=`#ifdef DITHERING +gl_Position = projectionMatrix * mvPosition;`,one=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,cne=`#ifdef DITHERING +#endif`,ane=`#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } -#endif`,Ane=`float roughnessFactor = roughness; +#endif`,lne=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; -#endif`,une=`#ifdef USE_ROUGHNESSMAP +#endif`,cne=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; -#endif`,fne=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,Ane=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 @@ -1947,7 +1947,7 @@ gl_Position = projectionMatrix * mvPosition;`,lne=`#ifdef DITHERING } return mix( 1.0, shadow, shadowIntensity ); } -#endif`,hne=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,une=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif @@ -1988,7 +1988,7 @@ gl_Position = projectionMatrix * mvPosition;`,lne=`#ifdef DITHERING }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif -#endif`,dne=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) +#endif`,fne=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif @@ -2020,7 +2020,7 @@ gl_Position = projectionMatrix * mvPosition;`,lne=`#ifdef DITHERING vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end -#endif`,pne=`float getShadowMask() { +#endif`,hne=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 @@ -2052,12 +2052,12 @@ gl_Position = projectionMatrix * mvPosition;`,lne=`#ifdef DITHERING #endif #endif return shadow; -}`,mne=`#ifdef USE_SKINNING +}`,dne=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,gne=`#ifdef USE_SKINNING +#endif`,pne=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; @@ -2072,7 +2072,7 @@ gl_Position = projectionMatrix * mvPosition;`,lne=`#ifdef DITHERING vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } -#endif`,vne=`#ifdef USE_SKINNING +#endif`,mne=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; @@ -2080,7 +2080,7 @@ gl_Position = projectionMatrix * mvPosition;`,lne=`#ifdef DITHERING skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,yne=`#ifdef USE_SKINNING +#endif`,gne=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; @@ -2091,17 +2091,17 @@ gl_Position = projectionMatrix * mvPosition;`,lne=`#ifdef DITHERING #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif -#endif`,wne=`float specularStrength; +#endif`,vne=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; -#endif`,_ne=`#ifdef USE_SPECULARMAP +#endif`,yne=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; -#endif`,xne=`#if defined( TONE_MAPPING ) +#endif`,wne=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,bne=`#ifndef saturate +#endif`,_ne=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; @@ -2198,7 +2198,7 @@ vec3 NeutralToneMapping( vec3 color ) { float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); return mix( color, vec3( newPeak ), g ); } -vec3 CustomToneMapping( vec3 color ) { return color; }`,Ene=`#ifdef USE_TRANSMISSION +vec3 CustomToneMapping( vec3 color ) { return color; }`,xne=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; @@ -2219,7 +2219,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Ene=`#ifdef USE_TRANSMIS material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,Bne=`#ifdef USE_TRANSMISSION +#endif`,bne=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; @@ -2350,7 +2350,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Ene=`#ifdef USE_TRANSMIS float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); } -#endif`,Sne=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,Ene=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2420,7 +2420,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Ene=`#ifdef USE_TRANSMIS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,Mne=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,Bne=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2514,7 +2514,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Ene=`#ifdef USE_TRANSMIS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,Cne=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,Mne=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP @@ -2585,7 +2585,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Ene=`#ifdef USE_TRANSMIS #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,Tne=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 +#endif`,Sne=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING worldPosition = batchingMatrix * worldPosition; @@ -2594,12 +2594,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Ene=`#ifdef USE_TRANSMIS worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; -#endif`;const Ine=`varying vec2 vUv; +#endif`;const Cne=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,Rne=`uniform sampler2D t2D; +}`,Tne=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { @@ -2611,14 +2611,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,Une=`varying vec3 vWorldDirection; +}`,Ine=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,Fne=`#ifdef ENVMAP_TYPE_CUBE +}`,Rne=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; @@ -2641,14 +2641,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,Pne=`varying vec3 vWorldDirection; +}`,Une=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,Lne=`uniform samplerCube tCube; +}`,Fne=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; @@ -2658,7 +2658,7 @@ void main() { gl_FragColor.a *= opacity; #include #include -}`,Dne=`#include +}`,Pne=`#include #include #include #include @@ -2685,7 +2685,7 @@ void main() { #include #include vHighPrecisionZW = gl_Position.zw; -}`,Nne=`#if DEPTH_PACKING == 3200 +}`,Lne=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include @@ -2719,7 +2719,7 @@ void main() { #elif DEPTH_PACKING == 3203 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); #endif -}`,One=`#define DISTANCE +}`,Dne=`#define DISTANCE varying vec3 vWorldPosition; #include #include @@ -2746,7 +2746,7 @@ void main() { #include #include vWorldPosition = worldPosition.xyz; -}`,kne=`#define DISTANCE +}`,Nne=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; @@ -2770,13 +2770,13 @@ void main () { dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); -}`,Hne=`varying vec3 vWorldDirection; +}`,One=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include -}`,Qne=`uniform sampler2D tEquirect; +}`,kne=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { @@ -2785,7 +2785,7 @@ void main() { gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include -}`,zne=`uniform float scale; +}`,Qne=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include @@ -2807,7 +2807,7 @@ void main() { #include #include #include -}`,Gne=`uniform vec3 diffuse; +}`,Hne=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; @@ -2835,7 +2835,7 @@ void main() { #include #include #include -}`,Vne=`#include +}`,zne=`#include #include #include #include @@ -2867,7 +2867,7 @@ void main() { #include #include #include -}`,jne=`uniform vec3 diffuse; +}`,Gne=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; @@ -2915,7 +2915,7 @@ void main() { #include #include #include -}`,Wne=`#define LAMBERT +}`,Vne=`#define LAMBERT varying vec3 vViewPosition; #include #include @@ -2954,7 +2954,7 @@ void main() { #include #include #include -}`,Kne=`#define LAMBERT +}`,jne=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3011,7 +3011,7 @@ void main() { #include #include #include -}`,Xne=`#define MATCAP +}`,Wne=`#define MATCAP varying vec3 vViewPosition; #include #include @@ -3045,7 +3045,7 @@ void main() { #include #include vViewPosition = - mvPosition.xyz; -}`,Yne=`#define MATCAP +}`,Kne=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; @@ -3091,7 +3091,7 @@ void main() { #include #include #include -}`,$ne=`#define NORMAL +}`,Xne=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif @@ -3124,7 +3124,7 @@ void main() { #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif -}`,Zne=`#define NORMAL +}`,Yne=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; @@ -3146,7 +3146,7 @@ void main() { #ifdef OPAQUE gl_FragColor.a = 1.0; #endif -}`,Jne=`#define PHONG +}`,$ne=`#define PHONG varying vec3 vViewPosition; #include #include @@ -3185,7 +3185,7 @@ void main() { #include #include #include -}`,qne=`#define PHONG +}`,Zne=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; @@ -3244,7 +3244,7 @@ void main() { #include #include #include -}`,ere=`#define STANDARD +}`,Jne=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; @@ -3287,7 +3287,7 @@ void main() { #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif -}`,tre=`#define STANDARD +}`,qne=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR @@ -3412,7 +3412,7 @@ void main() { #include #include #include -}`,nre=`#define TOON +}`,ere=`#define TOON varying vec3 vViewPosition; #include #include @@ -3449,7 +3449,7 @@ void main() { #include #include #include -}`,rre=`#define TOON +}`,tre=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3502,7 +3502,7 @@ void main() { #include #include #include -}`,ire=`uniform float size; +}`,nre=`uniform float size; uniform float scale; #include #include @@ -3533,7 +3533,7 @@ void main() { #include #include #include -}`,sre=`uniform vec3 diffuse; +}`,rre=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3558,7 +3558,7 @@ void main() { #include #include #include -}`,ore=`#include +}`,ire=`#include #include #include #include @@ -3581,7 +3581,7 @@ void main() { #include #include #include -}`,are=`uniform vec3 color; +}`,sre=`uniform vec3 color; uniform float opacity; #include #include @@ -3597,7 +3597,7 @@ void main() { #include #include #include -}`,lre=`uniform float rotation; +}`,ore=`uniform float rotation; uniform vec2 center; #include #include @@ -3621,7 +3621,7 @@ void main() { #include #include #include -}`,cre=`uniform vec3 diffuse; +}`,are=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3646,7 +3646,7 @@ void main() { #include #include #include -}`,St={alphahash_fragment:Ree,alphahash_pars_fragment:Uee,alphamap_fragment:Fee,alphamap_pars_fragment:Pee,alphatest_fragment:Lee,alphatest_pars_fragment:Dee,aomap_fragment:Nee,aomap_pars_fragment:Oee,batching_pars_vertex:kee,batching_vertex:Hee,begin_vertex:Qee,beginnormal_vertex:zee,bsdfs:Gee,iridescence_fragment:Vee,bumpmap_pars_fragment:jee,clipping_planes_fragment:Wee,clipping_planes_pars_fragment:Kee,clipping_planes_pars_vertex:Xee,clipping_planes_vertex:Yee,color_fragment:$ee,color_pars_fragment:Zee,color_pars_vertex:Jee,color_vertex:qee,common:ete,cube_uv_reflection_fragment:tte,defaultnormal_vertex:nte,displacementmap_pars_vertex:rte,displacementmap_vertex:ite,emissivemap_fragment:ste,emissivemap_pars_fragment:ote,colorspace_fragment:ate,colorspace_pars_fragment:lte,envmap_fragment:cte,envmap_common_pars_fragment:Ate,envmap_pars_fragment:ute,envmap_pars_vertex:fte,envmap_physical_pars_fragment:bte,envmap_vertex:hte,fog_vertex:dte,fog_pars_vertex:pte,fog_fragment:mte,fog_pars_fragment:gte,gradientmap_pars_fragment:vte,lightmap_pars_fragment:yte,lights_lambert_fragment:wte,lights_lambert_pars_fragment:_te,lights_pars_begin:xte,lights_toon_fragment:Ete,lights_toon_pars_fragment:Bte,lights_phong_fragment:Ste,lights_phong_pars_fragment:Mte,lights_physical_fragment:Cte,lights_physical_pars_fragment:Tte,lights_fragment_begin:Ite,lights_fragment_maps:Rte,lights_fragment_end:Ute,logdepthbuf_fragment:Fte,logdepthbuf_pars_fragment:Pte,logdepthbuf_pars_vertex:Lte,logdepthbuf_vertex:Dte,map_fragment:Nte,map_pars_fragment:Ote,map_particle_fragment:kte,map_particle_pars_fragment:Hte,metalnessmap_fragment:Qte,metalnessmap_pars_fragment:zte,morphinstance_vertex:Gte,morphcolor_vertex:Vte,morphnormal_vertex:jte,morphtarget_pars_vertex:Wte,morphtarget_vertex:Kte,normal_fragment_begin:Xte,normal_fragment_maps:Yte,normal_pars_fragment:$te,normal_pars_vertex:Zte,normal_vertex:Jte,normalmap_pars_fragment:qte,clearcoat_normal_fragment_begin:ene,clearcoat_normal_fragment_maps:tne,clearcoat_pars_fragment:nne,iridescence_pars_fragment:rne,opaque_fragment:ine,packing:sne,premultiplied_alpha_fragment:one,project_vertex:ane,dithering_fragment:lne,dithering_pars_fragment:cne,roughnessmap_fragment:Ane,roughnessmap_pars_fragment:une,shadowmap_pars_fragment:fne,shadowmap_pars_vertex:hne,shadowmap_vertex:dne,shadowmask_pars_fragment:pne,skinbase_vertex:mne,skinning_pars_vertex:gne,skinning_vertex:vne,skinnormal_vertex:yne,specularmap_fragment:wne,specularmap_pars_fragment:_ne,tonemapping_fragment:xne,tonemapping_pars_fragment:bne,transmission_fragment:Ene,transmission_pars_fragment:Bne,uv_pars_fragment:Sne,uv_pars_vertex:Mne,uv_vertex:Cne,worldpos_vertex:Tne,background_vert:Ine,background_frag:Rne,backgroundCube_vert:Une,backgroundCube_frag:Fne,cube_vert:Pne,cube_frag:Lne,depth_vert:Dne,depth_frag:Nne,distanceRGBA_vert:One,distanceRGBA_frag:kne,equirect_vert:Hne,equirect_frag:Qne,linedashed_vert:zne,linedashed_frag:Gne,meshbasic_vert:Vne,meshbasic_frag:jne,meshlambert_vert:Wne,meshlambert_frag:Kne,meshmatcap_vert:Xne,meshmatcap_frag:Yne,meshnormal_vert:$ne,meshnormal_frag:Zne,meshphong_vert:Jne,meshphong_frag:qne,meshphysical_vert:ere,meshphysical_frag:tre,meshtoon_vert:nre,meshtoon_frag:rre,points_vert:ire,points_frag:sre,shadow_vert:ore,shadow_frag:are,sprite_vert:lre,sprite_frag:cre},ze={common:{diffuse:{value:new ke(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new dt},alphaMap:{value:null},alphaMapTransform:{value:new dt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new dt}},envmap:{envMap:{value:null},envMapRotation:{value:new dt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new dt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new dt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new dt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new dt},normalScale:{value:new je(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new dt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new dt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new dt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new dt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ke(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ke(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new dt},alphaTest:{value:0},uvTransform:{value:new dt}},sprite:{diffuse:{value:new ke(16777215)},opacity:{value:1},center:{value:new je(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new dt},alphaMap:{value:null},alphaMapTransform:{value:new dt},alphaTest:{value:0}}},Ia={basic:{uniforms:Ui([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.fog]),vertexShader:St.meshbasic_vert,fragmentShader:St.meshbasic_frag},lambert:{uniforms:Ui([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,ze.lights,{emissive:{value:new ke(0)}}]),vertexShader:St.meshlambert_vert,fragmentShader:St.meshlambert_frag},phong:{uniforms:Ui([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,ze.lights,{emissive:{value:new ke(0)},specular:{value:new ke(1118481)},shininess:{value:30}}]),vertexShader:St.meshphong_vert,fragmentShader:St.meshphong_frag},standard:{uniforms:Ui([ze.common,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.roughnessmap,ze.metalnessmap,ze.fog,ze.lights,{emissive:{value:new ke(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:St.meshphysical_vert,fragmentShader:St.meshphysical_frag},toon:{uniforms:Ui([ze.common,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.gradientmap,ze.fog,ze.lights,{emissive:{value:new ke(0)}}]),vertexShader:St.meshtoon_vert,fragmentShader:St.meshtoon_frag},matcap:{uniforms:Ui([ze.common,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,{matcap:{value:null}}]),vertexShader:St.meshmatcap_vert,fragmentShader:St.meshmatcap_frag},points:{uniforms:Ui([ze.points,ze.fog]),vertexShader:St.points_vert,fragmentShader:St.points_frag},dashed:{uniforms:Ui([ze.common,ze.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:St.linedashed_vert,fragmentShader:St.linedashed_frag},depth:{uniforms:Ui([ze.common,ze.displacementmap]),vertexShader:St.depth_vert,fragmentShader:St.depth_frag},normal:{uniforms:Ui([ze.common,ze.bumpmap,ze.normalmap,ze.displacementmap,{opacity:{value:1}}]),vertexShader:St.meshnormal_vert,fragmentShader:St.meshnormal_frag},sprite:{uniforms:Ui([ze.sprite,ze.fog]),vertexShader:St.sprite_vert,fragmentShader:St.sprite_frag},background:{uniforms:{uvTransform:{value:new dt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:St.background_vert,fragmentShader:St.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new dt}},vertexShader:St.backgroundCube_vert,fragmentShader:St.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:St.cube_vert,fragmentShader:St.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:St.equirect_vert,fragmentShader:St.equirect_frag},distanceRGBA:{uniforms:Ui([ze.common,ze.displacementmap,{referencePosition:{value:new $},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:St.distanceRGBA_vert,fragmentShader:St.distanceRGBA_frag},shadow:{uniforms:Ui([ze.lights,ze.fog,{color:{value:new ke(0)},opacity:{value:1}}]),vertexShader:St.shadow_vert,fragmentShader:St.shadow_frag}};Ia.physical={uniforms:Ui([Ia.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new dt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new dt},clearcoatNormalScale:{value:new je(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new dt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new dt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new dt},sheen:{value:0},sheenColor:{value:new ke(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new dt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new dt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new dt},transmissionSamplerSize:{value:new je},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new dt},attenuationDistance:{value:0},attenuationColor:{value:new ke(0)},specularColor:{value:new ke(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new dt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new dt},anisotropyVector:{value:new je},anisotropyMap:{value:null},anisotropyMapTransform:{value:new dt}}]),vertexShader:St.meshphysical_vert,fragmentShader:St.meshphysical_frag};const Tv={r:0,b:0,g:0},QA=new tr,Are=new He;function ure(n,e,t,r,i,s,o){const a=new ke(0);let l=s===!0?0:1,c,A,u=null,f=0,h=null;function d(v){let w=v.isScene===!0?v.background:null;return w&&w.isTexture&&(w=(v.backgroundBlurriness>0?t:e).get(w)),w}function m(v){let w=!1;const _=d(v);_===null?p(a,l):_&&_.isColor&&(p(_,1),w=!0);const x=n.xr.getEnvironmentBlendMode();x==="additive"?r.buffers.color.setClear(0,0,0,1,o):x==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,o),(n.autoClear||w)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function g(v,w){const _=d(w);_&&(_.isCubeTexture||_.mapping===a1)?(A===void 0&&(A=new dn(new m0(1,1,1),new mr({name:"BackgroundCubeMaterial",uniforms:Dd(Ia.backgroundCube.uniforms),vertexShader:Ia.backgroundCube.vertexShader,fragmentShader:Ia.backgroundCube.fragmentShader,side:oi,depthTest:!1,depthWrite:!1,fog:!1})),A.geometry.deleteAttribute("normal"),A.geometry.deleteAttribute("uv"),A.onBeforeRender=function(x,b,B){this.matrixWorld.copyPosition(B.matrixWorld)},Object.defineProperty(A.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(A)),QA.copy(w.backgroundRotation),QA.x*=-1,QA.y*=-1,QA.z*=-1,_.isCubeTexture&&_.isRenderTargetTexture===!1&&(QA.y*=-1,QA.z*=-1),A.material.uniforms.envMap.value=_,A.material.uniforms.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,A.material.uniforms.backgroundBlurriness.value=w.backgroundBlurriness,A.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,A.material.uniforms.backgroundRotation.value.setFromMatrix4(Are.makeRotationFromEuler(QA)),A.material.toneMapped=Et.getTransfer(_.colorSpace)!==Mn,(u!==_||f!==_.version||h!==n.toneMapping)&&(A.material.needsUpdate=!0,u=_,f=_.version,h=n.toneMapping),A.layers.enableAll(),v.unshift(A,A.geometry,A.material,0,0,null)):_&&_.isTexture&&(c===void 0&&(c=new dn(new cc(2,2),new mr({name:"BackgroundMaterial",uniforms:Dd(Ia.background.uniforms),vertexShader:Ia.background.vertexShader,fragmentShader:Ia.background.fragmentShader,side:Qs,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=_,c.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,c.material.toneMapped=Et.getTransfer(_.colorSpace)!==Mn,_.matrixAutoUpdate===!0&&_.updateMatrix(),c.material.uniforms.uvTransform.value.copy(_.matrix),(u!==_||f!==_.version||h!==n.toneMapping)&&(c.material.needsUpdate=!0,u=_,f=_.version,h=n.toneMapping),c.layers.enableAll(),v.unshift(c,c.geometry,c.material,0,0,null))}function p(v,w){v.getRGB(Tv,Bz(n)),r.buffers.color.setClear(Tv.r,Tv.g,Tv.b,w,o)}return{getClearColor:function(){return a},setClearColor:function(v,w=1){a.set(v),l=w,p(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(v){l=v,p(a,l)},render:m,addToRenderList:g}}function fre(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),r={},i=f(null);let s=i,o=!1;function a(S,L,D,T,y){let E=!1;const R=u(T,D,L);s!==R&&(s=R,c(s.object)),E=h(S,T,D,y),E&&d(S,T,D,y),y!==null&&e.update(y,n.ELEMENT_ARRAY_BUFFER),(E||o)&&(o=!1,_(S,L,D,T),y!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(y).buffer))}function l(){return n.createVertexArray()}function c(S){return n.bindVertexArray(S)}function A(S){return n.deleteVertexArray(S)}function u(S,L,D){const T=D.wireframe===!0;let y=r[S.id];y===void 0&&(y={},r[S.id]=y);let E=y[L.id];E===void 0&&(E={},y[L.id]=E);let R=E[T];return R===void 0&&(R=f(l()),E[T]=R),R}function f(S){const L=[],D=[],T=[];for(let y=0;y=0){const j=y[O];let H=E[O];if(H===void 0&&(O==="instanceMatrix"&&S.instanceMatrix&&(H=S.instanceMatrix),O==="instanceColor"&&S.instanceColor&&(H=S.instanceColor)),j===void 0||j.attribute!==H||H&&j.data!==H.data)return!0;R++}return s.attributesNum!==R||s.index!==T}function d(S,L,D,T){const y={},E=L.attributes;let R=0;const F=D.getAttributes();for(const O in F)if(F[O].location>=0){let j=E[O];j===void 0&&(O==="instanceMatrix"&&S.instanceMatrix&&(j=S.instanceMatrix),O==="instanceColor"&&S.instanceColor&&(j=S.instanceColor));const H={};H.attribute=j,j&&j.data&&(H.data=j.data),y[O]=H,R++}s.attributes=y,s.attributesNum=R,s.index=T}function m(){const S=s.newAttributes;for(let L=0,D=S.length;L=0){let z=y[F];if(z===void 0&&(F==="instanceMatrix"&&S.instanceMatrix&&(z=S.instanceMatrix),F==="instanceColor"&&S.instanceColor&&(z=S.instanceColor)),z!==void 0){const j=z.normalized,H=z.itemSize,C=e.get(z);if(C===void 0)continue;const W=C.buffer,ee=C.type,P=C.bytesPerElement,re=ee===n.INT||ee===n.UNSIGNED_INT||z.gpuType===SR;if(z.isInterleavedBufferAttribute){const ue=z.data,le=ue.stride,me=z.offset;if(ue.isInstancedInterleavedBuffer){for(let ie=0;ie0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";B="mediump"}return B==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const A=l(c);A!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",A,"instead."),c=A);const u=t.logarithmicDepthBuffer===!0,f=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control");if(f===!0){const B=e.get("EXT_clip_control");B.clipControlEXT(B.LOWER_LEFT_EXT,B.ZERO_TO_ONE_EXT)}const h=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),d=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_TEXTURE_SIZE),g=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),p=n.getParameter(n.MAX_VERTEX_ATTRIBS),v=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),w=n.getParameter(n.MAX_VARYING_VECTORS),_=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),x=d>0,b=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:u,reverseDepthBuffer:f,maxTextures:h,maxVertexTextures:d,maxTextureSize:m,maxCubemapSize:g,maxAttributes:p,maxVertexUniforms:v,maxVaryings:w,maxFragmentUniforms:_,vertexTextures:x,maxSamples:b}}function pre(n){const e=this;let t=null,r=0,i=!1,s=!1;const o=new Ta,a=new dt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,f){const h=u.length!==0||f||r!==0||i;return i=f,r=u.length,h},this.beginShadows=function(){s=!0,A(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,f){t=A(u,f,0)},this.setState=function(u,f,h){const d=u.clippingPlanes,m=u.clipIntersection,g=u.clipShadows,p=n.get(u);if(!i||d===null||d.length===0||s&&!g)s?A(null):c();else{const v=s?0:r,w=v*4;let _=p.clippingState||null;l.value=_,_=A(d,f,w,h);for(let x=0;x!==w;++x)_[x]=t[x];p.clippingState=_,this.numIntersection=m?this.numPlanes:0,this.numPlanes+=v}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function A(u,f,h,d){const m=u!==null?u.length:0;let g=null;if(m!==0){if(g=l.value,d!==!0||g===null){const p=h+m*4,v=f.matrixWorldInverse;a.getNormalMatrix(v),(g===null||g.length0){const c=new Mee(l.height);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",i),t(c.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}class g0 extends Sz{constructor(e=-1,t=1,r=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,r,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,o=r+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,A=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=A*this.view.offsetY,l=a-A*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Nh=4,EL=[.125,.215,.35,.446,.526,.582],au=20,LE=new g0,BL=new ke;let DE=null,NE=0,OE=0,kE=!1;const nu=(1+Math.sqrt(5))/2,wf=1/nu,SL=[new $(-nu,wf,0),new $(nu,wf,0),new $(-wf,0,nu),new $(wf,0,nu),new $(0,nu,-wf),new $(0,nu,wf),new $(-1,1,-1),new $(1,1,-1),new $(-1,1,1),new $(1,1,1)];class ML{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,r=.1,i=100){DE=this._renderer.getRenderTarget(),NE=this._renderer.getActiveCubeFace(),OE=this._renderer.getActiveMipmapLevel(),kE=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,r,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=IL(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=TL(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?w:0,w,w),A.setRenderTarget(i),m&&A.render(d,a),A.render(e,a)}d.geometry.dispose(),d.material.dispose(),A.toneMapping=f,A.autoClear=u,e.background=g}_textureToCubeUV(e,t){const r=this._renderer,i=e.mapping===Td||e.mapping===Id;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=IL()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=TL());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new dn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Iv(t,0,0,3*l,2*l),r.setRenderTarget(t),r.render(o,LE)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;sau&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${au}`);const p=[];let v=0;for(let B=0;Bw-Nh?i-w+Nh:0),b=4*(this._cubeSize-_);Iv(t,x,b,3*_,2*_),l.setRenderTarget(t),l.render(u,LE)}}function gre(n){const e=[],t=[],r=[];let i=n;const s=n-Nh+1+EL.length;for(let o=0;on-Nh?l=EL[o-n+Nh-1]:o===0&&(l=0),r.push(l);const c=1/(a-2),A=-c,u=1+c,f=[A,A,u,A,u,u,A,A,u,u,A,u],h=6,d=6,m=3,g=2,p=1,v=new Float32Array(m*d*h),w=new Float32Array(g*d*h),_=new Float32Array(p*d*h);for(let b=0;b2?0:-1,I=[B,M,0,B+2/3,M,0,B+2/3,M+1,0,B,M,0,B+2/3,M+1,0,B,M+1,0];v.set(I,m*d*b),w.set(f,g*d*b);const S=[b,b,b,b,b,b];_.set(S,p*d*b)}const x=new Jt;x.setAttribute("position",new ct(v,m)),x.setAttribute("uv",new ct(w,g)),x.setAttribute("faceIndex",new ct(_,p)),e.push(x),i>Nh&&i--}return{lodPlanes:e,sizeLods:t,sigmas:r}}function CL(n,e,t){const r=new el(n,e,t);return r.texture.mapping=a1,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function Iv(n,e,t,r,i){n.viewport.set(e,t,r,i),n.scissor.set(e,t,r,i)}function vre(n,e,t){const r=new Float32Array(au),i=new $(0,1,0);return new mr({name:"SphericalGaussianBlur",defines:{n:au,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:OR(),fragmentShader:` +}`,Mt={alphahash_fragment:Tee,alphahash_pars_fragment:Iee,alphamap_fragment:Ree,alphamap_pars_fragment:Uee,alphatest_fragment:Fee,alphatest_pars_fragment:Pee,aomap_fragment:Lee,aomap_pars_fragment:Dee,batching_pars_vertex:Nee,batching_vertex:Oee,begin_vertex:kee,beginnormal_vertex:Qee,bsdfs:Hee,iridescence_fragment:zee,bumpmap_pars_fragment:Gee,clipping_planes_fragment:Vee,clipping_planes_pars_fragment:jee,clipping_planes_pars_vertex:Wee,clipping_planes_vertex:Kee,color_fragment:Xee,color_pars_fragment:Yee,color_pars_vertex:$ee,color_vertex:Zee,common:Jee,cube_uv_reflection_fragment:qee,defaultnormal_vertex:ete,displacementmap_pars_vertex:tte,displacementmap_vertex:nte,emissivemap_fragment:rte,emissivemap_pars_fragment:ite,colorspace_fragment:ste,colorspace_pars_fragment:ote,envmap_fragment:ate,envmap_common_pars_fragment:lte,envmap_pars_fragment:cte,envmap_pars_vertex:Ate,envmap_physical_pars_fragment:_te,envmap_vertex:ute,fog_vertex:fte,fog_pars_vertex:hte,fog_fragment:dte,fog_pars_fragment:pte,gradientmap_pars_fragment:mte,lightmap_pars_fragment:gte,lights_lambert_fragment:vte,lights_lambert_pars_fragment:yte,lights_pars_begin:wte,lights_toon_fragment:xte,lights_toon_pars_fragment:bte,lights_phong_fragment:Ete,lights_phong_pars_fragment:Bte,lights_physical_fragment:Mte,lights_physical_pars_fragment:Ste,lights_fragment_begin:Cte,lights_fragment_maps:Tte,lights_fragment_end:Ite,logdepthbuf_fragment:Rte,logdepthbuf_pars_fragment:Ute,logdepthbuf_pars_vertex:Fte,logdepthbuf_vertex:Pte,map_fragment:Lte,map_pars_fragment:Dte,map_particle_fragment:Nte,map_particle_pars_fragment:Ote,metalnessmap_fragment:kte,metalnessmap_pars_fragment:Qte,morphinstance_vertex:Hte,morphcolor_vertex:zte,morphnormal_vertex:Gte,morphtarget_pars_vertex:Vte,morphtarget_vertex:jte,normal_fragment_begin:Wte,normal_fragment_maps:Kte,normal_pars_fragment:Xte,normal_pars_vertex:Yte,normal_vertex:$te,normalmap_pars_fragment:Zte,clearcoat_normal_fragment_begin:Jte,clearcoat_normal_fragment_maps:qte,clearcoat_pars_fragment:ene,iridescence_pars_fragment:tne,opaque_fragment:nne,packing:rne,premultiplied_alpha_fragment:ine,project_vertex:sne,dithering_fragment:one,dithering_pars_fragment:ane,roughnessmap_fragment:lne,roughnessmap_pars_fragment:cne,shadowmap_pars_fragment:Ane,shadowmap_pars_vertex:une,shadowmap_vertex:fne,shadowmask_pars_fragment:hne,skinbase_vertex:dne,skinning_pars_vertex:pne,skinning_vertex:mne,skinnormal_vertex:gne,specularmap_fragment:vne,specularmap_pars_fragment:yne,tonemapping_fragment:wne,tonemapping_pars_fragment:_ne,transmission_fragment:xne,transmission_pars_fragment:bne,uv_pars_fragment:Ene,uv_pars_vertex:Bne,uv_vertex:Mne,worldpos_vertex:Sne,background_vert:Cne,background_frag:Tne,backgroundCube_vert:Ine,backgroundCube_frag:Rne,cube_vert:Une,cube_frag:Fne,depth_vert:Pne,depth_frag:Lne,distanceRGBA_vert:Dne,distanceRGBA_frag:Nne,equirect_vert:One,equirect_frag:kne,linedashed_vert:Qne,linedashed_frag:Hne,meshbasic_vert:zne,meshbasic_frag:Gne,meshlambert_vert:Vne,meshlambert_frag:jne,meshmatcap_vert:Wne,meshmatcap_frag:Kne,meshnormal_vert:Xne,meshnormal_frag:Yne,meshphong_vert:$ne,meshphong_frag:Zne,meshphysical_vert:Jne,meshphysical_frag:qne,meshtoon_vert:ere,meshtoon_frag:tre,points_vert:nre,points_frag:rre,shadow_vert:ire,shadow_frag:sre,sprite_vert:ore,sprite_frag:are},Ge={common:{diffuse:{value:new Qe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new dt},alphaMap:{value:null},alphaMapTransform:{value:new dt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new dt}},envmap:{envMap:{value:null},envMapRotation:{value:new dt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new dt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new dt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new dt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new dt},normalScale:{value:new We(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new dt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new dt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new dt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new dt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Qe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Qe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new dt},alphaTest:{value:0},uvTransform:{value:new dt}},sprite:{diffuse:{value:new Qe(16777215)},opacity:{value:1},center:{value:new We(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new dt},alphaMap:{value:null},alphaMapTransform:{value:new dt},alphaTest:{value:0}}},Ua={basic:{uniforms:Ui([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.fog]),vertexShader:Mt.meshbasic_vert,fragmentShader:Mt.meshbasic_frag},lambert:{uniforms:Ui([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Qe(0)}}]),vertexShader:Mt.meshlambert_vert,fragmentShader:Mt.meshlambert_frag},phong:{uniforms:Ui([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Qe(0)},specular:{value:new Qe(1118481)},shininess:{value:30}}]),vertexShader:Mt.meshphong_vert,fragmentShader:Mt.meshphong_frag},standard:{uniforms:Ui([Ge.common,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.roughnessmap,Ge.metalnessmap,Ge.fog,Ge.lights,{emissive:{value:new Qe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag},toon:{uniforms:Ui([Ge.common,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.gradientmap,Ge.fog,Ge.lights,{emissive:{value:new Qe(0)}}]),vertexShader:Mt.meshtoon_vert,fragmentShader:Mt.meshtoon_frag},matcap:{uniforms:Ui([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,{matcap:{value:null}}]),vertexShader:Mt.meshmatcap_vert,fragmentShader:Mt.meshmatcap_frag},points:{uniforms:Ui([Ge.points,Ge.fog]),vertexShader:Mt.points_vert,fragmentShader:Mt.points_frag},dashed:{uniforms:Ui([Ge.common,Ge.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Mt.linedashed_vert,fragmentShader:Mt.linedashed_frag},depth:{uniforms:Ui([Ge.common,Ge.displacementmap]),vertexShader:Mt.depth_vert,fragmentShader:Mt.depth_frag},normal:{uniforms:Ui([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,{opacity:{value:1}}]),vertexShader:Mt.meshnormal_vert,fragmentShader:Mt.meshnormal_frag},sprite:{uniforms:Ui([Ge.sprite,Ge.fog]),vertexShader:Mt.sprite_vert,fragmentShader:Mt.sprite_frag},background:{uniforms:{uvTransform:{value:new dt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Mt.background_vert,fragmentShader:Mt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new dt}},vertexShader:Mt.backgroundCube_vert,fragmentShader:Mt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Mt.cube_vert,fragmentShader:Mt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Mt.equirect_vert,fragmentShader:Mt.equirect_frag},distanceRGBA:{uniforms:Ui([Ge.common,Ge.displacementmap,{referencePosition:{value:new $},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Mt.distanceRGBA_vert,fragmentShader:Mt.distanceRGBA_frag},shadow:{uniforms:Ui([Ge.lights,Ge.fog,{color:{value:new Qe(0)},opacity:{value:1}}]),vertexShader:Mt.shadow_vert,fragmentShader:Mt.shadow_frag}};Ua.physical={uniforms:Ui([Ua.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new dt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new dt},clearcoatNormalScale:{value:new We(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new dt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new dt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new dt},sheen:{value:0},sheenColor:{value:new Qe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new dt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new dt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new dt},transmissionSamplerSize:{value:new We},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new dt},attenuationDistance:{value:0},attenuationColor:{value:new Qe(0)},specularColor:{value:new Qe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new dt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new dt},anisotropyVector:{value:new We},anisotropyMap:{value:null},anisotropyMapTransform:{value:new dt}}]),vertexShader:Mt.meshphysical_vert,fragmentShader:Mt.meshphysical_frag};const Iv={r:0,b:0,g:0},zA=new nr,lre=new He;function cre(n,e,t,r,i,s,o){const a=new Qe(0);let l=s===!0?0:1,c,A,u=null,f=0,h=null;function d(v){let w=v.isScene===!0?v.background:null;return w&&w.isTexture&&(w=(v.backgroundBlurriness>0?t:e).get(w)),w}function m(v){let w=!1;const _=d(v);_===null?p(a,l):_&&_.isColor&&(p(_,1),w=!0);const x=n.xr.getEnvironmentBlendMode();x==="additive"?r.buffers.color.setClear(0,0,0,1,o):x==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,o),(n.autoClear||w)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function g(v,w){const _=d(w);_&&(_.isCubeTexture||_.mapping===l1)?(A===void 0&&(A=new dn(new g0(1,1,1),new mr({name:"BackgroundCubeMaterial",uniforms:Nd(Ua.backgroundCube.uniforms),vertexShader:Ua.backgroundCube.vertexShader,fragmentShader:Ua.backgroundCube.fragmentShader,side:oi,depthTest:!1,depthWrite:!1,fog:!1})),A.geometry.deleteAttribute("normal"),A.geometry.deleteAttribute("uv"),A.onBeforeRender=function(x,b,B){this.matrixWorld.copyPosition(B.matrixWorld)},Object.defineProperty(A.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(A)),zA.copy(w.backgroundRotation),zA.x*=-1,zA.y*=-1,zA.z*=-1,_.isCubeTexture&&_.isRenderTargetTexture===!1&&(zA.y*=-1,zA.z*=-1),A.material.uniforms.envMap.value=_,A.material.uniforms.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,A.material.uniforms.backgroundBlurriness.value=w.backgroundBlurriness,A.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,A.material.uniforms.backgroundRotation.value.setFromMatrix4(lre.makeRotationFromEuler(zA)),A.material.toneMapped=Et.getTransfer(_.colorSpace)!==Sn,(u!==_||f!==_.version||h!==n.toneMapping)&&(A.material.needsUpdate=!0,u=_,f=_.version,h=n.toneMapping),A.layers.enableAll(),v.unshift(A,A.geometry,A.material,0,0,null)):_&&_.isTexture&&(c===void 0&&(c=new dn(new cc(2,2),new mr({name:"BackgroundMaterial",uniforms:Nd(Ua.background.uniforms),vertexShader:Ua.background.vertexShader,fragmentShader:Ua.background.fragmentShader,side:Hs,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=_,c.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,c.material.toneMapped=Et.getTransfer(_.colorSpace)!==Sn,_.matrixAutoUpdate===!0&&_.updateMatrix(),c.material.uniforms.uvTransform.value.copy(_.matrix),(u!==_||f!==_.version||h!==n.toneMapping)&&(c.material.needsUpdate=!0,u=_,f=_.version,h=n.toneMapping),c.layers.enableAll(),v.unshift(c,c.geometry,c.material,0,0,null))}function p(v,w){v.getRGB(Iv,Mz(n)),r.buffers.color.setClear(Iv.r,Iv.g,Iv.b,w,o)}return{getClearColor:function(){return a},setClearColor:function(v,w=1){a.set(v),l=w,p(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(v){l=v,p(a,l)},render:m,addToRenderList:g}}function Are(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),r={},i=f(null);let s=i,o=!1;function a(M,L,D,T,y){let E=!1;const R=u(T,D,L);s!==R&&(s=R,c(s.object)),E=h(M,T,D,y),E&&d(M,T,D,y),y!==null&&e.update(y,n.ELEMENT_ARRAY_BUFFER),(E||o)&&(o=!1,_(M,L,D,T),y!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(y).buffer))}function l(){return n.createVertexArray()}function c(M){return n.bindVertexArray(M)}function A(M){return n.deleteVertexArray(M)}function u(M,L,D){const T=D.wireframe===!0;let y=r[M.id];y===void 0&&(y={},r[M.id]=y);let E=y[L.id];E===void 0&&(E={},y[L.id]=E);let R=E[T];return R===void 0&&(R=f(l()),E[T]=R),R}function f(M){const L=[],D=[],T=[];for(let y=0;y=0){const j=y[O];let Q=E[O];if(Q===void 0&&(O==="instanceMatrix"&&M.instanceMatrix&&(Q=M.instanceMatrix),O==="instanceColor"&&M.instanceColor&&(Q=M.instanceColor)),j===void 0||j.attribute!==Q||Q&&j.data!==Q.data)return!0;R++}return s.attributesNum!==R||s.index!==T}function d(M,L,D,T){const y={},E=L.attributes;let R=0;const F=D.getAttributes();for(const O in F)if(F[O].location>=0){let j=E[O];j===void 0&&(O==="instanceMatrix"&&M.instanceMatrix&&(j=M.instanceMatrix),O==="instanceColor"&&M.instanceColor&&(j=M.instanceColor));const Q={};Q.attribute=j,j&&j.data&&(Q.data=j.data),y[O]=Q,R++}s.attributes=y,s.attributesNum=R,s.index=T}function m(){const M=s.newAttributes;for(let L=0,D=M.length;L=0){let z=y[F];if(z===void 0&&(F==="instanceMatrix"&&M.instanceMatrix&&(z=M.instanceMatrix),F==="instanceColor"&&M.instanceColor&&(z=M.instanceColor)),z!==void 0){const j=z.normalized,Q=z.itemSize,C=e.get(z);if(C===void 0)continue;const W=C.buffer,ee=C.type,P=C.bytesPerElement,re=ee===n.INT||ee===n.UNSIGNED_INT||z.gpuType===CR;if(z.isInterleavedBufferAttribute){const ue=z.data,le=ue.stride,me=z.offset;if(ue.isInstancedInterleavedBuffer){for(let ie=0;ie0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";B="mediump"}return B==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const A=l(c);A!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",A,"instead."),c=A);const u=t.logarithmicDepthBuffer===!0,f=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control");if(f===!0){const B=e.get("EXT_clip_control");B.clipControlEXT(B.LOWER_LEFT_EXT,B.ZERO_TO_ONE_EXT)}const h=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),d=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_TEXTURE_SIZE),g=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),p=n.getParameter(n.MAX_VERTEX_ATTRIBS),v=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),w=n.getParameter(n.MAX_VARYING_VECTORS),_=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),x=d>0,b=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:u,reverseDepthBuffer:f,maxTextures:h,maxVertexTextures:d,maxTextureSize:m,maxCubemapSize:g,maxAttributes:p,maxVertexUniforms:v,maxVaryings:w,maxFragmentUniforms:_,vertexTextures:x,maxSamples:b}}function hre(n){const e=this;let t=null,r=0,i=!1,s=!1;const o=new Ra,a=new dt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,f){const h=u.length!==0||f||r!==0||i;return i=f,r=u.length,h},this.beginShadows=function(){s=!0,A(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,f){t=A(u,f,0)},this.setState=function(u,f,h){const d=u.clippingPlanes,m=u.clipIntersection,g=u.clipShadows,p=n.get(u);if(!i||d===null||d.length===0||s&&!g)s?A(null):c();else{const v=s?0:r,w=v*4;let _=p.clippingState||null;l.value=_,_=A(d,f,w,h);for(let x=0;x!==w;++x)_[x]=t[x];p.clippingState=_,this.numIntersection=m?this.numPlanes:0,this.numPlanes+=v}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function A(u,f,h,d){const m=u!==null?u.length:0;let g=null;if(m!==0){if(g=l.value,d!==!0||g===null){const p=h+m*4,v=f.matrixWorldInverse;a.getNormalMatrix(v),(g===null||g.length0){const c=new Bee(l.height);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",i),t(c.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}class v0 extends Sz{constructor(e=-1,t=1,r=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,r,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,o=r+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,A=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=A*this.view.offsetY,l=a-A*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const kh=4,BL=[.125,.215,.35,.446,.526,.582],lu=20,NE=new v0,ML=new Qe;let OE=null,kE=0,QE=0,HE=!1;const ru=(1+Math.sqrt(5))/2,xf=1/ru,SL=[new $(-ru,xf,0),new $(ru,xf,0),new $(-xf,0,ru),new $(xf,0,ru),new $(0,ru,-xf),new $(0,ru,xf),new $(-1,1,-1),new $(1,1,-1),new $(-1,1,1),new $(1,1,1)];class CL{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,r=.1,i=100){OE=this._renderer.getRenderTarget(),kE=this._renderer.getActiveCubeFace(),QE=this._renderer.getActiveMipmapLevel(),HE=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,r,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=RL(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=IL(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?w:0,w,w),A.setRenderTarget(i),m&&A.render(d,a),A.render(e,a)}d.geometry.dispose(),d.material.dispose(),A.toneMapping=f,A.autoClear=u,e.background=g}_textureToCubeUV(e,t){const r=this._renderer,i=e.mapping===Id||e.mapping===Rd;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=RL()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=IL());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new dn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Rv(t,0,0,3*l,2*l),r.setRenderTarget(t),r.render(o,NE)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;slu&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${lu}`);const p=[];let v=0;for(let B=0;Bw-kh?i-w+kh:0),b=4*(this._cubeSize-_);Rv(t,x,b,3*_,2*_),l.setRenderTarget(t),l.render(u,NE)}}function pre(n){const e=[],t=[],r=[];let i=n;const s=n-kh+1+BL.length;for(let o=0;on-kh?l=BL[o-n+kh-1]:o===0&&(l=0),r.push(l);const c=1/(a-2),A=-c,u=1+c,f=[A,A,u,A,u,u,A,A,u,u,A,u],h=6,d=6,m=3,g=2,p=1,v=new Float32Array(m*d*h),w=new Float32Array(g*d*h),_=new Float32Array(p*d*h);for(let b=0;b2?0:-1,I=[B,S,0,B+2/3,S,0,B+2/3,S+1,0,B,S,0,B+2/3,S+1,0,B,S+1,0];v.set(I,m*d*b),w.set(f,g*d*b);const M=[b,b,b,b,b,b];_.set(M,p*d*b)}const x=new Jt;x.setAttribute("position",new ct(v,m)),x.setAttribute("uv",new ct(w,g)),x.setAttribute("faceIndex",new ct(_,p)),e.push(x),i>kh&&i--}return{lodPlanes:e,sizeLods:t,sigmas:r}}function TL(n,e,t){const r=new tl(n,e,t);return r.texture.mapping=l1,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function Rv(n,e,t,r,i){n.viewport.set(e,t,r,i),n.scissor.set(e,t,r,i)}function mre(n,e,t){const r=new Float32Array(lu),i=new $(0,1,0);return new mr({name:"SphericalGaussianBlur",defines:{n:lu,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:QR(),fragmentShader:` precision mediump float; precision mediump int; @@ -3706,7 +3706,7 @@ void main() { } } - `,blending:jl,depthTest:!1,depthWrite:!1})}function TL(){return new mr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:OR(),fragmentShader:` + `,blending:jl,depthTest:!1,depthWrite:!1})}function IL(){return new mr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:QR(),fragmentShader:` precision mediump float; precision mediump int; @@ -3725,7 +3725,7 @@ void main() { gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } - `,blending:jl,depthTest:!1,depthWrite:!1})}function IL(){return new mr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:OR(),fragmentShader:` + `,blending:jl,depthTest:!1,depthWrite:!1})}function RL(){return new mr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:QR(),fragmentShader:` precision mediump float; precision mediump int; @@ -3741,7 +3741,7 @@ void main() { gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); } - `,blending:jl,depthTest:!1,depthWrite:!1})}function OR(){return` + `,blending:jl,depthTest:!1,depthWrite:!1})}function QR(){return` precision mediump float; precision mediump int; @@ -3796,16 +3796,16 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function yre(n){let e=new WeakMap,t=null;function r(a){if(a&&a.isTexture){const l=a.mapping,c=l===Og||l===tC,A=l===Td||l===Id;if(c||A){let u=e.get(a);const f=u!==void 0?u.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==f)return t===null&&(t=new ML(n)),u=c?t.fromEquirectangular(a,u):t.fromCubemap(a,u),u.texture.pmremVersion=a.pmremVersion,e.set(a,u),u.texture;if(u!==void 0)return u.texture;{const h=a.image;return c&&h&&h.height>0||A&&h&&i(h)?(t===null&&(t=new ML(n)),u=c?t.fromEquirectangular(a):t.fromCubemap(a),u.texture.pmremVersion=a.pmremVersion,e.set(a,u),a.addEventListener("dispose",s),u.texture):null}}}return a}function i(a){let l=0;const c=6;for(let A=0;Ae.maxTextureSize&&(x=Math.ceil(_/e.maxTextureSize),_=e.maxTextureSize);const b=new Float32Array(_*x*4*u),B=new xz(b,_,x,u);B.type=xi,B.needsUpdate=!0;const M=w*4;for(let S=0;S0)return n;const i=e*t;let s=UL[i];if(s===void 0&&(s=new Float32Array(i),UL[i]=s),e!==0){r.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function Or(n,e){if(n.length!==e.length)return!1;for(let t=0,r=n.length;t0||A&&h&&i(h)?(t===null&&(t=new CL(n)),u=c?t.fromEquirectangular(a):t.fromCubemap(a),u.texture.pmremVersion=a.pmremVersion,e.set(a,u),a.addEventListener("dispose",s),u.texture):null}}}return a}function i(a){let l=0;const c=6;for(let A=0;Ae.maxTextureSize&&(x=Math.ceil(_/e.maxTextureSize),_=e.maxTextureSize);const b=new Float32Array(_*x*4*u),B=new bz(b,_,x,u);B.type=xi,B.needsUpdate=!0;const S=w*4;for(let M=0;M0)return n;const i=e*t;let s=FL[i];if(s===void 0&&(s=new Float32Array(i),FL[i]=s),e!==0){r.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function Or(n,e){if(n.length!==e.length)return!1;for(let t=0,r=n.length;t":" "} ${a}: ${t[o]}`)}return r.join(` -`)}function yie(n){const e=Et.getPrimaries(Et.workingColorSpace),t=Et.getPrimaries(n);let r;switch(e===t?r="":e===D_&&t===L_?r="LinearDisplayP3ToLinearSRGB":e===L_&&t===D_&&(r="LinearSRGBToLinearDisplayP3"),n){case Mr:case c1:return[r,"LinearTransferOETF"];case Ut:case FR:return[r,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[r,"LinearTransferOETF"]}}function kL(n,e,t){const r=n.getShaderParameter(e,n.COMPILE_STATUS),i=n.getShaderInfoLog(e).trim();if(r&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` +`)}function gie(n){const e=Et.getPrimaries(Et.workingColorSpace),t=Et.getPrimaries(n);let r;switch(e===t?r="":e===N_&&t===D_?r="LinearDisplayP3ToLinearSRGB":e===D_&&t===N_&&(r="LinearSRGBToLinearDisplayP3"),n){case Sr:case A1:return[r,"LinearTransferOETF"];case Ut:case LR:return[r,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[r,"LinearTransferOETF"]}}function QL(n,e,t){const r=n.getShaderParameter(e,n.COMPILE_STATUS),i=n.getShaderInfoLog(e).trim();if(r&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` `+i+` -`+vie(n.getShaderSource(e),o)}else return i}function wie(n,e){const t=yie(e);return`vec4 ${n}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function _ie(n,e){let t;switch(e){case dq:t="Linear";break;case pq:t="Reinhard";break;case mq:t="Cineon";break;case gq:t="ACESFilmic";break;case yq:t="AgX";break;case wq:t="Neutral";break;case vq:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Rv=new $;function xie(){Et.getLuminanceCoefficients(Rv);const n=Rv.x.toFixed(4),e=Rv.y.toFixed(4),t=Rv.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` -`)}function bie(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(_m).join(` -`)}function Eie(n){const e=[];for(const t in n){const r=n[t];r!==!1&&e.push("#define "+t+" "+r)}return e.join(` -`)}function Bie(n,e){const t={},r=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function IC(n){return n.replace(Sie,Cie)}const Mie=new Map;function Cie(n,e){let t=St[e];if(t===void 0){const r=Mie.get(e);if(r!==void 0)t=St[r],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return IC(t)}const Tie=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function zL(n){return n.replace(Tie,Iie)}function Iie(n,e,t,r){let i="";for(let s=parseInt(e);s/gm;function UC(n){return n.replace(Eie,Mie)}const Bie=new Map;function Mie(n,e){let t=Mt[e];if(t===void 0){const r=Bie.get(e);if(r!==void 0)t=Mt[r],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return UC(t)}const Sie=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function GL(n){return n.replace(Sie,Cie)}function Cie(n,e,t,r){let i="";for(let s=parseInt(e);s0&&(g+=` -`),p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d].filter(_m).join(` +`),p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d].filter(xm).join(` `),p.length>0&&(p+=` -`)):(g=[GL(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+A:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` -`].filter(_m).join(` -`),p=[GL(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+A:"",t.envMap?"#define "+u:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==uA?"#define TONE_MAPPING":"",t.toneMapping!==uA?St.tonemapping_pars_fragment:"",t.toneMapping!==uA?_ie("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",St.colorspace_pars_fragment,wie("linearToOutputTexel",t.outputColorSpace),xie(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` -`].filter(_m).join(` -`)),o=IC(o),o=HL(o,t),o=QL(o,t),a=IC(a),a=HL(a,t),a=QL(a,t),o=zL(o),a=zL(a),t.isRawShaderMaterial!==!0&&(v=`#version 300 es +`)):(g=[VL(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+A:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(xm).join(` +`),p=[VL(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+A:"",t.envMap?"#define "+u:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==fA?"#define TONE_MAPPING":"",t.toneMapping!==fA?Mt.tonemapping_pars_fragment:"",t.toneMapping!==fA?yie("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Mt.colorspace_pars_fragment,vie("linearToOutputTexel",t.outputColorSpace),wie(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(xm).join(` +`)),o=UC(o),o=HL(o,t),o=zL(o,t),a=UC(a),a=HL(a,t),a=zL(a,t),o=GL(o),a=GL(a),t.isRawShaderMaterial!==!0&&(v=`#version 300 es `,g=[h,"#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` -`+g,p=["#define varying in",t.glslVersion===sL?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===sL?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`+g,p=["#define varying in",t.glslVersion===oL?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===oL?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` `)+` -`+p);const w=v+g+o,_=v+p+a,x=OL(i,i.VERTEX_SHADER,w),b=OL(i,i.FRAGMENT_SHADER,_);i.attachShader(m,x),i.attachShader(m,b),t.index0AttributeName!==void 0?i.bindAttribLocation(m,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(m,0,"position"),i.linkProgram(m);function B(L){if(n.debug.checkShaderErrors){const D=i.getProgramInfoLog(m).trim(),T=i.getShaderInfoLog(x).trim(),y=i.getShaderInfoLog(b).trim();let E=!0,R=!0;if(i.getProgramParameter(m,i.LINK_STATUS)===!1)if(E=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(i,m,x,b);else{const F=kL(i,x,"vertex"),O=kL(i,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(m,i.VALIDATE_STATUS)+` +`+p);const w=v+g+o,_=v+p+a,x=kL(i,i.VERTEX_SHADER,w),b=kL(i,i.FRAGMENT_SHADER,_);i.attachShader(m,x),i.attachShader(m,b),t.index0AttributeName!==void 0?i.bindAttribLocation(m,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(m,0,"position"),i.linkProgram(m);function B(L){if(n.debug.checkShaderErrors){const D=i.getProgramInfoLog(m).trim(),T=i.getShaderInfoLog(x).trim(),y=i.getShaderInfoLog(b).trim();let E=!0,R=!0;if(i.getProgramParameter(m,i.LINK_STATUS)===!1)if(E=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(i,m,x,b);else{const F=QL(i,x,"vertex"),O=QL(i,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(m,i.VALIDATE_STATUS)+` Material Name: `+L.name+` Material Type: `+L.type+` Program Info Log: `+D+` `+F+` -`+O)}else D!==""?console.warn("THREE.WebGLProgram: Program Info Log:",D):(T===""||y==="")&&(R=!1);R&&(L.diagnostics={runnable:E,programLog:D,vertexShader:{log:T,prefix:g},fragmentShader:{log:y,prefix:p}})}i.deleteShader(x),i.deleteShader(b),M=new Mw(i,m),I=Bie(i,m)}let M;this.getUniforms=function(){return M===void 0&&B(this),M};let I;this.getAttributes=function(){return I===void 0&&B(this),I};let S=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return S===!1&&(S=i.getProgramParameter(m,mie)),S},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(m),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=gie++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=x,this.fragmentShader=b,this}let Nie=0;class Oie{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const r of t)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let r=t.get(e);return r===void 0&&(r=new Set,t.set(e,r)),r}_getShaderStage(e){const t=this.shaderCache;let r=t.get(e);return r===void 0&&(r=new kie(e),t.set(e,r)),r}}class kie{constructor(e){this.id=Nie++,this.code=e,this.usedTimes=0}}function Hie(n,e,t,r,i,s,o){const a=new DR,l=new Oie,c=new Set,A=[],u=i.logarithmicDepthBuffer,f=i.reverseDepthBuffer,h=i.vertexTextures;let d=i.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function g(S){return c.add(S),S===0?"uv":`uv${S}`}function p(S,L,D,T,y){const E=T.fog,R=y.geometry,F=S.isMeshStandardMaterial?T.environment:null,O=(S.isMeshStandardMaterial?t:e).get(S.envMap||F),z=O&&O.mapping===a1?O.image.height:null,j=m[S.type];S.precision!==null&&(d=i.getMaxPrecision(S.precision),d!==S.precision&&console.warn("THREE.WebGLProgram.getParameters:",S.precision,"not supported, using",d,"instead."));const H=R.morphAttributes.position||R.morphAttributes.normal||R.morphAttributes.color,C=H!==void 0?H.length:0;let W=0;R.morphAttributes.position!==void 0&&(W=1),R.morphAttributes.normal!==void 0&&(W=2),R.morphAttributes.color!==void 0&&(W=3);let ee,P,re,ue;if(j){const xt=Ia[j];ee=xt.vertexShader,P=xt.fragmentShader}else ee=S.vertexShader,P=S.fragmentShader,l.update(S),re=l.getVertexShaderID(S),ue=l.getFragmentShaderID(S);const le=n.getRenderTarget(),me=y.isInstancedMesh===!0,ie=y.isBatchedMesh===!0,ge=!!S.map,_e=!!S.matcap,se=!!O,Q=!!S.aoMap,fe=!!S.lightMap,Ae=!!S.bumpMap,Z=!!S.normalMap,q=!!S.displacementMap,he=!!S.emissiveMap,X=!!S.metalnessMap,G=!!S.roughnessMap,ne=S.anisotropy>0,Y=S.clearcoat>0,de=S.dispersion>0,ae=S.iridescence>0,Ee=S.sheen>0,V=S.transmission>0,U=ne&&!!S.anisotropyMap,N=Y&&!!S.clearcoatMap,K=Y&&!!S.clearcoatNormalMap,oe=Y&&!!S.clearcoatRoughnessMap,pe=ae&&!!S.iridescenceMap,ve=ae&&!!S.iridescenceThicknessMap,Ce=Ee&&!!S.sheenColorMap,Le=Ee&&!!S.sheenRoughnessMap,Re=!!S.specularMap,$e=!!S.specularColorMap,ce=!!S.specularIntensityMap,Pe=V&&!!S.transmissionMap,Me=V&&!!S.thicknessMap,Te=!!S.gradientMap,Fe=!!S.alphaMap,De=S.alphaTest>0,Ze=!!S.alphaHash,At=!!S.extensions;let Pn=uA;S.toneMapped&&(le===null||le.isXRRenderTarget===!0)&&(Pn=n.toneMapping);const rt={shaderID:j,shaderType:S.type,shaderName:S.name,vertexShader:ee,fragmentShader:P,defines:S.defines,customVertexShaderID:re,customFragmentShaderID:ue,isRawShaderMaterial:S.isRawShaderMaterial===!0,glslVersion:S.glslVersion,precision:d,batching:ie,batchingColor:ie&&y._colorsTexture!==null,instancing:me,instancingColor:me&&y.instanceColor!==null,instancingMorph:me&&y.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:le===null?n.outputColorSpace:le.isXRRenderTarget===!0?le.texture.colorSpace:Mr,alphaToCoverage:!!S.alphaToCoverage,map:ge,matcap:_e,envMap:se,envMapMode:se&&O.mapping,envMapCubeUVHeight:z,aoMap:Q,lightMap:fe,bumpMap:Ae,normalMap:Z,displacementMap:h&&q,emissiveMap:he,normalMapObjectSpace:Z&&S.normalMapType===Tq,normalMapTangentSpace:Z&&S.normalMapType===Kd,metalnessMap:X,roughnessMap:G,anisotropy:ne,anisotropyMap:U,clearcoat:Y,clearcoatMap:N,clearcoatNormalMap:K,clearcoatRoughnessMap:oe,dispersion:de,iridescence:ae,iridescenceMap:pe,iridescenceThicknessMap:ve,sheen:Ee,sheenColorMap:Ce,sheenRoughnessMap:Le,specularMap:Re,specularColorMap:$e,specularIntensityMap:ce,transmission:V,transmissionMap:Pe,thicknessMap:Me,gradientMap:Te,opaque:S.transparent===!1&&S.blending===rd&&S.alphaToCoverage===!1,alphaMap:Fe,alphaTest:De,alphaHash:Ze,combine:S.combine,mapUv:ge&&g(S.map.channel),aoMapUv:Q&&g(S.aoMap.channel),lightMapUv:fe&&g(S.lightMap.channel),bumpMapUv:Ae&&g(S.bumpMap.channel),normalMapUv:Z&&g(S.normalMap.channel),displacementMapUv:q&&g(S.displacementMap.channel),emissiveMapUv:he&&g(S.emissiveMap.channel),metalnessMapUv:X&&g(S.metalnessMap.channel),roughnessMapUv:G&&g(S.roughnessMap.channel),anisotropyMapUv:U&&g(S.anisotropyMap.channel),clearcoatMapUv:N&&g(S.clearcoatMap.channel),clearcoatNormalMapUv:K&&g(S.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:oe&&g(S.clearcoatRoughnessMap.channel),iridescenceMapUv:pe&&g(S.iridescenceMap.channel),iridescenceThicknessMapUv:ve&&g(S.iridescenceThicknessMap.channel),sheenColorMapUv:Ce&&g(S.sheenColorMap.channel),sheenRoughnessMapUv:Le&&g(S.sheenRoughnessMap.channel),specularMapUv:Re&&g(S.specularMap.channel),specularColorMapUv:$e&&g(S.specularColorMap.channel),specularIntensityMapUv:ce&&g(S.specularIntensityMap.channel),transmissionMapUv:Pe&&g(S.transmissionMap.channel),thicknessMapUv:Me&&g(S.thicknessMap.channel),alphaMapUv:Fe&&g(S.alphaMap.channel),vertexTangents:!!R.attributes.tangent&&(Z||ne),vertexColors:S.vertexColors,vertexAlphas:S.vertexColors===!0&&!!R.attributes.color&&R.attributes.color.itemSize===4,pointsUvs:y.isPoints===!0&&!!R.attributes.uv&&(ge||Fe),fog:!!E,useFog:S.fog===!0,fogExp2:!!E&&E.isFogExp2,flatShading:S.flatShading===!0,sizeAttenuation:S.sizeAttenuation===!0,logarithmicDepthBuffer:u,reverseDepthBuffer:f,skinning:y.isSkinnedMesh===!0,morphTargets:R.morphAttributes.position!==void 0,morphNormals:R.morphAttributes.normal!==void 0,morphColors:R.morphAttributes.color!==void 0,morphTargetsCount:C,morphTextureStride:W,numDirLights:L.directional.length,numPointLights:L.point.length,numSpotLights:L.spot.length,numSpotLightMaps:L.spotLightMap.length,numRectAreaLights:L.rectArea.length,numHemiLights:L.hemi.length,numDirLightShadows:L.directionalShadowMap.length,numPointLightShadows:L.pointShadowMap.length,numSpotLightShadows:L.spotShadowMap.length,numSpotLightShadowsWithMaps:L.numSpotLightShadowsWithMaps,numLightProbes:L.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:S.dithering,shadowMapEnabled:n.shadowMap.enabled&&D.length>0,shadowMapType:n.shadowMap.type,toneMapping:Pn,decodeVideoTexture:ge&&S.map.isVideoTexture===!0&&Et.getTransfer(S.map.colorSpace)===Mn,premultipliedAlpha:S.premultipliedAlpha,doubleSided:S.side===_i,flipSided:S.side===oi,useDepthPacking:S.depthPacking>=0,depthPacking:S.depthPacking||0,index0AttributeName:S.index0AttributeName,extensionClipCullDistance:At&&S.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(At&&S.extensions.multiDraw===!0||ie)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:S.customProgramCacheKey()};return rt.vertexUv1s=c.has(1),rt.vertexUv2s=c.has(2),rt.vertexUv3s=c.has(3),c.clear(),rt}function v(S){const L=[];if(S.shaderID?L.push(S.shaderID):(L.push(S.customVertexShaderID),L.push(S.customFragmentShaderID)),S.defines!==void 0)for(const D in S.defines)L.push(D),L.push(S.defines[D]);return S.isRawShaderMaterial===!1&&(w(L,S),_(L,S),L.push(n.outputColorSpace)),L.push(S.customProgramCacheKey),L.join()}function w(S,L){S.push(L.precision),S.push(L.outputColorSpace),S.push(L.envMapMode),S.push(L.envMapCubeUVHeight),S.push(L.mapUv),S.push(L.alphaMapUv),S.push(L.lightMapUv),S.push(L.aoMapUv),S.push(L.bumpMapUv),S.push(L.normalMapUv),S.push(L.displacementMapUv),S.push(L.emissiveMapUv),S.push(L.metalnessMapUv),S.push(L.roughnessMapUv),S.push(L.anisotropyMapUv),S.push(L.clearcoatMapUv),S.push(L.clearcoatNormalMapUv),S.push(L.clearcoatRoughnessMapUv),S.push(L.iridescenceMapUv),S.push(L.iridescenceThicknessMapUv),S.push(L.sheenColorMapUv),S.push(L.sheenRoughnessMapUv),S.push(L.specularMapUv),S.push(L.specularColorMapUv),S.push(L.specularIntensityMapUv),S.push(L.transmissionMapUv),S.push(L.thicknessMapUv),S.push(L.combine),S.push(L.fogExp2),S.push(L.sizeAttenuation),S.push(L.morphTargetsCount),S.push(L.morphAttributeCount),S.push(L.numDirLights),S.push(L.numPointLights),S.push(L.numSpotLights),S.push(L.numSpotLightMaps),S.push(L.numHemiLights),S.push(L.numRectAreaLights),S.push(L.numDirLightShadows),S.push(L.numPointLightShadows),S.push(L.numSpotLightShadows),S.push(L.numSpotLightShadowsWithMaps),S.push(L.numLightProbes),S.push(L.shadowMapType),S.push(L.toneMapping),S.push(L.numClippingPlanes),S.push(L.numClipIntersection),S.push(L.depthPacking)}function _(S,L){a.disableAll(),L.supportsVertexTextures&&a.enable(0),L.instancing&&a.enable(1),L.instancingColor&&a.enable(2),L.instancingMorph&&a.enable(3),L.matcap&&a.enable(4),L.envMap&&a.enable(5),L.normalMapObjectSpace&&a.enable(6),L.normalMapTangentSpace&&a.enable(7),L.clearcoat&&a.enable(8),L.iridescence&&a.enable(9),L.alphaTest&&a.enable(10),L.vertexColors&&a.enable(11),L.vertexAlphas&&a.enable(12),L.vertexUv1s&&a.enable(13),L.vertexUv2s&&a.enable(14),L.vertexUv3s&&a.enable(15),L.vertexTangents&&a.enable(16),L.anisotropy&&a.enable(17),L.alphaHash&&a.enable(18),L.batching&&a.enable(19),L.dispersion&&a.enable(20),L.batchingColor&&a.enable(21),S.push(a.mask),a.disableAll(),L.fog&&a.enable(0),L.useFog&&a.enable(1),L.flatShading&&a.enable(2),L.logarithmicDepthBuffer&&a.enable(3),L.reverseDepthBuffer&&a.enable(4),L.skinning&&a.enable(5),L.morphTargets&&a.enable(6),L.morphNormals&&a.enable(7),L.morphColors&&a.enable(8),L.premultipliedAlpha&&a.enable(9),L.shadowMapEnabled&&a.enable(10),L.doubleSided&&a.enable(11),L.flipSided&&a.enable(12),L.useDepthPacking&&a.enable(13),L.dithering&&a.enable(14),L.transmission&&a.enable(15),L.sheen&&a.enable(16),L.opaque&&a.enable(17),L.pointsUvs&&a.enable(18),L.decodeVideoTexture&&a.enable(19),L.alphaToCoverage&&a.enable(20),S.push(a.mask)}function x(S){const L=m[S.type];let D;if(L){const T=Ia[L];D=NR.clone(T.uniforms)}else D=S.uniforms;return D}function b(S,L){let D;for(let T=0,y=A.length;T0?r.push(p):h.transparent===!0?i.push(p):t.push(p)}function l(u,f,h,d,m,g){const p=o(u,f,h,d,m,g);h.transmission>0?r.unshift(p):h.transparent===!0?i.unshift(p):t.unshift(p)}function c(u,f){t.length>1&&t.sort(u||zie),r.length>1&&r.sort(f||VL),i.length>1&&i.sort(f||VL)}function A(){for(let u=e,f=n.length;u=s.length?(o=new jL,s.push(o)):o=s[i],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function Vie(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new $,color:new ke};break;case"SpotLight":t={position:new $,direction:new $,color:new ke,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new $,color:new ke,distance:0,decay:0};break;case"HemisphereLight":t={direction:new $,skyColor:new ke,groundColor:new ke};break;case"RectAreaLight":t={color:new ke,position:new $,halfWidth:new $,halfHeight:new $};break}return n[e.id]=t,t}}}function jie(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new je};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new je};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new je,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let Wie=0;function Kie(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function Xie(n){const e=new Vie,t=jie(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)r.probe.push(new $);const i=new $,s=new He,o=new He;function a(c){let A=0,u=0,f=0;for(let I=0;I<9;I++)r.probe[I].set(0,0,0);let h=0,d=0,m=0,g=0,p=0,v=0,w=0,_=0,x=0,b=0,B=0;c.sort(Kie);for(let I=0,S=c.length;I0&&(n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=ze.LTC_FLOAT_1,r.rectAreaLTC2=ze.LTC_FLOAT_2):(r.rectAreaLTC1=ze.LTC_HALF_1,r.rectAreaLTC2=ze.LTC_HALF_2)),r.ambient[0]=A,r.ambient[1]=u,r.ambient[2]=f;const M=r.hash;(M.directionalLength!==h||M.pointLength!==d||M.spotLength!==m||M.rectAreaLength!==g||M.hemiLength!==p||M.numDirectionalShadows!==v||M.numPointShadows!==w||M.numSpotShadows!==_||M.numSpotMaps!==x||M.numLightProbes!==B)&&(r.directional.length=h,r.spot.length=m,r.rectArea.length=g,r.point.length=d,r.hemi.length=p,r.directionalShadow.length=v,r.directionalShadowMap.length=v,r.pointShadow.length=w,r.pointShadowMap.length=w,r.spotShadow.length=_,r.spotShadowMap.length=_,r.directionalShadowMatrix.length=v,r.pointShadowMatrix.length=w,r.spotLightMatrix.length=_+x-b,r.spotLightMap.length=x,r.numSpotLightShadowsWithMaps=b,r.numLightProbes=B,M.directionalLength=h,M.pointLength=d,M.spotLength=m,M.rectAreaLength=g,M.hemiLength=p,M.numDirectionalShadows=v,M.numPointShadows=w,M.numSpotShadows=_,M.numSpotMaps=x,M.numLightProbes=B,r.version=Wie++)}function l(c,A){let u=0,f=0,h=0,d=0,m=0;const g=A.matrixWorldInverse;for(let p=0,v=c.length;p=o.length?(a=new WL(n),o.push(a)):a=o[s],a}function r(){e=new WeakMap}return{get:t,dispose:r}}class $ie extends as{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Mq,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Zie extends as{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Jie=`void main() { +`+O)}else D!==""?console.warn("THREE.WebGLProgram: Program Info Log:",D):(T===""||y==="")&&(R=!1);R&&(L.diagnostics={runnable:E,programLog:D,vertexShader:{log:T,prefix:g},fragmentShader:{log:y,prefix:p}})}i.deleteShader(x),i.deleteShader(b),S=new Cw(i,m),I=bie(i,m)}let S;this.getUniforms=function(){return S===void 0&&B(this),S};let I;this.getAttributes=function(){return I===void 0&&B(this),I};let M=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=i.getProgramParameter(m,die)),M},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(m),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=pie++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=x,this.fragmentShader=b,this}let Lie=0;class Die{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const r of t)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let r=t.get(e);return r===void 0&&(r=new Set,t.set(e,r)),r}_getShaderStage(e){const t=this.shaderCache;let r=t.get(e);return r===void 0&&(r=new Nie(e),t.set(e,r)),r}}class Nie{constructor(e){this.id=Lie++,this.code=e,this.usedTimes=0}}function Oie(n,e,t,r,i,s,o){const a=new OR,l=new Die,c=new Set,A=[],u=i.logarithmicDepthBuffer,f=i.reverseDepthBuffer,h=i.vertexTextures;let d=i.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function g(M){return c.add(M),M===0?"uv":`uv${M}`}function p(M,L,D,T,y){const E=T.fog,R=y.geometry,F=M.isMeshStandardMaterial?T.environment:null,O=(M.isMeshStandardMaterial?t:e).get(M.envMap||F),z=O&&O.mapping===l1?O.image.height:null,j=m[M.type];M.precision!==null&&(d=i.getMaxPrecision(M.precision),d!==M.precision&&console.warn("THREE.WebGLProgram.getParameters:",M.precision,"not supported, using",d,"instead."));const Q=R.morphAttributes.position||R.morphAttributes.normal||R.morphAttributes.color,C=Q!==void 0?Q.length:0;let W=0;R.morphAttributes.position!==void 0&&(W=1),R.morphAttributes.normal!==void 0&&(W=2),R.morphAttributes.color!==void 0&&(W=3);let ee,P,re,ue;if(j){const xt=Ua[j];ee=xt.vertexShader,P=xt.fragmentShader}else ee=M.vertexShader,P=M.fragmentShader,l.update(M),re=l.getVertexShaderID(M),ue=l.getFragmentShaderID(M);const le=n.getRenderTarget(),me=y.isInstancedMesh===!0,ie=y.isBatchedMesh===!0,ge=!!M.map,_e=!!M.matcap,se=!!O,H=!!M.aoMap,fe=!!M.lightMap,Ae=!!M.bumpMap,J=!!M.normalMap,q=!!M.displacementMap,he=!!M.emissiveMap,X=!!M.metalnessMap,G=!!M.roughnessMap,ne=M.anisotropy>0,Y=M.clearcoat>0,de=M.dispersion>0,ae=M.iridescence>0,Ee=M.sheen>0,V=M.transmission>0,U=ne&&!!M.anisotropyMap,N=Y&&!!M.clearcoatMap,K=Y&&!!M.clearcoatNormalMap,oe=Y&&!!M.clearcoatRoughnessMap,pe=ae&&!!M.iridescenceMap,ve=ae&&!!M.iridescenceThicknessMap,Ce=Ee&&!!M.sheenColorMap,Le=Ee&&!!M.sheenRoughnessMap,Re=!!M.specularMap,$e=!!M.specularColorMap,ce=!!M.specularIntensityMap,Pe=V&&!!M.transmissionMap,Se=V&&!!M.thicknessMap,Te=!!M.gradientMap,Fe=!!M.alphaMap,De=M.alphaTest>0,Ze=!!M.alphaHash,At=!!M.extensions;let Pn=fA;M.toneMapped&&(le===null||le.isXRRenderTarget===!0)&&(Pn=n.toneMapping);const rt={shaderID:j,shaderType:M.type,shaderName:M.name,vertexShader:ee,fragmentShader:P,defines:M.defines,customVertexShaderID:re,customFragmentShaderID:ue,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:d,batching:ie,batchingColor:ie&&y._colorsTexture!==null,instancing:me,instancingColor:me&&y.instanceColor!==null,instancingMorph:me&&y.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:le===null?n.outputColorSpace:le.isXRRenderTarget===!0?le.texture.colorSpace:Sr,alphaToCoverage:!!M.alphaToCoverage,map:ge,matcap:_e,envMap:se,envMapMode:se&&O.mapping,envMapCubeUVHeight:z,aoMap:H,lightMap:fe,bumpMap:Ae,normalMap:J,displacementMap:h&&q,emissiveMap:he,normalMapObjectSpace:J&&M.normalMapType===Sq,normalMapTangentSpace:J&&M.normalMapType===Kd,metalnessMap:X,roughnessMap:G,anisotropy:ne,anisotropyMap:U,clearcoat:Y,clearcoatMap:N,clearcoatNormalMap:K,clearcoatRoughnessMap:oe,dispersion:de,iridescence:ae,iridescenceMap:pe,iridescenceThicknessMap:ve,sheen:Ee,sheenColorMap:Ce,sheenRoughnessMap:Le,specularMap:Re,specularColorMap:$e,specularIntensityMap:ce,transmission:V,transmissionMap:Pe,thicknessMap:Se,gradientMap:Te,opaque:M.transparent===!1&&M.blending===id&&M.alphaToCoverage===!1,alphaMap:Fe,alphaTest:De,alphaHash:Ze,combine:M.combine,mapUv:ge&&g(M.map.channel),aoMapUv:H&&g(M.aoMap.channel),lightMapUv:fe&&g(M.lightMap.channel),bumpMapUv:Ae&&g(M.bumpMap.channel),normalMapUv:J&&g(M.normalMap.channel),displacementMapUv:q&&g(M.displacementMap.channel),emissiveMapUv:he&&g(M.emissiveMap.channel),metalnessMapUv:X&&g(M.metalnessMap.channel),roughnessMapUv:G&&g(M.roughnessMap.channel),anisotropyMapUv:U&&g(M.anisotropyMap.channel),clearcoatMapUv:N&&g(M.clearcoatMap.channel),clearcoatNormalMapUv:K&&g(M.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:oe&&g(M.clearcoatRoughnessMap.channel),iridescenceMapUv:pe&&g(M.iridescenceMap.channel),iridescenceThicknessMapUv:ve&&g(M.iridescenceThicknessMap.channel),sheenColorMapUv:Ce&&g(M.sheenColorMap.channel),sheenRoughnessMapUv:Le&&g(M.sheenRoughnessMap.channel),specularMapUv:Re&&g(M.specularMap.channel),specularColorMapUv:$e&&g(M.specularColorMap.channel),specularIntensityMapUv:ce&&g(M.specularIntensityMap.channel),transmissionMapUv:Pe&&g(M.transmissionMap.channel),thicknessMapUv:Se&&g(M.thicknessMap.channel),alphaMapUv:Fe&&g(M.alphaMap.channel),vertexTangents:!!R.attributes.tangent&&(J||ne),vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!R.attributes.color&&R.attributes.color.itemSize===4,pointsUvs:y.isPoints===!0&&!!R.attributes.uv&&(ge||Fe),fog:!!E,useFog:M.fog===!0,fogExp2:!!E&&E.isFogExp2,flatShading:M.flatShading===!0,sizeAttenuation:M.sizeAttenuation===!0,logarithmicDepthBuffer:u,reverseDepthBuffer:f,skinning:y.isSkinnedMesh===!0,morphTargets:R.morphAttributes.position!==void 0,morphNormals:R.morphAttributes.normal!==void 0,morphColors:R.morphAttributes.color!==void 0,morphTargetsCount:C,morphTextureStride:W,numDirLights:L.directional.length,numPointLights:L.point.length,numSpotLights:L.spot.length,numSpotLightMaps:L.spotLightMap.length,numRectAreaLights:L.rectArea.length,numHemiLights:L.hemi.length,numDirLightShadows:L.directionalShadowMap.length,numPointLightShadows:L.pointShadowMap.length,numSpotLightShadows:L.spotShadowMap.length,numSpotLightShadowsWithMaps:L.numSpotLightShadowsWithMaps,numLightProbes:L.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:M.dithering,shadowMapEnabled:n.shadowMap.enabled&&D.length>0,shadowMapType:n.shadowMap.type,toneMapping:Pn,decodeVideoTexture:ge&&M.map.isVideoTexture===!0&&Et.getTransfer(M.map.colorSpace)===Sn,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===_i,flipSided:M.side===oi,useDepthPacking:M.depthPacking>=0,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionClipCullDistance:At&&M.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(At&&M.extensions.multiDraw===!0||ie)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:M.customProgramCacheKey()};return rt.vertexUv1s=c.has(1),rt.vertexUv2s=c.has(2),rt.vertexUv3s=c.has(3),c.clear(),rt}function v(M){const L=[];if(M.shaderID?L.push(M.shaderID):(L.push(M.customVertexShaderID),L.push(M.customFragmentShaderID)),M.defines!==void 0)for(const D in M.defines)L.push(D),L.push(M.defines[D]);return M.isRawShaderMaterial===!1&&(w(L,M),_(L,M),L.push(n.outputColorSpace)),L.push(M.customProgramCacheKey),L.join()}function w(M,L){M.push(L.precision),M.push(L.outputColorSpace),M.push(L.envMapMode),M.push(L.envMapCubeUVHeight),M.push(L.mapUv),M.push(L.alphaMapUv),M.push(L.lightMapUv),M.push(L.aoMapUv),M.push(L.bumpMapUv),M.push(L.normalMapUv),M.push(L.displacementMapUv),M.push(L.emissiveMapUv),M.push(L.metalnessMapUv),M.push(L.roughnessMapUv),M.push(L.anisotropyMapUv),M.push(L.clearcoatMapUv),M.push(L.clearcoatNormalMapUv),M.push(L.clearcoatRoughnessMapUv),M.push(L.iridescenceMapUv),M.push(L.iridescenceThicknessMapUv),M.push(L.sheenColorMapUv),M.push(L.sheenRoughnessMapUv),M.push(L.specularMapUv),M.push(L.specularColorMapUv),M.push(L.specularIntensityMapUv),M.push(L.transmissionMapUv),M.push(L.thicknessMapUv),M.push(L.combine),M.push(L.fogExp2),M.push(L.sizeAttenuation),M.push(L.morphTargetsCount),M.push(L.morphAttributeCount),M.push(L.numDirLights),M.push(L.numPointLights),M.push(L.numSpotLights),M.push(L.numSpotLightMaps),M.push(L.numHemiLights),M.push(L.numRectAreaLights),M.push(L.numDirLightShadows),M.push(L.numPointLightShadows),M.push(L.numSpotLightShadows),M.push(L.numSpotLightShadowsWithMaps),M.push(L.numLightProbes),M.push(L.shadowMapType),M.push(L.toneMapping),M.push(L.numClippingPlanes),M.push(L.numClipIntersection),M.push(L.depthPacking)}function _(M,L){a.disableAll(),L.supportsVertexTextures&&a.enable(0),L.instancing&&a.enable(1),L.instancingColor&&a.enable(2),L.instancingMorph&&a.enable(3),L.matcap&&a.enable(4),L.envMap&&a.enable(5),L.normalMapObjectSpace&&a.enable(6),L.normalMapTangentSpace&&a.enable(7),L.clearcoat&&a.enable(8),L.iridescence&&a.enable(9),L.alphaTest&&a.enable(10),L.vertexColors&&a.enable(11),L.vertexAlphas&&a.enable(12),L.vertexUv1s&&a.enable(13),L.vertexUv2s&&a.enable(14),L.vertexUv3s&&a.enable(15),L.vertexTangents&&a.enable(16),L.anisotropy&&a.enable(17),L.alphaHash&&a.enable(18),L.batching&&a.enable(19),L.dispersion&&a.enable(20),L.batchingColor&&a.enable(21),M.push(a.mask),a.disableAll(),L.fog&&a.enable(0),L.useFog&&a.enable(1),L.flatShading&&a.enable(2),L.logarithmicDepthBuffer&&a.enable(3),L.reverseDepthBuffer&&a.enable(4),L.skinning&&a.enable(5),L.morphTargets&&a.enable(6),L.morphNormals&&a.enable(7),L.morphColors&&a.enable(8),L.premultipliedAlpha&&a.enable(9),L.shadowMapEnabled&&a.enable(10),L.doubleSided&&a.enable(11),L.flipSided&&a.enable(12),L.useDepthPacking&&a.enable(13),L.dithering&&a.enable(14),L.transmission&&a.enable(15),L.sheen&&a.enable(16),L.opaque&&a.enable(17),L.pointsUvs&&a.enable(18),L.decodeVideoTexture&&a.enable(19),L.alphaToCoverage&&a.enable(20),M.push(a.mask)}function x(M){const L=m[M.type];let D;if(L){const T=Ua[L];D=kR.clone(T.uniforms)}else D=M.uniforms;return D}function b(M,L){let D;for(let T=0,y=A.length;T0?r.push(p):h.transparent===!0?i.push(p):t.push(p)}function l(u,f,h,d,m,g){const p=o(u,f,h,d,m,g);h.transmission>0?r.unshift(p):h.transparent===!0?i.unshift(p):t.unshift(p)}function c(u,f){t.length>1&&t.sort(u||Qie),r.length>1&&r.sort(f||jL),i.length>1&&i.sort(f||jL)}function A(){for(let u=e,f=n.length;u=s.length?(o=new WL,s.push(o)):o=s[i],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function zie(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new $,color:new Qe};break;case"SpotLight":t={position:new $,direction:new $,color:new Qe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new $,color:new Qe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new $,skyColor:new Qe,groundColor:new Qe};break;case"RectAreaLight":t={color:new Qe,position:new $,halfWidth:new $,halfHeight:new $};break}return n[e.id]=t,t}}}function Gie(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new We};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new We};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new We,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let Vie=0;function jie(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function Wie(n){const e=new zie,t=Gie(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)r.probe.push(new $);const i=new $,s=new He,o=new He;function a(c){let A=0,u=0,f=0;for(let I=0;I<9;I++)r.probe[I].set(0,0,0);let h=0,d=0,m=0,g=0,p=0,v=0,w=0,_=0,x=0,b=0,B=0;c.sort(jie);for(let I=0,M=c.length;I0&&(n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=Ge.LTC_FLOAT_1,r.rectAreaLTC2=Ge.LTC_FLOAT_2):(r.rectAreaLTC1=Ge.LTC_HALF_1,r.rectAreaLTC2=Ge.LTC_HALF_2)),r.ambient[0]=A,r.ambient[1]=u,r.ambient[2]=f;const S=r.hash;(S.directionalLength!==h||S.pointLength!==d||S.spotLength!==m||S.rectAreaLength!==g||S.hemiLength!==p||S.numDirectionalShadows!==v||S.numPointShadows!==w||S.numSpotShadows!==_||S.numSpotMaps!==x||S.numLightProbes!==B)&&(r.directional.length=h,r.spot.length=m,r.rectArea.length=g,r.point.length=d,r.hemi.length=p,r.directionalShadow.length=v,r.directionalShadowMap.length=v,r.pointShadow.length=w,r.pointShadowMap.length=w,r.spotShadow.length=_,r.spotShadowMap.length=_,r.directionalShadowMatrix.length=v,r.pointShadowMatrix.length=w,r.spotLightMatrix.length=_+x-b,r.spotLightMap.length=x,r.numSpotLightShadowsWithMaps=b,r.numLightProbes=B,S.directionalLength=h,S.pointLength=d,S.spotLength=m,S.rectAreaLength=g,S.hemiLength=p,S.numDirectionalShadows=v,S.numPointShadows=w,S.numSpotShadows=_,S.numSpotMaps=x,S.numLightProbes=B,r.version=Vie++)}function l(c,A){let u=0,f=0,h=0,d=0,m=0;const g=A.matrixWorldInverse;for(let p=0,v=c.length;p=o.length?(a=new KL(n),o.push(a)):a=o[s],a}function r(){e=new WeakMap}return{get:t,dispose:r}}class Xie extends as{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Bq,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Yie extends as{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const $ie=`void main() { gl_Position = vec4( position, 1.0 ); -}`,qie=`uniform sampler2D shadow_pass; +}`,Zie=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include @@ -3874,12 +3874,12 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function ese(n,e,t){let r=new u1;const i=new je,s=new je,o=new Pt,a=new $ie({depthPacking:Cq}),l=new Zie,c={},A=t.maxTextureSize,u={[Qs]:oi,[oi]:Qs,[_i]:_i},f=new mr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new je},radius:{value:4}},vertexShader:Jie,fragmentShader:qie}),h=f.clone();h.defines.HORIZONTAL_PASS=1;const d=new Jt;d.setAttribute("position",new ct(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new dn(d,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=lz;let p=this.type;this.render=function(b,B,M){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||b.length===0)return;const I=n.getRenderTarget(),S=n.getActiveCubeFace(),L=n.getActiveMipmapLevel(),D=n.state;D.setBlending(jl),D.buffers.color.setClear(1,1,1,1),D.buffers.depth.setTest(!0),D.setScissorTest(!1);const T=p!==Bl&&this.type===Bl,y=p===Bl&&this.type!==Bl;for(let E=0,R=b.length;EA||i.y>A)&&(i.x>A&&(s.x=Math.floor(A/z.x),i.x=s.x*z.x,O.mapSize.x=s.x),i.y>A&&(s.y=Math.floor(A/z.y),i.y=s.y*z.y,O.mapSize.y=s.y)),O.map===null||T===!0||y===!0){const H=this.type!==Bl?{minFilter:Kr,magFilter:Kr}:{};O.map!==null&&O.map.dispose(),O.map=new el(i.x,i.y,H),O.map.texture.name=F.name+".shadowMap",O.camera.updateProjectionMatrix()}n.setRenderTarget(O.map),n.clear();const j=O.getViewportCount();for(let H=0;H0||B.map&&B.alphaTest>0){const D=S.uuid,T=B.uuid;let y=c[D];y===void 0&&(y={},c[D]=y);let E=y[T];E===void 0&&(E=S.clone(),y[T]=E,B.addEventListener("dispose",x)),S=E}if(S.visible=B.visible,S.wireframe=B.wireframe,I===Bl?S.side=B.shadowSide!==null?B.shadowSide:B.side:S.side=B.shadowSide!==null?B.shadowSide:u[B.side],S.alphaMap=B.alphaMap,S.alphaTest=B.alphaTest,S.map=B.map,S.clipShadows=B.clipShadows,S.clippingPlanes=B.clippingPlanes,S.clipIntersection=B.clipIntersection,S.displacementMap=B.displacementMap,S.displacementScale=B.displacementScale,S.displacementBias=B.displacementBias,S.wireframeLinewidth=B.wireframeLinewidth,S.linewidth=B.linewidth,M.isPointLight===!0&&S.isMeshDistanceMaterial===!0){const D=n.properties.get(S);D.light=M}return S}function _(b,B,M,I,S){if(b.visible===!1)return;if(b.layers.test(B.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&S===Bl)&&(!b.frustumCulled||r.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(M.matrixWorldInverse,b.matrixWorld);const T=e.update(b),y=b.material;if(Array.isArray(y)){const E=T.groups;for(let R=0,F=E.length;R=1):F.indexOf("OpenGL ES")!==-1&&(R=parseFloat(/^OpenGL ES (\d)/.exec(F)[1]),E=R>=2);let O=null,z={};const j=n.getParameter(n.SCISSOR_BOX),H=n.getParameter(n.VIEWPORT),C=new Pt().fromArray(j),W=new Pt().fromArray(H);function ee(ce,Pe,Me,Te){const Fe=new Uint8Array(4),De=n.createTexture();n.bindTexture(ce,De),n.texParameteri(ce,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(ce,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Ze=0;Ze"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new je,A=new WeakMap;let u;const f=new WeakMap;let h=!1;try{h=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function d(X,G){return h?new OffscreenCanvas(X,G):Qg("canvas")}function m(X,G,ne){let Y=1;const de=he(X);if((de.width>ne||de.height>ne)&&(Y=ne/Math.max(de.width,de.height)),Y<1)if(typeof HTMLImageElement<"u"&&X instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&X instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&X instanceof ImageBitmap||typeof VideoFrame<"u"&&X instanceof VideoFrame){const ae=Math.floor(Y*de.width),Ee=Math.floor(Y*de.height);u===void 0&&(u=d(ae,Ee));const V=G?d(ae,Ee):u;return V.width=ae,V.height=Ee,V.getContext("2d").drawImage(X,0,0,ae,Ee),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+de.width+"x"+de.height+") to ("+ae+"x"+Ee+")."),V}else return"data"in X&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+de.width+"x"+de.height+")."),X;return X}function g(X){return X.generateMipmaps&&X.minFilter!==Kr&&X.minFilter!==Lr}function p(X){n.generateMipmap(X)}function v(X,G,ne,Y,de=!1){if(X!==null){if(n[X]!==void 0)return n[X];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+X+"'")}let ae=G;if(G===n.RED&&(ne===n.FLOAT&&(ae=n.R32F),ne===n.HALF_FLOAT&&(ae=n.R16F),ne===n.UNSIGNED_BYTE&&(ae=n.R8)),G===n.RED_INTEGER&&(ne===n.UNSIGNED_BYTE&&(ae=n.R8UI),ne===n.UNSIGNED_SHORT&&(ae=n.R16UI),ne===n.UNSIGNED_INT&&(ae=n.R32UI),ne===n.BYTE&&(ae=n.R8I),ne===n.SHORT&&(ae=n.R16I),ne===n.INT&&(ae=n.R32I)),G===n.RG&&(ne===n.FLOAT&&(ae=n.RG32F),ne===n.HALF_FLOAT&&(ae=n.RG16F),ne===n.UNSIGNED_BYTE&&(ae=n.RG8)),G===n.RG_INTEGER&&(ne===n.UNSIGNED_BYTE&&(ae=n.RG8UI),ne===n.UNSIGNED_SHORT&&(ae=n.RG16UI),ne===n.UNSIGNED_INT&&(ae=n.RG32UI),ne===n.BYTE&&(ae=n.RG8I),ne===n.SHORT&&(ae=n.RG16I),ne===n.INT&&(ae=n.RG32I)),G===n.RGB_INTEGER&&(ne===n.UNSIGNED_BYTE&&(ae=n.RGB8UI),ne===n.UNSIGNED_SHORT&&(ae=n.RGB16UI),ne===n.UNSIGNED_INT&&(ae=n.RGB32UI),ne===n.BYTE&&(ae=n.RGB8I),ne===n.SHORT&&(ae=n.RGB16I),ne===n.INT&&(ae=n.RGB32I)),G===n.RGBA_INTEGER&&(ne===n.UNSIGNED_BYTE&&(ae=n.RGBA8UI),ne===n.UNSIGNED_SHORT&&(ae=n.RGBA16UI),ne===n.UNSIGNED_INT&&(ae=n.RGBA32UI),ne===n.BYTE&&(ae=n.RGBA8I),ne===n.SHORT&&(ae=n.RGBA16I),ne===n.INT&&(ae=n.RGBA32I)),G===n.RGB&&ne===n.UNSIGNED_INT_5_9_9_9_REV&&(ae=n.RGB9_E5),G===n.RGBA){const Ee=de?P_:Et.getTransfer(Y);ne===n.FLOAT&&(ae=n.RGBA32F),ne===n.HALF_FLOAT&&(ae=n.RGBA16F),ne===n.UNSIGNED_BYTE&&(ae=Ee===Mn?n.SRGB8_ALPHA8:n.RGBA8),ne===n.UNSIGNED_SHORT_4_4_4_4&&(ae=n.RGBA4),ne===n.UNSIGNED_SHORT_5_5_5_1&&(ae=n.RGB5_A1)}return(ae===n.R16F||ae===n.R32F||ae===n.RG16F||ae===n.RG32F||ae===n.RGBA16F||ae===n.RGBA32F)&&e.get("EXT_color_buffer_float"),ae}function w(X,G){let ne;return X?G===null||G===yA||G===Rd?ne=n.DEPTH24_STENCIL8:G===xi?ne=n.DEPTH32F_STENCIL8:G===Hg&&(ne=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):G===null||G===yA||G===Rd?ne=n.DEPTH_COMPONENT24:G===xi?ne=n.DEPTH_COMPONENT32F:G===Hg&&(ne=n.DEPTH_COMPONENT16),ne}function _(X,G){return g(X)===!0||X.isFramebufferTexture&&X.minFilter!==Kr&&X.minFilter!==Lr?Math.log2(Math.max(G.width,G.height))+1:X.mipmaps!==void 0&&X.mipmaps.length>0?X.mipmaps.length:X.isCompressedTexture&&Array.isArray(X.image)?G.mipmaps.length:1}function x(X){const G=X.target;G.removeEventListener("dispose",x),B(G),G.isVideoTexture&&A.delete(G)}function b(X){const G=X.target;G.removeEventListener("dispose",b),I(G)}function B(X){const G=r.get(X);if(G.__webglInit===void 0)return;const ne=X.source,Y=f.get(ne);if(Y){const de=Y[G.__cacheKey];de.usedTimes--,de.usedTimes===0&&M(X),Object.keys(Y).length===0&&f.delete(ne)}r.remove(X)}function M(X){const G=r.get(X);n.deleteTexture(G.__webglTexture);const ne=X.source,Y=f.get(ne);delete Y[G.__cacheKey],o.memory.textures--}function I(X){const G=r.get(X);if(X.depthTexture&&X.depthTexture.dispose(),X.isWebGLCubeRenderTarget)for(let Y=0;Y<6;Y++){if(Array.isArray(G.__webglFramebuffer[Y]))for(let de=0;de=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+X+" texture units while this GPU supports only "+i.maxTextures),S+=1,X}function T(X){const G=[];return G.push(X.wrapS),G.push(X.wrapT),G.push(X.wrapR||0),G.push(X.magFilter),G.push(X.minFilter),G.push(X.anisotropy),G.push(X.internalFormat),G.push(X.format),G.push(X.type),G.push(X.generateMipmaps),G.push(X.premultiplyAlpha),G.push(X.flipY),G.push(X.unpackAlignment),G.push(X.colorSpace),G.join()}function y(X,G){const ne=r.get(X);if(X.isVideoTexture&&Z(X),X.isRenderTargetTexture===!1&&X.version>0&&ne.__version!==X.version){const Y=X.image;if(Y===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Y.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{W(ne,X,G);return}}t.bindTexture(n.TEXTURE_2D,ne.__webglTexture,n.TEXTURE0+G)}function E(X,G){const ne=r.get(X);if(X.version>0&&ne.__version!==X.version){W(ne,X,G);return}t.bindTexture(n.TEXTURE_2D_ARRAY,ne.__webglTexture,n.TEXTURE0+G)}function R(X,G){const ne=r.get(X);if(X.version>0&&ne.__version!==X.version){W(ne,X,G);return}t.bindTexture(n.TEXTURE_3D,ne.__webglTexture,n.TEXTURE0+G)}function F(X,G){const ne=r.get(X);if(X.version>0&&ne.__version!==X.version){ee(ne,X,G);return}t.bindTexture(n.TEXTURE_CUBE_MAP,ne.__webglTexture,n.TEXTURE0+G)}const O={[zs]:n.REPEAT,[Rs]:n.CLAMP_TO_EDGE,[kg]:n.MIRRORED_REPEAT},z={[Kr]:n.NEAREST,[BR]:n.NEAREST_MIPMAP_NEAREST,[Ph]:n.NEAREST_MIPMAP_LINEAR,[Lr]:n.LINEAR,[Jm]:n.LINEAR_MIPMAP_NEAREST,[qo]:n.LINEAR_MIPMAP_LINEAR},j={[Iq]:n.NEVER,[Dq]:n.ALWAYS,[Rq]:n.LESS,[wz]:n.LEQUAL,[Uq]:n.EQUAL,[Lq]:n.GEQUAL,[Fq]:n.GREATER,[Pq]:n.NOTEQUAL};function H(X,G){if(G.type===xi&&e.has("OES_texture_float_linear")===!1&&(G.magFilter===Lr||G.magFilter===Jm||G.magFilter===Ph||G.magFilter===qo||G.minFilter===Lr||G.minFilter===Jm||G.minFilter===Ph||G.minFilter===qo)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(X,n.TEXTURE_WRAP_S,O[G.wrapS]),n.texParameteri(X,n.TEXTURE_WRAP_T,O[G.wrapT]),(X===n.TEXTURE_3D||X===n.TEXTURE_2D_ARRAY)&&n.texParameteri(X,n.TEXTURE_WRAP_R,O[G.wrapR]),n.texParameteri(X,n.TEXTURE_MAG_FILTER,z[G.magFilter]),n.texParameteri(X,n.TEXTURE_MIN_FILTER,z[G.minFilter]),G.compareFunction&&(n.texParameteri(X,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(X,n.TEXTURE_COMPARE_FUNC,j[G.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(G.magFilter===Kr||G.minFilter!==Ph&&G.minFilter!==qo||G.type===xi&&e.has("OES_texture_float_linear")===!1)return;if(G.anisotropy>1||r.get(G).__currentAnisotropy){const ne=e.get("EXT_texture_filter_anisotropic");n.texParameterf(X,ne.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(G.anisotropy,i.getMaxAnisotropy())),r.get(G).__currentAnisotropy=G.anisotropy}}}function C(X,G){let ne=!1;X.__webglInit===void 0&&(X.__webglInit=!0,G.addEventListener("dispose",x));const Y=G.source;let de=f.get(Y);de===void 0&&(de={},f.set(Y,de));const ae=T(G);if(ae!==X.__cacheKey){de[ae]===void 0&&(de[ae]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,ne=!0),de[ae].usedTimes++;const Ee=de[X.__cacheKey];Ee!==void 0&&(de[X.__cacheKey].usedTimes--,Ee.usedTimes===0&&M(G)),X.__cacheKey=ae,X.__webglTexture=de[ae].texture}return ne}function W(X,G,ne){let Y=n.TEXTURE_2D;(G.isDataArrayTexture||G.isCompressedArrayTexture)&&(Y=n.TEXTURE_2D_ARRAY),G.isData3DTexture&&(Y=n.TEXTURE_3D);const de=C(X,G),ae=G.source;t.bindTexture(Y,X.__webglTexture,n.TEXTURE0+ne);const Ee=r.get(ae);if(ae.version!==Ee.__version||de===!0){t.activeTexture(n.TEXTURE0+ne);const V=Et.getPrimaries(Et.workingColorSpace),U=G.colorSpace===Fa?null:Et.getPrimaries(G.colorSpace),N=G.colorSpace===Fa||V===U?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,G.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,G.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,G.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,N);let K=m(G.image,!1,i.maxTextureSize);K=q(G,K);const oe=s.convert(G.format,G.colorSpace),pe=s.convert(G.type);let ve=v(G.internalFormat,oe,pe,G.colorSpace,G.isVideoTexture);H(Y,G);let Ce;const Le=G.mipmaps,Re=G.isVideoTexture!==!0,$e=Ee.__version===void 0||de===!0,ce=ae.dataReady,Pe=_(G,K);if(G.isDepthTexture)ve=w(G.format===Ud,G.type),$e&&(Re?t.texStorage2D(n.TEXTURE_2D,1,ve,K.width,K.height):t.texImage2D(n.TEXTURE_2D,0,ve,K.width,K.height,0,oe,pe,null));else if(G.isDataTexture)if(Le.length>0){Re&&$e&&t.texStorage2D(n.TEXTURE_2D,Pe,ve,Le[0].width,Le[0].height);for(let Me=0,Te=Le.length;Me0){const Fe=KL(Ce.width,Ce.height,G.format,G.type);for(const De of G.layerUpdates){const Ze=Ce.data.subarray(De*Fe/Ce.data.BYTES_PER_ELEMENT,(De+1)*Fe/Ce.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Me,0,0,De,Ce.width,Ce.height,1,oe,Ze,0,0)}G.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Me,0,0,0,Ce.width,Ce.height,K.depth,oe,Ce.data,0,0)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,Me,ve,Ce.width,Ce.height,K.depth,0,Ce.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Re?ce&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,Me,0,0,0,Ce.width,Ce.height,K.depth,oe,pe,Ce.data):t.texImage3D(n.TEXTURE_2D_ARRAY,Me,ve,Ce.width,Ce.height,K.depth,0,oe,pe,Ce.data)}else{Re&&$e&&t.texStorage2D(n.TEXTURE_2D,Pe,ve,Le[0].width,Le[0].height);for(let Me=0,Te=Le.length;Me0){const Me=KL(K.width,K.height,G.format,G.type);for(const Te of G.layerUpdates){const Fe=K.data.subarray(Te*Me/K.data.BYTES_PER_ELEMENT,(Te+1)*Me/K.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,Te,K.width,K.height,1,oe,pe,Fe)}G.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,K.width,K.height,K.depth,oe,pe,K.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,ve,K.width,K.height,K.depth,0,oe,pe,K.data);else if(G.isData3DTexture)Re?($e&&t.texStorage3D(n.TEXTURE_3D,Pe,ve,K.width,K.height,K.depth),ce&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,K.width,K.height,K.depth,oe,pe,K.data)):t.texImage3D(n.TEXTURE_3D,0,ve,K.width,K.height,K.depth,0,oe,pe,K.data);else if(G.isFramebufferTexture){if($e)if(Re)t.texStorage2D(n.TEXTURE_2D,Pe,ve,K.width,K.height);else{let Me=K.width,Te=K.height;for(let Fe=0;Fe>=1,Te>>=1}}else if(Le.length>0){if(Re&&$e){const Me=he(Le[0]);t.texStorage2D(n.TEXTURE_2D,Pe,ve,Me.width,Me.height)}for(let Me=0,Te=Le.length;Me0&&Pe++;const Te=he(oe[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,Pe,Le,Te.width,Te.height)}for(let Te=0;Te<6;Te++)if(K){Re?ce&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Te,0,0,0,oe[Te].width,oe[Te].height,ve,Ce,oe[Te].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Te,0,Le,oe[Te].width,oe[Te].height,0,ve,Ce,oe[Te].data);for(let Fe=0;Fe>ae),oe=Math.max(1,G.height>>ae);de===n.TEXTURE_3D||de===n.TEXTURE_2D_ARRAY?t.texImage3D(de,ae,U,K,oe,G.depth,0,Ee,V,null):t.texImage2D(de,ae,U,K,oe,0,Ee,V,null)}t.bindFramebuffer(n.FRAMEBUFFER,X),Ae(G)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,Y,de,r.get(ne).__webglTexture,0,fe(G)):(de===n.TEXTURE_2D||de>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&de<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,Y,de,r.get(ne).__webglTexture,ae),t.bindFramebuffer(n.FRAMEBUFFER,null)}function re(X,G,ne){if(n.bindRenderbuffer(n.RENDERBUFFER,X),G.depthBuffer){const Y=G.depthTexture,de=Y&&Y.isDepthTexture?Y.type:null,ae=w(G.stencilBuffer,de),Ee=G.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,V=fe(G);Ae(G)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,V,ae,G.width,G.height):ne?n.renderbufferStorageMultisample(n.RENDERBUFFER,V,ae,G.width,G.height):n.renderbufferStorage(n.RENDERBUFFER,ae,G.width,G.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,Ee,n.RENDERBUFFER,X)}else{const Y=G.textures;for(let de=0;de{delete G.__boundDepthTexture,delete G.__depthDisposeCallback,Y.removeEventListener("dispose",de)};Y.addEventListener("dispose",de),G.__depthDisposeCallback=de}G.__boundDepthTexture=Y}if(X.depthTexture&&!G.__autoAllocateDepthBuffer){if(ne)throw new Error("target.depthTexture not supported in Cube render targets");ue(G.__webglFramebuffer,X)}else if(ne){G.__webglDepthbuffer=[];for(let Y=0;Y<6;Y++)if(t.bindFramebuffer(n.FRAMEBUFFER,G.__webglFramebuffer[Y]),G.__webglDepthbuffer[Y]===void 0)G.__webglDepthbuffer[Y]=n.createRenderbuffer(),re(G.__webglDepthbuffer[Y],X,!1);else{const de=X.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ae=G.__webglDepthbuffer[Y];n.bindRenderbuffer(n.RENDERBUFFER,ae),n.framebufferRenderbuffer(n.FRAMEBUFFER,de,n.RENDERBUFFER,ae)}}else if(t.bindFramebuffer(n.FRAMEBUFFER,G.__webglFramebuffer),G.__webglDepthbuffer===void 0)G.__webglDepthbuffer=n.createRenderbuffer(),re(G.__webglDepthbuffer,X,!1);else{const Y=X.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,de=G.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,de),n.framebufferRenderbuffer(n.FRAMEBUFFER,Y,n.RENDERBUFFER,de)}t.bindFramebuffer(n.FRAMEBUFFER,null)}function me(X,G,ne){const Y=r.get(X);G!==void 0&&P(Y.__webglFramebuffer,X,X.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),ne!==void 0&&le(X)}function ie(X){const G=X.texture,ne=r.get(X),Y=r.get(G);X.addEventListener("dispose",b);const de=X.textures,ae=X.isWebGLCubeRenderTarget===!0,Ee=de.length>1;if(Ee||(Y.__webglTexture===void 0&&(Y.__webglTexture=n.createTexture()),Y.__version=G.version,o.memory.textures++),ae){ne.__webglFramebuffer=[];for(let V=0;V<6;V++)if(G.mipmaps&&G.mipmaps.length>0){ne.__webglFramebuffer[V]=[];for(let U=0;U0){ne.__webglFramebuffer=[];for(let V=0;V0&&Ae(X)===!1){ne.__webglMultisampledFramebuffer=n.createFramebuffer(),ne.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,ne.__webglMultisampledFramebuffer);for(let V=0;V0)for(let U=0;U0)for(let U=0;U0){if(Ae(X)===!1){const G=X.textures,ne=X.width,Y=X.height;let de=n.COLOR_BUFFER_BIT;const ae=X.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Ee=r.get(X),V=G.length>1;if(V)for(let U=0;U0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&G.__useRenderToTexture!==!1}function Z(X){const G=o.render.frame;A.get(X)!==G&&(A.set(X,G),X.update())}function q(X,G){const ne=X.colorSpace,Y=X.format,de=X.type;return X.isCompressedTexture===!0||X.isVideoTexture===!0||ne!==Mr&&ne!==Fa&&(Et.getTransfer(ne)===Mn?(Y!==Nr||de!==rc)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ne)),G}function he(X){return typeof HTMLImageElement<"u"&&X instanceof HTMLImageElement?(c.width=X.naturalWidth||X.width,c.height=X.naturalHeight||X.height):typeof VideoFrame<"u"&&X instanceof VideoFrame?(c.width=X.displayWidth,c.height=X.displayHeight):(c.width=X.width,c.height=X.height),c}this.allocateTextureUnit=D,this.resetTextureUnits=L,this.setTexture2D=y,this.setTexture2DArray=E,this.setTexture3D=R,this.setTextureCube=F,this.rebindTextures=me,this.setupRenderTarget=ie,this.updateRenderTargetMipmap=ge,this.updateMultisampleRenderTarget=Q,this.setupDepthRenderbuffer=le,this.setupFrameBufferTexture=P,this.useMultisampledRTT=Ae}function sse(n,e){function t(r,i=Fa){let s;const o=Et.getTransfer(i);if(r===rc)return n.UNSIGNED_BYTE;if(r===MR)return n.UNSIGNED_SHORT_4_4_4_4;if(r===CR)return n.UNSIGNED_SHORT_5_5_5_1;if(r===fz)return n.UNSIGNED_INT_5_9_9_9_REV;if(r===Az)return n.BYTE;if(r===uz)return n.SHORT;if(r===Hg)return n.UNSIGNED_SHORT;if(r===SR)return n.INT;if(r===yA)return n.UNSIGNED_INT;if(r===xi)return n.FLOAT;if(r===ka)return n.HALF_FLOAT;if(r===hz)return n.ALPHA;if(r===dz)return n.RGB;if(r===Nr)return n.RGBA;if(r===pz)return n.LUMINANCE;if(r===mz)return n.LUMINANCE_ALPHA;if(r===id)return n.DEPTH_COMPONENT;if(r===Ud)return n.DEPTH_STENCIL;if(r===TR)return n.RED;if(r===l1)return n.RED_INTEGER;if(r===gz)return n.RG;if(r===IR)return n.RG_INTEGER;if(r===RR)return n.RGBA_INTEGER;if(r===_w||r===xw||r===bw||r===Ew)if(o===Mn)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===_w)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===xw)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===bw)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===Ew)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===_w)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===xw)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===bw)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===Ew)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===nC||r===rC||r===iC||r===sC)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===nC)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===rC)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===iC)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===sC)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===oC||r===aC||r===lC)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===oC||r===aC)return o===Mn?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===lC)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===cC||r===AC||r===uC||r===fC||r===hC||r===dC||r===pC||r===mC||r===gC||r===vC||r===yC||r===wC||r===_C||r===xC)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===cC)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===AC)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===uC)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===fC)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===hC)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===dC)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===pC)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===mC)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===gC)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===vC)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===yC)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===wC)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===_C)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===xC)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===Bw||r===bC||r===EC)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===Bw)return o===Mn?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===bC)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===EC)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===vz||r===BC||r===SC||r===MC)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===Bw)return s.COMPRESSED_RED_RGTC1_EXT;if(r===BC)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===SC)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===MC)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===Rd?n.UNSIGNED_INT_24_8:n[r]!==void 0?n[r]:null}return{convert:t}}class ose extends Fr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class ri extends Lt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const ase={type:"move"};class QE{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ri,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new ri,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new $,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new $),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ri,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new $,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new $),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const r of e.hand.values())this._getHandJoint(t,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,r){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const m of e.hand.values()){const g=t.getJointPose(m,r),p=this._getHandJoint(c,m);g!==null&&(p.matrix.fromArray(g.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=g.radius),p.visible=g!==null}const A=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],f=A.position.distanceTo(u.position),h=.02,d=.005;c.inputState.pinching&&f>h+d?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=h-d&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,r),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(ase)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const r=new ri;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}const lse=` +}`;function Jie(n,e,t){let r=new f1;const i=new We,s=new We,o=new Pt,a=new Xie({depthPacking:Mq}),l=new Yie,c={},A=t.maxTextureSize,u={[Hs]:oi,[oi]:Hs,[_i]:_i},f=new mr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new We},radius:{value:4}},vertexShader:$ie,fragmentShader:Zie}),h=f.clone();h.defines.HORIZONTAL_PASS=1;const d=new Jt;d.setAttribute("position",new ct(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new dn(d,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=cz;let p=this.type;this.render=function(b,B,S){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||b.length===0)return;const I=n.getRenderTarget(),M=n.getActiveCubeFace(),L=n.getActiveMipmapLevel(),D=n.state;D.setBlending(jl),D.buffers.color.setClear(1,1,1,1),D.buffers.depth.setTest(!0),D.setScissorTest(!1);const T=p!==Bl&&this.type===Bl,y=p===Bl&&this.type!==Bl;for(let E=0,R=b.length;EA||i.y>A)&&(i.x>A&&(s.x=Math.floor(A/z.x),i.x=s.x*z.x,O.mapSize.x=s.x),i.y>A&&(s.y=Math.floor(A/z.y),i.y=s.y*z.y,O.mapSize.y=s.y)),O.map===null||T===!0||y===!0){const Q=this.type!==Bl?{minFilter:Xr,magFilter:Xr}:{};O.map!==null&&O.map.dispose(),O.map=new tl(i.x,i.y,Q),O.map.texture.name=F.name+".shadowMap",O.camera.updateProjectionMatrix()}n.setRenderTarget(O.map),n.clear();const j=O.getViewportCount();for(let Q=0;Q0||B.map&&B.alphaTest>0){const D=M.uuid,T=B.uuid;let y=c[D];y===void 0&&(y={},c[D]=y);let E=y[T];E===void 0&&(E=M.clone(),y[T]=E,B.addEventListener("dispose",x)),M=E}if(M.visible=B.visible,M.wireframe=B.wireframe,I===Bl?M.side=B.shadowSide!==null?B.shadowSide:B.side:M.side=B.shadowSide!==null?B.shadowSide:u[B.side],M.alphaMap=B.alphaMap,M.alphaTest=B.alphaTest,M.map=B.map,M.clipShadows=B.clipShadows,M.clippingPlanes=B.clippingPlanes,M.clipIntersection=B.clipIntersection,M.displacementMap=B.displacementMap,M.displacementScale=B.displacementScale,M.displacementBias=B.displacementBias,M.wireframeLinewidth=B.wireframeLinewidth,M.linewidth=B.linewidth,S.isPointLight===!0&&M.isMeshDistanceMaterial===!0){const D=n.properties.get(M);D.light=S}return M}function _(b,B,S,I,M){if(b.visible===!1)return;if(b.layers.test(B.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&M===Bl)&&(!b.frustumCulled||r.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(S.matrixWorldInverse,b.matrixWorld);const T=e.update(b),y=b.material;if(Array.isArray(y)){const E=T.groups;for(let R=0,F=E.length;R=1):F.indexOf("OpenGL ES")!==-1&&(R=parseFloat(/^OpenGL ES (\d)/.exec(F)[1]),E=R>=2);let O=null,z={};const j=n.getParameter(n.SCISSOR_BOX),Q=n.getParameter(n.VIEWPORT),C=new Pt().fromArray(j),W=new Pt().fromArray(Q);function ee(ce,Pe,Se,Te){const Fe=new Uint8Array(4),De=n.createTexture();n.bindTexture(ce,De),n.texParameteri(ce,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(ce,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Ze=0;Ze"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new We,A=new WeakMap;let u;const f=new WeakMap;let h=!1;try{h=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function d(X,G){return h?new OffscreenCanvas(X,G):zg("canvas")}function m(X,G,ne){let Y=1;const de=he(X);if((de.width>ne||de.height>ne)&&(Y=ne/Math.max(de.width,de.height)),Y<1)if(typeof HTMLImageElement<"u"&&X instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&X instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&X instanceof ImageBitmap||typeof VideoFrame<"u"&&X instanceof VideoFrame){const ae=Math.floor(Y*de.width),Ee=Math.floor(Y*de.height);u===void 0&&(u=d(ae,Ee));const V=G?d(ae,Ee):u;return V.width=ae,V.height=Ee,V.getContext("2d").drawImage(X,0,0,ae,Ee),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+de.width+"x"+de.height+") to ("+ae+"x"+Ee+")."),V}else return"data"in X&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+de.width+"x"+de.height+")."),X;return X}function g(X){return X.generateMipmaps&&X.minFilter!==Xr&&X.minFilter!==Lr}function p(X){n.generateMipmap(X)}function v(X,G,ne,Y,de=!1){if(X!==null){if(n[X]!==void 0)return n[X];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+X+"'")}let ae=G;if(G===n.RED&&(ne===n.FLOAT&&(ae=n.R32F),ne===n.HALF_FLOAT&&(ae=n.R16F),ne===n.UNSIGNED_BYTE&&(ae=n.R8)),G===n.RED_INTEGER&&(ne===n.UNSIGNED_BYTE&&(ae=n.R8UI),ne===n.UNSIGNED_SHORT&&(ae=n.R16UI),ne===n.UNSIGNED_INT&&(ae=n.R32UI),ne===n.BYTE&&(ae=n.R8I),ne===n.SHORT&&(ae=n.R16I),ne===n.INT&&(ae=n.R32I)),G===n.RG&&(ne===n.FLOAT&&(ae=n.RG32F),ne===n.HALF_FLOAT&&(ae=n.RG16F),ne===n.UNSIGNED_BYTE&&(ae=n.RG8)),G===n.RG_INTEGER&&(ne===n.UNSIGNED_BYTE&&(ae=n.RG8UI),ne===n.UNSIGNED_SHORT&&(ae=n.RG16UI),ne===n.UNSIGNED_INT&&(ae=n.RG32UI),ne===n.BYTE&&(ae=n.RG8I),ne===n.SHORT&&(ae=n.RG16I),ne===n.INT&&(ae=n.RG32I)),G===n.RGB_INTEGER&&(ne===n.UNSIGNED_BYTE&&(ae=n.RGB8UI),ne===n.UNSIGNED_SHORT&&(ae=n.RGB16UI),ne===n.UNSIGNED_INT&&(ae=n.RGB32UI),ne===n.BYTE&&(ae=n.RGB8I),ne===n.SHORT&&(ae=n.RGB16I),ne===n.INT&&(ae=n.RGB32I)),G===n.RGBA_INTEGER&&(ne===n.UNSIGNED_BYTE&&(ae=n.RGBA8UI),ne===n.UNSIGNED_SHORT&&(ae=n.RGBA16UI),ne===n.UNSIGNED_INT&&(ae=n.RGBA32UI),ne===n.BYTE&&(ae=n.RGBA8I),ne===n.SHORT&&(ae=n.RGBA16I),ne===n.INT&&(ae=n.RGBA32I)),G===n.RGB&&ne===n.UNSIGNED_INT_5_9_9_9_REV&&(ae=n.RGB9_E5),G===n.RGBA){const Ee=de?L_:Et.getTransfer(Y);ne===n.FLOAT&&(ae=n.RGBA32F),ne===n.HALF_FLOAT&&(ae=n.RGBA16F),ne===n.UNSIGNED_BYTE&&(ae=Ee===Sn?n.SRGB8_ALPHA8:n.RGBA8),ne===n.UNSIGNED_SHORT_4_4_4_4&&(ae=n.RGBA4),ne===n.UNSIGNED_SHORT_5_5_5_1&&(ae=n.RGB5_A1)}return(ae===n.R16F||ae===n.R32F||ae===n.RG16F||ae===n.RG32F||ae===n.RGBA16F||ae===n.RGBA32F)&&e.get("EXT_color_buffer_float"),ae}function w(X,G){let ne;return X?G===null||G===wA||G===Ud?ne=n.DEPTH24_STENCIL8:G===xi?ne=n.DEPTH32F_STENCIL8:G===Hg&&(ne=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):G===null||G===wA||G===Ud?ne=n.DEPTH_COMPONENT24:G===xi?ne=n.DEPTH_COMPONENT32F:G===Hg&&(ne=n.DEPTH_COMPONENT16),ne}function _(X,G){return g(X)===!0||X.isFramebufferTexture&&X.minFilter!==Xr&&X.minFilter!==Lr?Math.log2(Math.max(G.width,G.height))+1:X.mipmaps!==void 0&&X.mipmaps.length>0?X.mipmaps.length:X.isCompressedTexture&&Array.isArray(X.image)?G.mipmaps.length:1}function x(X){const G=X.target;G.removeEventListener("dispose",x),B(G),G.isVideoTexture&&A.delete(G)}function b(X){const G=X.target;G.removeEventListener("dispose",b),I(G)}function B(X){const G=r.get(X);if(G.__webglInit===void 0)return;const ne=X.source,Y=f.get(ne);if(Y){const de=Y[G.__cacheKey];de.usedTimes--,de.usedTimes===0&&S(X),Object.keys(Y).length===0&&f.delete(ne)}r.remove(X)}function S(X){const G=r.get(X);n.deleteTexture(G.__webglTexture);const ne=X.source,Y=f.get(ne);delete Y[G.__cacheKey],o.memory.textures--}function I(X){const G=r.get(X);if(X.depthTexture&&X.depthTexture.dispose(),X.isWebGLCubeRenderTarget)for(let Y=0;Y<6;Y++){if(Array.isArray(G.__webglFramebuffer[Y]))for(let de=0;de=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+X+" texture units while this GPU supports only "+i.maxTextures),M+=1,X}function T(X){const G=[];return G.push(X.wrapS),G.push(X.wrapT),G.push(X.wrapR||0),G.push(X.magFilter),G.push(X.minFilter),G.push(X.anisotropy),G.push(X.internalFormat),G.push(X.format),G.push(X.type),G.push(X.generateMipmaps),G.push(X.premultiplyAlpha),G.push(X.flipY),G.push(X.unpackAlignment),G.push(X.colorSpace),G.join()}function y(X,G){const ne=r.get(X);if(X.isVideoTexture&&J(X),X.isRenderTargetTexture===!1&&X.version>0&&ne.__version!==X.version){const Y=X.image;if(Y===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Y.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{W(ne,X,G);return}}t.bindTexture(n.TEXTURE_2D,ne.__webglTexture,n.TEXTURE0+G)}function E(X,G){const ne=r.get(X);if(X.version>0&&ne.__version!==X.version){W(ne,X,G);return}t.bindTexture(n.TEXTURE_2D_ARRAY,ne.__webglTexture,n.TEXTURE0+G)}function R(X,G){const ne=r.get(X);if(X.version>0&&ne.__version!==X.version){W(ne,X,G);return}t.bindTexture(n.TEXTURE_3D,ne.__webglTexture,n.TEXTURE0+G)}function F(X,G){const ne=r.get(X);if(X.version>0&&ne.__version!==X.version){ee(ne,X,G);return}t.bindTexture(n.TEXTURE_CUBE_MAP,ne.__webglTexture,n.TEXTURE0+G)}const O={[zs]:n.REPEAT,[Rs]:n.CLAMP_TO_EDGE,[Qg]:n.MIRRORED_REPEAT},z={[Xr]:n.NEAREST,[SR]:n.NEAREST_MIPMAP_NEAREST,[Dh]:n.NEAREST_MIPMAP_LINEAR,[Lr]:n.LINEAR,[qm]:n.LINEAR_MIPMAP_NEAREST,[ea]:n.LINEAR_MIPMAP_LINEAR},j={[Cq]:n.NEVER,[Pq]:n.ALWAYS,[Tq]:n.LESS,[_z]:n.LEQUAL,[Iq]:n.EQUAL,[Fq]:n.GEQUAL,[Rq]:n.GREATER,[Uq]:n.NOTEQUAL};function Q(X,G){if(G.type===xi&&e.has("OES_texture_float_linear")===!1&&(G.magFilter===Lr||G.magFilter===qm||G.magFilter===Dh||G.magFilter===ea||G.minFilter===Lr||G.minFilter===qm||G.minFilter===Dh||G.minFilter===ea)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(X,n.TEXTURE_WRAP_S,O[G.wrapS]),n.texParameteri(X,n.TEXTURE_WRAP_T,O[G.wrapT]),(X===n.TEXTURE_3D||X===n.TEXTURE_2D_ARRAY)&&n.texParameteri(X,n.TEXTURE_WRAP_R,O[G.wrapR]),n.texParameteri(X,n.TEXTURE_MAG_FILTER,z[G.magFilter]),n.texParameteri(X,n.TEXTURE_MIN_FILTER,z[G.minFilter]),G.compareFunction&&(n.texParameteri(X,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(X,n.TEXTURE_COMPARE_FUNC,j[G.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(G.magFilter===Xr||G.minFilter!==Dh&&G.minFilter!==ea||G.type===xi&&e.has("OES_texture_float_linear")===!1)return;if(G.anisotropy>1||r.get(G).__currentAnisotropy){const ne=e.get("EXT_texture_filter_anisotropic");n.texParameterf(X,ne.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(G.anisotropy,i.getMaxAnisotropy())),r.get(G).__currentAnisotropy=G.anisotropy}}}function C(X,G){let ne=!1;X.__webglInit===void 0&&(X.__webglInit=!0,G.addEventListener("dispose",x));const Y=G.source;let de=f.get(Y);de===void 0&&(de={},f.set(Y,de));const ae=T(G);if(ae!==X.__cacheKey){de[ae]===void 0&&(de[ae]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,ne=!0),de[ae].usedTimes++;const Ee=de[X.__cacheKey];Ee!==void 0&&(de[X.__cacheKey].usedTimes--,Ee.usedTimes===0&&S(G)),X.__cacheKey=ae,X.__webglTexture=de[ae].texture}return ne}function W(X,G,ne){let Y=n.TEXTURE_2D;(G.isDataArrayTexture||G.isCompressedArrayTexture)&&(Y=n.TEXTURE_2D_ARRAY),G.isData3DTexture&&(Y=n.TEXTURE_3D);const de=C(X,G),ae=G.source;t.bindTexture(Y,X.__webglTexture,n.TEXTURE0+ne);const Ee=r.get(ae);if(ae.version!==Ee.__version||de===!0){t.activeTexture(n.TEXTURE0+ne);const V=Et.getPrimaries(Et.workingColorSpace),U=G.colorSpace===La?null:Et.getPrimaries(G.colorSpace),N=G.colorSpace===La||V===U?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,G.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,G.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,G.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,N);let K=m(G.image,!1,i.maxTextureSize);K=q(G,K);const oe=s.convert(G.format,G.colorSpace),pe=s.convert(G.type);let ve=v(G.internalFormat,oe,pe,G.colorSpace,G.isVideoTexture);Q(Y,G);let Ce;const Le=G.mipmaps,Re=G.isVideoTexture!==!0,$e=Ee.__version===void 0||de===!0,ce=ae.dataReady,Pe=_(G,K);if(G.isDepthTexture)ve=w(G.format===Fd,G.type),$e&&(Re?t.texStorage2D(n.TEXTURE_2D,1,ve,K.width,K.height):t.texImage2D(n.TEXTURE_2D,0,ve,K.width,K.height,0,oe,pe,null));else if(G.isDataTexture)if(Le.length>0){Re&&$e&&t.texStorage2D(n.TEXTURE_2D,Pe,ve,Le[0].width,Le[0].height);for(let Se=0,Te=Le.length;Se0){const Fe=XL(Ce.width,Ce.height,G.format,G.type);for(const De of G.layerUpdates){const Ze=Ce.data.subarray(De*Fe/Ce.data.BYTES_PER_ELEMENT,(De+1)*Fe/Ce.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Se,0,0,De,Ce.width,Ce.height,1,oe,Ze,0,0)}G.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Se,0,0,0,Ce.width,Ce.height,K.depth,oe,Ce.data,0,0)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,Se,ve,Ce.width,Ce.height,K.depth,0,Ce.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Re?ce&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,Se,0,0,0,Ce.width,Ce.height,K.depth,oe,pe,Ce.data):t.texImage3D(n.TEXTURE_2D_ARRAY,Se,ve,Ce.width,Ce.height,K.depth,0,oe,pe,Ce.data)}else{Re&&$e&&t.texStorage2D(n.TEXTURE_2D,Pe,ve,Le[0].width,Le[0].height);for(let Se=0,Te=Le.length;Se0){const Se=XL(K.width,K.height,G.format,G.type);for(const Te of G.layerUpdates){const Fe=K.data.subarray(Te*Se/K.data.BYTES_PER_ELEMENT,(Te+1)*Se/K.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,Te,K.width,K.height,1,oe,pe,Fe)}G.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,K.width,K.height,K.depth,oe,pe,K.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,ve,K.width,K.height,K.depth,0,oe,pe,K.data);else if(G.isData3DTexture)Re?($e&&t.texStorage3D(n.TEXTURE_3D,Pe,ve,K.width,K.height,K.depth),ce&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,K.width,K.height,K.depth,oe,pe,K.data)):t.texImage3D(n.TEXTURE_3D,0,ve,K.width,K.height,K.depth,0,oe,pe,K.data);else if(G.isFramebufferTexture){if($e)if(Re)t.texStorage2D(n.TEXTURE_2D,Pe,ve,K.width,K.height);else{let Se=K.width,Te=K.height;for(let Fe=0;Fe>=1,Te>>=1}}else if(Le.length>0){if(Re&&$e){const Se=he(Le[0]);t.texStorage2D(n.TEXTURE_2D,Pe,ve,Se.width,Se.height)}for(let Se=0,Te=Le.length;Se0&&Pe++;const Te=he(oe[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,Pe,Le,Te.width,Te.height)}for(let Te=0;Te<6;Te++)if(K){Re?ce&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Te,0,0,0,oe[Te].width,oe[Te].height,ve,Ce,oe[Te].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Te,0,Le,oe[Te].width,oe[Te].height,0,ve,Ce,oe[Te].data);for(let Fe=0;Fe>ae),oe=Math.max(1,G.height>>ae);de===n.TEXTURE_3D||de===n.TEXTURE_2D_ARRAY?t.texImage3D(de,ae,U,K,oe,G.depth,0,Ee,V,null):t.texImage2D(de,ae,U,K,oe,0,Ee,V,null)}t.bindFramebuffer(n.FRAMEBUFFER,X),Ae(G)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,Y,de,r.get(ne).__webglTexture,0,fe(G)):(de===n.TEXTURE_2D||de>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&de<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,Y,de,r.get(ne).__webglTexture,ae),t.bindFramebuffer(n.FRAMEBUFFER,null)}function re(X,G,ne){if(n.bindRenderbuffer(n.RENDERBUFFER,X),G.depthBuffer){const Y=G.depthTexture,de=Y&&Y.isDepthTexture?Y.type:null,ae=w(G.stencilBuffer,de),Ee=G.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,V=fe(G);Ae(G)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,V,ae,G.width,G.height):ne?n.renderbufferStorageMultisample(n.RENDERBUFFER,V,ae,G.width,G.height):n.renderbufferStorage(n.RENDERBUFFER,ae,G.width,G.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,Ee,n.RENDERBUFFER,X)}else{const Y=G.textures;for(let de=0;de{delete G.__boundDepthTexture,delete G.__depthDisposeCallback,Y.removeEventListener("dispose",de)};Y.addEventListener("dispose",de),G.__depthDisposeCallback=de}G.__boundDepthTexture=Y}if(X.depthTexture&&!G.__autoAllocateDepthBuffer){if(ne)throw new Error("target.depthTexture not supported in Cube render targets");ue(G.__webglFramebuffer,X)}else if(ne){G.__webglDepthbuffer=[];for(let Y=0;Y<6;Y++)if(t.bindFramebuffer(n.FRAMEBUFFER,G.__webglFramebuffer[Y]),G.__webglDepthbuffer[Y]===void 0)G.__webglDepthbuffer[Y]=n.createRenderbuffer(),re(G.__webglDepthbuffer[Y],X,!1);else{const de=X.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ae=G.__webglDepthbuffer[Y];n.bindRenderbuffer(n.RENDERBUFFER,ae),n.framebufferRenderbuffer(n.FRAMEBUFFER,de,n.RENDERBUFFER,ae)}}else if(t.bindFramebuffer(n.FRAMEBUFFER,G.__webglFramebuffer),G.__webglDepthbuffer===void 0)G.__webglDepthbuffer=n.createRenderbuffer(),re(G.__webglDepthbuffer,X,!1);else{const Y=X.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,de=G.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,de),n.framebufferRenderbuffer(n.FRAMEBUFFER,Y,n.RENDERBUFFER,de)}t.bindFramebuffer(n.FRAMEBUFFER,null)}function me(X,G,ne){const Y=r.get(X);G!==void 0&&P(Y.__webglFramebuffer,X,X.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),ne!==void 0&&le(X)}function ie(X){const G=X.texture,ne=r.get(X),Y=r.get(G);X.addEventListener("dispose",b);const de=X.textures,ae=X.isWebGLCubeRenderTarget===!0,Ee=de.length>1;if(Ee||(Y.__webglTexture===void 0&&(Y.__webglTexture=n.createTexture()),Y.__version=G.version,o.memory.textures++),ae){ne.__webglFramebuffer=[];for(let V=0;V<6;V++)if(G.mipmaps&&G.mipmaps.length>0){ne.__webglFramebuffer[V]=[];for(let U=0;U0){ne.__webglFramebuffer=[];for(let V=0;V0&&Ae(X)===!1){ne.__webglMultisampledFramebuffer=n.createFramebuffer(),ne.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,ne.__webglMultisampledFramebuffer);for(let V=0;V0)for(let U=0;U0)for(let U=0;U0){if(Ae(X)===!1){const G=X.textures,ne=X.width,Y=X.height;let de=n.COLOR_BUFFER_BIT;const ae=X.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Ee=r.get(X),V=G.length>1;if(V)for(let U=0;U0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&G.__useRenderToTexture!==!1}function J(X){const G=o.render.frame;A.get(X)!==G&&(A.set(X,G),X.update())}function q(X,G){const ne=X.colorSpace,Y=X.format,de=X.type;return X.isCompressedTexture===!0||X.isVideoTexture===!0||ne!==Sr&&ne!==La&&(Et.getTransfer(ne)===Sn?(Y!==Nr||de!==rc)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ne)),G}function he(X){return typeof HTMLImageElement<"u"&&X instanceof HTMLImageElement?(c.width=X.naturalWidth||X.width,c.height=X.naturalHeight||X.height):typeof VideoFrame<"u"&&X instanceof VideoFrame?(c.width=X.displayWidth,c.height=X.displayHeight):(c.width=X.width,c.height=X.height),c}this.allocateTextureUnit=D,this.resetTextureUnits=L,this.setTexture2D=y,this.setTexture2DArray=E,this.setTexture3D=R,this.setTextureCube=F,this.rebindTextures=me,this.setupRenderTarget=ie,this.updateRenderTargetMipmap=ge,this.updateMultisampleRenderTarget=H,this.setupDepthRenderbuffer=le,this.setupFrameBufferTexture=P,this.useMultisampledRTT=Ae}function rse(n,e){function t(r,i=La){let s;const o=Et.getTransfer(i);if(r===rc)return n.UNSIGNED_BYTE;if(r===TR)return n.UNSIGNED_SHORT_4_4_4_4;if(r===IR)return n.UNSIGNED_SHORT_5_5_5_1;if(r===hz)return n.UNSIGNED_INT_5_9_9_9_REV;if(r===uz)return n.BYTE;if(r===fz)return n.SHORT;if(r===Hg)return n.UNSIGNED_SHORT;if(r===CR)return n.INT;if(r===wA)return n.UNSIGNED_INT;if(r===xi)return n.FLOAT;if(r===Ha)return n.HALF_FLOAT;if(r===dz)return n.ALPHA;if(r===pz)return n.RGB;if(r===Nr)return n.RGBA;if(r===mz)return n.LUMINANCE;if(r===gz)return n.LUMINANCE_ALPHA;if(r===sd)return n.DEPTH_COMPONENT;if(r===Fd)return n.DEPTH_STENCIL;if(r===RR)return n.RED;if(r===c1)return n.RED_INTEGER;if(r===vz)return n.RG;if(r===UR)return n.RG_INTEGER;if(r===FR)return n.RGBA_INTEGER;if(r===xw||r===bw||r===Ew||r===Bw)if(o===Sn)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===xw)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===bw)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===Ew)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===Bw)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===xw)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===bw)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===Ew)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===Bw)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===iC||r===sC||r===oC||r===aC)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===iC)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===sC)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===oC)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===aC)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===lC||r===cC||r===AC)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===lC||r===cC)return o===Sn?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===AC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===uC||r===fC||r===hC||r===dC||r===pC||r===mC||r===gC||r===vC||r===yC||r===wC||r===_C||r===xC||r===bC||r===EC)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===uC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===fC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===hC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===dC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===pC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===mC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===gC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===vC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===yC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===wC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===_C)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===xC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===bC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===EC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===Mw||r===BC||r===MC)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===Mw)return o===Sn?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===BC)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===MC)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===yz||r===SC||r===CC||r===TC)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===Mw)return s.COMPRESSED_RED_RGTC1_EXT;if(r===SC)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===CC)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===TC)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===Ud?n.UNSIGNED_INT_24_8:n[r]!==void 0?n[r]:null}return{convert:t}}class ise extends Fr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class ri extends Lt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const sse={type:"move"};class GE{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ri,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new ri,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new $,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new $),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ri,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new $,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new $),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const r of e.hand.values())this._getHandJoint(t,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,r){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const m of e.hand.values()){const g=t.getJointPose(m,r),p=this._getHandJoint(c,m);g!==null&&(p.matrix.fromArray(g.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=g.radius),p.visible=g!==null}const A=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],f=A.position.distanceTo(u.position),h=.02,d=.005;c.inputState.pinching&&f>h+d?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=h-d&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,r),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(sse)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const r=new ri;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}const ose=` void main() { gl_Position = vec4( position, 1.0 ); -}`,cse=` +}`,ase=` uniform sampler2DArray depthColor; uniform float depthWidth; uniform float depthHeight; @@ -3898,12 +3898,12 @@ void main() { } -}`;class Ase{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,r){if(this.texture===null){const i=new Un,s=e.properties.get(i);s.__webglTexture=t.texture,(t.depthNear!=r.depthNear||t.depthFar!=r.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,r=new mr({vertexShader:lse,fragmentShader:cse,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new dn(new cc(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class use extends RA{constructor(e,t){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,A=null,u=null,f=null,h=null,d=null;const m=new Ase,g=t.getContextAttributes();let p=null,v=null;const w=[],_=[],x=new je;let b=null;const B=new Fr;B.layers.enable(1),B.viewport=new Pt;const M=new Fr;M.layers.enable(2),M.viewport=new Pt;const I=[B,M],S=new ose;S.layers.enable(1),S.layers.enable(2);let L=null,D=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ee){let P=w[ee];return P===void 0&&(P=new QE,w[ee]=P),P.getTargetRaySpace()},this.getControllerGrip=function(ee){let P=w[ee];return P===void 0&&(P=new QE,w[ee]=P),P.getGripSpace()},this.getHand=function(ee){let P=w[ee];return P===void 0&&(P=new QE,w[ee]=P),P.getHandSpace()};function T(ee){const P=_.indexOf(ee.inputSource);if(P===-1)return;const re=w[P];re!==void 0&&(re.update(ee.inputSource,ee.frame,c||o),re.dispatchEvent({type:ee.type,data:ee.inputSource}))}function y(){i.removeEventListener("select",T),i.removeEventListener("selectstart",T),i.removeEventListener("selectend",T),i.removeEventListener("squeeze",T),i.removeEventListener("squeezestart",T),i.removeEventListener("squeezeend",T),i.removeEventListener("end",y),i.removeEventListener("inputsourceschange",E);for(let ee=0;ee=0&&(_[ue]=null,w[ue].disconnect(re))}for(let P=0;P=_.length){_.push(re),ue=me;break}else if(_[me]===null){_[me]=re,ue=me;break}if(ue===-1)break}const le=w[ue];le&&le.connect(re)}}const R=new $,F=new $;function O(ee,P,re){R.setFromMatrixPosition(P.matrixWorld),F.setFromMatrixPosition(re.matrixWorld);const ue=R.distanceTo(F),le=P.projectionMatrix.elements,me=re.projectionMatrix.elements,ie=le[14]/(le[10]-1),ge=le[14]/(le[10]+1),_e=(le[9]+1)/le[5],se=(le[9]-1)/le[5],Q=(le[8]-1)/le[0],fe=(me[8]+1)/me[0],Ae=ie*Q,Z=ie*fe,q=ue/(-Q+fe),he=q*-Q;if(P.matrixWorld.decompose(ee.position,ee.quaternion,ee.scale),ee.translateX(he),ee.translateZ(q),ee.matrixWorld.compose(ee.position,ee.quaternion,ee.scale),ee.matrixWorldInverse.copy(ee.matrixWorld).invert(),le[10]===-1)ee.projectionMatrix.copy(P.projectionMatrix),ee.projectionMatrixInverse.copy(P.projectionMatrixInverse);else{const X=ie+q,G=ge+q,ne=Ae-he,Y=Z+(ue-he),de=_e*ge/G*X,ae=se*ge/G*X;ee.projectionMatrix.makePerspective(ne,Y,de,ae,X,G),ee.projectionMatrixInverse.copy(ee.projectionMatrix).invert()}}function z(ee,P){P===null?ee.matrixWorld.copy(ee.matrix):ee.matrixWorld.multiplyMatrices(P.matrixWorld,ee.matrix),ee.matrixWorldInverse.copy(ee.matrixWorld).invert()}this.updateCamera=function(ee){if(i===null)return;let P=ee.near,re=ee.far;m.texture!==null&&(m.depthNear>0&&(P=m.depthNear),m.depthFar>0&&(re=m.depthFar)),S.near=M.near=B.near=P,S.far=M.far=B.far=re,(L!==S.near||D!==S.far)&&(i.updateRenderState({depthNear:S.near,depthFar:S.far}),L=S.near,D=S.far);const ue=ee.parent,le=S.cameras;z(S,ue);for(let me=0;me0&&(g.alphaTest.value=p.alphaTest);const v=e.get(p),w=v.envMap,_=v.envMapRotation;w&&(g.envMap.value=w,zA.copy(_),zA.x*=-1,zA.y*=-1,zA.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(zA.y*=-1,zA.z*=-1),g.envMapRotation.value.setFromMatrix4(fse.makeRotationFromEuler(zA)),g.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap&&(g.lightMap.value=p.lightMap,g.lightMapIntensity.value=p.lightMapIntensity,t(p.lightMap,g.lightMapTransform)),p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,g.aoMapTransform))}function o(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform))}function a(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function l(g,p,v,w){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*v,g.scale.value=w*.5,p.map&&(g.map.value=p.map,t(p.map,g.uvTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function c(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function A(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4)}function u(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap)}function f(g,p){g.metalness.value=p.metalness,p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,g.metalnessMapTransform)),g.roughness.value=p.roughness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,g.roughnessMapTransform)),p.envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function h(g,p,v){g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,g.sheenColorMapTransform)),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,g.sheenRoughnessMapTransform))),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,g.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(g.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===oi&&g.clearcoatNormalScale.value.negate())),p.dispersion>0&&(g.dispersion.value=p.dispersion),p.iridescence>0&&(g.iridescence.value=p.iridescence,g.iridescenceIOR.value=p.iridescenceIOR,g.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(g.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,g.iridescenceMapTransform)),p.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=v.texture,g.transmissionSamplerSize.value.set(v.width,v.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,g.transmissionMapTransform)),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(g.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(g.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,g.specularColorMapTransform)),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,g.specularIntensityMapTransform))}function d(g,p){p.matcap&&(g.matcap.value=p.matcap)}function m(g,p){const v=e.get(p).light;g.referencePosition.value.setFromMatrixPosition(v.matrixWorld),g.nearDistance.value=v.shadow.camera.near,g.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function dse(n,e,t,r){let i={},s={},o=[];const a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(v,w){const _=w.program;r.uniformBlockBinding(v,_)}function c(v,w){let _=i[v.id];_===void 0&&(d(v),_=A(v),i[v.id]=_,v.addEventListener("dispose",g));const x=w.program;r.updateUBOMapping(v,x);const b=e.render.frame;s[v.id]!==b&&(f(v),s[v.id]=b)}function A(v){const w=u();v.__bindingPointIndex=w;const _=n.createBuffer(),x=v.__size,b=v.usage;return n.bindBuffer(n.UNIFORM_BUFFER,_),n.bufferData(n.UNIFORM_BUFFER,x,b),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,w,_),_}function u(){for(let v=0;v0&&(_+=x-b),v.__size=_,v.__cache={},this}function m(v){const w={boundary:0,storage:0};return typeof v=="number"||typeof v=="boolean"?(w.boundary=4,w.storage=4):v.isVector2?(w.boundary=8,w.storage=8):v.isVector3||v.isColor?(w.boundary=16,w.storage=12):v.isVector4?(w.boundary=16,w.storage=16):v.isMatrix3?(w.boundary=48,w.storage=48):v.isMatrix4?(w.boundary=64,w.storage=64):v.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",v),w}function g(v){const w=v.target;w.removeEventListener("dispose",g);const _=o.indexOf(w.__bindingPointIndex);o.splice(_,1),n.deleteBuffer(i[w.id]),delete i[w.id],delete s[w.id]}function p(){for(const v in i)n.deleteBuffer(i[v]);o=[],i={},s={}}return{bind:l,update:c,dispose:p}}class v0{constructor(e={}){const{canvas:t=eee(),context:r=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:A="default",failIfMajorPerformanceCaveat:u=!1}=e;this.isWebGLRenderer=!0;let f;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=r.getContextAttributes().alpha}else f=o;const h=new Uint32Array(4),d=new Int32Array(4);let m=null,g=null;const p=[],v=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Ut,this.toneMapping=uA,this.toneMappingExposure=1;const w=this;let _=!1,x=0,b=0,B=null,M=-1,I=null;const S=new Pt,L=new Pt;let D=null;const T=new ke(0);let y=0,E=t.width,R=t.height,F=1,O=null,z=null;const j=new Pt(0,0,E,R),H=new Pt(0,0,E,R);let C=!1;const W=new u1;let ee=!1,P=!1;const re=new He,ue=new He,le=new $,me=new Pt,ie={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ge=!1;function _e(){return B===null?F:1}let se=r;function Q(te,ye){return t.getContext(te,ye)}try{const te={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:A,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${nc}`),t.addEventListener("webglcontextlost",Te,!1),t.addEventListener("webglcontextrestored",Fe,!1),t.addEventListener("webglcontextcreationerror",De,!1),se===null){const ye="webgl2";if(se=Q(ye,te),se===null)throw Q(ye)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(te){throw console.error("THREE.WebGLRenderer: "+te.message),te}let fe,Ae,Z,q,he,X,G,ne,Y,de,ae,Ee,V,U,N,K,oe,pe,ve,Ce,Le,Re,$e,ce;function Pe(){fe=new wre(se),fe.init(),Re=new sse(se,fe),Ae=new dre(se,fe,e,Re),Z=new nse(se),Ae.reverseDepthBuffer&&Z.buffers.depth.setReversed(!0),q=new bre(se),he=new Qie,X=new ise(se,fe,Z,he,Ae,Re,q),G=new mre(w),ne=new yre(w),Y=new Iee(se),$e=new fre(se,Y),de=new _re(se,Y,q,$e),ae=new Bre(se,de,Y,q),ve=new Ere(se,Ae,X),K=new pre(he),Ee=new Hie(w,G,ne,fe,Ae,$e,K),V=new hse(w,he),U=new Gie,N=new Yie(fe),pe=new ure(w,G,ne,Z,ae,f,l),oe=new ese(w,ae,Ae),ce=new dse(se,q,Ae,Z),Ce=new hre(se,fe,q),Le=new xre(se,fe,q),q.programs=Ee.programs,w.capabilities=Ae,w.extensions=fe,w.properties=he,w.renderLists=U,w.shadowMap=oe,w.state=Z,w.info=q}Pe();const Me=new use(w,se);this.xr=Me,this.getContext=function(){return se},this.getContextAttributes=function(){return se.getContextAttributes()},this.forceContextLoss=function(){const te=fe.get("WEBGL_lose_context");te&&te.loseContext()},this.forceContextRestore=function(){const te=fe.get("WEBGL_lose_context");te&&te.restoreContext()},this.getPixelRatio=function(){return F},this.setPixelRatio=function(te){te!==void 0&&(F=te,this.setSize(E,R,!1))},this.getSize=function(te){return te.set(E,R)},this.setSize=function(te,ye,Be=!0){if(Me.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}E=te,R=ye,t.width=Math.floor(te*F),t.height=Math.floor(ye*F),Be===!0&&(t.style.width=te+"px",t.style.height=ye+"px"),this.setViewport(0,0,te,ye)},this.getDrawingBufferSize=function(te){return te.set(E*F,R*F).floor()},this.setDrawingBufferSize=function(te,ye,Be){E=te,R=ye,F=Be,t.width=Math.floor(te*Be),t.height=Math.floor(ye*Be),this.setViewport(0,0,te,ye)},this.getCurrentViewport=function(te){return te.copy(S)},this.getViewport=function(te){return te.copy(j)},this.setViewport=function(te,ye,Be,Se){te.isVector4?j.set(te.x,te.y,te.z,te.w):j.set(te,ye,Be,Se),Z.viewport(S.copy(j).multiplyScalar(F).round())},this.getScissor=function(te){return te.copy(H)},this.setScissor=function(te,ye,Be,Se){te.isVector4?H.set(te.x,te.y,te.z,te.w):H.set(te,ye,Be,Se),Z.scissor(L.copy(H).multiplyScalar(F).round())},this.getScissorTest=function(){return C},this.setScissorTest=function(te){Z.setScissorTest(C=te)},this.setOpaqueSort=function(te){O=te},this.setTransparentSort=function(te){z=te},this.getClearColor=function(te){return te.copy(pe.getClearColor())},this.setClearColor=function(){pe.setClearColor.apply(pe,arguments)},this.getClearAlpha=function(){return pe.getClearAlpha()},this.setClearAlpha=function(){pe.setClearAlpha.apply(pe,arguments)},this.clear=function(te=!0,ye=!0,Be=!0){let Se=0;if(te){let we=!1;if(B!==null){const Oe=B.texture.format;we=Oe===RR||Oe===IR||Oe===l1}if(we){const Oe=B.texture.type,Xe=Oe===rc||Oe===yA||Oe===Hg||Oe===Rd||Oe===MR||Oe===CR,qe=pe.getClearColor(),tt=pe.getClearAlpha(),ft=qe.r,mt=qe.g,st=qe.b;Xe?(h[0]=ft,h[1]=mt,h[2]=st,h[3]=tt,se.clearBufferuiv(se.COLOR,0,h)):(d[0]=ft,d[1]=mt,d[2]=st,d[3]=tt,se.clearBufferiv(se.COLOR,0,d))}else Se|=se.COLOR_BUFFER_BIT}ye&&(Se|=se.DEPTH_BUFFER_BIT,se.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),Be&&(Se|=se.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),se.clear(Se)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Te,!1),t.removeEventListener("webglcontextrestored",Fe,!1),t.removeEventListener("webglcontextcreationerror",De,!1),U.dispose(),N.dispose(),he.dispose(),G.dispose(),ne.dispose(),ae.dispose(),$e.dispose(),ce.dispose(),Ee.dispose(),Me.dispose(),Me.removeEventListener("sessionstart",tn),Me.removeEventListener("sessionend",qt),Zr.stop()};function Te(te){te.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),_=!0}function Fe(){console.log("THREE.WebGLRenderer: Context Restored."),_=!1;const te=q.autoReset,ye=oe.enabled,Be=oe.autoUpdate,Se=oe.needsUpdate,we=oe.type;Pe(),q.autoReset=te,oe.enabled=ye,oe.autoUpdate=Be,oe.needsUpdate=Se,oe.type=we}function De(te){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",te.statusMessage)}function Ze(te){const ye=te.target;ye.removeEventListener("dispose",Ze),At(ye)}function At(te){Pn(te),he.remove(te)}function Pn(te){const ye=he.get(te).programs;ye!==void 0&&(ye.forEach(function(Be){Ee.releaseProgram(Be)}),te.isShaderMaterial&&Ee.releaseShaderCache(te))}this.renderBufferDirect=function(te,ye,Be,Se,we,Oe){ye===null&&(ye=ie);const Xe=we.isMesh&&we.matrixWorld.determinant()<0,qe=da(te,ye,Be,Se,we);Z.setMaterial(Se,Xe);let tt=Be.index,ft=1;if(Se.wireframe===!0){if(tt=de.getWireframeAttribute(Be),tt===void 0)return;ft=2}const mt=Be.drawRange,st=Be.attributes.position;let Wt=mt.start*ft,fn=(mt.start+mt.count)*ft;Oe!==null&&(Wt=Math.max(Wt,Oe.start*ft),fn=Math.min(fn,(Oe.start+Oe.count)*ft)),tt!==null?(Wt=Math.max(Wt,0),fn=Math.min(fn,tt.count)):st!=null&&(Wt=Math.max(Wt,0),fn=Math.min(fn,st.count));const yn=fn-Wt;if(yn<0||yn===1/0)return;$e.setup(we,Se,qe,Be,tt);let Jr,Vt=Ce;if(tt!==null&&(Jr=Y.get(tt),Vt=Le,Vt.setIndex(Jr)),we.isMesh)Se.wireframe===!0?(Z.setLineWidth(Se.wireframeLinewidth*_e()),Vt.setMode(se.LINES)):Vt.setMode(se.TRIANGLES);else if(we.isLine){let at=Se.linewidth;at===void 0&&(at=1),Z.setLineWidth(at*_e()),we.isLineSegments?Vt.setMode(se.LINES):we.isLineLoop?Vt.setMode(se.LINE_LOOP):Vt.setMode(se.LINE_STRIP)}else we.isPoints?Vt.setMode(se.POINTS):we.isSprite&&Vt.setMode(se.TRIANGLES);if(we.isBatchedMesh)if(we._multiDrawInstances!==null)Vt.renderMultiDrawInstances(we._multiDrawStarts,we._multiDrawCounts,we._multiDrawCount,we._multiDrawInstances);else if(fe.get("WEBGL_multi_draw"))Vt.renderMultiDraw(we._multiDrawStarts,we._multiDrawCounts,we._multiDrawCount);else{const at=we._multiDrawStarts,or=we._multiDrawCounts,an=we._multiDrawCount,Ro=tt?Y.get(tt).bytesPerElement:1,nf=he.get(Se).currentProgram.getUniforms();for(let ds=0;ds{function Oe(){if(Se.forEach(function(Xe){he.get(Xe).currentProgram.isReady()&&Se.delete(Xe)}),Se.size===0){we(te);return}setTimeout(Oe,10)}fe.get("KHR_parallel_shader_compile")!==null?Oe():setTimeout(Oe,10)})};let xt=null;function Tr(te){xt&&xt(te)}function tn(){Zr.stop()}function qt(){Zr.start()}const Zr=new Cz;Zr.setAnimationLoop(Tr),typeof self<"u"&&Zr.setContext(self),this.setAnimationLoop=function(te){xt=te,Me.setAnimationLoop(te),te===null?Zr.stop():Zr.start()},Me.addEventListener("sessionstart",tn),Me.addEventListener("sessionend",qt),this.render=function(te,ye){if(ye!==void 0&&ye.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(_===!0)return;if(te.matrixWorldAutoUpdate===!0&&te.updateMatrixWorld(),ye.parent===null&&ye.matrixWorldAutoUpdate===!0&&ye.updateMatrixWorld(),Me.enabled===!0&&Me.isPresenting===!0&&(Me.cameraAutoUpdate===!0&&Me.updateCamera(ye),ye=Me.getCamera()),te.isScene===!0&&te.onBeforeRender(w,te,ye,B),g=N.get(te,v.length),g.init(ye),v.push(g),ue.multiplyMatrices(ye.projectionMatrix,ye.matrixWorldInverse),W.setFromProjectionMatrix(ue),P=this.localClippingEnabled,ee=K.init(this.clippingPlanes,P),m=U.get(te,p.length),m.init(),p.push(m),Me.enabled===!0&&Me.isPresenting===!0){const Oe=w.xr.getDepthSensingMesh();Oe!==null&&en(Oe,ye,-1/0,w.sortObjects)}en(te,ye,0,w.sortObjects),m.finish(),w.sortObjects===!0&&m.sort(O,z),ge=Me.enabled===!1||Me.isPresenting===!1||Me.hasDepthSensing()===!1,ge&&pe.addToRenderList(m,te),this.info.render.frame++,ee===!0&&K.beginShadows();const Be=g.state.shadowsArray;oe.render(Be,te,ye),ee===!0&&K.endShadows(),this.info.autoReset===!0&&this.info.reset();const Se=m.opaque,we=m.transmissive;if(g.setupLights(),ye.isArrayCamera){const Oe=ye.cameras;if(we.length>0)for(let Xe=0,qe=Oe.length;Xe0&&Ks(Se,we,te,ye),ge&&pe.render(te),nn(m,te,ye);B!==null&&(X.updateMultisampleRenderTarget(B),X.updateRenderTargetMipmap(B)),te.isScene===!0&&te.onAfterRender(w,te,ye),$e.resetDefaultState(),M=-1,I=null,v.pop(),v.length>0?(g=v[v.length-1],ee===!0&&K.setGlobalState(w.clippingPlanes,g.state.camera)):g=null,p.pop(),p.length>0?m=p[p.length-1]:m=null};function en(te,ye,Be,Se){if(te.visible===!1)return;if(te.layers.test(ye.layers)){if(te.isGroup)Be=te.renderOrder;else if(te.isLOD)te.autoUpdate===!0&&te.update(ye);else if(te.isLight)g.pushLight(te),te.castShadow&&g.pushShadow(te);else if(te.isSprite){if(!te.frustumCulled||W.intersectsSprite(te)){Se&&me.setFromMatrixPosition(te.matrixWorld).applyMatrix4(ue);const Xe=ae.update(te),qe=te.material;qe.visible&&m.push(te,Xe,qe,Be,me.z,null)}}else if((te.isMesh||te.isLine||te.isPoints)&&(!te.frustumCulled||W.intersectsObject(te))){const Xe=ae.update(te),qe=te.material;if(Se&&(te.boundingSphere!==void 0?(te.boundingSphere===null&&te.computeBoundingSphere(),me.copy(te.boundingSphere.center)):(Xe.boundingSphere===null&&Xe.computeBoundingSphere(),me.copy(Xe.boundingSphere.center)),me.applyMatrix4(te.matrixWorld).applyMatrix4(ue)),Array.isArray(qe)){const tt=Xe.groups;for(let ft=0,mt=tt.length;ft0&&Xt(we,ye,Be),Oe.length>0&&Xt(Oe,ye,Be),Xe.length>0&&Xt(Xe,ye,Be),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function Ks(te,ye,Be,Se){if((Be.isScene===!0?Be.overrideMaterial:null)!==null)return;g.state.transmissionRenderTarget[Se.id]===void 0&&(g.state.transmissionRenderTarget[Se.id]=new el(1,1,{generateMipmaps:!0,type:fe.has("EXT_color_buffer_half_float")||fe.has("EXT_color_buffer_float")?ka:rc,minFilter:qo,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Et.workingColorSpace}));const Oe=g.state.transmissionRenderTarget[Se.id],Xe=Se.viewport||S;Oe.setSize(Xe.z,Xe.w);const qe=w.getRenderTarget();w.setRenderTarget(Oe),w.getClearColor(T),y=w.getClearAlpha(),y<1&&w.setClearColor(16777215,.5),w.clear(),ge&&pe.render(Be);const tt=w.toneMapping;w.toneMapping=uA;const ft=Se.viewport;if(Se.viewport!==void 0&&(Se.viewport=void 0),g.setupLightsView(Se),ee===!0&&K.setGlobalState(w.clippingPlanes,Se),Xt(te,Be,Se),X.updateMultisampleRenderTarget(Oe),X.updateRenderTargetMipmap(Oe),fe.has("WEBGL_multisampled_render_to_texture")===!1){let mt=!1;for(let st=0,Wt=ye.length;st0),st=!!Be.morphAttributes.position,Wt=!!Be.morphAttributes.normal,fn=!!Be.morphAttributes.color;let yn=uA;Se.toneMapped&&(B===null||B.isXRRenderTarget===!0)&&(yn=w.toneMapping);const Jr=Be.morphAttributes.position||Be.morphAttributes.normal||Be.morphAttributes.color,Vt=Jr!==void 0?Jr.length:0,at=he.get(Se),or=g.state.lights;if(ee===!0&&(P===!0||te!==I)){const Xs=te===I&&Se.id===M;K.setState(Se,te,Xs)}let an=!1;Se.version===at.__version?(at.needsLights&&at.lightsStateVersion!==or.state.version||at.outputColorSpace!==qe||we.isBatchedMesh&&at.batching===!1||!we.isBatchedMesh&&at.batching===!0||we.isBatchedMesh&&at.batchingColor===!0&&we.colorTexture===null||we.isBatchedMesh&&at.batchingColor===!1&&we.colorTexture!==null||we.isInstancedMesh&&at.instancing===!1||!we.isInstancedMesh&&at.instancing===!0||we.isSkinnedMesh&&at.skinning===!1||!we.isSkinnedMesh&&at.skinning===!0||we.isInstancedMesh&&at.instancingColor===!0&&we.instanceColor===null||we.isInstancedMesh&&at.instancingColor===!1&&we.instanceColor!==null||we.isInstancedMesh&&at.instancingMorph===!0&&we.morphTexture===null||we.isInstancedMesh&&at.instancingMorph===!1&&we.morphTexture!==null||at.envMap!==tt||Se.fog===!0&&at.fog!==Oe||at.numClippingPlanes!==void 0&&(at.numClippingPlanes!==K.numPlanes||at.numIntersection!==K.numIntersection)||at.vertexAlphas!==ft||at.vertexTangents!==mt||at.morphTargets!==st||at.morphNormals!==Wt||at.morphColors!==fn||at.toneMapping!==yn||at.morphTargetsCount!==Vt)&&(an=!0):(an=!0,at.__version=Se.version);let Ro=at.currentProgram;an===!0&&(Ro=Ii(Se,ye,we));let nf=!1,ds=!1,cb=!1;const ar=Ro.getUniforms(),pc=at.uniforms;if(Z.useProgram(Ro.program)&&(nf=!0,ds=!0,cb=!0),Se.id!==M&&(M=Se.id,ds=!0),nf||I!==te){Ae.reverseDepthBuffer?(re.copy(te.projectionMatrix),nee(re),ree(re),ar.setValue(se,"projectionMatrix",re)):ar.setValue(se,"projectionMatrix",te.projectionMatrix),ar.setValue(se,"viewMatrix",te.matrixWorldInverse);const Xs=ar.map.cameraPosition;Xs!==void 0&&Xs.setValue(se,le.setFromMatrixPosition(te.matrixWorld)),Ae.logarithmicDepthBuffer&&ar.setValue(se,"logDepthBufFC",2/(Math.log(te.far+1)/Math.LN2)),(Se.isMeshPhongMaterial||Se.isMeshToonMaterial||Se.isMeshLambertMaterial||Se.isMeshBasicMaterial||Se.isMeshStandardMaterial||Se.isShaderMaterial)&&ar.setValue(se,"isOrthographic",te.isOrthographicCamera===!0),I!==te&&(I=te,ds=!0,cb=!0)}if(we.isSkinnedMesh){ar.setOptional(se,we,"bindMatrix"),ar.setOptional(se,we,"bindMatrixInverse");const Xs=we.skeleton;Xs&&(Xs.boneTexture===null&&Xs.computeBoneTexture(),ar.setValue(se,"boneTexture",Xs.boneTexture,X))}we.isBatchedMesh&&(ar.setOptional(se,we,"batchingTexture"),ar.setValue(se,"batchingTexture",we._matricesTexture,X),ar.setOptional(se,we,"batchingIdTexture"),ar.setValue(se,"batchingIdTexture",we._indirectTexture,X),ar.setOptional(se,we,"batchingColorTexture"),we._colorsTexture!==null&&ar.setValue(se,"batchingColorTexture",we._colorsTexture,X));const Ab=Be.morphAttributes;if((Ab.position!==void 0||Ab.normal!==void 0||Ab.color!==void 0)&&ve.update(we,Be,Ro),(ds||at.receiveShadow!==we.receiveShadow)&&(at.receiveShadow=we.receiveShadow,ar.setValue(se,"receiveShadow",we.receiveShadow)),Se.isMeshGouraudMaterial&&Se.envMap!==null&&(pc.envMap.value=tt,pc.flipEnvMap.value=tt.isCubeTexture&&tt.isRenderTargetTexture===!1?-1:1),Se.isMeshStandardMaterial&&Se.envMap===null&&ye.environment!==null&&(pc.envMapIntensity.value=ye.environmentIntensity),ds&&(ar.setValue(se,"toneMappingExposure",w.toneMappingExposure),at.needsLights&&un(pc,cb),Oe&&Se.fog===!0&&V.refreshFogUniforms(pc,Oe),V.refreshMaterialUniforms(pc,Se,F,R,g.state.transmissionRenderTarget[te.id]),Mw.upload(se,rn(at),pc,X)),Se.isShaderMaterial&&Se.uniformsNeedUpdate===!0&&(Mw.upload(se,rn(at),pc,X),Se.uniformsNeedUpdate=!1),Se.isSpriteMaterial&&ar.setValue(se,"center",we.center),ar.setValue(se,"modelViewMatrix",we.modelViewMatrix),ar.setValue(se,"normalMatrix",we.normalMatrix),ar.setValue(se,"modelMatrix",we.matrixWorld),Se.isShaderMaterial||Se.isRawShaderMaterial){const Xs=Se.uniformsGroups;for(let ub=0,MW=Xs.length;ub0&&X.useMultisampledRTT(te)===!1?we=he.get(te).__webglMultisampledFramebuffer:Array.isArray(mt)?we=mt[Be]:we=mt,S.copy(te.viewport),L.copy(te.scissor),D=te.scissorTest}else S.copy(j).multiplyScalar(F).floor(),L.copy(H).multiplyScalar(F).floor(),D=C;if(Z.bindFramebuffer(se.FRAMEBUFFER,we)&&Se&&Z.drawBuffers(te,we),Z.viewport(S),Z.scissor(L),Z.setScissorTest(D),Oe){const tt=he.get(te.texture);se.framebufferTexture2D(se.FRAMEBUFFER,se.COLOR_ATTACHMENT0,se.TEXTURE_CUBE_MAP_POSITIVE_X+ye,tt.__webglTexture,Be)}else if(Xe){const tt=he.get(te.texture),ft=ye||0;se.framebufferTextureLayer(se.FRAMEBUFFER,se.COLOR_ATTACHMENT0,tt.__webglTexture,Be||0,ft)}M=-1},this.readRenderTargetPixels=function(te,ye,Be,Se,we,Oe,Xe){if(!(te&&te.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let qe=he.get(te).__webglFramebuffer;if(te.isWebGLCubeRenderTarget&&Xe!==void 0&&(qe=qe[Xe]),qe){Z.bindFramebuffer(se.FRAMEBUFFER,qe);try{const tt=te.texture,ft=tt.format,mt=tt.type;if(!Ae.textureFormatReadable(ft)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Ae.textureTypeReadable(mt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ye>=0&&ye<=te.width-Se&&Be>=0&&Be<=te.height-we&&se.readPixels(ye,Be,Se,we,Re.convert(ft),Re.convert(mt),Oe)}finally{const tt=B!==null?he.get(B).__webglFramebuffer:null;Z.bindFramebuffer(se.FRAMEBUFFER,tt)}}},this.readRenderTargetPixelsAsync=async function(te,ye,Be,Se,we,Oe,Xe){if(!(te&&te.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let qe=he.get(te).__webglFramebuffer;if(te.isWebGLCubeRenderTarget&&Xe!==void 0&&(qe=qe[Xe]),qe){const tt=te.texture,ft=tt.format,mt=tt.type;if(!Ae.textureFormatReadable(ft))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Ae.textureTypeReadable(mt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(ye>=0&&ye<=te.width-Se&&Be>=0&&Be<=te.height-we){Z.bindFramebuffer(se.FRAMEBUFFER,qe);const st=se.createBuffer();se.bindBuffer(se.PIXEL_PACK_BUFFER,st),se.bufferData(se.PIXEL_PACK_BUFFER,Oe.byteLength,se.STREAM_READ),se.readPixels(ye,Be,Se,we,Re.convert(ft),Re.convert(mt),0);const Wt=B!==null?he.get(B).__webglFramebuffer:null;Z.bindFramebuffer(se.FRAMEBUFFER,Wt);const fn=se.fenceSync(se.SYNC_GPU_COMMANDS_COMPLETE,0);return se.flush(),await tee(se,fn,4),se.bindBuffer(se.PIXEL_PACK_BUFFER,st),se.getBufferSubData(se.PIXEL_PACK_BUFFER,0,Oe),se.deleteBuffer(st),se.deleteSync(fn),Oe}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(te,ye=null,Be=0){te.isTexture!==!0&&(Sw("WebGLRenderer: copyFramebufferToTexture function signature has changed."),ye=arguments[0]||null,te=arguments[1]);const Se=Math.pow(2,-Be),we=Math.floor(te.image.width*Se),Oe=Math.floor(te.image.height*Se),Xe=ye!==null?ye.x:0,qe=ye!==null?ye.y:0;X.setTexture2D(te,0),se.copyTexSubImage2D(se.TEXTURE_2D,Be,0,0,Xe,qe,we,Oe),Z.unbindTexture()},this.copyTextureToTexture=function(te,ye,Be=null,Se=null,we=0){te.isTexture!==!0&&(Sw("WebGLRenderer: copyTextureToTexture function signature has changed."),Se=arguments[0]||null,te=arguments[1],ye=arguments[2],we=arguments[3]||0,Be=null);let Oe,Xe,qe,tt,ft,mt;Be!==null?(Oe=Be.max.x-Be.min.x,Xe=Be.max.y-Be.min.y,qe=Be.min.x,tt=Be.min.y):(Oe=te.image.width,Xe=te.image.height,qe=0,tt=0),Se!==null?(ft=Se.x,mt=Se.y):(ft=0,mt=0);const st=Re.convert(ye.format),Wt=Re.convert(ye.type);X.setTexture2D(ye,0),se.pixelStorei(se.UNPACK_FLIP_Y_WEBGL,ye.flipY),se.pixelStorei(se.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ye.premultiplyAlpha),se.pixelStorei(se.UNPACK_ALIGNMENT,ye.unpackAlignment);const fn=se.getParameter(se.UNPACK_ROW_LENGTH),yn=se.getParameter(se.UNPACK_IMAGE_HEIGHT),Jr=se.getParameter(se.UNPACK_SKIP_PIXELS),Vt=se.getParameter(se.UNPACK_SKIP_ROWS),at=se.getParameter(se.UNPACK_SKIP_IMAGES),or=te.isCompressedTexture?te.mipmaps[we]:te.image;se.pixelStorei(se.UNPACK_ROW_LENGTH,or.width),se.pixelStorei(se.UNPACK_IMAGE_HEIGHT,or.height),se.pixelStorei(se.UNPACK_SKIP_PIXELS,qe),se.pixelStorei(se.UNPACK_SKIP_ROWS,tt),te.isDataTexture?se.texSubImage2D(se.TEXTURE_2D,we,ft,mt,Oe,Xe,st,Wt,or.data):te.isCompressedTexture?se.compressedTexSubImage2D(se.TEXTURE_2D,we,ft,mt,or.width,or.height,st,or.data):se.texSubImage2D(se.TEXTURE_2D,we,ft,mt,Oe,Xe,st,Wt,or),se.pixelStorei(se.UNPACK_ROW_LENGTH,fn),se.pixelStorei(se.UNPACK_IMAGE_HEIGHT,yn),se.pixelStorei(se.UNPACK_SKIP_PIXELS,Jr),se.pixelStorei(se.UNPACK_SKIP_ROWS,Vt),se.pixelStorei(se.UNPACK_SKIP_IMAGES,at),we===0&&ye.generateMipmaps&&se.generateMipmap(se.TEXTURE_2D),Z.unbindTexture()},this.copyTextureToTexture3D=function(te,ye,Be=null,Se=null,we=0){te.isTexture!==!0&&(Sw("WebGLRenderer: copyTextureToTexture3D function signature has changed."),Be=arguments[0]||null,Se=arguments[1]||null,te=arguments[2],ye=arguments[3],we=arguments[4]||0);let Oe,Xe,qe,tt,ft,mt,st,Wt,fn;const yn=te.isCompressedTexture?te.mipmaps[we]:te.image;Be!==null?(Oe=Be.max.x-Be.min.x,Xe=Be.max.y-Be.min.y,qe=Be.max.z-Be.min.z,tt=Be.min.x,ft=Be.min.y,mt=Be.min.z):(Oe=yn.width,Xe=yn.height,qe=yn.depth,tt=0,ft=0,mt=0),Se!==null?(st=Se.x,Wt=Se.y,fn=Se.z):(st=0,Wt=0,fn=0);const Jr=Re.convert(ye.format),Vt=Re.convert(ye.type);let at;if(ye.isData3DTexture)X.setTexture3D(ye,0),at=se.TEXTURE_3D;else if(ye.isDataArrayTexture||ye.isCompressedArrayTexture)X.setTexture2DArray(ye,0),at=se.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}se.pixelStorei(se.UNPACK_FLIP_Y_WEBGL,ye.flipY),se.pixelStorei(se.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ye.premultiplyAlpha),se.pixelStorei(se.UNPACK_ALIGNMENT,ye.unpackAlignment);const or=se.getParameter(se.UNPACK_ROW_LENGTH),an=se.getParameter(se.UNPACK_IMAGE_HEIGHT),Ro=se.getParameter(se.UNPACK_SKIP_PIXELS),nf=se.getParameter(se.UNPACK_SKIP_ROWS),ds=se.getParameter(se.UNPACK_SKIP_IMAGES);se.pixelStorei(se.UNPACK_ROW_LENGTH,yn.width),se.pixelStorei(se.UNPACK_IMAGE_HEIGHT,yn.height),se.pixelStorei(se.UNPACK_SKIP_PIXELS,tt),se.pixelStorei(se.UNPACK_SKIP_ROWS,ft),se.pixelStorei(se.UNPACK_SKIP_IMAGES,mt),te.isDataTexture||te.isData3DTexture?se.texSubImage3D(at,we,st,Wt,fn,Oe,Xe,qe,Jr,Vt,yn.data):ye.isCompressedArrayTexture?se.compressedTexSubImage3D(at,we,st,Wt,fn,Oe,Xe,qe,Jr,yn.data):se.texSubImage3D(at,we,st,Wt,fn,Oe,Xe,qe,Jr,Vt,yn),se.pixelStorei(se.UNPACK_ROW_LENGTH,or),se.pixelStorei(se.UNPACK_IMAGE_HEIGHT,an),se.pixelStorei(se.UNPACK_SKIP_PIXELS,Ro),se.pixelStorei(se.UNPACK_SKIP_ROWS,nf),se.pixelStorei(se.UNPACK_SKIP_IMAGES,ds),we===0&&ye.generateMipmaps&&se.generateMipmap(at),Z.unbindTexture()},this.initRenderTarget=function(te){he.get(te).__webglFramebuffer===void 0&&X.setupRenderTarget(te)},this.initTexture=function(te){te.isCubeTexture?X.setTextureCube(te,0):te.isData3DTexture?X.setTexture3D(te,0):te.isDataArrayTexture||te.isCompressedArrayTexture?X.setTexture2DArray(te,0):X.setTexture2D(te,0),Z.unbindTexture()},this.resetState=function(){x=0,b=0,B=null,Z.reset(),$e.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return zl}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===FR?"display-p3":"srgb",t.unpackColorSpace=Et.workingColorSpace===c1?"display-p3":"srgb"}}class zg extends Lt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new tr,this.environmentIntensity=1,this.environmentRotation=new tr,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class pse{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=TC,this.updateRanges=[],this.version=0,this.uuid=ra()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,r){e*=this.stride,r*=t.stride;for(let i=0,s=this.stride;i=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});const o=i[this.index];s.push(o),this.index++,o.start=e.start,o.count=e.count,o.z=t,o.index=r}reset(){this.list.length=0,this.index=0}}const Bc=new He,VE=new He,xse=new He,bse=new ke(1,1,1),nD=new He,jE=new u1,Pv=new Qn,GA=new Si,Lp=new $,rD=new $,Ese=new $,WE=new _se,di=new dn,Lv=[];function Bse(n,e,t=0){const r=e.itemSize;if(n.isInterleavedBufferAttribute||n.array.constructor!==e.array.constructor){const i=n.count;for(let s=0;s65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new ct(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const r in t.attributes){if(!e.hasAttribute(r))throw new Error(`BatchedMesh: Added geometry missing "${r}". All geometries must have consistent attributes.`);const i=e.getAttribute(r),s=t.getAttribute(r);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Qn);const e=this.boundingBox,t=this._drawInfo;e.makeEmpty();for(let r=0,i=t.length;r=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("BatchedMesh: Maximum item count reached.");const r={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(i=this._availableInstanceIds.pop(),this._drawInfo[i]=r):(i=this._drawInfo.length,this._drawInfo.push(r));const s=this._matricesTexture,o=s.image.data;xse.toArray(o,i*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(bse.toArray(a.image.data,i*4),a.needsUpdate=!0),i}addGeometry(e,t=-1,r=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const o=this._reservedRanges,a=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(s=o[o.length-1]),t===-1?i.vertexCount=e.getAttribute("position").count:i.vertexCount=t,s===null?i.vertexStart=0:i.vertexStart=s.vertexStart+s.vertexCount;const c=e.getIndex(),A=c!==null;if(A&&(r===-1?i.indexCount=c.count:i.indexCount=r,s===null?i.indexStart=0:i.indexStart=s.indexStart+s.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const u=this._geometryCount;return this._geometryCount++,o.push(i),a.push({start:A?i.indexStart:i.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new Qn,sphereInitialized:!1,sphere:new Si}),this.setGeometryAt(u,e),u}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const r=this.geometry,i=r.getIndex()!==null,s=r.getIndex(),o=t.getIndex(),a=this._reservedRanges[e];if(i&&o.count>a.indexCount||t.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.vertexCount;for(const h in r.attributes){const d=t.getAttribute(h),m=r.getAttribute(h);Bse(d,m,l);const g=d.itemSize;for(let p=d.count,v=c;p=t.length||t[e].active===!1?this:(t[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this)}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const r=this._bounds[e],i=r.box,s=this.geometry;if(r.boxInitialized===!1){i.makeEmpty();const o=s.index,a=s.attributes.position,l=this._drawRanges[e];for(let c=l.start,A=l.start+l.count;c=this._geometryCount)return null;const r=this._bounds[e],i=r.sphere,s=this.geometry;if(r.sphereInitialized===!1){i.makeEmpty(),this.getBoundingBoxAt(e,Pv),Pv.getCenter(i.center);const o=s.index,a=s.attributes.position,l=this._drawRanges[e];let c=0;for(let A=l.start,u=l.start+l.count;A=r.length||r[e].active===!1?this:(t.toArray(s,e*16),i.needsUpdate=!0,this)}getMatrixAt(e,t){const r=this._drawInfo,i=this._matricesTexture.image.data;return e>=r.length||r[e].active===!1?null:t.fromArray(i,e*16)}setColorAt(e,t){this._colorsTexture===null&&this._initColorsTexture();const r=this._colorsTexture,i=this._colorsTexture.image.data,s=this._drawInfo;return e>=s.length||s[e].active===!1?this:(t.toArray(i,e*4),r.needsUpdate=!0,this)}getColorAt(e,t){const r=this._colorsTexture.image.data,i=this._drawInfo;return e>=i.length||i[e].active===!1?null:t.fromArray(r,e*4)}setVisibleAt(e,t){const r=this._drawInfo;return e>=r.length||r[e].active===!1||r[e].visible===t?this:(r[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?!1:t[e].visible}setGeometryIdAt(e,t){const r=this._drawInfo;return e>=r.length||r[e].active===!1||t<0||t>=this._geometryCount?null:(r[e].geometryIndex=t,this)}getGeometryIdAt(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?-1:t[e].geometryIndex}getGeometryRangeAt(e,t={}){if(e<0||e>=this._geometryCount)return null;const r=this._drawRanges[e];return t.start=r.start,t.count=r.count,t}raycast(e,t){const r=this._drawInfo,i=this._drawRanges,s=this.matrixWorld,o=this.geometry;di.material=this.material,di.geometry.index=o.index,di.geometry.attributes=o.attributes,di.geometry.boundingBox===null&&(di.geometry.boundingBox=new Qn),di.geometry.boundingSphere===null&&(di.geometry.boundingSphere=new Si);for(let a=0,l=r.length;a({...t})),this._reservedRanges=e._reservedRanges.map(t=>({...t})),this._drawInfo=e._drawInfo.map(t=>({...t})),this._bounds=e._bounds.map(t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,t,r,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._drawInfo,c=this._multiDrawStarts,A=this._multiDrawCounts,u=this._drawRanges,f=this.perObjectFrustumCulled,h=this._indirectTexture,d=h.image.data;f&&(nD.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),jE.setFromProjectionMatrix(nD,e.coordinateSystem));let m=0;if(this.sortObjects){VE.copy(this.matrixWorld).invert(),Lp.setFromMatrixPosition(r.matrixWorld).applyMatrix4(VE),rD.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(VE);for(let v=0,w=l.length;v0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;sr)return;KE.applyMatrix4(n.matrixWorld);const l=e.ray.origin.distanceTo(KE);if(!(le.far))return{distance:l,point:sD.clone().applyMatrix4(n.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:n}}const oD=new $,aD=new $;class y0 extends Yd{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,r=[];for(let i=0,s=t.count;i0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;si.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class XE extends Un{constructor(e,t,r,i,s,o,a,l,c,A,u,f){super(null,o,a,l,c,A,i,s,u,f),this.isCompressedTexture=!0,this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Tse extends Un{constructor(e,t,r,i,s,o,a,l,c){super(e,t,r,i,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Ise{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let r,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(i),t.push(s),i=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const r=this.getLengths();let i=0;const s=r.length;let o;t?o=t:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=r[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const A=r[i],f=r[i+1]-A,h=(o-A)/f;return(i+h)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=t||(o.isVector2?new je:new $);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t){const r=new $,i=[],s=[],o=[],a=new $,l=new He;for(let h=0;h<=e;h++){const d=h/e;i[h]=this.getTangentAt(d,new $)}s[0]=new $,o[0]=new $;let c=Number.MAX_VALUE;const A=Math.abs(i[0].x),u=Math.abs(i[0].y),f=Math.abs(i[0].z);A<=c&&(c=A,r.set(1,0,0)),u<=c&&(c=u,r.set(0,1,0)),f<=c&&r.set(0,0,1),a.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let h=1;h<=e;h++){if(s[h]=s[h-1].clone(),o[h]=o[h-1].clone(),a.crossVectors(i[h-1],i[h]),a.length()>Number.EPSILON){a.normalize();const d=Math.acos(pr(i[h-1].dot(i[h]),-1,1));s[h].applyMatrix4(l.makeRotationAxis(a,d))}o[h].crossVectors(i[h],s[h])}if(t===!0){let h=Math.acos(pr(s[0].dot(s[e]),-1,1));h/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(h=-h);for(let d=1;d<=e;d++)s[d].applyMatrix4(l.makeRotationAxis(i[d],h*d)),o[d].crossVectors(i[d],s[d])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class d1 extends Jt{constructor(e=1,t=1,r=1,i=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const A=[],u=[],f=[],h=[];let d=0;const m=[],g=r/2;let p=0;v(),o===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(A),this.setAttribute("position",new xn(u,3)),this.setAttribute("normal",new xn(f,3)),this.setAttribute("uv",new xn(h,2));function v(){const _=new $,x=new $;let b=0;const B=(t-e)/r;for(let M=0;M<=s;M++){const I=[],S=M/s,L=S*(t-e)+e;for(let D=0;D<=i;D++){const T=D/i,y=T*l+a,E=Math.sin(y),R=Math.cos(y);x.x=L*E,x.y=-S*r+g,x.z=L*R,u.push(x.x,x.y,x.z),_.set(E,B,R).normalize(),f.push(_.x,_.y,_.z),h.push(T,1-S),I.push(d++)}m.push(I)}for(let M=0;M0&&(A.push(S,L,T),b+=3),t>0&&(A.push(L,D,T),b+=3)}c.addGroup(p,b,0),p+=b}function w(_){const x=d,b=new je,B=new $;let M=0;const I=_===!0?e:t,S=_===!0?1:-1;for(let D=1;D<=i;D++)u.push(0,g*S,0),f.push(0,S,0),h.push(.5,.5),d++;const L=d;for(let D=0;D<=i;D++){const y=D/i*l+a,E=Math.cos(y),R=Math.sin(y);B.x=I*R,B.y=g*S,B.z=I*E,u.push(B.x,B.y,B.z),f.push(0,S,0),b.x=E*.5+.5,b.y=R*.5*S+.5,h.push(b.x,b.y),d++}for(let D=0;D80*t){a=c=n[0],l=A=n[1];for(let d=t;dc&&(c=u),f>A&&(A=f);h=Math.max(c-a,A-l),h=h!==0?32767/h:0}return Vg(s,o,t,a,l,h,0),o}};function Pz(n,e,t,r,i){let s,o;if(i===Kse(n,e,t,r)>0)for(s=e;s=e;s-=r)o=AD(s,n[s],n[s+1],o);return o&&p1(o,o.next)&&(Wg(o),o=o.next),o}function Lu(n,e){if(!n)return n;e||(e=n);let t=n,r;do if(r=!1,!t.steiner&&(p1(t,t.next)||Kn(t.prev,t,t.next)===0)){if(Wg(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function Vg(n,e,t,r,i,s,o){if(!n)return;!o&&s&&Qse(n,r,i,s);let a=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,s?Fse(n,r,i,s):Use(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),Wg(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=Pse(Lu(n),e,t),Vg(n,e,t,r,i,s,2)):o===2&&Lse(n,e,t,r,i,s):Vg(Lu(n),e,t,r,i,s,1);break}}}function Use(n){const e=n.prev,t=n,r=n.next;if(Kn(e,t,r)>=0)return!1;const i=e.x,s=t.x,o=r.x,a=e.y,l=t.y,c=r.y,A=is?i>o?i:o:s>o?s:o,h=a>l?a>c?a:c:l>c?l:c;let d=r.next;for(;d!==e;){if(d.x>=A&&d.x<=f&&d.y>=u&&d.y<=h&&Oh(i,a,s,l,o,c,d.x,d.y)&&Kn(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Fse(n,e,t,r){const i=n.prev,s=n,o=n.next;if(Kn(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,A=i.y,u=s.y,f=o.y,h=al?a>c?a:c:l>c?l:c,g=A>u?A>f?A:f:u>f?u:f,p=UC(h,d,e,t,r),v=UC(m,g,e,t,r);let w=n.prevZ,_=n.nextZ;for(;w&&w.z>=p&&_&&_.z<=v;){if(w.x>=h&&w.x<=m&&w.y>=d&&w.y<=g&&w!==i&&w!==o&&Oh(a,A,l,u,c,f,w.x,w.y)&&Kn(w.prev,w,w.next)>=0||(w=w.prevZ,_.x>=h&&_.x<=m&&_.y>=d&&_.y<=g&&_!==i&&_!==o&&Oh(a,A,l,u,c,f,_.x,_.y)&&Kn(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;w&&w.z>=p;){if(w.x>=h&&w.x<=m&&w.y>=d&&w.y<=g&&w!==i&&w!==o&&Oh(a,A,l,u,c,f,w.x,w.y)&&Kn(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;_&&_.z<=v;){if(_.x>=h&&_.x<=m&&_.y>=d&&_.y<=g&&_!==i&&_!==o&&Oh(a,A,l,u,c,f,_.x,_.y)&&Kn(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function Pse(n,e,t){let r=n;do{const i=r.prev,s=r.next.next;!p1(i,s)&&Lz(i,r,r.next,s)&&jg(i,s)&&jg(s,i)&&(e.push(i.i/t|0),e.push(r.i/t|0),e.push(s.i/t|0),Wg(r),Wg(r.next),r=n=s),r=r.next}while(r!==n);return Lu(r)}function Lse(n,e,t,r,i,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Vse(o,a)){let l=Dz(o,a);o=Lu(o,o.next),l=Lu(l,l.next),Vg(o,e,t,r,i,s,0),Vg(l,e,t,r,i,s,0);return}a=a.next}o=o.next}while(o!==n)}function Dse(n,e,t,r){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s=t.next.y&&t.next.y!==t.y){const f=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=s&&f>r&&(r=f,i=t.x=t.x&&t.x>=l&&s!==t.x&&Oh(oi.x||t.x===i.x&&Hse(i,t)))&&(i=t,A=u)),t=t.next;while(t!==a);return i}function Hse(n,e){return Kn(n.prev,n,e.prev)<0&&Kn(e.next,n,n.next)<0}function Qse(n,e,t,r){let i=n;do i.z===0&&(i.z=UC(i.x,i.y,e,t,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==n);i.prevZ.nextZ=null,i.prevZ=null,zse(i)}function zse(n){let e,t,r,i,s,o,a,l,c=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,r=t,a=0,e=0;e0||l>0&&r;)a!==0&&(l===0||!r||t.z<=r.z)?(i=t,t=t.nextZ,a--):(i=r,r=r.nextZ,l--),s?s.nextZ=i:n=i,i.prevZ=s,s=i;t=r}s.nextZ=null,c*=2}while(o>1);return n}function UC(n,e,t,r,i){return n=(n-t)*i|0,e=(e-r)*i|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function Gse(n){let e=n,t=n;do(e.x=(n-o)*(s-a)&&(n-o)*(r-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(i-o)*(r-a)}function Vse(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!jse(n,e)&&(jg(n,e)&&jg(e,n)&&Wse(n,e)&&(Kn(n.prev,n,e.prev)||Kn(n,e.prev,e))||p1(n,e)&&Kn(n.prev,n,n.next)>0&&Kn(e.prev,e,e.next)>0)}function Kn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function p1(n,e){return n.x===e.x&&n.y===e.y}function Lz(n,e,t,r){const i=Qv(Kn(n,e,t)),s=Qv(Kn(n,e,r)),o=Qv(Kn(t,r,n)),a=Qv(Kn(t,r,e));return!!(i!==s&&o!==a||i===0&&Hv(n,t,e)||s===0&&Hv(n,r,e)||o===0&&Hv(t,n,r)||a===0&&Hv(t,e,r))}function Hv(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function Qv(n){return n>0?1:n<0?-1:0}function jse(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&Lz(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function jg(n,e){return Kn(n.prev,n,n.next)<0?Kn(n,e,n.next)>=0&&Kn(n,n.prev,e)>=0:Kn(n,e,n.prev)<0||Kn(n,n.next,e)<0}function Wse(n,e){let t=n,r=!1;const i=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==n);return r}function Dz(n,e){const t=new FC(n.i,n.x,n.y),r=new FC(e.i,e.x,e.y),i=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=i,i.prev=t,r.next=t,t.prev=r,s.next=r,r.prev=s,r}function AD(n,e,t,r){const i=new FC(n,e,t);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Wg(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function FC(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Kse(n,e,t,r){let i=0;for(let s=e,o=t-r;s2&&n[e-1].equals(n[0])&&n.pop()}function fD(n,e){for(let t=0;t0)&&h.push(w,_,b),(p!==r-1||l0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class YE extends as{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ke(16777215),this.specular=new ke(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kd,this.normalScale=new je(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new tr,this.combine=o1,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Xse extends as{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kd,this.normalScale=new je(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class Yse extends as{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ke(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kd,this.normalScale=new je(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new tr,this.combine=o1,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}function zv(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function $se(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Zse(n){function e(i,s){return n[i]-n[s]}const t=n.length,r=new Array(t);for(let i=0;i!==t;++i)r[i]=i;return r.sort(e),r}function hD(n,e,t){const r=n.length,i=new n.constructor(r);for(let s=0,o=0;o!==r;++s){const a=t[s]*e;for(let l=0;l!==e;++l)i[o++]=n[a+l]}return i}function Nz(n,e,t,r){let i=1,s=n[0];for(;s!==void 0&&s[r]===void 0;)s=n[i++];if(s===void 0)return;let o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[i++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),t.push(o)),s=n[i++];while(s!==void 0)}class w0{constructor(e,t,r,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(r),this.sampleValues=t,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let r=this._cachedIndex,i=t[r],s=t[r-1];e:{t:{let o;n:{r:if(!(e=s)){const a=t[1];e=s)break t}o=r,r=0;break n}break e}for(;r>>1;et;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=r.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,s=r.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=r[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&$se(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),r=this.getValueSize(),i=this.getInterpolation()===hE,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*r,l=o*r,c=0;c!==r;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*r)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),r=this.constructor,i=new r(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}al.prototype.TimeBufferType=Float32Array;al.prototype.ValueBufferType=Float32Array;al.prototype.DefaultInterpolation=Pd;class $d extends al{constructor(e,t,r){super(e,t,r)}}$d.prototype.ValueTypeName="bool";$d.prototype.ValueBufferType=Array;$d.prototype.DefaultInterpolation=Fd;$d.prototype.InterpolantFactoryMethodLinear=void 0;$d.prototype.InterpolantFactoryMethodSmooth=void 0;class kz extends al{}kz.prototype.ValueTypeName="color";class Du extends al{}Du.prototype.ValueTypeName="number";class eoe extends w0{constructor(e,t,r,i){super(e,t,r,i)}interpolate_(e,t,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-t)/(i-t);let c=e*a;for(let A=c+a;c!==A;c+=4)nt.slerpFlat(s,0,o,c-a,o,c,l);return s}}class tl extends al{InterpolantFactoryMethodLinear(e){return new eoe(this.times,this.values,this.getValueSize(),e)}}tl.prototype.ValueTypeName="quaternion";tl.prototype.InterpolantFactoryMethodSmooth=void 0;class Zd extends al{constructor(e,t,r){super(e,t,r)}}Zd.prototype.ValueTypeName="string";Zd.prototype.ValueBufferType=Array;Zd.prototype.DefaultInterpolation=Fd;Zd.prototype.InterpolantFactoryMethodLinear=void 0;Zd.prototype.InterpolantFactoryMethodSmooth=void 0;class ic extends al{}ic.prototype.ValueTypeName="vector";class Nu{constructor(e="",t=-1,r=[],i=UR){this.name=e,this.tracks=r,this.duration=t,this.blendMode=i,this.uuid=ra(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],r=e.tracks,i=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)t.push(noe(r[o]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)t.push(al.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,t,r,i){const s=t.length,o=[];for(let a=0;a1){const u=A[1];let f=i[u];f||(i[u]=f=[]),f.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,r));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(u,f,h,d,m){if(h.length!==0){const g=[],p=[];Nz(h,g,p,d),g.length!==0&&m.push(new u(f,g,p))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let u=0;u{t&&t(s),this.manager.itemEnd(e)},0),s;if(gl[e]!==void 0){gl[e].push({onLoad:t,onProgress:r,onError:i});return}gl[e]=[],gl[e].push({onLoad:t,onProgress:r,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const A=gl[e],u=c.body.getReader(),f=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),h=f?parseInt(f):0,d=h!==0;let m=0;const g=new ReadableStream({start(p){v();function v(){u.read().then(({done:w,value:_})=>{if(w)p.close();else{m+=_.byteLength;const x=new ProgressEvent("progress",{lengthComputable:d,loaded:m,total:h});for(let b=0,B=A.length;b{p.error(w)})}}});return new Response(g)}else throw new ioe(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(A=>new DOMParser().parseFromString(A,a));case"json":return c.json();default:if(a===void 0)return c.text();{const u=/charset="?([^;"\s]*)"?/i.exec(a),f=u&&u[1]?u[1].toLowerCase():void 0,h=new TextDecoder(f);return c.arrayBuffer().then(d=>h.decode(d))}}}).then(c=>{Yc.add(e,c);const A=gl[e];delete gl[e];for(let u=0,f=A.length;u{const A=gl[e];if(A===void 0)throw this.manager.itemError(e),c;delete gl[e];for(let u=0,f=A.length;u{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class Qz extends nl{constructor(e){super(e)}load(e,t,r,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Yc.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=Qg("img");function l(){A(),Yc.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(u){A(),i&&i(u),s.manager.itemError(e),s.manager.itemEnd(e)}function A(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class soe extends nl{constructor(e){super(e)}load(e,t,r,i){const s=this,o=new xu,a=new m1(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(l){let c;try{c=s.parse(l)}catch(A){if(i!==void 0)i(A);else{console.error(A);return}}c.image!==void 0?o.image=c.image:c.data!==void 0&&(o.image.width=c.width,o.image.height=c.height,o.image.data=c.data),o.wrapS=c.wrapS!==void 0?c.wrapS:Rs,o.wrapT=c.wrapT!==void 0?c.wrapT:Rs,o.magFilter=c.magFilter!==void 0?c.magFilter:Lr,o.minFilter=c.minFilter!==void 0?c.minFilter:Lr,o.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(o.colorSpace=c.colorSpace),c.flipY!==void 0&&(o.flipY=c.flipY),c.format!==void 0&&(o.format=c.format),c.type!==void 0&&(o.type=c.type),c.mipmaps!==void 0&&(o.mipmaps=c.mipmaps,o.minFilter=qo),c.mipmapCount===1&&(o.minFilter=Lr),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,t&&t(o,c)},r,i),o}}class FA extends nl{constructor(e){super(e)}load(e,t,r,i){const s=new Un,o=new Qz(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},r,i),s}}class g1 extends Lt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new ke(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}const $E=new He,dD=new $,pD=new $;class GR{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new je(512,512),this.map=null,this.mapPass=null,this.matrix=new He,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new u1,this._frameExtents=new je(1,1),this._viewportCount=1,this._viewports=[new Pt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,r=this.matrix;dD.setFromMatrixPosition(e.matrixWorld),t.position.copy(dD),pD.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(pD),t.updateMatrixWorld(),$E.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix($E),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply($E)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class ooe extends GR{constructor(){super(new Fr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,r=Ld*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(r!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=r,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class zz extends g1{constructor(e,t,r=0,i=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Lt.DEFAULT_UP),this.updateMatrix(),this.target=new Lt,this.distance=r,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new ooe}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const mD=new He,Np=new $,ZE=new $;class aoe extends GR{constructor(){super(new Fr(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new je(4,2),this._viewportCount=6,this._viewports=[new Pt(2,1,1,1),new Pt(0,1,1,1),new Pt(3,1,1,1),new Pt(1,1,1,1),new Pt(3,0,1,1),new Pt(1,0,1,1)],this._cubeDirections=[new $(1,0,0),new $(-1,0,0),new $(0,0,1),new $(0,0,-1),new $(0,1,0),new $(0,-1,0)],this._cubeUps=[new $(0,1,0),new $(0,1,0),new $(0,1,0),new $(0,1,0),new $(0,0,1),new $(0,0,-1)]}updateMatrices(e,t=0){const r=this.camera,i=this.matrix,s=e.distance||r.far;s!==r.far&&(r.far=s,r.updateProjectionMatrix()),Np.setFromMatrixPosition(e.matrixWorld),r.position.copy(Np),ZE.copy(r.position),ZE.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(ZE),r.updateMatrixWorld(),i.makeTranslation(-Np.x,-Np.y,-Np.z),mD.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(mD)}}class PC extends g1{constructor(e,t,r=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=r,this.decay=i,this.shadow=new aoe}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class loe extends GR{constructor(){super(new g0(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class VR extends g1{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Lt.DEFAULT_UP),this.updateMatrix(),this.target=new Lt,this.shadow=new loe}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Gz extends g1{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class od{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let r=0,i=e.length;r"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Yc.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{t&&t(c),s.manager.itemEnd(e)}).catch(c=>{i&&i(c)});return}return setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Yc.add(e,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),Yc.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Yc.add(e,l),s.manager.itemStart(e)}}class jR{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=gD(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=gD();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function gD(){return performance.now()}class Aoe{constructor(e,t,r){this.binding=e,this.valueSize=r;let i,s,o;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(r*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(r*5);break;default:i=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(r*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const r=this.buffer,i=this.valueSize,s=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)r[s+a]=r[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(r,s,0,a,i)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,r=this.valueSize,i=r*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,r=this.buffer,i=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(r,i,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(r,i,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(r[l]!==r[l+t]){a.setValue(r,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(t,i);for(let s=r,o=i;s!==o;++s)t[s]=t[i+s%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let r=e;r=.5)for(let o=0;o!==s;++o)e[t+o]=e[r+o]}_slerp(e,t,r,i){nt.slerpFlat(e,t,e,t,e,r,i)}_slerpAdditive(e,t,r,i,s){const o=this._workIndex*s;nt.multiplyQuaternionsFlat(e,o,e,t,e,r),nt.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,r,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[r+a]*i}}_lerpAdditive(e,t,r,i,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[r+o]*i}}}const WR="\\[\\]\\.:\\/",uoe=new RegExp("["+WR+"]","g"),KR="[^"+WR+"]",foe="[^"+WR.replace("\\.","")+"]",hoe=/((?:WC+[\/:])*)/.source.replace("WC",KR),doe=/(WCOD+)?/.source.replace("WCOD",foe),poe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",KR),moe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",KR),goe=new RegExp("^"+hoe+doe+poe+moe+"$"),voe=["material","materials","bones","map"];class yoe{constructor(e,t,r){const i=r||Ct.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const r=this._targetGroup.nCachedObjects_,i=this._bindings[r];i!==void 0&&i.getValue(e,t)}setValue(e,t){const r=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=r.length;i!==s;++i)r[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}}class Ct{constructor(e,t,r){this.path=t,this.parsedPath=r||Ct.parseTrackName(t),this.node=Ct.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new Ct.Composite(e,t,r):new Ct(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(uoe,"")}static parseTrackName(e){const t=goe.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=r.nodeName.substring(i+1);voe.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(t);if(r!==void 0)return r}if(e.children){const r=function(s){for(let o=0;o0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Bq:for(let A=0,u=l.length;A!==u;++A)l[A].evaluate(o),c[A].accumulateAdditive(a);break;case UR:default:for(let A=0,u=l.length;A!==u;++A)l[A].evaluate(o),c[A].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const r=this._weightInterpolant;if(r!==null){const i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,r=this.loop;let i=this.time+e,s=this._loopCount;const o=r===Eq;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(r===xq){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return t-i}return i}_setEndings(e,t,r){const i=this._interpolantSettings;r?(i.endingStart=Dh,i.endingEnd=Dh):(e?i.endingStart=this.zeroSlopeAtStart?Dh:Lh:i.endingStart=F_,t?i.endingEnd=this.zeroSlopeAtEnd?Dh:Lh:i.endingEnd=F_)}_scheduleFading(e,t,r){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=r,this}}const _oe=new Float32Array(1);class xoe extends RA{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const r=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName;let A=c[l];A===void 0&&(A={},c[l]=A);for(let u=0;u!==s;++u){const f=i[u],h=f.name;let d=A[h];if(d!==void 0)++d.referenceCount,o[u]=d;else{if(d=o[u],d!==void 0){d._cacheIndex===null&&(++d.referenceCount,this._addInactiveBinding(d,l,h));continue}const m=t&&t._propertyBindings[u].binding.parsedPath;d=new Aoe(Ct.create(r,h,m),f.ValueTypeName,f.getValueSize()),++d.referenceCount,this._addInactiveBinding(d,l,h),o[u]=d}a[u].resultBuffer=d.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const r=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,r)}const t=e._propertyBindings;for(let r=0,i=t.length;r!==i;++r){const s=t[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let r=0,i=t.length;r!==i;++r){const s=t[r];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;const t=this._actions,r=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==r;++c)t[c]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;tMath.PI&&(r-=Vi),i<-Math.PI?i+=Vi:i>Math.PI&&(i-=Vi),r<=i?this._spherical.theta=Math.max(r,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(r+i)/2?Math.max(r,this._spherical.theta):Math.min(i,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(Ir.setFromSpherical(this._spherical),Ir.applyQuaternion(this._quatInverse),t.copy(this.target).add(Ir),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const a=Ir.length();o=this._clampDistance(a*this._scale);const l=a-o;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){const a=new $(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;const c=new $(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=Ir.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(Vv.origin.copy(this.object.position),Vv.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Vv.direction))JE||8*(1-this._lastQuaternion.dot(this.object.quaternion))>JE||this._lastTargetPosition.distanceToSquared(this.target)>JE?(this.dispatchEvent(bD),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Vi/60*this.autoRotateSpeed*e:Vi/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){Ir.setFromMatrixColumn(t,0),Ir.multiplyScalar(-e),this._panOffset.add(Ir)}_panUp(e,t){this.screenSpacePanning===!0?Ir.setFromMatrixColumn(t,1):(Ir.setFromMatrixColumn(t,0),Ir.crossVectors(this.object.up,Ir)),Ir.multiplyScalar(e),this._panOffset.add(Ir)}_pan(e,t){const r=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;Ir.copy(i).sub(this.target);let s=Ir.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/r.clientHeight,this.object.matrix),this._panUp(2*t*s/r.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/r.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/r.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const r=this.domElement.getBoundingClientRect(),i=e-r.left,s=t-r.top,o=r.width,a=r.height;this._mouse.x=i/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Vi*this._rotateDelta.x/t.clientHeight),this._rotateUp(Vi*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateUp(Vi*this.rotateSpeed/this.domElement.clientHeight):this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateUp(-Vi*this.rotateSpeed/this.domElement.clientHeight):this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateLeft(Vi*this.rotateSpeed/this.domElement.clientHeight):this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateLeft(-Vi*this.rotateSpeed/this.domElement.clientHeight):this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._rotateStart.set(r,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panStart.set(r,i)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),r=e.pageX-t.x,i=e.pageY-t.y,s=Math.sqrt(r*r+i*i);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),i=.5*(e.pageX+r.x),s=.5*(e.pageY+r.y);this._rotateEnd.set(i,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Vi*this._rotateDelta.x/t.clientHeight),this._rotateUp(Vi*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panEnd.set(r,i)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),r=e.pageX-t.x,i=e.pageY-t.y,s=Math.sqrt(r*r+i*i);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t=2.0 are supported."));return}const c=new gae(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let A=0;A=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(r,i)}parseAsync(e,t){const r=this;return new Promise(function(i,s){r.parse(e,t,i,s)})}}function koe(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const Ft={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Hoe{constructor(e){this.parser=e,this.name=Ft.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let r=0,i=t.length;r=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class eae{constructor(e){this.parser=e,this.name=Ft.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class tae{constructor(e){this.parser=e,this.name=Ft.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class nae{constructor(e){this.name=Ft.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const i=r.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=i.byteOffset||0,c=i.byteLength||0,A=i.count,u=i.byteStride,f=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(A,u,f,i.mode,i.filter).then(function(h){return h.buffer}):o.ready.then(function(){const h=new ArrayBuffer(A*u);return o.decodeGltfBuffer(new Uint8Array(h),A,u,f,i.mode,i.filter),h})})}else return null}}let rae=class{constructor(e){this.name=Ft.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const i=t.meshes[r.mesh];for(const c of i.primitives)if(c.mode!==to.TRIANGLES&&c.mode!==to.TRIANGLE_STRIP&&c.mode!==to.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=r.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(A=>(l[c]=A,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const A=c.pop(),u=A.isGroup?A.children:[A],f=c[0].count,h=[];for(const d of u){const m=new He,g=new $,p=new nt,v=new $(1,1,1),w=new h1(d.geometry,d.material,f);for(let _=0;_0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const mae=new He;class gae{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new koe,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,i=-1,s=!1,o=-1;if(typeof navigator<"u"){const a=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(a)===!0;const l=a.match(/Version\/(\d+)/);i=r&&l?parseInt(l[1],10):-1,s=a.indexOf("Firefox")>-1,o=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&i<17||s&&o<98?this.textureLoader=new FA(this.options.manager):this.textureLoader=new coe(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new m1(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const r=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(o){const a={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:r,userData:{}};return VA(s,a,i),Ul(a,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(const l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let i=0,s=t.length;i{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,A]of o.children.entries())s(A,a.children[c])};return s(r,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let r=0;r=2&&g.setY(I,b[B*l+1]),l>=3&&g.setZ(I,b[B*l+2]),l>=4&&g.setW(I,b[B*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}g.normalized=d}return g})}loadTexture(e){const t=this.json,r=this.options,s=t.textures[e].source,o=t.images[s];let a=this.textureLoader;if(o.uri){const l=r.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,r){const i=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,r).then(function(A){A.flipY=!1,A.name=o.name||a.name||"",A.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(A.name=a.uri);const f=(s.samplers||{})[o.sampler]||{};return A.magFilter=MD[f.magFilter]||Lr,A.minFilter=MD[f.minFilter]||qo,A.wrapS=CD[f.wrapS]||zs,A.wrapT=CD[f.wrapT]||zs,i.associations.set(A,{textures:e}),A}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const r=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const o=i.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=r.getDependency("bufferView",o.bufferView).then(function(u){c=!0;const f=new Blob([u],{type:o.mimeType});return l=a.createObjectURL(f),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const A=Promise.resolve(l).then(function(u){return new Promise(function(f,h){let d=f;t.isImageBitmapLoader===!0&&(d=function(m){const g=new Un(m);g.needsUpdate=!0,f(g)}),t.load(od.resolveURL(u,s.path),d,void 0,h)})}).then(function(u){return c===!0&&a.revokeObjectURL(l),Ul(u,o),u.userData.mimeType=o.mimeType||pae(o.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),u});return this.sourceCache[e]=A,A}assignTexture(e,t,r,i){const s=this;return this.getDependency("texture",r.index).then(function(o){if(!o)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(o=o.clone(),o.channel=r.texCoord),s.extensions[Ft.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[Ft.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[Ft.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return i!==void 0&&(o.colorSpace=i),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let r=e.material;const i=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new Fz,as.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(a,l)),r=l}else if(e.isLine){const a="LineBasicMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new Ac,as.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(a,l)),r=l}if(i||s||o){let a="ClonedMaterial:"+r.uuid+":";i&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=r.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(r))),r=l}e.material=r}getMaterialType(){return Nd}loadMaterial(e){const t=this,r=this.json,i=this.extensions,s=r.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[Ft.KHR_MATERIALS_UNLIT]){const u=i[Ft.KHR_MATERIALS_UNLIT];o=u.getMaterialType(),c.push(u.extendParams(a,s,t))}else{const u=s.pbrMetallicRoughness||{};if(a.color=new ke(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const f=u.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],Mr),a.opacity=f[3]}u.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",u.baseColorTexture,Ut)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),o=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=_i);const A=s.alphaMode||eB.OPAQUE;if(A===eB.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,A===eB.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==qi&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new je(1,1),s.normalTexture.scale!==void 0)){const u=s.normalTexture.scale;a.normalScale.set(u,u)}if(s.occlusionTexture!==void 0&&o!==qi&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==qi){const u=s.emissiveFactor;a.emissive=new ke().setRGB(u[0],u[1],u[2],Mr)}return s.emissiveTexture!==void 0&&o!==qi&&c.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,Ut)),Promise.all(c).then(function(){const u=new o(a);return s.name&&(u.name=s.name),Ul(u,s),t.associations.set(u,{materials:e}),s.extensions&&VA(i,u,s),u})}createUniqueName(e){const t=Ct.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,r=this.extensions,i=this.primitiveCache;function s(a){return r[Ft.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return TD(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&hae(p,s),p.name=t.createUniqueName(s.name||"mesh_"+e),Ul(p,s),g.extensions&&VA(i,p,g),t.assignFinalMaterial(p),u.push(p)}for(let h=0,d=u.length;h1?A=new ri:c.length===1?A=c[0]:A=new Lt,A!==c[0])for(let u=0,f=c.length;u{const u=new Map;for(const[f,h]of i.associations)(f instanceof as||f instanceof Un)&&u.set(f,h);return A.traverse(f=>{const h=i.associations.get(f);h!=null&&u.set(f,h)}),u};return i.associations=c(s),s})}_createAnimationTracks(e,t,r,i,s){const o=[],a=e.name?e.name:e.uuid,l=[];Sc[s.path]===Sc.weights?e.traverse(function(f){f.morphTargetInfluences&&l.push(f.name?f.name:f.uuid)}):l.push(a);let c;switch(Sc[s.path]){case Sc.weights:c=Du;break;case Sc.rotation:c=tl;break;case Sc.position:case Sc.scale:c=ic;break;default:switch(r.itemSize){case 1:c=Du;break;case 2:case 3:default:c=ic;break}break}const A=i.interpolation!==void 0?Aae[i.interpolation]:Pd,u=this._getArrayFromAccessor(r);for(let f=0,h=l.length;f=0&&(_[ue]=null,w[ue].disconnect(re))}for(let P=0;P=_.length){_.push(re),ue=me;break}else if(_[me]===null){_[me]=re,ue=me;break}if(ue===-1)break}const le=w[ue];le&&le.connect(re)}}const R=new $,F=new $;function O(ee,P,re){R.setFromMatrixPosition(P.matrixWorld),F.setFromMatrixPosition(re.matrixWorld);const ue=R.distanceTo(F),le=P.projectionMatrix.elements,me=re.projectionMatrix.elements,ie=le[14]/(le[10]-1),ge=le[14]/(le[10]+1),_e=(le[9]+1)/le[5],se=(le[9]-1)/le[5],H=(le[8]-1)/le[0],fe=(me[8]+1)/me[0],Ae=ie*H,J=ie*fe,q=ue/(-H+fe),he=q*-H;if(P.matrixWorld.decompose(ee.position,ee.quaternion,ee.scale),ee.translateX(he),ee.translateZ(q),ee.matrixWorld.compose(ee.position,ee.quaternion,ee.scale),ee.matrixWorldInverse.copy(ee.matrixWorld).invert(),le[10]===-1)ee.projectionMatrix.copy(P.projectionMatrix),ee.projectionMatrixInverse.copy(P.projectionMatrixInverse);else{const X=ie+q,G=ge+q,ne=Ae-he,Y=J+(ue-he),de=_e*ge/G*X,ae=se*ge/G*X;ee.projectionMatrix.makePerspective(ne,Y,de,ae,X,G),ee.projectionMatrixInverse.copy(ee.projectionMatrix).invert()}}function z(ee,P){P===null?ee.matrixWorld.copy(ee.matrix):ee.matrixWorld.multiplyMatrices(P.matrixWorld,ee.matrix),ee.matrixWorldInverse.copy(ee.matrixWorld).invert()}this.updateCamera=function(ee){if(i===null)return;let P=ee.near,re=ee.far;m.texture!==null&&(m.depthNear>0&&(P=m.depthNear),m.depthFar>0&&(re=m.depthFar)),M.near=S.near=B.near=P,M.far=S.far=B.far=re,(L!==M.near||D!==M.far)&&(i.updateRenderState({depthNear:M.near,depthFar:M.far}),L=M.near,D=M.far);const ue=ee.parent,le=M.cameras;z(M,ue);for(let me=0;me0&&(g.alphaTest.value=p.alphaTest);const v=e.get(p),w=v.envMap,_=v.envMapRotation;w&&(g.envMap.value=w,GA.copy(_),GA.x*=-1,GA.y*=-1,GA.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(GA.y*=-1,GA.z*=-1),g.envMapRotation.value.setFromMatrix4(Ase.makeRotationFromEuler(GA)),g.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap&&(g.lightMap.value=p.lightMap,g.lightMapIntensity.value=p.lightMapIntensity,t(p.lightMap,g.lightMapTransform)),p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,g.aoMapTransform))}function o(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform))}function a(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function l(g,p,v,w){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*v,g.scale.value=w*.5,p.map&&(g.map.value=p.map,t(p.map,g.uvTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function c(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function A(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4)}function u(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap)}function f(g,p){g.metalness.value=p.metalness,p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,g.metalnessMapTransform)),g.roughness.value=p.roughness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,g.roughnessMapTransform)),p.envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function h(g,p,v){g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,g.sheenColorMapTransform)),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,g.sheenRoughnessMapTransform))),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,g.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(g.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===oi&&g.clearcoatNormalScale.value.negate())),p.dispersion>0&&(g.dispersion.value=p.dispersion),p.iridescence>0&&(g.iridescence.value=p.iridescence,g.iridescenceIOR.value=p.iridescenceIOR,g.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(g.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,g.iridescenceMapTransform)),p.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=v.texture,g.transmissionSamplerSize.value.set(v.width,v.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,g.transmissionMapTransform)),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(g.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(g.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,g.specularColorMapTransform)),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,g.specularIntensityMapTransform))}function d(g,p){p.matcap&&(g.matcap.value=p.matcap)}function m(g,p){const v=e.get(p).light;g.referencePosition.value.setFromMatrixPosition(v.matrixWorld),g.nearDistance.value=v.shadow.camera.near,g.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function fse(n,e,t,r){let i={},s={},o=[];const a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(v,w){const _=w.program;r.uniformBlockBinding(v,_)}function c(v,w){let _=i[v.id];_===void 0&&(d(v),_=A(v),i[v.id]=_,v.addEventListener("dispose",g));const x=w.program;r.updateUBOMapping(v,x);const b=e.render.frame;s[v.id]!==b&&(f(v),s[v.id]=b)}function A(v){const w=u();v.__bindingPointIndex=w;const _=n.createBuffer(),x=v.__size,b=v.usage;return n.bindBuffer(n.UNIFORM_BUFFER,_),n.bufferData(n.UNIFORM_BUFFER,x,b),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,w,_),_}function u(){for(let v=0;v0&&(_+=x-b),v.__size=_,v.__cache={},this}function m(v){const w={boundary:0,storage:0};return typeof v=="number"||typeof v=="boolean"?(w.boundary=4,w.storage=4):v.isVector2?(w.boundary=8,w.storage=8):v.isVector3||v.isColor?(w.boundary=16,w.storage=12):v.isVector4?(w.boundary=16,w.storage=16):v.isMatrix3?(w.boundary=48,w.storage=48):v.isMatrix4?(w.boundary=64,w.storage=64):v.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",v),w}function g(v){const w=v.target;w.removeEventListener("dispose",g);const _=o.indexOf(w.__bindingPointIndex);o.splice(_,1),n.deleteBuffer(i[w.id]),delete i[w.id],delete s[w.id]}function p(){for(const v in i)n.deleteBuffer(i[v]);o=[],i={},s={}}return{bind:l,update:c,dispose:p}}class y0{constructor(e={}){const{canvas:t=Jq(),context:r=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:A="default",failIfMajorPerformanceCaveat:u=!1}=e;this.isWebGLRenderer=!0;let f;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=r.getContextAttributes().alpha}else f=o;const h=new Uint32Array(4),d=new Int32Array(4);let m=null,g=null;const p=[],v=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Ut,this.toneMapping=fA,this.toneMappingExposure=1;const w=this;let _=!1,x=0,b=0,B=null,S=-1,I=null;const M=new Pt,L=new Pt;let D=null;const T=new Qe(0);let y=0,E=t.width,R=t.height,F=1,O=null,z=null;const j=new Pt(0,0,E,R),Q=new Pt(0,0,E,R);let C=!1;const W=new f1;let ee=!1,P=!1;const re=new He,ue=new He,le=new $,me=new Pt,ie={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ge=!1;function _e(){return B===null?F:1}let se=r;function H(te,ye){return t.getContext(te,ye)}try{const te={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:A,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${nc}`),t.addEventListener("webglcontextlost",Te,!1),t.addEventListener("webglcontextrestored",Fe,!1),t.addEventListener("webglcontextcreationerror",De,!1),se===null){const ye="webgl2";if(se=H(ye,te),se===null)throw H(ye)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(te){throw console.error("THREE.WebGLRenderer: "+te.message),te}let fe,Ae,J,q,he,X,G,ne,Y,de,ae,Ee,V,U,N,K,oe,pe,ve,Ce,Le,Re,$e,ce;function Pe(){fe=new vre(se),fe.init(),Re=new rse(se,fe),Ae=new fre(se,fe,e,Re),J=new ese(se),Ae.reverseDepthBuffer&&J.buffers.depth.setReversed(!0),q=new _re(se),he=new kie,X=new nse(se,fe,J,he,Ae,Re,q),G=new dre(w),ne=new gre(w),Y=new Cee(se),$e=new Are(se,Y),de=new yre(se,Y,q,$e),ae=new bre(se,de,Y,q),ve=new xre(se,Ae,X),K=new hre(he),Ee=new Oie(w,G,ne,fe,Ae,$e,K),V=new use(w,he),U=new Hie,N=new Kie(fe),pe=new cre(w,G,ne,J,ae,f,l),oe=new Jie(w,ae,Ae),ce=new fse(se,q,Ae,J),Ce=new ure(se,fe,q),Le=new wre(se,fe,q),q.programs=Ee.programs,w.capabilities=Ae,w.extensions=fe,w.properties=he,w.renderLists=U,w.shadowMap=oe,w.state=J,w.info=q}Pe();const Se=new cse(w,se);this.xr=Se,this.getContext=function(){return se},this.getContextAttributes=function(){return se.getContextAttributes()},this.forceContextLoss=function(){const te=fe.get("WEBGL_lose_context");te&&te.loseContext()},this.forceContextRestore=function(){const te=fe.get("WEBGL_lose_context");te&&te.restoreContext()},this.getPixelRatio=function(){return F},this.setPixelRatio=function(te){te!==void 0&&(F=te,this.setSize(E,R,!1))},this.getSize=function(te){return te.set(E,R)},this.setSize=function(te,ye,Be=!0){if(Se.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}E=te,R=ye,t.width=Math.floor(te*F),t.height=Math.floor(ye*F),Be===!0&&(t.style.width=te+"px",t.style.height=ye+"px"),this.setViewport(0,0,te,ye)},this.getDrawingBufferSize=function(te){return te.set(E*F,R*F).floor()},this.setDrawingBufferSize=function(te,ye,Be){E=te,R=ye,F=Be,t.width=Math.floor(te*Be),t.height=Math.floor(ye*Be),this.setViewport(0,0,te,ye)},this.getCurrentViewport=function(te){return te.copy(M)},this.getViewport=function(te){return te.copy(j)},this.setViewport=function(te,ye,Be,Me){te.isVector4?j.set(te.x,te.y,te.z,te.w):j.set(te,ye,Be,Me),J.viewport(M.copy(j).multiplyScalar(F).round())},this.getScissor=function(te){return te.copy(Q)},this.setScissor=function(te,ye,Be,Me){te.isVector4?Q.set(te.x,te.y,te.z,te.w):Q.set(te,ye,Be,Me),J.scissor(L.copy(Q).multiplyScalar(F).round())},this.getScissorTest=function(){return C},this.setScissorTest=function(te){J.setScissorTest(C=te)},this.setOpaqueSort=function(te){O=te},this.setTransparentSort=function(te){z=te},this.getClearColor=function(te){return te.copy(pe.getClearColor())},this.setClearColor=function(){pe.setClearColor.apply(pe,arguments)},this.getClearAlpha=function(){return pe.getClearAlpha()},this.setClearAlpha=function(){pe.setClearAlpha.apply(pe,arguments)},this.clear=function(te=!0,ye=!0,Be=!0){let Me=0;if(te){let we=!1;if(B!==null){const ke=B.texture.format;we=ke===FR||ke===UR||ke===c1}if(we){const ke=B.texture.type,Xe=ke===rc||ke===wA||ke===Hg||ke===Ud||ke===TR||ke===IR,qe=pe.getClearColor(),tt=pe.getClearAlpha(),ft=qe.r,mt=qe.g,st=qe.b;Xe?(h[0]=ft,h[1]=mt,h[2]=st,h[3]=tt,se.clearBufferuiv(se.COLOR,0,h)):(d[0]=ft,d[1]=mt,d[2]=st,d[3]=tt,se.clearBufferiv(se.COLOR,0,d))}else Me|=se.COLOR_BUFFER_BIT}ye&&(Me|=se.DEPTH_BUFFER_BIT,se.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),Be&&(Me|=se.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),se.clear(Me)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Te,!1),t.removeEventListener("webglcontextrestored",Fe,!1),t.removeEventListener("webglcontextcreationerror",De,!1),U.dispose(),N.dispose(),he.dispose(),G.dispose(),ne.dispose(),ae.dispose(),$e.dispose(),ce.dispose(),Ee.dispose(),Se.dispose(),Se.removeEventListener("sessionstart",tn),Se.removeEventListener("sessionend",qt),Jr.stop()};function Te(te){te.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),_=!0}function Fe(){console.log("THREE.WebGLRenderer: Context Restored."),_=!1;const te=q.autoReset,ye=oe.enabled,Be=oe.autoUpdate,Me=oe.needsUpdate,we=oe.type;Pe(),q.autoReset=te,oe.enabled=ye,oe.autoUpdate=Be,oe.needsUpdate=Me,oe.type=we}function De(te){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",te.statusMessage)}function Ze(te){const ye=te.target;ye.removeEventListener("dispose",Ze),At(ye)}function At(te){Pn(te),he.remove(te)}function Pn(te){const ye=he.get(te).programs;ye!==void 0&&(ye.forEach(function(Be){Ee.releaseProgram(Be)}),te.isShaderMaterial&&Ee.releaseShaderCache(te))}this.renderBufferDirect=function(te,ye,Be,Me,we,ke){ye===null&&(ye=ie);const Xe=we.isMesh&&we.matrixWorld.determinant()<0,qe=ma(te,ye,Be,Me,we);J.setMaterial(Me,Xe);let tt=Be.index,ft=1;if(Me.wireframe===!0){if(tt=de.getWireframeAttribute(Be),tt===void 0)return;ft=2}const mt=Be.drawRange,st=Be.attributes.position;let Wt=mt.start*ft,fn=(mt.start+mt.count)*ft;ke!==null&&(Wt=Math.max(Wt,ke.start*ft),fn=Math.min(fn,(ke.start+ke.count)*ft)),tt!==null?(Wt=Math.max(Wt,0),fn=Math.min(fn,tt.count)):st!=null&&(Wt=Math.max(Wt,0),fn=Math.min(fn,st.count));const yn=fn-Wt;if(yn<0||yn===1/0)return;$e.setup(we,Me,qe,Be,tt);let qr,Vt=Ce;if(tt!==null&&(qr=Y.get(tt),Vt=Le,Vt.setIndex(qr)),we.isMesh)Me.wireframe===!0?(J.setLineWidth(Me.wireframeLinewidth*_e()),Vt.setMode(se.LINES)):Vt.setMode(se.TRIANGLES);else if(we.isLine){let at=Me.linewidth;at===void 0&&(at=1),J.setLineWidth(at*_e()),we.isLineSegments?Vt.setMode(se.LINES):we.isLineLoop?Vt.setMode(se.LINE_LOOP):Vt.setMode(se.LINE_STRIP)}else we.isPoints?Vt.setMode(se.POINTS):we.isSprite&&Vt.setMode(se.TRIANGLES);if(we.isBatchedMesh)if(we._multiDrawInstances!==null)Vt.renderMultiDrawInstances(we._multiDrawStarts,we._multiDrawCounts,we._multiDrawCount,we._multiDrawInstances);else if(fe.get("WEBGL_multi_draw"))Vt.renderMultiDraw(we._multiDrawStarts,we._multiDrawCounts,we._multiDrawCount);else{const at=we._multiDrawStarts,or=we._multiDrawCounts,an=we._multiDrawCount,Ro=tt?Y.get(tt).bytesPerElement:1,sf=he.get(Me).currentProgram.getUniforms();for(let ds=0;ds{function ke(){if(Me.forEach(function(Xe){he.get(Xe).currentProgram.isReady()&&Me.delete(Xe)}),Me.size===0){we(te);return}setTimeout(ke,10)}fe.get("KHR_parallel_shader_compile")!==null?ke():setTimeout(ke,10)})};let xt=null;function Tr(te){xt&&xt(te)}function tn(){Jr.stop()}function qt(){Jr.start()}const Jr=new Tz;Jr.setAnimationLoop(Tr),typeof self<"u"&&Jr.setContext(self),this.setAnimationLoop=function(te){xt=te,Se.setAnimationLoop(te),te===null?Jr.stop():Jr.start()},Se.addEventListener("sessionstart",tn),Se.addEventListener("sessionend",qt),this.render=function(te,ye){if(ye!==void 0&&ye.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(_===!0)return;if(te.matrixWorldAutoUpdate===!0&&te.updateMatrixWorld(),ye.parent===null&&ye.matrixWorldAutoUpdate===!0&&ye.updateMatrixWorld(),Se.enabled===!0&&Se.isPresenting===!0&&(Se.cameraAutoUpdate===!0&&Se.updateCamera(ye),ye=Se.getCamera()),te.isScene===!0&&te.onBeforeRender(w,te,ye,B),g=N.get(te,v.length),g.init(ye),v.push(g),ue.multiplyMatrices(ye.projectionMatrix,ye.matrixWorldInverse),W.setFromProjectionMatrix(ue),P=this.localClippingEnabled,ee=K.init(this.clippingPlanes,P),m=U.get(te,p.length),m.init(),p.push(m),Se.enabled===!0&&Se.isPresenting===!0){const ke=w.xr.getDepthSensingMesh();ke!==null&&en(ke,ye,-1/0,w.sortObjects)}en(te,ye,0,w.sortObjects),m.finish(),w.sortObjects===!0&&m.sort(O,z),ge=Se.enabled===!1||Se.isPresenting===!1||Se.hasDepthSensing()===!1,ge&&pe.addToRenderList(m,te),this.info.render.frame++,ee===!0&&K.beginShadows();const Be=g.state.shadowsArray;oe.render(Be,te,ye),ee===!0&&K.endShadows(),this.info.autoReset===!0&&this.info.reset();const Me=m.opaque,we=m.transmissive;if(g.setupLights(),ye.isArrayCamera){const ke=ye.cameras;if(we.length>0)for(let Xe=0,qe=ke.length;Xe0&&Ks(Me,we,te,ye),ge&&pe.render(te),nn(m,te,ye);B!==null&&(X.updateMultisampleRenderTarget(B),X.updateRenderTargetMipmap(B)),te.isScene===!0&&te.onAfterRender(w,te,ye),$e.resetDefaultState(),S=-1,I=null,v.pop(),v.length>0?(g=v[v.length-1],ee===!0&&K.setGlobalState(w.clippingPlanes,g.state.camera)):g=null,p.pop(),p.length>0?m=p[p.length-1]:m=null};function en(te,ye,Be,Me){if(te.visible===!1)return;if(te.layers.test(ye.layers)){if(te.isGroup)Be=te.renderOrder;else if(te.isLOD)te.autoUpdate===!0&&te.update(ye);else if(te.isLight)g.pushLight(te),te.castShadow&&g.pushShadow(te);else if(te.isSprite){if(!te.frustumCulled||W.intersectsSprite(te)){Me&&me.setFromMatrixPosition(te.matrixWorld).applyMatrix4(ue);const Xe=ae.update(te),qe=te.material;qe.visible&&m.push(te,Xe,qe,Be,me.z,null)}}else if((te.isMesh||te.isLine||te.isPoints)&&(!te.frustumCulled||W.intersectsObject(te))){const Xe=ae.update(te),qe=te.material;if(Me&&(te.boundingSphere!==void 0?(te.boundingSphere===null&&te.computeBoundingSphere(),me.copy(te.boundingSphere.center)):(Xe.boundingSphere===null&&Xe.computeBoundingSphere(),me.copy(Xe.boundingSphere.center)),me.applyMatrix4(te.matrixWorld).applyMatrix4(ue)),Array.isArray(qe)){const tt=Xe.groups;for(let ft=0,mt=tt.length;ft0&&Xt(we,ye,Be),ke.length>0&&Xt(ke,ye,Be),Xe.length>0&&Xt(Xe,ye,Be),J.buffers.depth.setTest(!0),J.buffers.depth.setMask(!0),J.buffers.color.setMask(!0),J.setPolygonOffset(!1)}function Ks(te,ye,Be,Me){if((Be.isScene===!0?Be.overrideMaterial:null)!==null)return;g.state.transmissionRenderTarget[Me.id]===void 0&&(g.state.transmissionRenderTarget[Me.id]=new tl(1,1,{generateMipmaps:!0,type:fe.has("EXT_color_buffer_half_float")||fe.has("EXT_color_buffer_float")?Ha:rc,minFilter:ea,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Et.workingColorSpace}));const ke=g.state.transmissionRenderTarget[Me.id],Xe=Me.viewport||M;ke.setSize(Xe.z,Xe.w);const qe=w.getRenderTarget();w.setRenderTarget(ke),w.getClearColor(T),y=w.getClearAlpha(),y<1&&w.setClearColor(16777215,.5),w.clear(),ge&&pe.render(Be);const tt=w.toneMapping;w.toneMapping=fA;const ft=Me.viewport;if(Me.viewport!==void 0&&(Me.viewport=void 0),g.setupLightsView(Me),ee===!0&&K.setGlobalState(w.clippingPlanes,Me),Xt(te,Be,Me),X.updateMultisampleRenderTarget(ke),X.updateRenderTargetMipmap(ke),fe.has("WEBGL_multisampled_render_to_texture")===!1){let mt=!1;for(let st=0,Wt=ye.length;st0),st=!!Be.morphAttributes.position,Wt=!!Be.morphAttributes.normal,fn=!!Be.morphAttributes.color;let yn=fA;Me.toneMapped&&(B===null||B.isXRRenderTarget===!0)&&(yn=w.toneMapping);const qr=Be.morphAttributes.position||Be.morphAttributes.normal||Be.morphAttributes.color,Vt=qr!==void 0?qr.length:0,at=he.get(Me),or=g.state.lights;if(ee===!0&&(P===!0||te!==I)){const Xs=te===I&&Me.id===S;K.setState(Me,te,Xs)}let an=!1;Me.version===at.__version?(at.needsLights&&at.lightsStateVersion!==or.state.version||at.outputColorSpace!==qe||we.isBatchedMesh&&at.batching===!1||!we.isBatchedMesh&&at.batching===!0||we.isBatchedMesh&&at.batchingColor===!0&&we.colorTexture===null||we.isBatchedMesh&&at.batchingColor===!1&&we.colorTexture!==null||we.isInstancedMesh&&at.instancing===!1||!we.isInstancedMesh&&at.instancing===!0||we.isSkinnedMesh&&at.skinning===!1||!we.isSkinnedMesh&&at.skinning===!0||we.isInstancedMesh&&at.instancingColor===!0&&we.instanceColor===null||we.isInstancedMesh&&at.instancingColor===!1&&we.instanceColor!==null||we.isInstancedMesh&&at.instancingMorph===!0&&we.morphTexture===null||we.isInstancedMesh&&at.instancingMorph===!1&&we.morphTexture!==null||at.envMap!==tt||Me.fog===!0&&at.fog!==ke||at.numClippingPlanes!==void 0&&(at.numClippingPlanes!==K.numPlanes||at.numIntersection!==K.numIntersection)||at.vertexAlphas!==ft||at.vertexTangents!==mt||at.morphTargets!==st||at.morphNormals!==Wt||at.morphColors!==fn||at.toneMapping!==yn||at.morphTargetsCount!==Vt)&&(an=!0):(an=!0,at.__version=Me.version);let Ro=at.currentProgram;an===!0&&(Ro=Ii(Me,ye,we));let sf=!1,ds=!1,ub=!1;const ar=Ro.getUniforms(),pc=at.uniforms;if(J.useProgram(Ro.program)&&(sf=!0,ds=!0,ub=!0),Me.id!==S&&(S=Me.id,ds=!0),sf||I!==te){Ae.reverseDepthBuffer?(re.copy(te.projectionMatrix),eee(re),tee(re),ar.setValue(se,"projectionMatrix",re)):ar.setValue(se,"projectionMatrix",te.projectionMatrix),ar.setValue(se,"viewMatrix",te.matrixWorldInverse);const Xs=ar.map.cameraPosition;Xs!==void 0&&Xs.setValue(se,le.setFromMatrixPosition(te.matrixWorld)),Ae.logarithmicDepthBuffer&&ar.setValue(se,"logDepthBufFC",2/(Math.log(te.far+1)/Math.LN2)),(Me.isMeshPhongMaterial||Me.isMeshToonMaterial||Me.isMeshLambertMaterial||Me.isMeshBasicMaterial||Me.isMeshStandardMaterial||Me.isShaderMaterial)&&ar.setValue(se,"isOrthographic",te.isOrthographicCamera===!0),I!==te&&(I=te,ds=!0,ub=!0)}if(we.isSkinnedMesh){ar.setOptional(se,we,"bindMatrix"),ar.setOptional(se,we,"bindMatrixInverse");const Xs=we.skeleton;Xs&&(Xs.boneTexture===null&&Xs.computeBoneTexture(),ar.setValue(se,"boneTexture",Xs.boneTexture,X))}we.isBatchedMesh&&(ar.setOptional(se,we,"batchingTexture"),ar.setValue(se,"batchingTexture",we._matricesTexture,X),ar.setOptional(se,we,"batchingIdTexture"),ar.setValue(se,"batchingIdTexture",we._indirectTexture,X),ar.setOptional(se,we,"batchingColorTexture"),we._colorsTexture!==null&&ar.setValue(se,"batchingColorTexture",we._colorsTexture,X));const fb=Be.morphAttributes;if((fb.position!==void 0||fb.normal!==void 0||fb.color!==void 0)&&ve.update(we,Be,Ro),(ds||at.receiveShadow!==we.receiveShadow)&&(at.receiveShadow=we.receiveShadow,ar.setValue(se,"receiveShadow",we.receiveShadow)),Me.isMeshGouraudMaterial&&Me.envMap!==null&&(pc.envMap.value=tt,pc.flipEnvMap.value=tt.isCubeTexture&&tt.isRenderTargetTexture===!1?-1:1),Me.isMeshStandardMaterial&&Me.envMap===null&&ye.environment!==null&&(pc.envMapIntensity.value=ye.environmentIntensity),ds&&(ar.setValue(se,"toneMappingExposure",w.toneMappingExposure),at.needsLights&&un(pc,ub),ke&&Me.fog===!0&&V.refreshFogUniforms(pc,ke),V.refreshMaterialUniforms(pc,Me,F,R,g.state.transmissionRenderTarget[te.id]),Cw.upload(se,rn(at),pc,X)),Me.isShaderMaterial&&Me.uniformsNeedUpdate===!0&&(Cw.upload(se,rn(at),pc,X),Me.uniformsNeedUpdate=!1),Me.isSpriteMaterial&&ar.setValue(se,"center",we.center),ar.setValue(se,"modelViewMatrix",we.modelViewMatrix),ar.setValue(se,"normalMatrix",we.normalMatrix),ar.setValue(se,"modelMatrix",we.matrixWorld),Me.isShaderMaterial||Me.isRawShaderMaterial){const Xs=Me.uniformsGroups;for(let hb=0,CW=Xs.length;hb0&&X.useMultisampledRTT(te)===!1?we=he.get(te).__webglMultisampledFramebuffer:Array.isArray(mt)?we=mt[Be]:we=mt,M.copy(te.viewport),L.copy(te.scissor),D=te.scissorTest}else M.copy(j).multiplyScalar(F).floor(),L.copy(Q).multiplyScalar(F).floor(),D=C;if(J.bindFramebuffer(se.FRAMEBUFFER,we)&&Me&&J.drawBuffers(te,we),J.viewport(M),J.scissor(L),J.setScissorTest(D),ke){const tt=he.get(te.texture);se.framebufferTexture2D(se.FRAMEBUFFER,se.COLOR_ATTACHMENT0,se.TEXTURE_CUBE_MAP_POSITIVE_X+ye,tt.__webglTexture,Be)}else if(Xe){const tt=he.get(te.texture),ft=ye||0;se.framebufferTextureLayer(se.FRAMEBUFFER,se.COLOR_ATTACHMENT0,tt.__webglTexture,Be||0,ft)}S=-1},this.readRenderTargetPixels=function(te,ye,Be,Me,we,ke,Xe){if(!(te&&te.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let qe=he.get(te).__webglFramebuffer;if(te.isWebGLCubeRenderTarget&&Xe!==void 0&&(qe=qe[Xe]),qe){J.bindFramebuffer(se.FRAMEBUFFER,qe);try{const tt=te.texture,ft=tt.format,mt=tt.type;if(!Ae.textureFormatReadable(ft)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Ae.textureTypeReadable(mt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ye>=0&&ye<=te.width-Me&&Be>=0&&Be<=te.height-we&&se.readPixels(ye,Be,Me,we,Re.convert(ft),Re.convert(mt),ke)}finally{const tt=B!==null?he.get(B).__webglFramebuffer:null;J.bindFramebuffer(se.FRAMEBUFFER,tt)}}},this.readRenderTargetPixelsAsync=async function(te,ye,Be,Me,we,ke,Xe){if(!(te&&te.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let qe=he.get(te).__webglFramebuffer;if(te.isWebGLCubeRenderTarget&&Xe!==void 0&&(qe=qe[Xe]),qe){const tt=te.texture,ft=tt.format,mt=tt.type;if(!Ae.textureFormatReadable(ft))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Ae.textureTypeReadable(mt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(ye>=0&&ye<=te.width-Me&&Be>=0&&Be<=te.height-we){J.bindFramebuffer(se.FRAMEBUFFER,qe);const st=se.createBuffer();se.bindBuffer(se.PIXEL_PACK_BUFFER,st),se.bufferData(se.PIXEL_PACK_BUFFER,ke.byteLength,se.STREAM_READ),se.readPixels(ye,Be,Me,we,Re.convert(ft),Re.convert(mt),0);const Wt=B!==null?he.get(B).__webglFramebuffer:null;J.bindFramebuffer(se.FRAMEBUFFER,Wt);const fn=se.fenceSync(se.SYNC_GPU_COMMANDS_COMPLETE,0);return se.flush(),await qq(se,fn,4),se.bindBuffer(se.PIXEL_PACK_BUFFER,st),se.getBufferSubData(se.PIXEL_PACK_BUFFER,0,ke),se.deleteBuffer(st),se.deleteSync(fn),ke}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(te,ye=null,Be=0){te.isTexture!==!0&&(Sw("WebGLRenderer: copyFramebufferToTexture function signature has changed."),ye=arguments[0]||null,te=arguments[1]);const Me=Math.pow(2,-Be),we=Math.floor(te.image.width*Me),ke=Math.floor(te.image.height*Me),Xe=ye!==null?ye.x:0,qe=ye!==null?ye.y:0;X.setTexture2D(te,0),se.copyTexSubImage2D(se.TEXTURE_2D,Be,0,0,Xe,qe,we,ke),J.unbindTexture()},this.copyTextureToTexture=function(te,ye,Be=null,Me=null,we=0){te.isTexture!==!0&&(Sw("WebGLRenderer: copyTextureToTexture function signature has changed."),Me=arguments[0]||null,te=arguments[1],ye=arguments[2],we=arguments[3]||0,Be=null);let ke,Xe,qe,tt,ft,mt;Be!==null?(ke=Be.max.x-Be.min.x,Xe=Be.max.y-Be.min.y,qe=Be.min.x,tt=Be.min.y):(ke=te.image.width,Xe=te.image.height,qe=0,tt=0),Me!==null?(ft=Me.x,mt=Me.y):(ft=0,mt=0);const st=Re.convert(ye.format),Wt=Re.convert(ye.type);X.setTexture2D(ye,0),se.pixelStorei(se.UNPACK_FLIP_Y_WEBGL,ye.flipY),se.pixelStorei(se.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ye.premultiplyAlpha),se.pixelStorei(se.UNPACK_ALIGNMENT,ye.unpackAlignment);const fn=se.getParameter(se.UNPACK_ROW_LENGTH),yn=se.getParameter(se.UNPACK_IMAGE_HEIGHT),qr=se.getParameter(se.UNPACK_SKIP_PIXELS),Vt=se.getParameter(se.UNPACK_SKIP_ROWS),at=se.getParameter(se.UNPACK_SKIP_IMAGES),or=te.isCompressedTexture?te.mipmaps[we]:te.image;se.pixelStorei(se.UNPACK_ROW_LENGTH,or.width),se.pixelStorei(se.UNPACK_IMAGE_HEIGHT,or.height),se.pixelStorei(se.UNPACK_SKIP_PIXELS,qe),se.pixelStorei(se.UNPACK_SKIP_ROWS,tt),te.isDataTexture?se.texSubImage2D(se.TEXTURE_2D,we,ft,mt,ke,Xe,st,Wt,or.data):te.isCompressedTexture?se.compressedTexSubImage2D(se.TEXTURE_2D,we,ft,mt,or.width,or.height,st,or.data):se.texSubImage2D(se.TEXTURE_2D,we,ft,mt,ke,Xe,st,Wt,or),se.pixelStorei(se.UNPACK_ROW_LENGTH,fn),se.pixelStorei(se.UNPACK_IMAGE_HEIGHT,yn),se.pixelStorei(se.UNPACK_SKIP_PIXELS,qr),se.pixelStorei(se.UNPACK_SKIP_ROWS,Vt),se.pixelStorei(se.UNPACK_SKIP_IMAGES,at),we===0&&ye.generateMipmaps&&se.generateMipmap(se.TEXTURE_2D),J.unbindTexture()},this.copyTextureToTexture3D=function(te,ye,Be=null,Me=null,we=0){te.isTexture!==!0&&(Sw("WebGLRenderer: copyTextureToTexture3D function signature has changed."),Be=arguments[0]||null,Me=arguments[1]||null,te=arguments[2],ye=arguments[3],we=arguments[4]||0);let ke,Xe,qe,tt,ft,mt,st,Wt,fn;const yn=te.isCompressedTexture?te.mipmaps[we]:te.image;Be!==null?(ke=Be.max.x-Be.min.x,Xe=Be.max.y-Be.min.y,qe=Be.max.z-Be.min.z,tt=Be.min.x,ft=Be.min.y,mt=Be.min.z):(ke=yn.width,Xe=yn.height,qe=yn.depth,tt=0,ft=0,mt=0),Me!==null?(st=Me.x,Wt=Me.y,fn=Me.z):(st=0,Wt=0,fn=0);const qr=Re.convert(ye.format),Vt=Re.convert(ye.type);let at;if(ye.isData3DTexture)X.setTexture3D(ye,0),at=se.TEXTURE_3D;else if(ye.isDataArrayTexture||ye.isCompressedArrayTexture)X.setTexture2DArray(ye,0),at=se.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}se.pixelStorei(se.UNPACK_FLIP_Y_WEBGL,ye.flipY),se.pixelStorei(se.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ye.premultiplyAlpha),se.pixelStorei(se.UNPACK_ALIGNMENT,ye.unpackAlignment);const or=se.getParameter(se.UNPACK_ROW_LENGTH),an=se.getParameter(se.UNPACK_IMAGE_HEIGHT),Ro=se.getParameter(se.UNPACK_SKIP_PIXELS),sf=se.getParameter(se.UNPACK_SKIP_ROWS),ds=se.getParameter(se.UNPACK_SKIP_IMAGES);se.pixelStorei(se.UNPACK_ROW_LENGTH,yn.width),se.pixelStorei(se.UNPACK_IMAGE_HEIGHT,yn.height),se.pixelStorei(se.UNPACK_SKIP_PIXELS,tt),se.pixelStorei(se.UNPACK_SKIP_ROWS,ft),se.pixelStorei(se.UNPACK_SKIP_IMAGES,mt),te.isDataTexture||te.isData3DTexture?se.texSubImage3D(at,we,st,Wt,fn,ke,Xe,qe,qr,Vt,yn.data):ye.isCompressedArrayTexture?se.compressedTexSubImage3D(at,we,st,Wt,fn,ke,Xe,qe,qr,yn.data):se.texSubImage3D(at,we,st,Wt,fn,ke,Xe,qe,qr,Vt,yn),se.pixelStorei(se.UNPACK_ROW_LENGTH,or),se.pixelStorei(se.UNPACK_IMAGE_HEIGHT,an),se.pixelStorei(se.UNPACK_SKIP_PIXELS,Ro),se.pixelStorei(se.UNPACK_SKIP_ROWS,sf),se.pixelStorei(se.UNPACK_SKIP_IMAGES,ds),we===0&&ye.generateMipmaps&&se.generateMipmap(at),J.unbindTexture()},this.initRenderTarget=function(te){he.get(te).__webglFramebuffer===void 0&&X.setupRenderTarget(te)},this.initTexture=function(te){te.isCubeTexture?X.setTextureCube(te,0):te.isData3DTexture?X.setTexture3D(te,0):te.isDataArrayTexture||te.isCompressedArrayTexture?X.setTexture2DArray(te,0):X.setTexture2D(te,0),J.unbindTexture()},this.resetState=function(){x=0,b=0,B=null,J.reset(),$e.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return zl}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===LR?"display-p3":"srgb",t.unpackColorSpace=Et.workingColorSpace===A1?"display-p3":"srgb"}}class Gg extends Lt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new nr,this.environmentIntensity=1,this.environmentRotation=new nr,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class hse{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=RC,this.updateRanges=[],this.version=0,this.uuid=ia()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,r){e*=this.stride,r*=t.stride;for(let i=0,s=this.stride;i=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});const o=i[this.index];s.push(o),this.index++,o.start=e.start,o.count=e.count,o.z=t,o.index=r}reset(){this.list.length=0,this.index=0}}const Bc=new He,WE=new He,wse=new He,_se=new Qe(1,1,1),rD=new He,KE=new f1,Lv=new Hn,VA=new Mi,Dp=new $,iD=new $,xse=new $,XE=new yse,di=new dn,Dv=[];function bse(n,e,t=0){const r=e.itemSize;if(n.isInterleavedBufferAttribute||n.array.constructor!==e.array.constructor){const i=n.count;for(let s=0;s65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new ct(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const r in t.attributes){if(!e.hasAttribute(r))throw new Error(`BatchedMesh: Added geometry missing "${r}". All geometries must have consistent attributes.`);const i=e.getAttribute(r),s=t.getAttribute(r);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Hn);const e=this.boundingBox,t=this._drawInfo;e.makeEmpty();for(let r=0,i=t.length;r=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("BatchedMesh: Maximum item count reached.");const r={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(i=this._availableInstanceIds.pop(),this._drawInfo[i]=r):(i=this._drawInfo.length,this._drawInfo.push(r));const s=this._matricesTexture,o=s.image.data;wse.toArray(o,i*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(_se.toArray(a.image.data,i*4),a.needsUpdate=!0),i}addGeometry(e,t=-1,r=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const o=this._reservedRanges,a=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(s=o[o.length-1]),t===-1?i.vertexCount=e.getAttribute("position").count:i.vertexCount=t,s===null?i.vertexStart=0:i.vertexStart=s.vertexStart+s.vertexCount;const c=e.getIndex(),A=c!==null;if(A&&(r===-1?i.indexCount=c.count:i.indexCount=r,s===null?i.indexStart=0:i.indexStart=s.indexStart+s.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const u=this._geometryCount;return this._geometryCount++,o.push(i),a.push({start:A?i.indexStart:i.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new Hn,sphereInitialized:!1,sphere:new Mi}),this.setGeometryAt(u,e),u}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const r=this.geometry,i=r.getIndex()!==null,s=r.getIndex(),o=t.getIndex(),a=this._reservedRanges[e];if(i&&o.count>a.indexCount||t.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.vertexCount;for(const h in r.attributes){const d=t.getAttribute(h),m=r.getAttribute(h);bse(d,m,l);const g=d.itemSize;for(let p=d.count,v=c;p=t.length||t[e].active===!1?this:(t[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this)}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const r=this._bounds[e],i=r.box,s=this.geometry;if(r.boxInitialized===!1){i.makeEmpty();const o=s.index,a=s.attributes.position,l=this._drawRanges[e];for(let c=l.start,A=l.start+l.count;c=this._geometryCount)return null;const r=this._bounds[e],i=r.sphere,s=this.geometry;if(r.sphereInitialized===!1){i.makeEmpty(),this.getBoundingBoxAt(e,Lv),Lv.getCenter(i.center);const o=s.index,a=s.attributes.position,l=this._drawRanges[e];let c=0;for(let A=l.start,u=l.start+l.count;A=r.length||r[e].active===!1?this:(t.toArray(s,e*16),i.needsUpdate=!0,this)}getMatrixAt(e,t){const r=this._drawInfo,i=this._matricesTexture.image.data;return e>=r.length||r[e].active===!1?null:t.fromArray(i,e*16)}setColorAt(e,t){this._colorsTexture===null&&this._initColorsTexture();const r=this._colorsTexture,i=this._colorsTexture.image.data,s=this._drawInfo;return e>=s.length||s[e].active===!1?this:(t.toArray(i,e*4),r.needsUpdate=!0,this)}getColorAt(e,t){const r=this._colorsTexture.image.data,i=this._drawInfo;return e>=i.length||i[e].active===!1?null:t.fromArray(r,e*4)}setVisibleAt(e,t){const r=this._drawInfo;return e>=r.length||r[e].active===!1||r[e].visible===t?this:(r[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?!1:t[e].visible}setGeometryIdAt(e,t){const r=this._drawInfo;return e>=r.length||r[e].active===!1||t<0||t>=this._geometryCount?null:(r[e].geometryIndex=t,this)}getGeometryIdAt(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?-1:t[e].geometryIndex}getGeometryRangeAt(e,t={}){if(e<0||e>=this._geometryCount)return null;const r=this._drawRanges[e];return t.start=r.start,t.count=r.count,t}raycast(e,t){const r=this._drawInfo,i=this._drawRanges,s=this.matrixWorld,o=this.geometry;di.material=this.material,di.geometry.index=o.index,di.geometry.attributes=o.attributes,di.geometry.boundingBox===null&&(di.geometry.boundingBox=new Hn),di.geometry.boundingSphere===null&&(di.geometry.boundingSphere=new Mi);for(let a=0,l=r.length;a({...t})),this._reservedRanges=e._reservedRanges.map(t=>({...t})),this._drawInfo=e._drawInfo.map(t=>({...t})),this._bounds=e._bounds.map(t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,t,r,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._drawInfo,c=this._multiDrawStarts,A=this._multiDrawCounts,u=this._drawRanges,f=this.perObjectFrustumCulled,h=this._indirectTexture,d=h.image.data;f&&(rD.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),KE.setFromProjectionMatrix(rD,e.coordinateSystem));let m=0;if(this.sortObjects){WE.copy(this.matrixWorld).invert(),Dp.setFromMatrixPosition(r.matrixWorld).applyMatrix4(WE),iD.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(WE);for(let v=0,w=l.length;v0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;sr)return;YE.applyMatrix4(n.matrixWorld);const l=e.ray.origin.distanceTo(YE);if(!(le.far))return{distance:l,point:oD.clone().applyMatrix4(n.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:n}}const aD=new $,lD=new $;class w0 extends Yd{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,r=[];for(let i=0,s=t.count;i0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;si.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class $E extends Un{constructor(e,t,r,i,s,o,a,l,c,A,u,f){super(null,o,a,l,c,A,i,s,u,f),this.isCompressedTexture=!0,this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Sse extends Un{constructor(e,t,r,i,s,o,a,l,c){super(e,t,r,i,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Cse{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let r,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(i),t.push(s),i=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const r=this.getLengths();let i=0;const s=r.length;let o;t?o=t:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=r[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const A=r[i],f=r[i+1]-A,h=(o-A)/f;return(i+h)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=t||(o.isVector2?new We:new $);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t){const r=new $,i=[],s=[],o=[],a=new $,l=new He;for(let h=0;h<=e;h++){const d=h/e;i[h]=this.getTangentAt(d,new $)}s[0]=new $,o[0]=new $;let c=Number.MAX_VALUE;const A=Math.abs(i[0].x),u=Math.abs(i[0].y),f=Math.abs(i[0].z);A<=c&&(c=A,r.set(1,0,0)),u<=c&&(c=u,r.set(0,1,0)),f<=c&&r.set(0,0,1),a.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let h=1;h<=e;h++){if(s[h]=s[h-1].clone(),o[h]=o[h-1].clone(),a.crossVectors(i[h-1],i[h]),a.length()>Number.EPSILON){a.normalize();const d=Math.acos(pr(i[h-1].dot(i[h]),-1,1));s[h].applyMatrix4(l.makeRotationAxis(a,d))}o[h].crossVectors(i[h],s[h])}if(t===!0){let h=Math.acos(pr(s[0].dot(s[e]),-1,1));h/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(h=-h);for(let d=1;d<=e;d++)s[d].applyMatrix4(l.makeRotationAxis(i[d],h*d)),o[d].crossVectors(i[d],s[d])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class p1 extends Jt{constructor(e=1,t=1,r=1,i=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const A=[],u=[],f=[],h=[];let d=0;const m=[],g=r/2;let p=0;v(),o===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(A),this.setAttribute("position",new xn(u,3)),this.setAttribute("normal",new xn(f,3)),this.setAttribute("uv",new xn(h,2));function v(){const _=new $,x=new $;let b=0;const B=(t-e)/r;for(let S=0;S<=s;S++){const I=[],M=S/s,L=M*(t-e)+e;for(let D=0;D<=i;D++){const T=D/i,y=T*l+a,E=Math.sin(y),R=Math.cos(y);x.x=L*E,x.y=-M*r+g,x.z=L*R,u.push(x.x,x.y,x.z),_.set(E,B,R).normalize(),f.push(_.x,_.y,_.z),h.push(T,1-M),I.push(d++)}m.push(I)}for(let S=0;S0&&(A.push(M,L,T),b+=3),t>0&&(A.push(L,D,T),b+=3)}c.addGroup(p,b,0),p+=b}function w(_){const x=d,b=new We,B=new $;let S=0;const I=_===!0?e:t,M=_===!0?1:-1;for(let D=1;D<=i;D++)u.push(0,g*M,0),f.push(0,M,0),h.push(.5,.5),d++;const L=d;for(let D=0;D<=i;D++){const y=D/i*l+a,E=Math.cos(y),R=Math.sin(y);B.x=I*R,B.y=g*M,B.z=I*E,u.push(B.x,B.y,B.z),f.push(0,M,0),b.x=E*.5+.5,b.y=R*.5*M+.5,h.push(b.x,b.y),d++}for(let D=0;D80*t){a=c=n[0],l=A=n[1];for(let d=t;dc&&(c=u),f>A&&(A=f);h=Math.max(c-a,A-l),h=h!==0?32767/h:0}return jg(s,o,t,a,l,h,0),o}};function Lz(n,e,t,r,i){let s,o;if(i===jse(n,e,t,r)>0)for(s=e;s=e;s-=r)o=uD(s,n[s],n[s+1],o);return o&&m1(o,o.next)&&(Kg(o),o=o.next),o}function Nu(n,e){if(!n)return n;e||(e=n);let t=n,r;do if(r=!1,!t.steiner&&(m1(t,t.next)||Kn(t.prev,t,t.next)===0)){if(Kg(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function jg(n,e,t,r,i,s,o){if(!n)return;!o&&s&&kse(n,r,i,s);let a=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,s?Rse(n,r,i,s):Ise(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),Kg(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=Use(Nu(n),e,t),jg(n,e,t,r,i,s,2)):o===2&&Fse(n,e,t,r,i,s):jg(Nu(n),e,t,r,i,s,1);break}}}function Ise(n){const e=n.prev,t=n,r=n.next;if(Kn(e,t,r)>=0)return!1;const i=e.x,s=t.x,o=r.x,a=e.y,l=t.y,c=r.y,A=is?i>o?i:o:s>o?s:o,h=a>l?a>c?a:c:l>c?l:c;let d=r.next;for(;d!==e;){if(d.x>=A&&d.x<=f&&d.y>=u&&d.y<=h&&Qh(i,a,s,l,o,c,d.x,d.y)&&Kn(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Rse(n,e,t,r){const i=n.prev,s=n,o=n.next;if(Kn(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,A=i.y,u=s.y,f=o.y,h=al?a>c?a:c:l>c?l:c,g=A>u?A>f?A:f:u>f?u:f,p=PC(h,d,e,t,r),v=PC(m,g,e,t,r);let w=n.prevZ,_=n.nextZ;for(;w&&w.z>=p&&_&&_.z<=v;){if(w.x>=h&&w.x<=m&&w.y>=d&&w.y<=g&&w!==i&&w!==o&&Qh(a,A,l,u,c,f,w.x,w.y)&&Kn(w.prev,w,w.next)>=0||(w=w.prevZ,_.x>=h&&_.x<=m&&_.y>=d&&_.y<=g&&_!==i&&_!==o&&Qh(a,A,l,u,c,f,_.x,_.y)&&Kn(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;w&&w.z>=p;){if(w.x>=h&&w.x<=m&&w.y>=d&&w.y<=g&&w!==i&&w!==o&&Qh(a,A,l,u,c,f,w.x,w.y)&&Kn(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;_&&_.z<=v;){if(_.x>=h&&_.x<=m&&_.y>=d&&_.y<=g&&_!==i&&_!==o&&Qh(a,A,l,u,c,f,_.x,_.y)&&Kn(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function Use(n,e,t){let r=n;do{const i=r.prev,s=r.next.next;!m1(i,s)&&Dz(i,r,r.next,s)&&Wg(i,s)&&Wg(s,i)&&(e.push(i.i/t|0),e.push(r.i/t|0),e.push(s.i/t|0),Kg(r),Kg(r.next),r=n=s),r=r.next}while(r!==n);return Nu(r)}function Fse(n,e,t,r,i,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&zse(o,a)){let l=Nz(o,a);o=Nu(o,o.next),l=Nu(l,l.next),jg(o,e,t,r,i,s,0),jg(l,e,t,r,i,s,0);return}a=a.next}o=o.next}while(o!==n)}function Pse(n,e,t,r){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s=t.next.y&&t.next.y!==t.y){const f=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=s&&f>r&&(r=f,i=t.x=t.x&&t.x>=l&&s!==t.x&&Qh(oi.x||t.x===i.x&&Ose(i,t)))&&(i=t,A=u)),t=t.next;while(t!==a);return i}function Ose(n,e){return Kn(n.prev,n,e.prev)<0&&Kn(e.next,n,n.next)<0}function kse(n,e,t,r){let i=n;do i.z===0&&(i.z=PC(i.x,i.y,e,t,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==n);i.prevZ.nextZ=null,i.prevZ=null,Qse(i)}function Qse(n){let e,t,r,i,s,o,a,l,c=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,r=t,a=0,e=0;e0||l>0&&r;)a!==0&&(l===0||!r||t.z<=r.z)?(i=t,t=t.nextZ,a--):(i=r,r=r.nextZ,l--),s?s.nextZ=i:n=i,i.prevZ=s,s=i;t=r}s.nextZ=null,c*=2}while(o>1);return n}function PC(n,e,t,r,i){return n=(n-t)*i|0,e=(e-r)*i|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function Hse(n){let e=n,t=n;do(e.x=(n-o)*(s-a)&&(n-o)*(r-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(i-o)*(r-a)}function zse(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!Gse(n,e)&&(Wg(n,e)&&Wg(e,n)&&Vse(n,e)&&(Kn(n.prev,n,e.prev)||Kn(n,e.prev,e))||m1(n,e)&&Kn(n.prev,n,n.next)>0&&Kn(e.prev,e,e.next)>0)}function Kn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function m1(n,e){return n.x===e.x&&n.y===e.y}function Dz(n,e,t,r){const i=zv(Kn(n,e,t)),s=zv(Kn(n,e,r)),o=zv(Kn(t,r,n)),a=zv(Kn(t,r,e));return!!(i!==s&&o!==a||i===0&&Hv(n,t,e)||s===0&&Hv(n,r,e)||o===0&&Hv(t,n,r)||a===0&&Hv(t,e,r))}function Hv(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function zv(n){return n>0?1:n<0?-1:0}function Gse(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&Dz(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Wg(n,e){return Kn(n.prev,n,n.next)<0?Kn(n,e,n.next)>=0&&Kn(n,n.prev,e)>=0:Kn(n,e,n.prev)<0||Kn(n,n.next,e)<0}function Vse(n,e){let t=n,r=!1;const i=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==n);return r}function Nz(n,e){const t=new LC(n.i,n.x,n.y),r=new LC(e.i,e.x,e.y),i=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=i,i.prev=t,r.next=t,t.prev=r,s.next=r,r.prev=s,r}function uD(n,e,t,r){const i=new LC(n,e,t);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Kg(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function LC(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function jse(n,e,t,r){let i=0;for(let s=e,o=t-r;s2&&n[e-1].equals(n[0])&&n.pop()}function hD(n,e){for(let t=0;t0)&&h.push(w,_,b),(p!==r-1||l0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class ZE extends as{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Qe(16777215),this.specular=new Qe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Qe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kd,this.normalScale=new We(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new nr,this.combine=a1,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Wse extends as{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kd,this.normalScale=new We(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class Kse extends as{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Qe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Qe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kd,this.normalScale=new We(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new nr,this.combine=a1,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}function Gv(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function Xse(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Yse(n){function e(i,s){return n[i]-n[s]}const t=n.length,r=new Array(t);for(let i=0;i!==t;++i)r[i]=i;return r.sort(e),r}function dD(n,e,t){const r=n.length,i=new n.constructor(r);for(let s=0,o=0;o!==r;++s){const a=t[s]*e;for(let l=0;l!==e;++l)i[o++]=n[a+l]}return i}function Oz(n,e,t,r){let i=1,s=n[0];for(;s!==void 0&&s[r]===void 0;)s=n[i++];if(s===void 0)return;let o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[i++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),t.push(o)),s=n[i++];while(s!==void 0)}class _0{constructor(e,t,r,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(r),this.sampleValues=t,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let r=this._cachedIndex,i=t[r],s=t[r-1];e:{t:{let o;n:{r:if(!(e=s)){const a=t[1];e=s)break t}o=r,r=0;break n}break e}for(;r>>1;et;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=r.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,s=r.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=r[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&Xse(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),r=this.getValueSize(),i=this.getInterpolation()===pE,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*r,l=o*r,c=0;c!==r;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*r)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),r=this.constructor,i=new r(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}al.prototype.TimeBufferType=Float32Array;al.prototype.ValueBufferType=Float32Array;al.prototype.DefaultInterpolation=Ld;class $d extends al{constructor(e,t,r){super(e,t,r)}}$d.prototype.ValueTypeName="bool";$d.prototype.ValueBufferType=Array;$d.prototype.DefaultInterpolation=Pd;$d.prototype.InterpolantFactoryMethodLinear=void 0;$d.prototype.InterpolantFactoryMethodSmooth=void 0;class Qz extends al{}Qz.prototype.ValueTypeName="color";class Ou extends al{}Ou.prototype.ValueTypeName="number";class Jse extends _0{constructor(e,t,r,i){super(e,t,r,i)}interpolate_(e,t,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-t)/(i-t);let c=e*a;for(let A=c+a;c!==A;c+=4)nt.slerpFlat(s,0,o,c-a,o,c,l);return s}}class nl extends al{InterpolantFactoryMethodLinear(e){return new Jse(this.times,this.values,this.getValueSize(),e)}}nl.prototype.ValueTypeName="quaternion";nl.prototype.InterpolantFactoryMethodSmooth=void 0;class Zd extends al{constructor(e,t,r){super(e,t,r)}}Zd.prototype.ValueTypeName="string";Zd.prototype.ValueBufferType=Array;Zd.prototype.DefaultInterpolation=Pd;Zd.prototype.InterpolantFactoryMethodLinear=void 0;Zd.prototype.InterpolantFactoryMethodSmooth=void 0;class ic extends al{}ic.prototype.ValueTypeName="vector";class ku{constructor(e="",t=-1,r=[],i=PR){this.name=e,this.tracks=r,this.duration=t,this.blendMode=i,this.uuid=ia(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],r=e.tracks,i=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)t.push(eoe(r[o]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)t.push(al.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,t,r,i){const s=t.length,o=[];for(let a=0;a1){const u=A[1];let f=i[u];f||(i[u]=f=[]),f.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,r));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(u,f,h,d,m){if(h.length!==0){const g=[],p=[];Oz(h,g,p,d),g.length!==0&&m.push(new u(f,g,p))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let u=0;u{t&&t(s),this.manager.itemEnd(e)},0),s;if(gl[e]!==void 0){gl[e].push({onLoad:t,onProgress:r,onError:i});return}gl[e]=[],gl[e].push({onLoad:t,onProgress:r,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const A=gl[e],u=c.body.getReader(),f=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),h=f?parseInt(f):0,d=h!==0;let m=0;const g=new ReadableStream({start(p){v();function v(){u.read().then(({done:w,value:_})=>{if(w)p.close();else{m+=_.byteLength;const x=new ProgressEvent("progress",{lengthComputable:d,loaded:m,total:h});for(let b=0,B=A.length;b{p.error(w)})}}});return new Response(g)}else throw new noe(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(A=>new DOMParser().parseFromString(A,a));case"json":return c.json();default:if(a===void 0)return c.text();{const u=/charset="?([^;"\s]*)"?/i.exec(a),f=u&&u[1]?u[1].toLowerCase():void 0,h=new TextDecoder(f);return c.arrayBuffer().then(d=>h.decode(d))}}}).then(c=>{$c.add(e,c);const A=gl[e];delete gl[e];for(let u=0,f=A.length;u{const A=gl[e];if(A===void 0)throw this.manager.itemError(e),c;delete gl[e];for(let u=0,f=A.length;u{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class zz extends rl{constructor(e){super(e)}load(e,t,r,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=$c.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=zg("img");function l(){A(),$c.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(u){A(),i&&i(u),s.manager.itemError(e),s.manager.itemEnd(e)}function A(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class roe extends rl{constructor(e){super(e)}load(e,t,r,i){const s=this,o=new Eu,a=new g1(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(l){let c;try{c=s.parse(l)}catch(A){if(i!==void 0)i(A);else{console.error(A);return}}c.image!==void 0?o.image=c.image:c.data!==void 0&&(o.image.width=c.width,o.image.height=c.height,o.image.data=c.data),o.wrapS=c.wrapS!==void 0?c.wrapS:Rs,o.wrapT=c.wrapT!==void 0?c.wrapT:Rs,o.magFilter=c.magFilter!==void 0?c.magFilter:Lr,o.minFilter=c.minFilter!==void 0?c.minFilter:Lr,o.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(o.colorSpace=c.colorSpace),c.flipY!==void 0&&(o.flipY=c.flipY),c.format!==void 0&&(o.format=c.format),c.type!==void 0&&(o.type=c.type),c.mipmaps!==void 0&&(o.mipmaps=c.mipmaps,o.minFilter=ea),c.mipmapCount===1&&(o.minFilter=Lr),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,t&&t(o,c)},r,i),o}}class PA extends rl{constructor(e){super(e)}load(e,t,r,i){const s=new Un,o=new zz(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},r,i),s}}class v1 extends Lt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Qe(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}const JE=new He,pD=new $,mD=new $;class jR{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new We(512,512),this.map=null,this.mapPass=null,this.matrix=new He,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new f1,this._frameExtents=new We(1,1),this._viewportCount=1,this._viewports=[new Pt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,r=this.matrix;pD.setFromMatrixPosition(e.matrixWorld),t.position.copy(pD),mD.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(mD),t.updateMatrixWorld(),JE.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(JE),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(JE)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class ioe extends jR{constructor(){super(new Fr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,r=Dd*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(r!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=r,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Gz extends v1{constructor(e,t,r=0,i=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Lt.DEFAULT_UP),this.updateMatrix(),this.target=new Lt,this.distance=r,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new ioe}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const gD=new He,Op=new $,qE=new $;class soe extends jR{constructor(){super(new Fr(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new We(4,2),this._viewportCount=6,this._viewports=[new Pt(2,1,1,1),new Pt(0,1,1,1),new Pt(3,1,1,1),new Pt(1,1,1,1),new Pt(3,0,1,1),new Pt(1,0,1,1)],this._cubeDirections=[new $(1,0,0),new $(-1,0,0),new $(0,0,1),new $(0,0,-1),new $(0,1,0),new $(0,-1,0)],this._cubeUps=[new $(0,1,0),new $(0,1,0),new $(0,1,0),new $(0,1,0),new $(0,0,1),new $(0,0,-1)]}updateMatrices(e,t=0){const r=this.camera,i=this.matrix,s=e.distance||r.far;s!==r.far&&(r.far=s,r.updateProjectionMatrix()),Op.setFromMatrixPosition(e.matrixWorld),r.position.copy(Op),qE.copy(r.position),qE.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(qE),r.updateMatrixWorld(),i.makeTranslation(-Op.x,-Op.y,-Op.z),gD.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(gD)}}class DC extends v1{constructor(e,t,r=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=r,this.decay=i,this.shadow=new soe}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class ooe extends jR{constructor(){super(new v0(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class WR extends v1{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Lt.DEFAULT_UP),this.updateMatrix(),this.target=new Lt,this.shadow=new ooe}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Vz extends v1{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class ad{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let r=0,i=e.length;r"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=$c.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{t&&t(c),s.manager.itemEnd(e)}).catch(c=>{i&&i(c)});return}return setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return $c.add(e,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),$c.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});$c.add(e,l),s.manager.itemStart(e)}}class y1{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=vD(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=vD();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function vD(){return performance.now()}class loe{constructor(e,t,r){this.binding=e,this.valueSize=r;let i,s,o;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(r*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(r*5);break;default:i=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(r*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const r=this.buffer,i=this.valueSize,s=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)r[s+a]=r[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(r,s,0,a,i)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,r=this.valueSize,i=r*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,r=this.buffer,i=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(r,i,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(r,i,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(r[l]!==r[l+t]){a.setValue(r,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(t,i);for(let s=r,o=i;s!==o;++s)t[s]=t[i+s%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let r=e;r=.5)for(let o=0;o!==s;++o)e[t+o]=e[r+o]}_slerp(e,t,r,i){nt.slerpFlat(e,t,e,t,e,r,i)}_slerpAdditive(e,t,r,i,s){const o=this._workIndex*s;nt.multiplyQuaternionsFlat(e,o,e,t,e,r),nt.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,r,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[r+a]*i}}_lerpAdditive(e,t,r,i,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[r+o]*i}}}const KR="\\[\\]\\.:\\/",coe=new RegExp("["+KR+"]","g"),XR="[^"+KR+"]",Aoe="[^"+KR.replace("\\.","")+"]",uoe=/((?:WC+[\/:])*)/.source.replace("WC",XR),foe=/(WCOD+)?/.source.replace("WCOD",Aoe),hoe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",XR),doe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",XR),poe=new RegExp("^"+uoe+foe+hoe+doe+"$"),moe=["material","materials","bones","map"];class goe{constructor(e,t,r){const i=r||Ct.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const r=this._targetGroup.nCachedObjects_,i=this._bindings[r];i!==void 0&&i.getValue(e,t)}setValue(e,t){const r=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=r.length;i!==s;++i)r[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}}class Ct{constructor(e,t,r){this.path=t,this.parsedPath=r||Ct.parseTrackName(t),this.node=Ct.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new Ct.Composite(e,t,r):new Ct(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(coe,"")}static parseTrackName(e){const t=poe.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=r.nodeName.substring(i+1);moe.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(t);if(r!==void 0)return r}if(e.children){const r=function(s){for(let o=0;o0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case bq:for(let A=0,u=l.length;A!==u;++A)l[A].evaluate(o),c[A].accumulateAdditive(a);break;case PR:default:for(let A=0,u=l.length;A!==u;++A)l[A].evaluate(o),c[A].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const r=this._weightInterpolant;if(r!==null){const i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,r=this.loop;let i=this.time+e,s=this._loopCount;const o=r===xq;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(r===wq){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return t-i}return i}_setEndings(e,t,r){const i=this._interpolantSettings;r?(i.endingStart=Oh,i.endingEnd=Oh):(e?i.endingStart=this.zeroSlopeAtStart?Oh:Nh:i.endingStart=P_,t?i.endingEnd=this.zeroSlopeAtEnd?Oh:Nh:i.endingEnd=P_)}_scheduleFading(e,t,r){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=r,this}}const yoe=new Float32Array(1);class woe extends UA{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const r=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName;let A=c[l];A===void 0&&(A={},c[l]=A);for(let u=0;u!==s;++u){const f=i[u],h=f.name;let d=A[h];if(d!==void 0)++d.referenceCount,o[u]=d;else{if(d=o[u],d!==void 0){d._cacheIndex===null&&(++d.referenceCount,this._addInactiveBinding(d,l,h));continue}const m=t&&t._propertyBindings[u].binding.parsedPath;d=new loe(Ct.create(r,h,m),f.ValueTypeName,f.getValueSize()),++d.referenceCount,this._addInactiveBinding(d,l,h),o[u]=d}a[u].resultBuffer=d.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const r=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,r)}const t=e._propertyBindings;for(let r=0,i=t.length;r!==i;++r){const s=t[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let r=0,i=t.length;r!==i;++r){const s=t[r];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;const t=this._actions,r=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==r;++c)t[c]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;tMath.PI&&(r-=Vi),i<-Math.PI?i+=Vi:i>Math.PI&&(i-=Vi),r<=i?this._spherical.theta=Math.max(r,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(r+i)/2?Math.max(r,this._spherical.theta):Math.min(i,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(Ir.setFromSpherical(this._spherical),Ir.applyQuaternion(this._quatInverse),t.copy(this.target).add(Ir),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const a=Ir.length();o=this._clampDistance(a*this._scale);const l=a-o;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){const a=new $(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;const c=new $(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=Ir.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(jv.origin.copy(this.object.position),jv.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(jv.direction))eB||8*(1-this._lastQuaternion.dot(this.object.quaternion))>eB||this._lastTargetPosition.distanceToSquared(this.target)>eB?(this.dispatchEvent(ED),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Vi/60*this.autoRotateSpeed*e:Vi/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){Ir.setFromMatrixColumn(t,0),Ir.multiplyScalar(-e),this._panOffset.add(Ir)}_panUp(e,t){this.screenSpacePanning===!0?Ir.setFromMatrixColumn(t,1):(Ir.setFromMatrixColumn(t,0),Ir.crossVectors(this.object.up,Ir)),Ir.multiplyScalar(e),this._panOffset.add(Ir)}_pan(e,t){const r=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;Ir.copy(i).sub(this.target);let s=Ir.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/r.clientHeight,this.object.matrix),this._panUp(2*t*s/r.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/r.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/r.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const r=this.domElement.getBoundingClientRect(),i=e-r.left,s=t-r.top,o=r.width,a=r.height;this._mouse.x=i/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Vi*this._rotateDelta.x/t.clientHeight),this._rotateUp(Vi*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateUp(Vi*this.rotateSpeed/this.domElement.clientHeight):this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateUp(-Vi*this.rotateSpeed/this.domElement.clientHeight):this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateLeft(Vi*this.rotateSpeed/this.domElement.clientHeight):this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateLeft(-Vi*this.rotateSpeed/this.domElement.clientHeight):this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._rotateStart.set(r,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panStart.set(r,i)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),r=e.pageX-t.x,i=e.pageY-t.y,s=Math.sqrt(r*r+i*i);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),i=.5*(e.pageX+r.x),s=.5*(e.pageY+r.y);this._rotateEnd.set(i,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Vi*this._rotateDelta.x/t.clientHeight),this._rotateUp(Vi*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panEnd.set(r,i)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),r=e.pageX-t.x,i=e.pageY-t.y,s=Math.sqrt(r*r+i*i);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t=2.0 are supported."));return}const c=new pae(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let A=0;A=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(r,i)}parseAsync(e,t){const r=this;return new Promise(function(i,s){r.parse(e,t,i,s)})}}function Noe(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const Ft={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Ooe{constructor(e){this.parser=e,this.name=Ft.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let r=0,i=t.length;r=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class Joe{constructor(e){this.parser=e,this.name=Ft.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class qoe{constructor(e){this.parser=e,this.name=Ft.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class eae{constructor(e){this.name=Ft.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const i=r.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=i.byteOffset||0,c=i.byteLength||0,A=i.count,u=i.byteStride,f=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(A,u,f,i.mode,i.filter).then(function(h){return h.buffer}):o.ready.then(function(){const h=new ArrayBuffer(A*u);return o.decodeGltfBuffer(new Uint8Array(h),A,u,f,i.mode,i.filter),h})})}else return null}}let tae=class{constructor(e){this.name=Ft.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const i=t.meshes[r.mesh];for(const c of i.primitives)if(c.mode!==to.TRIANGLES&&c.mode!==to.TRIANGLE_STRIP&&c.mode!==to.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=r.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(A=>(l[c]=A,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const A=c.pop(),u=A.isGroup?A.children:[A],f=c[0].count,h=[];for(const d of u){const m=new He,g=new $,p=new nt,v=new $(1,1,1),w=new d1(d.geometry,d.material,f);for(let _=0;_0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const dae=new He;class pae{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Noe,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,i=-1,s=!1,o=-1;if(typeof navigator<"u"){const a=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(a)===!0;const l=a.match(/Version\/(\d+)/);i=r&&l?parseInt(l[1],10):-1,s=a.indexOf("Firefox")>-1,o=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&i<17||s&&o<98?this.textureLoader=new PA(this.options.manager):this.textureLoader=new aoe(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new g1(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const r=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(o){const a={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:r,userData:{}};return jA(s,a,i),Ul(a,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(const l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let i=0,s=t.length;i{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,A]of o.children.entries())s(A,a.children[c])};return s(r,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let r=0;r=2&&g.setY(I,b[B*l+1]),l>=3&&g.setZ(I,b[B*l+2]),l>=4&&g.setW(I,b[B*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}g.normalized=d}return g})}loadTexture(e){const t=this.json,r=this.options,s=t.textures[e].source,o=t.images[s];let a=this.textureLoader;if(o.uri){const l=r.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,r){const i=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,r).then(function(A){A.flipY=!1,A.name=o.name||a.name||"",A.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(A.name=a.uri);const f=(s.samplers||{})[o.sampler]||{};return A.magFilter=CD[f.magFilter]||Lr,A.minFilter=CD[f.minFilter]||ea,A.wrapS=TD[f.wrapS]||zs,A.wrapT=TD[f.wrapT]||zs,i.associations.set(A,{textures:e}),A}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const r=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const o=i.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=r.getDependency("bufferView",o.bufferView).then(function(u){c=!0;const f=new Blob([u],{type:o.mimeType});return l=a.createObjectURL(f),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const A=Promise.resolve(l).then(function(u){return new Promise(function(f,h){let d=f;t.isImageBitmapLoader===!0&&(d=function(m){const g=new Un(m);g.needsUpdate=!0,f(g)}),t.load(ad.resolveURL(u,s.path),d,void 0,h)})}).then(function(u){return c===!0&&a.revokeObjectURL(l),Ul(u,o),u.userData.mimeType=o.mimeType||hae(o.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),u});return this.sourceCache[e]=A,A}assignTexture(e,t,r,i){const s=this;return this.getDependency("texture",r.index).then(function(o){if(!o)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(o=o.clone(),o.channel=r.texCoord),s.extensions[Ft.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[Ft.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[Ft.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return i!==void 0&&(o.colorSpace=i),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let r=e.material;const i=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new Pz,as.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(a,l)),r=l}else if(e.isLine){const a="LineBasicMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new Ac,as.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(a,l)),r=l}if(i||s||o){let a="ClonedMaterial:"+r.uuid+":";i&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=r.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(r))),r=l}e.material=r}getMaterialType(){return Od}loadMaterial(e){const t=this,r=this.json,i=this.extensions,s=r.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[Ft.KHR_MATERIALS_UNLIT]){const u=i[Ft.KHR_MATERIALS_UNLIT];o=u.getMaterialType(),c.push(u.extendParams(a,s,t))}else{const u=s.pbrMetallicRoughness||{};if(a.color=new Qe(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const f=u.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],Sr),a.opacity=f[3]}u.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",u.baseColorTexture,Ut)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),o=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=_i);const A=s.alphaMode||nB.OPAQUE;if(A===nB.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,A===nB.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==qi&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new We(1,1),s.normalTexture.scale!==void 0)){const u=s.normalTexture.scale;a.normalScale.set(u,u)}if(s.occlusionTexture!==void 0&&o!==qi&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==qi){const u=s.emissiveFactor;a.emissive=new Qe().setRGB(u[0],u[1],u[2],Sr)}return s.emissiveTexture!==void 0&&o!==qi&&c.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,Ut)),Promise.all(c).then(function(){const u=new o(a);return s.name&&(u.name=s.name),Ul(u,s),t.associations.set(u,{materials:e}),s.extensions&&jA(i,u,s),u})}createUniqueName(e){const t=Ct.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,r=this.extensions,i=this.primitiveCache;function s(a){return r[Ft.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return ID(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&uae(p,s),p.name=t.createUniqueName(s.name||"mesh_"+e),Ul(p,s),g.extensions&&jA(i,p,g),t.assignFinalMaterial(p),u.push(p)}for(let h=0,d=u.length;h1?A=new ri:c.length===1?A=c[0]:A=new Lt,A!==c[0])for(let u=0,f=c.length;u{const u=new Map;for(const[f,h]of i.associations)(f instanceof as||f instanceof Un)&&u.set(f,h);return A.traverse(f=>{const h=i.associations.get(f);h!=null&&u.set(f,h)}),u};return i.associations=c(s),s})}_createAnimationTracks(e,t,r,i,s){const o=[],a=e.name?e.name:e.uuid,l=[];Mc[s.path]===Mc.weights?e.traverse(function(f){f.morphTargetInfluences&&l.push(f.name?f.name:f.uuid)}):l.push(a);let c;switch(Mc[s.path]){case Mc.weights:c=Ou;break;case Mc.rotation:c=nl;break;case Mc.position:case Mc.scale:c=ic;break;default:switch(r.itemSize){case 1:c=Ou;break;case 2:case 3:default:c=ic;break}break}const A=i.interpolation!==void 0?lae[i.interpolation]:Ld,u=this._getArrayFromAccessor(r);for(let f=0,h=l.length;f Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE version 0.8.2 -*/var ao=Uint8Array,kh=Uint16Array,yae=Int32Array,$z=new ao([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Zz=new ao([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),wae=new ao([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Jz=function(n,e){for(var t=new kh(31),r=0;r<31;++r)t[r]=e+=1<>1|(In&21845)<<1;Mc=(Mc&52428)>>2|(Mc&13107)<<2,Mc=(Mc&61680)>>4|(Mc&3855)<<4,OC[In]=((Mc&65280)>>8|(Mc&255)<<8)>>1}var tg=function(n,e,t){for(var r=n.length,i=0,s=new kh(e);i>l]=c}else for(a=new kh(r),i=0;i>15-n[i]);return a},_0=new ao(288);for(var In=0;In<144;++In)_0[In]=8;for(var In=144;In<256;++In)_0[In]=9;for(var In=256;In<280;++In)_0[In]=7;for(var In=280;In<288;++In)_0[In]=8;var t8=new ao(32);for(var In=0;In<32;++In)t8[In]=5;var Eae=tg(_0,9,1),Bae=tg(t8,5,1),nB=function(n){for(var e=n[0],t=1;te&&(e=n[t]);return e},Oo=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},rB=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},Sae=function(n){return(n+7)/8|0},Mae=function(n,e,t){return(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length),new ao(n.subarray(e,t))},Cae=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ko=function(n,e,t){var r=new Error(e||Cae[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,Ko),!t)throw r;return r},Tae=function(n,e,t,r){var i=n.length,s=r?r.length:0;if(!i||e.f&&!e.l)return t||new ao(0);var o=!t,a=o||e.i!=2,l=e.i;o&&(t=new ao(i*3));var c=function(ge){var _e=t.length;if(ge>_e){var se=new ao(Math.max(_e*2,ge));se.set(t),t=se}},A=e.f||0,u=e.p||0,f=e.b||0,h=e.l,d=e.d,m=e.m,g=e.n,p=i*8;do{if(!h){A=Oo(n,u,1);var v=Oo(n,u+1,3);if(u+=3,v)if(v==1)h=Eae,d=Bae,m=9,g=5;else if(v==2){var b=Oo(n,u,31)+257,B=Oo(n,u+10,15)+4,M=b+Oo(n,u+5,31)+1;u+=14;for(var I=new ao(M),S=new ao(19),L=0;L>4;if(w<16)I[L++]=w;else{var R=0,F=0;for(w==16?(F=3+Oo(n,u,3),u+=2,R=I[L-1]):w==17?(F=3+Oo(n,u,7),u+=3):w==18&&(F=11+Oo(n,u,127),u+=7);F--;)I[L++]=R}}var O=I.subarray(0,b),z=I.subarray(b);m=nB(O),g=nB(z),h=tg(O,m,1),d=tg(z,g,1)}else Ko(1);else{var w=Sae(u)+4,_=n[w-4]|n[w-3]<<8,x=w+_;if(x>i){l&&Ko(0);break}a&&c(f+_),t.set(n.subarray(w,x),f),e.b=f+=_,e.p=u=x*8,e.f=A;continue}if(u>p){l&&Ko(0);break}}a&&c(f+131072);for(var j=(1<>4;if(u+=R&15,u>p){l&&Ko(0);break}if(R||Ko(2),W<256)t[f++]=W;else if(W==256){C=u,h=null;break}else{var ee=W-254;if(W>264){var L=W-257,P=$z[L];ee=Oo(n,u,(1<>4;re||Ko(3),u+=re&15;var z=bae[ue];if(ue>3){var P=Zz[ue];z+=rB(n,u)&(1<p){l&&Ko(0);break}a&&c(f+131072);var le=f+ee;if(f>4>7||(n[0]<<8|n[1])%31)&&Ko(6,"invalid zlib data"),(n[1]>>5&1)==+!e&&Ko(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2};function Uae(n,e){return Tae(n.subarray(Rae(n,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}var Fae=typeof TextDecoder<"u"&&new TextDecoder,Pae=0;try{Fae.decode(Iae,{stream:!0}),Pae=1}catch{}function n8(n,e,t){const r=t.length-n-1;if(e>=t[r])return r-1;if(e<=t[n])return n;let i=n,s=r,o=Math.floor((i+s)/2);for(;e=t[o+1];)e=m&&(d[h][0]=d[f][0]/a[v+1][p],g=d[h][0]*a[p][v]);const w=p>=-1?1:-p,_=u-1<=v?m-1:t-u;for(let b=w;b<=_;++b)d[h][b]=(d[f][b]-d[f][b-1])/a[v+1][p+b],g+=d[h][b]*a[p+b][v];u<=v&&(d[h][m]=-d[f][m-1]/a[v+1][u],g+=d[h][m]*a[u][v]),o[m][u]=g;const x=f;f=h,h=x}}let A=t;for(let u=1;u<=r;++u){for(let f=0;f<=t;++f)o[u][f]*=A;A*=t-u}return o}function Oae(n,e,t,r,i){const s=i0,l=typeof s.Content=="string"&&s.Content!=="";if(a||l){const c=this.parseImage(r[i]);t[s.RelativeFilename||s.Filename]=c}}}}for(const r in e){const i=e[r];t[i]!==void 0?e[r]=t[i]:e[r]=e[r].split("\\").pop()}return e}parseImage(e){const t=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.lastIndexOf(".")+1).toLowerCase();let s;switch(i){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",r),s="image/tga";break;default:console.warn('FBXLoader: Image type "'+i+'" is not supported.');return}if(typeof t=="string")return"data:"+s+";base64,"+t;{const o=new Uint8Array(t);return window.URL.createObjectURL(new Blob([o],{type:s}))}}parseTextures(e){const t=new Map;if("Texture"in Mt.Objects){const r=Mt.Objects.Texture;for(const i in r){const s=this.parseTexture(r[i],e);t.set(parseInt(i),s)}}return t}parseTexture(e,t){const r=this.loadTexture(e,t);r.ID=e.id,r.name=e.attrName;const i=e.WrapModeU,s=e.WrapModeV,o=i!==void 0?i.value:0,a=s!==void 0?s.value:0;if(r.wrapS=o===0?zs:Rs,r.wrapT=a===0?zs:Rs,"Scaling"in e){const l=e.Scaling.value;r.repeat.x=l[0],r.repeat.y=l[1]}if("Translation"in e){const l=e.Translation.value;r.offset.x=l[0],r.offset.y=l[1]}return r}loadTexture(e,t){const r=new Set(["tga","tif","tiff","exr","dds","hdr","ktx2"]),i=e.FileName.split(".").pop().toLowerCase(),s=r.has(i)?this.manager.getHandler(`.${i}`):this.textureLoader;if(!s)return console.warn(`FBXLoader: ${i.toUpperCase()} loader not found, creating placeholder texture for`,e.RelativeFilename),new Un;const o=s.path;o||s.setPath(this.textureLoader.path);const a=ur.get(e.id).children;let l;a!==void 0&&a.length>0&&t[a[0].ID]!==void 0&&(l=t[a[0].ID],(l.indexOf("blob:")===0||l.indexOf("data:")===0)&&s.setPath(void 0));const c=s.load(l);return s.setPath(o),c}parseMaterials(e){const t=new Map;if("Material"in Mt.Objects){const r=Mt.Objects.Material;for(const i in r){const s=this.parseMaterial(r[i],e);s!==null&&t.set(parseInt(i),s)}}return t}parseMaterial(e,t){const r=e.id,i=e.attrName;let s=e.ShadingModel;if(typeof s=="object"&&(s=s.value),!ur.has(r))return null;const o=this.parseParameters(e,t,r);let a;switch(s.toLowerCase()){case"phong":a=new YE;break;case"lambert":a=new Yse;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),a=new YE;break}return a.setValues(o),a.name=i,a}parseParameters(e,t,r){const i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=Et.toWorkingColorSpace(new ke().fromArray(e.Diffuse.value),Ut):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(i.color=Et.toWorkingColorSpace(new ke().fromArray(e.DiffuseColor.value),Ut)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=Et.toWorkingColorSpace(new ke().fromArray(e.Emissive.value),Ut):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(i.emissive=Et.toWorkingColorSpace(new ke().fromArray(e.EmissiveColor.value),Ut)),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0),e.ReflectionFactor&&(i.reflectivity=e.ReflectionFactor.value),e.Shininess&&(i.shininess=e.Shininess.value),e.Specular?i.specular=Et.toWorkingColorSpace(new ke().fromArray(e.Specular.value),Ut):e.SpecularColor&&e.SpecularColor.type==="Color"&&(i.specular=Et.toWorkingColorSpace(new ke().fromArray(e.SpecularColor.value),Ut));const s=this;return ur.get(r).children.forEach(function(o){const a=o.relationship;switch(a){case"Bump":i.bumpMap=s.getTexture(t,o.ID);break;case"Maya|TEX_ao_map":i.aoMap=s.getTexture(t,o.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=s.getTexture(t,o.ID),i.map!==void 0&&(i.map.colorSpace=Ut);break;case"DisplacementColor":i.displacementMap=s.getTexture(t,o.ID);break;case"EmissiveColor":i.emissiveMap=s.getTexture(t,o.ID),i.emissiveMap!==void 0&&(i.emissiveMap.colorSpace=Ut);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=s.getTexture(t,o.ID);break;case"ReflectionColor":i.envMap=s.getTexture(t,o.ID),i.envMap!==void 0&&(i.envMap.mapping=Og,i.envMap.colorSpace=Ut);break;case"SpecularColor":i.specularMap=s.getTexture(t,o.ID),i.specularMap!==void 0&&(i.specularMap.colorSpace=Ut);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=s.getTexture(t,o.ID),i.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",a);break}}),i}getTexture(e,t){return"LayeredTexture"in Mt.Objects&&t in Mt.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=ur.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in Mt.Objects){const r=Mt.Objects.Deformer;for(const i in r){const s=r[i],o=ur.get(parseInt(i));if(s.attrType==="Skin"){const a=this.parseSkeleton(o,r);a.ID=i,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=o.parents[0].ID,e[i]=a}else if(s.attrType==="BlendShape"){const a={id:i};a.rawTargets=this.parseMorphTargets(o,r),a.id=i,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[i]=a}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const r=[];return e.children.forEach(function(i){const s=t[i.ID];if(s.attrType!=="Cluster")return;const o={ID:i.ID,indices:[],weights:[],transformLink:new He().fromArray(s.TransformLink.a)};"Indexes"in s&&(o.indices=s.Indexes.a,o.weights=s.Weights.a),r.push(o)}),{rawBones:r,bones:[]}}parseMorphTargets(e,t){const r=[];for(let i=0;i1?o=a:a.length>0?o=a[0]:(o=new YE({name:nl.DEFAULT_MATERIAL_NAME,color:13421772}),a.push(o)),"color"in s.attributes&&a.forEach(function(l){l.vertexColors=!0}),s.FBX_Deformer?(i=new ia(s,o),i.normalizeSkinWeights()):i=new dn(s,o),i}createCurve(e,t){const r=e.children.reduce(function(s,o){return t.has(o.ID)&&(s=t.get(o.ID)),s},null),i=new Ac({name:nl.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new Yd(r,i)}getTransformData(e,t){const r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?r.eulerOrder=Kg(t.RotationOrder.value):r.eulerOrder=Kg(0),"Lcl_Translation"in t&&(r.translation=t.Lcl_Translation.value),"PreRotation"in t&&(r.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(r.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(r.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(r.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(r.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(r.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(r.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(r.rotationPivot=t.RotationPivot.value),e.userData.transformData=r}setLookAtProperties(e,t){"LookAtProperty"in t&&ur.get(e.ID).children.forEach(function(i){if(i.relationship==="LookAtProperty"){const s=Mt.Objects.Model[i.ID];if("Lcl_Translation"in s){const o=s.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(o),Fi.add(e.target)):e.lookAt(new $().fromArray(o))}}})}bindSkeleton(e,t,r){const i=this.parsePoseNodes();for(const s in e){const o=e[s];ur.get(parseInt(o.ID)).parents.forEach(function(l){if(t.has(l.ID)){const c=l.ID;ur.get(c).parents.forEach(function(u){r.has(u.ID)&&r.get(u.ID).bind(new UA(o.bones),i[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in Mt.Objects){const t=Mt.Objects.Pose;for(const r in t)if(t[r].attrType==="BindPose"&&t[r].NbPoseNodes>0){const i=t[r].PoseNode;Array.isArray(i)?i.forEach(function(s){e[s.Node]=new He().fromArray(s.Matrix.a)}):e[i.Node]=new He().fromArray(i.Matrix.a)}}return e}addGlobalSceneSettings(){if("GlobalSettings"in Mt){if("AmbientColor"in Mt.GlobalSettings){const e=Mt.GlobalSettings.AmbientColor.value,t=e[0],r=e[1],i=e[2];if(t!==0||r!==0||i!==0){const s=new ke().setRGB(t,r,i,Ut);Fi.add(new Gz(s,1))}}"UnitScaleFactor"in Mt.GlobalSettings&&(Fi.userData.unitScaleFactor=Mt.GlobalSettings.UnitScaleFactor.value)}}}class jae{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in Mt.Objects){const r=Mt.Objects.Geometry;for(const i in r){const s=ur.get(parseInt(i)),o=this.parseGeometry(s,r[i],e);t.set(parseInt(i),o)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,r){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,r);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,r){const i=r.skeletons,s=[],o=e.parents.map(function(u){return Mt.Objects.Model[u.ID]});if(o.length===0)return;const a=e.children.reduce(function(u,f){return i[f.ID]!==void 0&&(u=i[f.ID]),u},null);e.children.forEach(function(u){r.morphTargets[u.ID]!==void 0&&s.push(r.morphTargets[u.ID])});const l=o[0],c={};"RotationOrder"in l&&(c.eulerOrder=Kg(l.RotationOrder.value)),"InheritType"in l&&(c.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(c.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(c.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(c.scale=l.GeometricScaling.value);const A=i8(c);return this.genGeometry(t,a,s,A)}genGeometry(e,t,r,i){const s=new Jt;e.attrName&&(s.name=e.attrName);const o=this.parseGeoNode(e,t),a=this.genBuffers(o),l=new xn(a.vertex,3);if(l.applyMatrix4(i),s.setAttribute("position",l),a.colors.length>0&&s.setAttribute("color",new xn(a.colors,3)),t&&(s.setAttribute("skinIndex",new A1(a.weightsIndices,4)),s.setAttribute("skinWeight",new xn(a.vertexWeights,4)),s.FBX_Deformer=t),a.normal.length>0){const c=new dt().getNormalMatrix(i),A=new xn(a.normal,3);A.applyNormalMatrix(c),s.setAttribute("normal",A)}if(a.uvs.forEach(function(c,A){const u=A===0?"uv":`uv${A}`;s.setAttribute(u,new xn(a.uvs[A],2))}),o.material&&o.material.mappingType!=="AllSame"){let c=a.materialIndex[0],A=0;if(a.materialIndex.forEach(function(u,f){u!==c&&(s.addGroup(A,f-A,c),c=u,A=f)}),s.groups.length>0){const u=s.groups[s.groups.length-1],f=u.start+u.count;f!==a.materialIndex.length&&s.addGroup(f,a.materialIndex.length-f,c)}s.groups.length===0&&s.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(s,e,r,i),s}parseGeoNode(e,t){const r={};if(r.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],r.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(r.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(r.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(r.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){r.uv=[];let i=0;for(;e.LayerElementUV[i];)e.LayerElementUV[i].UV&&r.uv.push(this.parseUVs(e.LayerElementUV[i])),i++}return r.weightTable={},t!==null&&(r.skeleton=t,t.rawBones.forEach(function(i,s){i.indices.forEach(function(o,a){r.weightTable[o]===void 0&&(r.weightTable[o]=[]),r.weightTable[o].push({id:s,weight:i.weights[a]})})})),r}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let r=0,i=0,s=!1,o=[],a=[],l=[],c=[],A=[],u=[];const f=this;return e.vertexIndices.forEach(function(h,d){let m,g=!1;h<0&&(h=h^-1,g=!0);let p=[],v=[];if(o.push(h*3,h*3+1,h*3+2),e.color){const w=jv(d,r,h,e.color);l.push(w[0],w[1],w[2])}if(e.skeleton){if(e.weightTable[h]!==void 0&&e.weightTable[h].forEach(function(w){v.push(w.weight),p.push(w.id)}),v.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);const w=[0,0,0,0],_=[0,0,0,0];v.forEach(function(x,b){let B=x,M=p[b];_.forEach(function(I,S,L){if(B>I){L[S]=B,B=I;const D=w[S];w[S]=M,M=D}})}),p=w,v=_}for(;v.length<4;)v.push(0),p.push(0);for(let w=0;w<4;++w)A.push(v[w]),u.push(p[w])}if(e.normal){const w=jv(d,r,h,e.normal);a.push(w[0],w[1],w[2])}e.material&&e.material.mappingType!=="AllSame"&&(m=jv(d,r,h,e.material)[0],m<0&&(f.negativeMaterialIndices=!0,m=0)),e.uv&&e.uv.forEach(function(w,_){const x=jv(d,r,h,w);c[_]===void 0&&(c[_]=[]),c[_].push(x[0]),c[_].push(x[1])}),i++,g&&(f.genFace(t,e,o,m,a,l,c,A,u,i),r++,i=0,o=[],a=[],l=[],c=[],A=[],u=[])}),t}getNormalNewell(e){const t=new $(0,0,0);for(let r=0;r.5?new $(0,1,0):new $(0,0,1)).cross(t).normalize(),s=t.clone().cross(i).normalize();return{normal:t,tangent:i,bitangent:s}}flattenVertex(e,t,r){return new je(e.dot(t),e.dot(r))}genFace(e,t,r,i,s,o,a,l,c,A){let u;if(A>3){const f=[],h=t.baseVertexPositions||t.vertexPositions;for(let p=0;p1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const o=e.get(s[0].ID);r[i]={name:t[i].attrName,layer:o}}return r}addClip(e){let t=[];const r=this;return e.layer.forEach(function(i){t=t.concat(r.generateTracks(i))}),new Nu(e.name,-1,t)}generateTracks(e){const t=[];let r=new $,i=new $;if(e.transform&&e.transform.decompose(r,new nt,i),r=r.toArray(),i=i.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.T.curves,r,"position");s!==void 0&&t.push(s)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const s=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder);s!==void 0&&t.push(s)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.S.curves,i,"scale");s!==void 0&&t.push(s)}if(e.DeformPercent!==void 0){const s=this.generateMorphTrack(e);s!==void 0&&t.push(s)}return t}generateVectorTrack(e,t,r,i){const s=this.getTimesForAllAxes(t),o=this.getKeyframeTrackValues(s,t,r);return new ic(e+"."+i,s,o)}generateRotationTrack(e,t,r,i,s){let o,a;if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){const f=this.interpolateRotations(t.x,t.y,t.z,s);o=f[0],a=f[1]}const l=Kg(0);r!==void 0&&(r=r.map(Bt.degToRad),r.push(l),r=new tr().fromArray(r),r=new nt().setFromEuler(r)),i!==void 0&&(i=i.map(Bt.degToRad),i.push(l),i=new tr().fromArray(i),i=new nt().setFromEuler(i).invert());const c=new nt,A=new tr,u=[];if(!a||!o)return new tl(e+".quaternion",[0],[0]);for(let f=0;f2&&new nt().fromArray(u,(f-3)/3*4).dot(c)<0&&c.set(-c.x,-c.y,-c.z,-c.w),c.toArray(u,f/3*4);return new tl(e+".quaternion",o,u)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,r=t.values.map(function(s){return s/100}),i=Fi.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new Du(e.modelName+".morphTargetInfluences["+i+"]",t.times,r)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(r,i){return r-i}),t.length>1){let r=1,i=t[0];for(let s=1;s=180||h[1]>=180||h[2]>=180){const m=Math.max(...h)/180,g=new tr(...c,i),p=new tr(...u,i),v=new nt().setFromEuler(g),w=new nt().setFromEuler(p);v.dot(w)&&w.set(-w.x,-w.y,-w.z,-w.w);const _=e.times[a-1],x=e.times[a]-_,b=new nt,B=new tr;for(let M=0;M<1;M+=1/m)b.copy(v.clone().slerp(w.clone(),M)),s.push(_+M*x),B.setFromQuaternion(b,i),o.push(B.x),o.push(B.y),o.push(B.z)}else s.push(e.times[a]),o.push(Bt.degToRad(e.values[a])),o.push(Bt.degToRad(t.values[a])),o.push(Bt.degToRad(r.values[a]))}return[s,o]}}class Kae{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new r8,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,r=e.split(/[\r\n]+/);return r.forEach(function(i,s){const o=i.match(/^[\s\t]*;/),a=i.match(/^[\s\t]*$/);if(o||a)return;const l=i.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),c=i.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),A=i.match("^\\t{"+(t.currentIndent-1)+"}}");l?t.parseNodeBegin(i,l):c?t.parseNodeProperty(i,c,r[++s]):A?t.popStack():i.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(i)}),this.allNodes}parseNodeBegin(e,t){const r=t[1].trim().replace(/^"/,"").replace(/"$/,""),i=t[2].split(",").map(function(l){return l.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:r},o=this.parseNodeAttr(i),a=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(r,s):r in a?(r==="PoseNode"?a.PoseNode.push(s):a[r].id!==void 0&&(a[r]={},a[r][a[r].id]=a[r]),o.id!==""&&(a[r][o.id]=s)):typeof o.id=="number"?(a[r]={},a[r][o.id]=s):r!=="Properties70"&&(r==="PoseNode"?a[r]=[s]:a[r]=s),typeof o.id=="number"&&(s.id=o.id),o.name!==""&&(s.attrName=o.name),o.type!==""&&(s.attrType=o.type),this.pushStack(s)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let r="",i="";return e.length>1&&(r=e[1].replace(/^(\w+)::/,""),i=e[2]),{id:t,name:r,type:i}}parseNodeProperty(e,t,r){let i=t[1].replace(/^"/,"").replace(/"$/,"").trim(),s=t[2].replace(/^"/,"").replace(/"$/,"").trim();i==="Content"&&s===","&&(s=r.replace(/"/g,"").replace(/,$/,"").trim());const o=this.getCurrentNode();if(o.name==="Properties70"){this.parseNodeSpecialProperty(e,i,s);return}if(i==="C"){const l=s.split(",").slice(1),c=parseInt(l[0]),A=parseInt(l[1]);let u=s.split(",").slice(3);u=u.map(function(f){return f.trim().replace(/^"/,"")}),i="connections",s=[c,A],qae(s,u),o[i]===void 0&&(o[i]=[])}i==="Node"&&(o.id=s),i in o&&Array.isArray(o[i])?o[i].push(s):i!=="a"?o[i]=s:o.a=s,this.setCurrentProp(o,i),i==="a"&&s.slice(-1)!==","&&(o.a=sB(s))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=sB(t.a))}parseNodeSpecialProperty(e,t,r){const i=r.split('",').map(function(A){return A.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=i[0],o=i[1],a=i[2],l=i[3];let c=i[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":c=parseFloat(c);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":c=sB(c);break}this.getPrevNode()[s]={type:o,type2:a,flag:l,value:c},this.setCurrentProp(this.getPrevNode(),s)}}class Xae{parse(e){const t=new ID(e);t.skip(23);const r=t.getUint32();if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);const i=new r8;for(;!this.endOfContent(t);){const s=this.parseNode(t,r);s!==null&&i.add(s.name,s)}return i}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const r={},i=t>=7500?e.getUint64():e.getUint32(),s=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const o=e.getUint8(),a=e.getString(o);if(i===0)return null;const l=[];for(let f=0;f0?l[0]:"",A=l.length>1?l[1]:"",u=l.length>2?l[2]:"";for(r.singleProperty=s===1&&e.getOffset()===i;i>e.getOffset();){const f=this.parseNode(e,t);f!==null&&this.parseSubNode(a,r,f)}return r.propertyList=l,typeof c=="number"&&(r.id=c),A!==""&&(r.attrName=A),u!==""&&(r.attrType=u),a!==""&&(r.name=a),r}parseSubNode(e,t,r){if(r.singleProperty===!0){const i=r.propertyList[0];Array.isArray(i)?(t[r.name]=r,r.a=i):t[r.name]=i}else if(e==="Connections"&&r.name==="C"){const i=[];r.propertyList.forEach(function(s,o){o!==0&&i.push(s)}),t.connections===void 0&&(t.connections=[]),t.connections.push(i)}else if(r.name==="Properties70")Object.keys(r).forEach(function(s){t[s]=r[s]});else if(e==="Properties70"&&r.name==="P"){let i=r.propertyList[0],s=r.propertyList[1];const o=r.propertyList[2],a=r.propertyList[3];let l;i.indexOf("Lcl ")===0&&(i=i.replace("Lcl ","Lcl_")),s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),s==="Color"||s==="ColorRGB"||s==="Vector"||s==="Vector3D"||s.indexOf("Lcl_")===0?l=[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:l=r.propertyList[4],t[i]={type:s,type2:o,flag:a,value:l}}else t[r.name]===void 0?typeof r.id=="number"?(t[r.name]={},t[r.name][r.id]=r):t[r.name]=r:r.name==="PoseNode"?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(r)):t[r.name][r.id]===void 0&&(t[r.name][r.id]=r)}parseProperty(e){const t=e.getString(1);let r;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return r=e.getUint32(),e.getArrayBuffer(r);case"S":return r=e.getUint32(),e.getString(r);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const i=e.getUint32(),s=e.getUint32(),o=e.getUint32();if(s===0)switch(t){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}const a=Uae(new Uint8Array(e.getArrayBuffer(o))),l=new ID(a.buffer);switch(t){case"b":case"c":return l.getBooleanArray(i);case"d":return l.getFloat64Array(i);case"f":return l.getFloat32Array(i);case"i":return l.getInt32Array(i);case"l":return l.getInt64Array(i)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class ID{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let r=0;r=0&&(r=new Uint8Array(this.dv.buffer,t,i)),this._textDecoder.decode(r)}}class r8{add(e,t){this[e]=t}}function Yae(n){const e="Kaydara FBX Binary \0";return n.byteLength>=e.length&&e===s8(n,0,e.length)}function $ae(n){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function r(i){const s=n[i-1];return n=n.slice(t+i),t++,s}for(let i=0;i>1|(In&21845)<<1;Sc=(Sc&52428)>>2|(Sc&13107)<<2,Sc=(Sc&61680)>>4|(Sc&3855)<<4,QC[In]=((Sc&65280)>>8|(Sc&255)<<8)>>1}var ng=function(n,e,t){for(var r=n.length,i=0,s=new Hh(e);i>l]=c}else for(a=new Hh(r),i=0;i>15-n[i]);return a},x0=new ao(288);for(var In=0;In<144;++In)x0[In]=8;for(var In=144;In<256;++In)x0[In]=9;for(var In=256;In<280;++In)x0[In]=7;for(var In=280;In<288;++In)x0[In]=8;var n8=new ao(32);for(var In=0;In<32;++In)n8[In]=5;var xae=ng(x0,9,1),bae=ng(n8,5,1),iB=function(n){for(var e=n[0],t=1;te&&(e=n[t]);return e},Oo=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},sB=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},Eae=function(n){return(n+7)/8|0},Bae=function(n,e,t){return(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length),new ao(n.subarray(e,t))},Mae=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ko=function(n,e,t){var r=new Error(e||Mae[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,Ko),!t)throw r;return r},Sae=function(n,e,t,r){var i=n.length,s=r?r.length:0;if(!i||e.f&&!e.l)return t||new ao(0);var o=!t,a=o||e.i!=2,l=e.i;o&&(t=new ao(i*3));var c=function(ge){var _e=t.length;if(ge>_e){var se=new ao(Math.max(_e*2,ge));se.set(t),t=se}},A=e.f||0,u=e.p||0,f=e.b||0,h=e.l,d=e.d,m=e.m,g=e.n,p=i*8;do{if(!h){A=Oo(n,u,1);var v=Oo(n,u+1,3);if(u+=3,v)if(v==1)h=xae,d=bae,m=9,g=5;else if(v==2){var b=Oo(n,u,31)+257,B=Oo(n,u+10,15)+4,S=b+Oo(n,u+5,31)+1;u+=14;for(var I=new ao(S),M=new ao(19),L=0;L>4;if(w<16)I[L++]=w;else{var R=0,F=0;for(w==16?(F=3+Oo(n,u,3),u+=2,R=I[L-1]):w==17?(F=3+Oo(n,u,7),u+=3):w==18&&(F=11+Oo(n,u,127),u+=7);F--;)I[L++]=R}}var O=I.subarray(0,b),z=I.subarray(b);m=iB(O),g=iB(z),h=ng(O,m,1),d=ng(z,g,1)}else Ko(1);else{var w=Eae(u)+4,_=n[w-4]|n[w-3]<<8,x=w+_;if(x>i){l&&Ko(0);break}a&&c(f+_),t.set(n.subarray(w,x),f),e.b=f+=_,e.p=u=x*8,e.f=A;continue}if(u>p){l&&Ko(0);break}}a&&c(f+131072);for(var j=(1<>4;if(u+=R&15,u>p){l&&Ko(0);break}if(R||Ko(2),W<256)t[f++]=W;else if(W==256){C=u,h=null;break}else{var ee=W-254;if(W>264){var L=W-257,P=Zz[L];ee=Oo(n,u,(1<>4;re||Ko(3),u+=re&15;var z=_ae[ue];if(ue>3){var P=Jz[ue];z+=sB(n,u)&(1<p){l&&Ko(0);break}a&&c(f+131072);var le=f+ee;if(f>4>7||(n[0]<<8|n[1])%31)&&Ko(6,"invalid zlib data"),(n[1]>>5&1)==+!e&&Ko(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2};function Iae(n,e){return Sae(n.subarray(Tae(n,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}var Rae=typeof TextDecoder<"u"&&new TextDecoder,Uae=0;try{Rae.decode(Cae,{stream:!0}),Uae=1}catch{}function r8(n,e,t){const r=t.length-n-1;if(e>=t[r])return r-1;if(e<=t[n])return n;let i=n,s=r,o=Math.floor((i+s)/2);for(;e=t[o+1];)e=m&&(d[h][0]=d[f][0]/a[v+1][p],g=d[h][0]*a[p][v]);const w=p>=-1?1:-p,_=u-1<=v?m-1:t-u;for(let b=w;b<=_;++b)d[h][b]=(d[f][b]-d[f][b-1])/a[v+1][p+b],g+=d[h][b]*a[p+b][v];u<=v&&(d[h][m]=-d[f][m-1]/a[v+1][u],g+=d[h][m]*a[u][v]),o[m][u]=g;const x=f;f=h,h=x}}let A=t;for(let u=1;u<=r;++u){for(let f=0;f<=t;++f)o[u][f]*=A;A*=t-u}return o}function Dae(n,e,t,r,i){const s=i0,l=typeof s.Content=="string"&&s.Content!=="";if(a||l){const c=this.parseImage(r[i]);t[s.RelativeFilename||s.Filename]=c}}}}for(const r in e){const i=e[r];t[i]!==void 0?e[r]=t[i]:e[r]=e[r].split("\\").pop()}return e}parseImage(e){const t=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.lastIndexOf(".")+1).toLowerCase();let s;switch(i){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",r),s="image/tga";break;default:console.warn('FBXLoader: Image type "'+i+'" is not supported.');return}if(typeof t=="string")return"data:"+s+";base64,"+t;{const o=new Uint8Array(t);return window.URL.createObjectURL(new Blob([o],{type:s}))}}parseTextures(e){const t=new Map;if("Texture"in St.Objects){const r=St.Objects.Texture;for(const i in r){const s=this.parseTexture(r[i],e);t.set(parseInt(i),s)}}return t}parseTexture(e,t){const r=this.loadTexture(e,t);r.ID=e.id,r.name=e.attrName;const i=e.WrapModeU,s=e.WrapModeV,o=i!==void 0?i.value:0,a=s!==void 0?s.value:0;if(r.wrapS=o===0?zs:Rs,r.wrapT=a===0?zs:Rs,"Scaling"in e){const l=e.Scaling.value;r.repeat.x=l[0],r.repeat.y=l[1]}if("Translation"in e){const l=e.Translation.value;r.offset.x=l[0],r.offset.y=l[1]}return r}loadTexture(e,t){const r=new Set(["tga","tif","tiff","exr","dds","hdr","ktx2"]),i=e.FileName.split(".").pop().toLowerCase(),s=r.has(i)?this.manager.getHandler(`.${i}`):this.textureLoader;if(!s)return console.warn(`FBXLoader: ${i.toUpperCase()} loader not found, creating placeholder texture for`,e.RelativeFilename),new Un;const o=s.path;o||s.setPath(this.textureLoader.path);const a=ur.get(e.id).children;let l;a!==void 0&&a.length>0&&t[a[0].ID]!==void 0&&(l=t[a[0].ID],(l.indexOf("blob:")===0||l.indexOf("data:")===0)&&s.setPath(void 0));const c=s.load(l);return s.setPath(o),c}parseMaterials(e){const t=new Map;if("Material"in St.Objects){const r=St.Objects.Material;for(const i in r){const s=this.parseMaterial(r[i],e);s!==null&&t.set(parseInt(i),s)}}return t}parseMaterial(e,t){const r=e.id,i=e.attrName;let s=e.ShadingModel;if(typeof s=="object"&&(s=s.value),!ur.has(r))return null;const o=this.parseParameters(e,t,r);let a;switch(s.toLowerCase()){case"phong":a=new ZE;break;case"lambert":a=new Kse;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),a=new ZE;break}return a.setValues(o),a.name=i,a}parseParameters(e,t,r){const i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=Et.toWorkingColorSpace(new Qe().fromArray(e.Diffuse.value),Ut):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(i.color=Et.toWorkingColorSpace(new Qe().fromArray(e.DiffuseColor.value),Ut)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=Et.toWorkingColorSpace(new Qe().fromArray(e.Emissive.value),Ut):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(i.emissive=Et.toWorkingColorSpace(new Qe().fromArray(e.EmissiveColor.value),Ut)),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0),e.ReflectionFactor&&(i.reflectivity=e.ReflectionFactor.value),e.Shininess&&(i.shininess=e.Shininess.value),e.Specular?i.specular=Et.toWorkingColorSpace(new Qe().fromArray(e.Specular.value),Ut):e.SpecularColor&&e.SpecularColor.type==="Color"&&(i.specular=Et.toWorkingColorSpace(new Qe().fromArray(e.SpecularColor.value),Ut));const s=this;return ur.get(r).children.forEach(function(o){const a=o.relationship;switch(a){case"Bump":i.bumpMap=s.getTexture(t,o.ID);break;case"Maya|TEX_ao_map":i.aoMap=s.getTexture(t,o.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=s.getTexture(t,o.ID),i.map!==void 0&&(i.map.colorSpace=Ut);break;case"DisplacementColor":i.displacementMap=s.getTexture(t,o.ID);break;case"EmissiveColor":i.emissiveMap=s.getTexture(t,o.ID),i.emissiveMap!==void 0&&(i.emissiveMap.colorSpace=Ut);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=s.getTexture(t,o.ID);break;case"ReflectionColor":i.envMap=s.getTexture(t,o.ID),i.envMap!==void 0&&(i.envMap.mapping=kg,i.envMap.colorSpace=Ut);break;case"SpecularColor":i.specularMap=s.getTexture(t,o.ID),i.specularMap!==void 0&&(i.specularMap.colorSpace=Ut);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=s.getTexture(t,o.ID),i.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",a);break}}),i}getTexture(e,t){return"LayeredTexture"in St.Objects&&t in St.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=ur.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in St.Objects){const r=St.Objects.Deformer;for(const i in r){const s=r[i],o=ur.get(parseInt(i));if(s.attrType==="Skin"){const a=this.parseSkeleton(o,r);a.ID=i,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=o.parents[0].ID,e[i]=a}else if(s.attrType==="BlendShape"){const a={id:i};a.rawTargets=this.parseMorphTargets(o,r),a.id=i,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[i]=a}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const r=[];return e.children.forEach(function(i){const s=t[i.ID];if(s.attrType!=="Cluster")return;const o={ID:i.ID,indices:[],weights:[],transformLink:new He().fromArray(s.TransformLink.a)};"Indexes"in s&&(o.indices=s.Indexes.a,o.weights=s.Weights.a),r.push(o)}),{rawBones:r,bones:[]}}parseMorphTargets(e,t){const r=[];for(let i=0;i1?o=a:a.length>0?o=a[0]:(o=new ZE({name:rl.DEFAULT_MATERIAL_NAME,color:13421772}),a.push(o)),"color"in s.attributes&&a.forEach(function(l){l.vertexColors=!0}),s.FBX_Deformer?(i=new sa(s,o),i.normalizeSkinWeights()):i=new dn(s,o),i}createCurve(e,t){const r=e.children.reduce(function(s,o){return t.has(o.ID)&&(s=t.get(o.ID)),s},null),i=new Ac({name:rl.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new Yd(r,i)}getTransformData(e,t){const r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?r.eulerOrder=Xg(t.RotationOrder.value):r.eulerOrder=Xg(0),"Lcl_Translation"in t&&(r.translation=t.Lcl_Translation.value),"PreRotation"in t&&(r.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(r.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(r.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(r.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(r.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(r.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(r.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(r.rotationPivot=t.RotationPivot.value),e.userData.transformData=r}setLookAtProperties(e,t){"LookAtProperty"in t&&ur.get(e.ID).children.forEach(function(i){if(i.relationship==="LookAtProperty"){const s=St.Objects.Model[i.ID];if("Lcl_Translation"in s){const o=s.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(o),Fi.add(e.target)):e.lookAt(new $().fromArray(o))}}})}bindSkeleton(e,t,r){const i=this.parsePoseNodes();for(const s in e){const o=e[s];ur.get(parseInt(o.ID)).parents.forEach(function(l){if(t.has(l.ID)){const c=l.ID;ur.get(c).parents.forEach(function(u){r.has(u.ID)&&r.get(u.ID).bind(new FA(o.bones),i[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in St.Objects){const t=St.Objects.Pose;for(const r in t)if(t[r].attrType==="BindPose"&&t[r].NbPoseNodes>0){const i=t[r].PoseNode;Array.isArray(i)?i.forEach(function(s){e[s.Node]=new He().fromArray(s.Matrix.a)}):e[i.Node]=new He().fromArray(i.Matrix.a)}}return e}addGlobalSceneSettings(){if("GlobalSettings"in St){if("AmbientColor"in St.GlobalSettings){const e=St.GlobalSettings.AmbientColor.value,t=e[0],r=e[1],i=e[2];if(t!==0||r!==0||i!==0){const s=new Qe().setRGB(t,r,i,Ut);Fi.add(new Vz(s,1))}}"UnitScaleFactor"in St.GlobalSettings&&(Fi.userData.unitScaleFactor=St.GlobalSettings.UnitScaleFactor.value)}}}class Gae{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in St.Objects){const r=St.Objects.Geometry;for(const i in r){const s=ur.get(parseInt(i)),o=this.parseGeometry(s,r[i],e);t.set(parseInt(i),o)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,r){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,r);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,r){const i=r.skeletons,s=[],o=e.parents.map(function(u){return St.Objects.Model[u.ID]});if(o.length===0)return;const a=e.children.reduce(function(u,f){return i[f.ID]!==void 0&&(u=i[f.ID]),u},null);e.children.forEach(function(u){r.morphTargets[u.ID]!==void 0&&s.push(r.morphTargets[u.ID])});const l=o[0],c={};"RotationOrder"in l&&(c.eulerOrder=Xg(l.RotationOrder.value)),"InheritType"in l&&(c.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(c.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(c.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(c.scale=l.GeometricScaling.value);const A=s8(c);return this.genGeometry(t,a,s,A)}genGeometry(e,t,r,i){const s=new Jt;e.attrName&&(s.name=e.attrName);const o=this.parseGeoNode(e,t),a=this.genBuffers(o),l=new xn(a.vertex,3);if(l.applyMatrix4(i),s.setAttribute("position",l),a.colors.length>0&&s.setAttribute("color",new xn(a.colors,3)),t&&(s.setAttribute("skinIndex",new u1(a.weightsIndices,4)),s.setAttribute("skinWeight",new xn(a.vertexWeights,4)),s.FBX_Deformer=t),a.normal.length>0){const c=new dt().getNormalMatrix(i),A=new xn(a.normal,3);A.applyNormalMatrix(c),s.setAttribute("normal",A)}if(a.uvs.forEach(function(c,A){const u=A===0?"uv":`uv${A}`;s.setAttribute(u,new xn(a.uvs[A],2))}),o.material&&o.material.mappingType!=="AllSame"){let c=a.materialIndex[0],A=0;if(a.materialIndex.forEach(function(u,f){u!==c&&(s.addGroup(A,f-A,c),c=u,A=f)}),s.groups.length>0){const u=s.groups[s.groups.length-1],f=u.start+u.count;f!==a.materialIndex.length&&s.addGroup(f,a.materialIndex.length-f,c)}s.groups.length===0&&s.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(s,e,r,i),s}parseGeoNode(e,t){const r={};if(r.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],r.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(r.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(r.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(r.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){r.uv=[];let i=0;for(;e.LayerElementUV[i];)e.LayerElementUV[i].UV&&r.uv.push(this.parseUVs(e.LayerElementUV[i])),i++}return r.weightTable={},t!==null&&(r.skeleton=t,t.rawBones.forEach(function(i,s){i.indices.forEach(function(o,a){r.weightTable[o]===void 0&&(r.weightTable[o]=[]),r.weightTable[o].push({id:s,weight:i.weights[a]})})})),r}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let r=0,i=0,s=!1,o=[],a=[],l=[],c=[],A=[],u=[];const f=this;return e.vertexIndices.forEach(function(h,d){let m,g=!1;h<0&&(h=h^-1,g=!0);let p=[],v=[];if(o.push(h*3,h*3+1,h*3+2),e.color){const w=Wv(d,r,h,e.color);l.push(w[0],w[1],w[2])}if(e.skeleton){if(e.weightTable[h]!==void 0&&e.weightTable[h].forEach(function(w){v.push(w.weight),p.push(w.id)}),v.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);const w=[0,0,0,0],_=[0,0,0,0];v.forEach(function(x,b){let B=x,S=p[b];_.forEach(function(I,M,L){if(B>I){L[M]=B,B=I;const D=w[M];w[M]=S,S=D}})}),p=w,v=_}for(;v.length<4;)v.push(0),p.push(0);for(let w=0;w<4;++w)A.push(v[w]),u.push(p[w])}if(e.normal){const w=Wv(d,r,h,e.normal);a.push(w[0],w[1],w[2])}e.material&&e.material.mappingType!=="AllSame"&&(m=Wv(d,r,h,e.material)[0],m<0&&(f.negativeMaterialIndices=!0,m=0)),e.uv&&e.uv.forEach(function(w,_){const x=Wv(d,r,h,w);c[_]===void 0&&(c[_]=[]),c[_].push(x[0]),c[_].push(x[1])}),i++,g&&(f.genFace(t,e,o,m,a,l,c,A,u,i),r++,i=0,o=[],a=[],l=[],c=[],A=[],u=[])}),t}getNormalNewell(e){const t=new $(0,0,0);for(let r=0;r.5?new $(0,1,0):new $(0,0,1)).cross(t).normalize(),s=t.clone().cross(i).normalize();return{normal:t,tangent:i,bitangent:s}}flattenVertex(e,t,r){return new We(e.dot(t),e.dot(r))}genFace(e,t,r,i,s,o,a,l,c,A){let u;if(A>3){const f=[],h=t.baseVertexPositions||t.vertexPositions;for(let p=0;p1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const o=e.get(s[0].ID);r[i]={name:t[i].attrName,layer:o}}return r}addClip(e){let t=[];const r=this;return e.layer.forEach(function(i){t=t.concat(r.generateTracks(i))}),new ku(e.name,-1,t)}generateTracks(e){const t=[];let r=new $,i=new $;if(e.transform&&e.transform.decompose(r,new nt,i),r=r.toArray(),i=i.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.T.curves,r,"position");s!==void 0&&t.push(s)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const s=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder);s!==void 0&&t.push(s)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.S.curves,i,"scale");s!==void 0&&t.push(s)}if(e.DeformPercent!==void 0){const s=this.generateMorphTrack(e);s!==void 0&&t.push(s)}return t}generateVectorTrack(e,t,r,i){const s=this.getTimesForAllAxes(t),o=this.getKeyframeTrackValues(s,t,r);return new ic(e+"."+i,s,o)}generateRotationTrack(e,t,r,i,s){let o,a;if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){const f=this.interpolateRotations(t.x,t.y,t.z,s);o=f[0],a=f[1]}const l=Xg(0);r!==void 0&&(r=r.map(Bt.degToRad),r.push(l),r=new nr().fromArray(r),r=new nt().setFromEuler(r)),i!==void 0&&(i=i.map(Bt.degToRad),i.push(l),i=new nr().fromArray(i),i=new nt().setFromEuler(i).invert());const c=new nt,A=new nr,u=[];if(!a||!o)return new nl(e+".quaternion",[0],[0]);for(let f=0;f2&&new nt().fromArray(u,(f-3)/3*4).dot(c)<0&&c.set(-c.x,-c.y,-c.z,-c.w),c.toArray(u,f/3*4);return new nl(e+".quaternion",o,u)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,r=t.values.map(function(s){return s/100}),i=Fi.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new Ou(e.modelName+".morphTargetInfluences["+i+"]",t.times,r)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(r,i){return r-i}),t.length>1){let r=1,i=t[0];for(let s=1;s=180||h[1]>=180||h[2]>=180){const m=Math.max(...h)/180,g=new nr(...c,i),p=new nr(...u,i),v=new nt().setFromEuler(g),w=new nt().setFromEuler(p);v.dot(w)&&w.set(-w.x,-w.y,-w.z,-w.w);const _=e.times[a-1],x=e.times[a]-_,b=new nt,B=new nr;for(let S=0;S<1;S+=1/m)b.copy(v.clone().slerp(w.clone(),S)),s.push(_+S*x),B.setFromQuaternion(b,i),o.push(B.x),o.push(B.y),o.push(B.z)}else s.push(e.times[a]),o.push(Bt.degToRad(e.values[a])),o.push(Bt.degToRad(t.values[a])),o.push(Bt.degToRad(r.values[a]))}return[s,o]}}class jae{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new i8,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,r=e.split(/[\r\n]+/);return r.forEach(function(i,s){const o=i.match(/^[\s\t]*;/),a=i.match(/^[\s\t]*$/);if(o||a)return;const l=i.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),c=i.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),A=i.match("^\\t{"+(t.currentIndent-1)+"}}");l?t.parseNodeBegin(i,l):c?t.parseNodeProperty(i,c,r[++s]):A?t.popStack():i.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(i)}),this.allNodes}parseNodeBegin(e,t){const r=t[1].trim().replace(/^"/,"").replace(/"$/,""),i=t[2].split(",").map(function(l){return l.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:r},o=this.parseNodeAttr(i),a=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(r,s):r in a?(r==="PoseNode"?a.PoseNode.push(s):a[r].id!==void 0&&(a[r]={},a[r][a[r].id]=a[r]),o.id!==""&&(a[r][o.id]=s)):typeof o.id=="number"?(a[r]={},a[r][o.id]=s):r!=="Properties70"&&(r==="PoseNode"?a[r]=[s]:a[r]=s),typeof o.id=="number"&&(s.id=o.id),o.name!==""&&(s.attrName=o.name),o.type!==""&&(s.attrType=o.type),this.pushStack(s)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let r="",i="";return e.length>1&&(r=e[1].replace(/^(\w+)::/,""),i=e[2]),{id:t,name:r,type:i}}parseNodeProperty(e,t,r){let i=t[1].replace(/^"/,"").replace(/"$/,"").trim(),s=t[2].replace(/^"/,"").replace(/"$/,"").trim();i==="Content"&&s===","&&(s=r.replace(/"/g,"").replace(/,$/,"").trim());const o=this.getCurrentNode();if(o.name==="Properties70"){this.parseNodeSpecialProperty(e,i,s);return}if(i==="C"){const l=s.split(",").slice(1),c=parseInt(l[0]),A=parseInt(l[1]);let u=s.split(",").slice(3);u=u.map(function(f){return f.trim().replace(/^"/,"")}),i="connections",s=[c,A],Zae(s,u),o[i]===void 0&&(o[i]=[])}i==="Node"&&(o.id=s),i in o&&Array.isArray(o[i])?o[i].push(s):i!=="a"?o[i]=s:o.a=s,this.setCurrentProp(o,i),i==="a"&&s.slice(-1)!==","&&(o.a=aB(s))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=aB(t.a))}parseNodeSpecialProperty(e,t,r){const i=r.split('",').map(function(A){return A.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=i[0],o=i[1],a=i[2],l=i[3];let c=i[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":c=parseFloat(c);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":c=aB(c);break}this.getPrevNode()[s]={type:o,type2:a,flag:l,value:c},this.setCurrentProp(this.getPrevNode(),s)}}class Wae{parse(e){const t=new RD(e);t.skip(23);const r=t.getUint32();if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);const i=new i8;for(;!this.endOfContent(t);){const s=this.parseNode(t,r);s!==null&&i.add(s.name,s)}return i}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const r={},i=t>=7500?e.getUint64():e.getUint32(),s=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const o=e.getUint8(),a=e.getString(o);if(i===0)return null;const l=[];for(let f=0;f0?l[0]:"",A=l.length>1?l[1]:"",u=l.length>2?l[2]:"";for(r.singleProperty=s===1&&e.getOffset()===i;i>e.getOffset();){const f=this.parseNode(e,t);f!==null&&this.parseSubNode(a,r,f)}return r.propertyList=l,typeof c=="number"&&(r.id=c),A!==""&&(r.attrName=A),u!==""&&(r.attrType=u),a!==""&&(r.name=a),r}parseSubNode(e,t,r){if(r.singleProperty===!0){const i=r.propertyList[0];Array.isArray(i)?(t[r.name]=r,r.a=i):t[r.name]=i}else if(e==="Connections"&&r.name==="C"){const i=[];r.propertyList.forEach(function(s,o){o!==0&&i.push(s)}),t.connections===void 0&&(t.connections=[]),t.connections.push(i)}else if(r.name==="Properties70")Object.keys(r).forEach(function(s){t[s]=r[s]});else if(e==="Properties70"&&r.name==="P"){let i=r.propertyList[0],s=r.propertyList[1];const o=r.propertyList[2],a=r.propertyList[3];let l;i.indexOf("Lcl ")===0&&(i=i.replace("Lcl ","Lcl_")),s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),s==="Color"||s==="ColorRGB"||s==="Vector"||s==="Vector3D"||s.indexOf("Lcl_")===0?l=[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:l=r.propertyList[4],t[i]={type:s,type2:o,flag:a,value:l}}else t[r.name]===void 0?typeof r.id=="number"?(t[r.name]={},t[r.name][r.id]=r):t[r.name]=r:r.name==="PoseNode"?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(r)):t[r.name][r.id]===void 0&&(t[r.name][r.id]=r)}parseProperty(e){const t=e.getString(1);let r;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return r=e.getUint32(),e.getArrayBuffer(r);case"S":return r=e.getUint32(),e.getString(r);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const i=e.getUint32(),s=e.getUint32(),o=e.getUint32();if(s===0)switch(t){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}const a=Iae(new Uint8Array(e.getArrayBuffer(o))),l=new RD(a.buffer);switch(t){case"b":case"c":return l.getBooleanArray(i);case"d":return l.getFloat64Array(i);case"f":return l.getFloat32Array(i);case"i":return l.getInt32Array(i);case"l":return l.getInt64Array(i)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class RD{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let r=0;r=0&&(r=new Uint8Array(this.dv.buffer,t,i)),this._textDecoder.decode(r)}}class i8{add(e,t){this[e]=t}}function Kae(n){const e="Kaydara FBX Binary \0";return n.byteLength>=e.length&&e===o8(n,0,e.length)}function Xae(n){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function r(i){const s=n[i-1];return n=n.slice(t+i),t++,s}for(let i=0;i4?o=n.array[i*n.itemSize+s]:(s===0?o=n.getX(i):s===1?o=n.getY(i):s===2?o=n.getZ(i):s===3&&(o=n.getW(i)),n.normalized===!0&&(o=Bt.normalize(o,n.array))),r.min[s]=Math.min(r.min[s],o),r.max[s]=Math.max(r.max[s],o)}return r}function o8(n){return Math.ceil(n/4)*4}function cB(n,e=0){const t=o8(n.byteLength);if(t!==n.byteLength){const r=new Uint8Array(t);if(r.set(new Uint8Array(n)),e!==0)for(let i=n.byteLength;i"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function ND(n,e){if(n.toBlob!==void 0)return new Promise(r=>n.toBlob(r,e));let t;return e==="image/jpeg"?t=.92:e==="image/webp"&&(t=.8),n.convertToBlob({type:e,quality:t})}class cle{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter r"+nc}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,t,r={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const i=this,s=i.buffers,o=i.json;r=i.options;const a=i.extensionsUsed,l=i.extensionsRequired,c=new Blob(s,{type:"application/octet-stream"}),A=Object.keys(a),u=Object.keys(l);if(A.length>0&&(o.extensionsUsed=A),u.length>0&&(o.extensionsRequired=u),o.buffers&&o.buffers.length>0&&(o.buffers[0].byteLength=c.size),r.binary===!0){const f=new FileReader;f.readAsArrayBuffer(c),f.onloadend=function(){const h=cB(f.result),d=new DataView(new ArrayBuffer(LD));d.setUint32(0,h.byteLength,!0),d.setUint32(4,sle,!0);const m=cB(ole(JSON.stringify(o)),32),g=new DataView(new ArrayBuffer(LD));g.setUint32(0,m.byteLength,!0),g.setUint32(4,ile,!0);const p=new ArrayBuffer(PD),v=new DataView(p);v.setUint32(0,nle,!0),v.setUint32(4,rle,!0);const w=PD+g.byteLength+m.byteLength+d.byteLength+h.byteLength;v.setUint32(8,w,!0);const _=new Blob([p,g,m,d,h],{type:"application/octet-stream"}),x=new FileReader;x.readAsArrayBuffer(_),x.onloadend=function(){t(x.result)}}}else if(o.buffers&&o.buffers.length>0){const f=new FileReader;f.readAsDataURL(c),f.onloadend=function(){const h=f.result;o.buffers[0].uri=h,t(o)}}else t(o)}serializeUserData(e,t){if(Object.keys(e.userData).length===0)return;const r=this.options,i=this.extensionsUsed;try{const s=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&s.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(const o in s.gltfExtensions)t.extensions[o]=s.gltfExtensions[o],i[o]=!0;delete s.gltfExtensions}Object.keys(s).length>0&&(t.extras=s)}catch(s){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+s.message)}}getUID(e,t=!1){if(this.uids.has(e)===!1){const i=new Map;i.set(!0,this.uid++),i.set(!1,this.uid++),this.uids.set(e,i)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const r=new $;for(let i=0,s=e.count;i5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const r=e.clone(),i=new $;for(let s=0,o=r.count;s4?g=e.array[d*e.itemSize+m]:(m===0?g=e.getX(d):m===1?g=e.getY(d):m===2?g=e.getZ(d):m===3&&(g=e.getW(d)),e.normalized===!0&&(g=Bt.normalize(g,e.array))),t===Rt.FLOAT?A.setFloat32(u,g,!0):t===Rt.INT?A.setInt32(u,g,!0):t===Rt.UNSIGNED_INT?A.setUint32(u,g,!0):t===Rt.SHORT?A.setInt16(u,g,!0):t===Rt.UNSIGNED_SHORT?A.setUint16(u,g,!0):t===Rt.BYTE?A.setInt8(u,g):t===Rt.UNSIGNED_BYTE&&A.setUint8(u,g),u+=a}u%l!==0&&(u+=l-u%l)}const f={buffer:this.processBuffer(A.buffer),byteOffset:this.byteOffset,byteLength:c};return s!==void 0&&(f.target=s),s===Rt.ARRAY_BUFFER&&(f.byteStride=l),this.byteOffset+=c,o.bufferViews.push(f),{id:o.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise(function(i){const s=new FileReader;s.readAsArrayBuffer(e),s.onloadend=function(){const o=cB(s.result),a={buffer:t.processBuffer(o),byteOffset:t.byteOffset,byteLength:o.byteLength};t.byteOffset+=o.byteLength,i(r.bufferViews.push(a)-1)}})}processAccessor(e,t,r,i){const s=this.json,o={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"};let a;if(e.array.constructor===Float32Array)a=Rt.FLOAT;else if(e.array.constructor===Int32Array)a=Rt.INT;else if(e.array.constructor===Uint32Array)a=Rt.UNSIGNED_INT;else if(e.array.constructor===Int16Array)a=Rt.SHORT;else if(e.array.constructor===Uint16Array)a=Rt.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)a=Rt.BYTE;else if(e.array.constructor===Uint8Array)a=Rt.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(r===void 0&&(r=0),(i===void 0||i===1/0)&&(i=e.count),i===0)return null;const l=lle(e,r,i);let c;t!==void 0&&(c=e===t.index?Rt.ELEMENT_ARRAY_BUFFER:Rt.ARRAY_BUFFER);const A=this.processBufferView(e,a,r,i,c),u={bufferView:A.id,byteOffset:A.byteOffset,componentType:a,count:i,max:l.max,min:l.min,type:o[e.itemSize]};return e.normalized===!0&&(u.normalized=!0),s.accessors||(s.accessors=[]),s.accessors.push(u)-1}processImage(e,t,r,i="image/png"){if(e!==null){const s=this,o=s.cache,a=s.json,l=s.options,c=s.pending;o.images.has(e)||o.images.set(e,{});const A=o.images.get(e),u=i+":flipY/"+r.toString();if(A[u]!==void 0)return A[u];a.images||(a.images=[]);const f={mimeType:i},h=DD();h.width=Math.min(e.width,l.maxTextureSize),h.height=Math.min(e.height,l.maxTextureSize);const d=h.getContext("2d",{willReadFrequently:!0});if(r===!0&&(d.translate(0,h.height),d.scale(1,-1)),e.data!==void 0){t!==Nr&&console.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const g=new Uint8ClampedArray(e.height*e.width*4);for(let p=0;ps.processBufferViewImage(g)).then(g=>{f.bufferView=g})):h.toDataURL!==void 0?f.uri=h.toDataURL(i):c.push(ND(h,i).then(g=>new FileReader().readAsDataURL(g)).then(g=>{f.uri=g}));const m=a.images.push(f)-1;return A[u]=m,m}else throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const r={magFilter:Us[e.magFilter],minFilter:Us[e.minFilter],wrapS:Us[e.wrapS],wrapT:Us[e.wrapT]};return t.samplers.push(r)-1}processTexture(e){const r=this.options,i=this.cache,s=this.json;if(i.textures.has(e))return i.textures.get(e);s.textures||(s.textures=[]),e instanceof XE&&(e=aB(e,r.maxTextureSize));let o=e.userData.mimeType;o==="image/webp"&&(o="image/png");const a={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,o)};e.name&&(a.name=e.name),this._invokeAll(function(c){c.writeTexture&&c.writeTexture(e,a)});const l=s.textures.push(a)-1;return i.textures.set(e,l),l}processMaterial(e){const t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);const i={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const s=e.color.toArray().concat([e.opacity]);if(xm(s,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=s),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),l={index:this.processTexture(a),channel:a.channel};this.applyTextureTransform(l,a),i.pbrMetallicRoughness.metallicRoughnessTexture=l}if(e.map){const a={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(a,e.map),i.pbrMetallicRoughness.baseColorTexture=a}if(e.emissive){const a=e.emissive;if(Math.max(a.r,a.g,a.b)>0&&(i.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const c={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(c,e.emissiveMap),i.emissiveTexture=c}}if(e.normalMap){const a={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&e.normalScale.x!==1&&(a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),i.normalTexture=a}if(e.aoMap){const a={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};e.aoMapIntensity!==1&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),i.occlusionTexture=a}e.transparent?i.alphaMode="BLEND":e.alphaTest>0&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===_i&&(i.doubleSided=!0),e.name!==""&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll(function(a){a.writeMaterial&&a.writeMaterial(e,i)});const o=r.materials.push(i)-1;return t.materials.set(e,o),o}processMesh(e){const t=this.cache,r=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(let _=0,x=e.material.length;_0){const _=[],x=[],b={};if(e.morphTargetDictionary!==void 0)for(const B in e.morphTargetDictionary)b[e.morphTargetDictionary[B]]=B;for(let B=0;B0&&(l.extras={},l.extras.targetNames=x)}const m=Array.isArray(e.material);if(m&&o.groups.length===0)return null;let g=!1;if(m&&o.index===null){const _=[];for(let x=0,b=o.attributes.position.count;x0&&(b.targets=u),o.index!==null){let M=this.getUID(o.index);(v[_].start!==void 0||v[_].count!==void 0)&&(M+=":"+v[_].start+":"+v[_].count),t.attributes.has(M)?b.indices=t.attributes.get(M):(b.indices=this.processAccessor(o.index,o,v[_].start,v[_].count),t.attributes.set(M,b.indices)),b.indices===null&&delete b.indices}const B=this.processMaterial(p[v[_].materialIndex]);B!==null&&(b.material=B),A.push(b)}g===!0&&o.setIndex(null),l.primitives=A,r.meshes||(r.meshes=[]),this._invokeAll(function(_){_.writeMesh&&_.writeMesh(e,l)});const w=r.meshes.push(l)-1;return t.meshes.set(s,w),w}detectMeshQuantization(e,t){if(this.extensionsUsed[lB])return;let r;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized");const i=e.split("_",1)[0];UD[i]&&UD[i].includes(r)&&(this.extensionsUsed[lB]=!0,this.extensionsRequired[lB]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const r=e.isOrthographicCamera,i={type:r?"orthographic":"perspective"};return r?i.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:Bt.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(i.name=e.type),t.cameras.push(i)-1}processAnimation(e,t){const r=this.json,i=this.nodeMap;r.animations||(r.animations=[]),e=$R.Utils.mergeMorphTargetTracks(e.clone(),t);const s=e.tracks,o=[],a=[];for(let l=0;l0){const a=[];for(let l=0,c=e.children.length;l0&&(s.children=a)}this._invokeAll(function(a){a.writeNode&&a.writeNode(e,s)});const o=t.nodes.push(s)-1;return i.set(e,o),o}processScene(e){const t=this.json,r=this.options;t.scenes||(t.scenes=[],t.scene=0);const i={};e.name!==""&&(i.name=e.name),t.scenes.push(i);const s=[];for(let o=0,a=e.children.length;o0&&(i.nodes=s),this.serializeUserData(e,i)}processObjects(e){const t=new zg;t.name="AuxScene";for(let r=0;r0&&this.processObjects(r);for(let i=0;i0&&(o.range=e.distance)):e.isSpotLight&&(o.type="spot",e.distance>0&&(o.range=e.distance),o.spot={},o.spot.innerConeAngle=(1-e.penumbra)*e.angle,o.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),s[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},s[this.name]=!0);const a=i.extensions[this.name].lights;a.push(o),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}}}class ule{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const i=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},i[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class fle{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.clearcoat===0)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.clearcoatFactor=e.clearcoat,e.clearcoatMap){const o={index:r.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};r.applyTextureTransform(o,e.clearcoatMap),s.clearcoatTexture=o}if(s.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const o={index:r.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};r.applyTextureTransform(o,e.clearcoatRoughnessMap),s.clearcoatRoughnessTexture=o}if(e.clearcoatNormalMap){const o={index:r.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};e.clearcoatNormalScale.x!==1&&(o.scale=e.clearcoatNormalScale.x),r.applyTextureTransform(o,e.clearcoatNormalMap),s.clearcoatNormalTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class hle{constructor(e){this.writer=e,this.name="KHR_materials_dispersion"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.dispersion===0)return;const i=this.writer.extensionsUsed,s={};s.dispersion=e.dispersion,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class dle{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.iridescence===0)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.iridescenceFactor=e.iridescence,e.iridescenceMap){const o={index:r.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};r.applyTextureTransform(o,e.iridescenceMap),s.iridescenceTexture=o}if(s.iridescenceIor=e.iridescenceIOR,s.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],s.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const o={index:r.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};r.applyTextureTransform(o,e.iridescenceThicknessMap),s.iridescenceThicknessTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class ple{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.transmissionFactor=e.transmission,e.transmissionMap){const o={index:r.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};r.applyTextureTransform(o,e.transmissionMap),s.transmissionTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class mle{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.thicknessFactor=e.thickness,e.thicknessMap){const o={index:r.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};r.applyTextureTransform(o,e.thicknessMap),s.thicknessTexture=o}e.attenuationDistance!==1/0&&(s.attenuationDistance=e.attenuationDistance),s.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class gle{constructor(e){this.writer=e,this.name="KHR_materials_ior"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.ior===1.5)return;const i=this.writer.extensionsUsed,s={};s.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class vle{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.specularIntensity===1&&e.specularColor.equals(tle)&&!e.specularIntensityMap&&!e.specularColorMap)return;const r=this.writer,i=r.extensionsUsed,s={};if(e.specularIntensityMap){const o={index:r.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};r.applyTextureTransform(o,e.specularIntensityMap),s.specularTexture=o}if(e.specularColorMap){const o={index:r.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};r.applyTextureTransform(o,e.specularColorMap),s.specularColorTexture=o}s.specularFactor=e.specularIntensity,s.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class yle{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.sheen==0)return;const r=this.writer,i=r.extensionsUsed,s={};if(e.sheenRoughnessMap){const o={index:r.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};r.applyTextureTransform(o,e.sheenRoughnessMap),s.sheenRoughnessTexture=o}if(e.sheenColorMap){const o={index:r.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};r.applyTextureTransform(o,e.sheenColorMap),s.sheenColorTexture=o}s.sheenRoughnessFactor=e.sheenRoughness,s.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class wle{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.anisotropy==0)return;const r=this.writer,i=r.extensionsUsed,s={};if(e.anisotropyMap){const o={index:r.processTexture(e.anisotropyMap)};r.applyTextureTransform(o,e.anisotropyMap),s.anisotropyTexture=o}s.anisotropyStrength=e.anisotropy,s.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class _le{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||e.emissiveIntensity===1)return;const i=this.writer.extensionsUsed,s={};s.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class xle{constructor(e){this.writer=e,this.name="EXT_materials_bump"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||e.bumpScale===1&&!e.bumpMap)return;const r=this.writer,i=r.extensionsUsed,s={};if(e.bumpMap){const o={index:r.processTexture(e.bumpMap),texCoord:e.bumpMap.channel};r.applyTextureTransform(o,e.bumpMap),s.bumpTexture=o}s.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class ble{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;const r=this.writer,i=e,s=new Float32Array(i.count*3),o=new Float32Array(i.count*4),a=new Float32Array(i.count*3),l=new He,c=new $,A=new nt,u=new $;for(let h=0;hn.times[n.times.length-1]){if(Math.abs(n.times[n.times.length-1]-e)<.001)return n.times.length-1;i[i.length-1]=e,i.set(n.times,0),s.set(n.values,0),s.set(o.evaluate(e),n.values.length),a=i.length-1}else for(let l=0;le){i.set(n.times.slice(0,l+1),0),i[l+1]=e,i.set(n.times.slice(l+1),l+2),s.set(n.values.slice(0,(l+1)*r),0),s.set(o.evaluate(e),(l+1)*r),s.set(n.values.slice((l+1)*r),(l+2)*r),a=l+1;break}}return n.times=i,n.values=s,a},mergeMorphTargetTracks:function(n,e){const t=[],r={},i=n.tracks;for(let s=0;s0)throw new Error("Invalid string. Length must be a multiple of 4");var t=n.indexOf("=");t===-1&&(t=e);var r=t===e?0:4-t%4;return[t,r]}function Sle(n){var e=l8(n),t=e[0],r=e[1];return(t+r)*3/4-r}function Mle(n,e,t){return(e+t)*3/4-t}function Cle(n){var e,t=l8(n),r=t[0],i=t[1],s=new Ele(Mle(n,r,i)),o=0,a=i>0?r-4:r,l;for(l=0;l>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=no[n.charCodeAt(l)]<<2|no[n.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=no[n.charCodeAt(l)]<<10|no[n.charCodeAt(l+1)]<<4|no[n.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function Tle(n){return Pa[n>>18&63]+Pa[n>>12&63]+Pa[n>>6&63]+Pa[n&63]}function Ile(n,e,t){for(var r,i=[],s=e;sa?a:o+s));return r===1?(e=n[t-1],i.push(Pa[e>>2]+Pa[e<<4&63]+"==")):r===2&&(e=(n[t-2]<<8)+n[t-1],i.push(Pa[e>>10]+Pa[e>>4&63]+Pa[e<<2&63]+"=")),i.join("")}var ZR={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ZR.read=function(n,e,t,r,i){var s,o,a=i*8-r-1,l=(1<>1,A=-7,u=t?i-1:0,f=t?-1:1,h=n[e+u];for(u+=f,s=h&(1<<-A)-1,h>>=-A,A+=a;A>0;s=s*256+n[e+u],u+=f,A-=8);for(o=s&(1<<-A)-1,s>>=-A,A+=r;A>0;o=o*256+n[e+u],u+=f,A-=8);if(s===0)s=1-c;else{if(s===l)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,r),s=s-c}return(h?-1:1)*o*Math.pow(2,s-r)};ZR.write=function(n,e,t,r,i,s){var o,a,l,c=s*8-i-1,A=(1<>1,f=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:s-1,d=r?1:-1,m=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=A):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+u>=1?e+=f/l:e+=f*Math.pow(2,1-u),e*l>=2&&(o++,l/=2),o+u>=A?(a=0,o=A):o+u>=1?(a=(e*l-1)*Math.pow(2,i),o=o+u):(a=e*Math.pow(2,u-1)*Math.pow(2,i),o=0));i>=8;n[t+h]=a&255,h+=d,a/=256,i-=8);for(o=o<0;n[t+h]=o&255,h+=d,o/=256,c-=8);n[t+h-d]|=m*128};/*! + }`})),Bf.uniforms.blitTexture.value=n,Bf.defines.IS_SRGB=n.colorSpace==Ut,Bf.needsUpdate=!0,Kv||(Kv=new dn(lB,Bf),Kv.frustumCulled=!1);const r=new Fr,i=new Gg;i.add(Kv),t===null&&(t=Qp=new y0({antialias:!1}));const s=Math.min(n.image.width,e),o=Math.min(n.image.height,e);t.setSize(s,o),t.clear(),t.render(i,r);const a=document.createElement("canvas"),l=a.getContext("2d");a.width=s,a.height=o,l.drawImage(t.domElement,0,0,s,o);const c=new Sse(a);return c.minFilter=n.minFilter,c.magFilter=n.magFilter,c.wrapS=n.wrapS,c.wrapT=n.wrapT,c.colorSpace=n.colorSpace,c.name=n.name,Qp&&(Qp.forceContextLoss(),Qp.dispose(),Qp=null),c}const FD={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class ZR{constructor(){this.pluginCallbacks=[],this.register(function(e){return new lle(e)}),this.register(function(e){return new cle(e)}),this.register(function(e){return new hle(e)}),this.register(function(e){return new dle(e)}),this.register(function(e){return new ple(e)}),this.register(function(e){return new mle(e)}),this.register(function(e){return new Ale(e)}),this.register(function(e){return new ule(e)}),this.register(function(e){return new fle(e)}),this.register(function(e){return new gle(e)}),this.register(function(e){return new vle(e)}),this.register(function(e){return new yle(e)}),this.register(function(e){return new wle(e)}),this.register(function(e){return new _le(e)})}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,i){const s=new ale,o=[];for(let a=0,l=this.pluginCallbacks.length;a4?o=n.array[i*n.itemSize+s]:(s===0?o=n.getX(i):s===1?o=n.getY(i):s===2?o=n.getZ(i):s===3&&(o=n.getW(i)),n.normalized===!0&&(o=Bt.normalize(o,n.array))),r.min[s]=Math.min(r.min[s],o),r.max[s]=Math.max(r.max[s],o)}return r}function a8(n){return Math.ceil(n/4)*4}function uB(n,e=0){const t=a8(n.byteLength);if(t!==n.byteLength){const r=new Uint8Array(t);if(r.set(new Uint8Array(n)),e!==0)for(let i=n.byteLength;i"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function OD(n,e){if(n.toBlob!==void 0)return new Promise(r=>n.toBlob(r,e));let t;return e==="image/jpeg"?t=.92:e==="image/webp"&&(t=.8),n.convertToBlob({type:e,quality:t})}class ale{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter r"+nc}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,t,r={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const i=this,s=i.buffers,o=i.json;r=i.options;const a=i.extensionsUsed,l=i.extensionsRequired,c=new Blob(s,{type:"application/octet-stream"}),A=Object.keys(a),u=Object.keys(l);if(A.length>0&&(o.extensionsUsed=A),u.length>0&&(o.extensionsRequired=u),o.buffers&&o.buffers.length>0&&(o.buffers[0].byteLength=c.size),r.binary===!0){const f=new FileReader;f.readAsArrayBuffer(c),f.onloadend=function(){const h=uB(f.result),d=new DataView(new ArrayBuffer(DD));d.setUint32(0,h.byteLength,!0),d.setUint32(4,rle,!0);const m=uB(ile(JSON.stringify(o)),32),g=new DataView(new ArrayBuffer(DD));g.setUint32(0,m.byteLength,!0),g.setUint32(4,nle,!0);const p=new ArrayBuffer(LD),v=new DataView(p);v.setUint32(0,ele,!0),v.setUint32(4,tle,!0);const w=LD+g.byteLength+m.byteLength+d.byteLength+h.byteLength;v.setUint32(8,w,!0);const _=new Blob([p,g,m,d,h],{type:"application/octet-stream"}),x=new FileReader;x.readAsArrayBuffer(_),x.onloadend=function(){t(x.result)}}}else if(o.buffers&&o.buffers.length>0){const f=new FileReader;f.readAsDataURL(c),f.onloadend=function(){const h=f.result;o.buffers[0].uri=h,t(o)}}else t(o)}serializeUserData(e,t){if(Object.keys(e.userData).length===0)return;const r=this.options,i=this.extensionsUsed;try{const s=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&s.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(const o in s.gltfExtensions)t.extensions[o]=s.gltfExtensions[o],i[o]=!0;delete s.gltfExtensions}Object.keys(s).length>0&&(t.extras=s)}catch(s){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+s.message)}}getUID(e,t=!1){if(this.uids.has(e)===!1){const i=new Map;i.set(!0,this.uid++),i.set(!1,this.uid++),this.uids.set(e,i)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const r=new $;for(let i=0,s=e.count;i5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const r=e.clone(),i=new $;for(let s=0,o=r.count;s4?g=e.array[d*e.itemSize+m]:(m===0?g=e.getX(d):m===1?g=e.getY(d):m===2?g=e.getZ(d):m===3&&(g=e.getW(d)),e.normalized===!0&&(g=Bt.normalize(g,e.array))),t===Rt.FLOAT?A.setFloat32(u,g,!0):t===Rt.INT?A.setInt32(u,g,!0):t===Rt.UNSIGNED_INT?A.setUint32(u,g,!0):t===Rt.SHORT?A.setInt16(u,g,!0):t===Rt.UNSIGNED_SHORT?A.setUint16(u,g,!0):t===Rt.BYTE?A.setInt8(u,g):t===Rt.UNSIGNED_BYTE&&A.setUint8(u,g),u+=a}u%l!==0&&(u+=l-u%l)}const f={buffer:this.processBuffer(A.buffer),byteOffset:this.byteOffset,byteLength:c};return s!==void 0&&(f.target=s),s===Rt.ARRAY_BUFFER&&(f.byteStride=l),this.byteOffset+=c,o.bufferViews.push(f),{id:o.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise(function(i){const s=new FileReader;s.readAsArrayBuffer(e),s.onloadend=function(){const o=uB(s.result),a={buffer:t.processBuffer(o),byteOffset:t.byteOffset,byteLength:o.byteLength};t.byteOffset+=o.byteLength,i(r.bufferViews.push(a)-1)}})}processAccessor(e,t,r,i){const s=this.json,o={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"};let a;if(e.array.constructor===Float32Array)a=Rt.FLOAT;else if(e.array.constructor===Int32Array)a=Rt.INT;else if(e.array.constructor===Uint32Array)a=Rt.UNSIGNED_INT;else if(e.array.constructor===Int16Array)a=Rt.SHORT;else if(e.array.constructor===Uint16Array)a=Rt.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)a=Rt.BYTE;else if(e.array.constructor===Uint8Array)a=Rt.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(r===void 0&&(r=0),(i===void 0||i===1/0)&&(i=e.count),i===0)return null;const l=ole(e,r,i);let c;t!==void 0&&(c=e===t.index?Rt.ELEMENT_ARRAY_BUFFER:Rt.ARRAY_BUFFER);const A=this.processBufferView(e,a,r,i,c),u={bufferView:A.id,byteOffset:A.byteOffset,componentType:a,count:i,max:l.max,min:l.min,type:o[e.itemSize]};return e.normalized===!0&&(u.normalized=!0),s.accessors||(s.accessors=[]),s.accessors.push(u)-1}processImage(e,t,r,i="image/png"){if(e!==null){const s=this,o=s.cache,a=s.json,l=s.options,c=s.pending;o.images.has(e)||o.images.set(e,{});const A=o.images.get(e),u=i+":flipY/"+r.toString();if(A[u]!==void 0)return A[u];a.images||(a.images=[]);const f={mimeType:i},h=ND();h.width=Math.min(e.width,l.maxTextureSize),h.height=Math.min(e.height,l.maxTextureSize);const d=h.getContext("2d",{willReadFrequently:!0});if(r===!0&&(d.translate(0,h.height),d.scale(1,-1)),e.data!==void 0){t!==Nr&&console.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const g=new Uint8ClampedArray(e.height*e.width*4);for(let p=0;ps.processBufferViewImage(g)).then(g=>{f.bufferView=g})):h.toDataURL!==void 0?f.uri=h.toDataURL(i):c.push(OD(h,i).then(g=>new FileReader().readAsDataURL(g)).then(g=>{f.uri=g}));const m=a.images.push(f)-1;return A[u]=m,m}else throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const r={magFilter:Us[e.magFilter],minFilter:Us[e.minFilter],wrapS:Us[e.wrapS],wrapT:Us[e.wrapT]};return t.samplers.push(r)-1}processTexture(e){const r=this.options,i=this.cache,s=this.json;if(i.textures.has(e))return i.textures.get(e);s.textures||(s.textures=[]),e instanceof $E&&(e=cB(e,r.maxTextureSize));let o=e.userData.mimeType;o==="image/webp"&&(o="image/png");const a={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,o)};e.name&&(a.name=e.name),this._invokeAll(function(c){c.writeTexture&&c.writeTexture(e,a)});const l=s.textures.push(a)-1;return i.textures.set(e,l),l}processMaterial(e){const t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);const i={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const s=e.color.toArray().concat([e.opacity]);if(bm(s,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=s),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),l={index:this.processTexture(a),channel:a.channel};this.applyTextureTransform(l,a),i.pbrMetallicRoughness.metallicRoughnessTexture=l}if(e.map){const a={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(a,e.map),i.pbrMetallicRoughness.baseColorTexture=a}if(e.emissive){const a=e.emissive;if(Math.max(a.r,a.g,a.b)>0&&(i.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const c={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(c,e.emissiveMap),i.emissiveTexture=c}}if(e.normalMap){const a={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&e.normalScale.x!==1&&(a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),i.normalTexture=a}if(e.aoMap){const a={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};e.aoMapIntensity!==1&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),i.occlusionTexture=a}e.transparent?i.alphaMode="BLEND":e.alphaTest>0&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===_i&&(i.doubleSided=!0),e.name!==""&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll(function(a){a.writeMaterial&&a.writeMaterial(e,i)});const o=r.materials.push(i)-1;return t.materials.set(e,o),o}processMesh(e){const t=this.cache,r=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(let _=0,x=e.material.length;_0){const _=[],x=[],b={};if(e.morphTargetDictionary!==void 0)for(const B in e.morphTargetDictionary)b[e.morphTargetDictionary[B]]=B;for(let B=0;B0&&(l.extras={},l.extras.targetNames=x)}const m=Array.isArray(e.material);if(m&&o.groups.length===0)return null;let g=!1;if(m&&o.index===null){const _=[];for(let x=0,b=o.attributes.position.count;x0&&(b.targets=u),o.index!==null){let S=this.getUID(o.index);(v[_].start!==void 0||v[_].count!==void 0)&&(S+=":"+v[_].start+":"+v[_].count),t.attributes.has(S)?b.indices=t.attributes.get(S):(b.indices=this.processAccessor(o.index,o,v[_].start,v[_].count),t.attributes.set(S,b.indices)),b.indices===null&&delete b.indices}const B=this.processMaterial(p[v[_].materialIndex]);B!==null&&(b.material=B),A.push(b)}g===!0&&o.setIndex(null),l.primitives=A,r.meshes||(r.meshes=[]),this._invokeAll(function(_){_.writeMesh&&_.writeMesh(e,l)});const w=r.meshes.push(l)-1;return t.meshes.set(s,w),w}detectMeshQuantization(e,t){if(this.extensionsUsed[AB])return;let r;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized");const i=e.split("_",1)[0];FD[i]&&FD[i].includes(r)&&(this.extensionsUsed[AB]=!0,this.extensionsRequired[AB]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const r=e.isOrthographicCamera,i={type:r?"orthographic":"perspective"};return r?i.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:Bt.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(i.name=e.type),t.cameras.push(i)-1}processAnimation(e,t){const r=this.json,i=this.nodeMap;r.animations||(r.animations=[]),e=ZR.Utils.mergeMorphTargetTracks(e.clone(),t);const s=e.tracks,o=[],a=[];for(let l=0;l0){const a=[];for(let l=0,c=e.children.length;l0&&(s.children=a)}this._invokeAll(function(a){a.writeNode&&a.writeNode(e,s)});const o=t.nodes.push(s)-1;return i.set(e,o),o}processScene(e){const t=this.json,r=this.options;t.scenes||(t.scenes=[],t.scene=0);const i={};e.name!==""&&(i.name=e.name),t.scenes.push(i);const s=[];for(let o=0,a=e.children.length;o0&&(i.nodes=s),this.serializeUserData(e,i)}processObjects(e){const t=new Gg;t.name="AuxScene";for(let r=0;r0&&this.processObjects(r);for(let i=0;i0&&(o.range=e.distance)):e.isSpotLight&&(o.type="spot",e.distance>0&&(o.range=e.distance),o.spot={},o.spot.innerConeAngle=(1-e.penumbra)*e.angle,o.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),s[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},s[this.name]=!0);const a=i.extensions[this.name].lights;a.push(o),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}}}class cle{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const i=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},i[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class Ale{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.clearcoat===0)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.clearcoatFactor=e.clearcoat,e.clearcoatMap){const o={index:r.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};r.applyTextureTransform(o,e.clearcoatMap),s.clearcoatTexture=o}if(s.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const o={index:r.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};r.applyTextureTransform(o,e.clearcoatRoughnessMap),s.clearcoatRoughnessTexture=o}if(e.clearcoatNormalMap){const o={index:r.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};e.clearcoatNormalScale.x!==1&&(o.scale=e.clearcoatNormalScale.x),r.applyTextureTransform(o,e.clearcoatNormalMap),s.clearcoatNormalTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class ule{constructor(e){this.writer=e,this.name="KHR_materials_dispersion"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.dispersion===0)return;const i=this.writer.extensionsUsed,s={};s.dispersion=e.dispersion,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class fle{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.iridescence===0)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.iridescenceFactor=e.iridescence,e.iridescenceMap){const o={index:r.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};r.applyTextureTransform(o,e.iridescenceMap),s.iridescenceTexture=o}if(s.iridescenceIor=e.iridescenceIOR,s.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],s.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const o={index:r.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};r.applyTextureTransform(o,e.iridescenceThicknessMap),s.iridescenceThicknessTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class hle{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.transmissionFactor=e.transmission,e.transmissionMap){const o={index:r.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};r.applyTextureTransform(o,e.transmissionMap),s.transmissionTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class dle{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.thicknessFactor=e.thickness,e.thicknessMap){const o={index:r.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};r.applyTextureTransform(o,e.thicknessMap),s.thicknessTexture=o}e.attenuationDistance!==1/0&&(s.attenuationDistance=e.attenuationDistance),s.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class ple{constructor(e){this.writer=e,this.name="KHR_materials_ior"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.ior===1.5)return;const i=this.writer.extensionsUsed,s={};s.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class mle{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.specularIntensity===1&&e.specularColor.equals(qae)&&!e.specularIntensityMap&&!e.specularColorMap)return;const r=this.writer,i=r.extensionsUsed,s={};if(e.specularIntensityMap){const o={index:r.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};r.applyTextureTransform(o,e.specularIntensityMap),s.specularTexture=o}if(e.specularColorMap){const o={index:r.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};r.applyTextureTransform(o,e.specularColorMap),s.specularColorTexture=o}s.specularFactor=e.specularIntensity,s.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class gle{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.sheen==0)return;const r=this.writer,i=r.extensionsUsed,s={};if(e.sheenRoughnessMap){const o={index:r.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};r.applyTextureTransform(o,e.sheenRoughnessMap),s.sheenRoughnessTexture=o}if(e.sheenColorMap){const o={index:r.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};r.applyTextureTransform(o,e.sheenColorMap),s.sheenColorTexture=o}s.sheenRoughnessFactor=e.sheenRoughness,s.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class vle{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.anisotropy==0)return;const r=this.writer,i=r.extensionsUsed,s={};if(e.anisotropyMap){const o={index:r.processTexture(e.anisotropyMap)};r.applyTextureTransform(o,e.anisotropyMap),s.anisotropyTexture=o}s.anisotropyStrength=e.anisotropy,s.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class yle{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||e.emissiveIntensity===1)return;const i=this.writer.extensionsUsed,s={};s.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class wle{constructor(e){this.writer=e,this.name="EXT_materials_bump"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||e.bumpScale===1&&!e.bumpMap)return;const r=this.writer,i=r.extensionsUsed,s={};if(e.bumpMap){const o={index:r.processTexture(e.bumpMap),texCoord:e.bumpMap.channel};r.applyTextureTransform(o,e.bumpMap),s.bumpTexture=o}s.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class _le{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;const r=this.writer,i=e,s=new Float32Array(i.count*3),o=new Float32Array(i.count*4),a=new Float32Array(i.count*3),l=new He,c=new $,A=new nt,u=new $;for(let h=0;hn.times[n.times.length-1]){if(Math.abs(n.times[n.times.length-1]-e)<.001)return n.times.length-1;i[i.length-1]=e,i.set(n.times,0),s.set(n.values,0),s.set(o.evaluate(e),n.values.length),a=i.length-1}else for(let l=0;le){i.set(n.times.slice(0,l+1),0),i[l+1]=e,i.set(n.times.slice(l+1),l+2),s.set(n.values.slice(0,(l+1)*r),0),s.set(o.evaluate(e),(l+1)*r),s.set(n.values.slice((l+1)*r),(l+2)*r),a=l+1;break}}return n.times=i,n.values=s,a},mergeMorphTargetTracks:function(n,e){const t=[],r={},i=n.tracks;for(let s=0;s0)throw new Error("Invalid string. Length must be a multiple of 4");var t=n.indexOf("=");t===-1&&(t=e);var r=t===e?0:4-t%4;return[t,r]}function Ele(n){var e=c8(n),t=e[0],r=e[1];return(t+r)*3/4-r}function Ble(n,e,t){return(e+t)*3/4-t}function Mle(n){var e,t=c8(n),r=t[0],i=t[1],s=new xle(Ble(n,r,i)),o=0,a=i>0?r-4:r,l;for(l=0;l>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=no[n.charCodeAt(l)]<<2|no[n.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=no[n.charCodeAt(l)]<<10|no[n.charCodeAt(l+1)]<<4|no[n.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function Sle(n){return Da[n>>18&63]+Da[n>>12&63]+Da[n>>6&63]+Da[n&63]}function Cle(n,e,t){for(var r,i=[],s=e;sa?a:o+s));return r===1?(e=n[t-1],i.push(Da[e>>2]+Da[e<<4&63]+"==")):r===2&&(e=(n[t-2]<<8)+n[t-1],i.push(Da[e>>10]+Da[e>>4&63]+Da[e<<2&63]+"=")),i.join("")}var JR={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */JR.read=function(n,e,t,r,i){var s,o,a=i*8-r-1,l=(1<>1,A=-7,u=t?i-1:0,f=t?-1:1,h=n[e+u];for(u+=f,s=h&(1<<-A)-1,h>>=-A,A+=a;A>0;s=s*256+n[e+u],u+=f,A-=8);for(o=s&(1<<-A)-1,s>>=-A,A+=r;A>0;o=o*256+n[e+u],u+=f,A-=8);if(s===0)s=1-c;else{if(s===l)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,r),s=s-c}return(h?-1:1)*o*Math.pow(2,s-r)};JR.write=function(n,e,t,r,i,s){var o,a,l,c=s*8-i-1,A=(1<>1,f=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:s-1,d=r?1:-1,m=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=A):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+u>=1?e+=f/l:e+=f*Math.pow(2,1-u),e*l>=2&&(o++,l/=2),o+u>=A?(a=0,o=A):o+u>=1?(a=(e*l-1)*Math.pow(2,i),o=o+u):(a=e*Math.pow(2,u-1)*Math.pow(2,i),o=0));i>=8;n[t+h]=a&255,h+=d,a/=256,i-=8);for(o=o<0;n[t+h]=o&255,h+=d,o/=256,c-=8);n[t+h-d]|=m*128};/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT - */(function(n){const e=v1,t=ZR,r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;n.Buffer=a,n.SlowBuffer=v,n.INSPECT_MAX_BYTES=50;const i=2147483647;n.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=s(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{const V=new Uint8Array(1),U={foo:function(){return 42}};return Object.setPrototypeOf(U,Uint8Array.prototype),Object.setPrototypeOf(V,U),V.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function o(V){if(V>i)throw new RangeError('The value "'+V+'" is invalid for option "size"');const U=new Uint8Array(V);return Object.setPrototypeOf(U,a.prototype),U}function a(V,U,N){if(typeof V=="number"){if(typeof U=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return u(V)}return l(V,U,N)}a.poolSize=8192;function l(V,U,N){if(typeof V=="string")return f(V,U);if(ArrayBuffer.isView(V))return d(V);if(V==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof V);if(ne(V,ArrayBuffer)||V&&ne(V.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ne(V,SharedArrayBuffer)||V&&ne(V.buffer,SharedArrayBuffer)))return m(V,U,N);if(typeof V=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const K=V.valueOf&&V.valueOf();if(K!=null&&K!==V)return a.from(K,U,N);const oe=g(V);if(oe)return oe;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof V[Symbol.toPrimitive]=="function")return a.from(V[Symbol.toPrimitive]("string"),U,N);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof V)}a.from=function(V,U,N){return l(V,U,N)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function c(V){if(typeof V!="number")throw new TypeError('"size" argument must be of type number');if(V<0)throw new RangeError('The value "'+V+'" is invalid for option "size"')}function A(V,U,N){return c(V),V<=0?o(V):U!==void 0?typeof N=="string"?o(V).fill(U,N):o(V).fill(U):o(V)}a.alloc=function(V,U,N){return A(V,U,N)};function u(V){return c(V),o(V<0?0:p(V)|0)}a.allocUnsafe=function(V){return u(V)},a.allocUnsafeSlow=function(V){return u(V)};function f(V,U){if((typeof U!="string"||U==="")&&(U="utf8"),!a.isEncoding(U))throw new TypeError("Unknown encoding: "+U);const N=w(V,U)|0;let K=o(N);const oe=K.write(V,U);return oe!==N&&(K=K.slice(0,oe)),K}function h(V){const U=V.length<0?0:p(V.length)|0,N=o(U);for(let K=0;K=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return V|0}function v(V){return+V!=V&&(V=0),a.alloc(+V)}a.isBuffer=function(U){return U!=null&&U._isBuffer===!0&&U!==a.prototype},a.compare=function(U,N){if(ne(U,Uint8Array)&&(U=a.from(U,U.offset,U.byteLength)),ne(N,Uint8Array)&&(N=a.from(N,N.offset,N.byteLength)),!a.isBuffer(U)||!a.isBuffer(N))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(U===N)return 0;let K=U.length,oe=N.length;for(let pe=0,ve=Math.min(K,oe);peoe.length?(a.isBuffer(ve)||(ve=a.from(ve)),ve.copy(oe,pe)):Uint8Array.prototype.set.call(oe,ve,pe);else if(a.isBuffer(ve))ve.copy(oe,pe);else throw new TypeError('"list" argument must be an Array of Buffers');pe+=ve.length}return oe};function w(V,U){if(a.isBuffer(V))return V.length;if(ArrayBuffer.isView(V)||ne(V,ArrayBuffer))return V.byteLength;if(typeof V!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof V);const N=V.length,K=arguments.length>2&&arguments[2]===!0;if(!K&&N===0)return 0;let oe=!1;for(;;)switch(U){case"ascii":case"latin1":case"binary":return N;case"utf8":case"utf-8":return Z(V).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N*2;case"hex":return N>>>1;case"base64":return X(V).length;default:if(oe)return K?-1:Z(V).length;U=(""+U).toLowerCase(),oe=!0}}a.byteLength=w;function _(V,U,N){let K=!1;if((U===void 0||U<0)&&(U=0),U>this.length||((N===void 0||N>this.length)&&(N=this.length),N<=0)||(N>>>=0,U>>>=0,N<=U))return"";for(V||(V="utf8");;)switch(V){case"hex":return z(this,U,N);case"utf8":case"utf-8":return y(this,U,N);case"ascii":return F(this,U,N);case"latin1":case"binary":return O(this,U,N);case"base64":return T(this,U,N);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,U,N);default:if(K)throw new TypeError("Unknown encoding: "+V);V=(V+"").toLowerCase(),K=!0}}a.prototype._isBuffer=!0;function x(V,U,N){const K=V[U];V[U]=V[N],V[N]=K}a.prototype.swap16=function(){const U=this.length;if(U%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let N=0;NN&&(U+=" ... "),""},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(U,N,K,oe,pe){if(ne(U,Uint8Array)&&(U=a.from(U,U.offset,U.byteLength)),!a.isBuffer(U))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof U);if(N===void 0&&(N=0),K===void 0&&(K=U?U.length:0),oe===void 0&&(oe=0),pe===void 0&&(pe=this.length),N<0||K>U.length||oe<0||pe>this.length)throw new RangeError("out of range index");if(oe>=pe&&N>=K)return 0;if(oe>=pe)return-1;if(N>=K)return 1;if(N>>>=0,K>>>=0,oe>>>=0,pe>>>=0,this===U)return 0;let ve=pe-oe,Ce=K-N;const Le=Math.min(ve,Ce),Re=this.slice(oe,pe),$e=U.slice(N,K);for(let ce=0;ce2147483647?N=2147483647:N<-2147483648&&(N=-2147483648),N=+N,Y(N)&&(N=oe?0:V.length-1),N<0&&(N=V.length+N),N>=V.length){if(oe)return-1;N=V.length-1}else if(N<0)if(oe)N=0;else return-1;if(typeof U=="string"&&(U=a.from(U,K)),a.isBuffer(U))return U.length===0?-1:B(V,U,N,K,oe);if(typeof U=="number")return U=U&255,typeof Uint8Array.prototype.indexOf=="function"?oe?Uint8Array.prototype.indexOf.call(V,U,N):Uint8Array.prototype.lastIndexOf.call(V,U,N):B(V,[U],N,K,oe);throw new TypeError("val must be string, number or Buffer")}function B(V,U,N,K,oe){let pe=1,ve=V.length,Ce=U.length;if(K!==void 0&&(K=String(K).toLowerCase(),K==="ucs2"||K==="ucs-2"||K==="utf16le"||K==="utf-16le")){if(V.length<2||U.length<2)return-1;pe=2,ve/=2,Ce/=2,N/=2}function Le($e,ce){return pe===1?$e[ce]:$e.readUInt16BE(ce*pe)}let Re;if(oe){let $e=-1;for(Re=N;Reve&&(N=ve-Ce),Re=N;Re>=0;Re--){let $e=!0;for(let ce=0;ceoe&&(K=oe)):K=oe;const pe=U.length;K>pe/2&&(K=pe/2);let ve;for(ve=0;ve>>0,isFinite(K)?(K=K>>>0,oe===void 0&&(oe="utf8")):(oe=K,K=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const pe=this.length-N;if((K===void 0||K>pe)&&(K=pe),U.length>0&&(K<0||N<0)||N>this.length)throw new RangeError("Attempt to write outside buffer bounds");oe||(oe="utf8");let ve=!1;for(;;)switch(oe){case"hex":return M(this,U,N,K);case"utf8":case"utf-8":return I(this,U,N,K);case"ascii":case"latin1":case"binary":return S(this,U,N,K);case"base64":return L(this,U,N,K);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,U,N,K);default:if(ve)throw new TypeError("Unknown encoding: "+oe);oe=(""+oe).toLowerCase(),ve=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(V,U,N){return U===0&&N===V.length?e.fromByteArray(V):e.fromByteArray(V.slice(U,N))}function y(V,U,N){N=Math.min(V.length,N);const K=[];let oe=U;for(;oe239?4:pe>223?3:pe>191?2:1;if(oe+Ce<=N){let Le,Re,$e,ce;switch(Ce){case 1:pe<128&&(ve=pe);break;case 2:Le=V[oe+1],(Le&192)===128&&(ce=(pe&31)<<6|Le&63,ce>127&&(ve=ce));break;case 3:Le=V[oe+1],Re=V[oe+2],(Le&192)===128&&(Re&192)===128&&(ce=(pe&15)<<12|(Le&63)<<6|Re&63,ce>2047&&(ce<55296||ce>57343)&&(ve=ce));break;case 4:Le=V[oe+1],Re=V[oe+2],$e=V[oe+3],(Le&192)===128&&(Re&192)===128&&($e&192)===128&&(ce=(pe&15)<<18|(Le&63)<<12|(Re&63)<<6|$e&63,ce>65535&&ce<1114112&&(ve=ce))}}ve===null?(ve=65533,Ce=1):ve>65535&&(ve-=65536,K.push(ve>>>10&1023|55296),ve=56320|ve&1023),K.push(ve),oe+=Ce}return R(K)}const E=4096;function R(V){const U=V.length;if(U<=E)return String.fromCharCode.apply(String,V);let N="",K=0;for(;KK)&&(N=K);let oe="";for(let pe=U;peK&&(U=K),N<0?(N+=K,N<0&&(N=0)):N>K&&(N=K),NN)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(U,N,K){U=U>>>0,N=N>>>0,K||H(U,N,this.length);let oe=this[U],pe=1,ve=0;for(;++ve>>0,N=N>>>0,K||H(U,N,this.length);let oe=this[U+--N],pe=1;for(;N>0&&(pe*=256);)oe+=this[U+--N]*pe;return oe},a.prototype.readUint8=a.prototype.readUInt8=function(U,N){return U=U>>>0,N||H(U,1,this.length),this[U]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(U,N){return U=U>>>0,N||H(U,2,this.length),this[U]|this[U+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(U,N){return U=U>>>0,N||H(U,2,this.length),this[U]<<8|this[U+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(U,N){return U=U>>>0,N||H(U,4,this.length),(this[U]|this[U+1]<<8|this[U+2]<<16)+this[U+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(U,N){return U=U>>>0,N||H(U,4,this.length),this[U]*16777216+(this[U+1]<<16|this[U+2]<<8|this[U+3])},a.prototype.readBigUInt64LE=ae(function(U){U=U>>>0,se(U,"offset");const N=this[U],K=this[U+7];(N===void 0||K===void 0)&&Q(U,this.length-8);const oe=N+this[++U]*2**8+this[++U]*2**16+this[++U]*2**24,pe=this[++U]+this[++U]*2**8+this[++U]*2**16+K*2**24;return BigInt(oe)+(BigInt(pe)<>>0,se(U,"offset");const N=this[U],K=this[U+7];(N===void 0||K===void 0)&&Q(U,this.length-8);const oe=N*2**24+this[++U]*2**16+this[++U]*2**8+this[++U],pe=this[++U]*2**24+this[++U]*2**16+this[++U]*2**8+K;return(BigInt(oe)<>>0,N=N>>>0,K||H(U,N,this.length);let oe=this[U],pe=1,ve=0;for(;++ve=pe&&(oe-=Math.pow(2,8*N)),oe},a.prototype.readIntBE=function(U,N,K){U=U>>>0,N=N>>>0,K||H(U,N,this.length);let oe=N,pe=1,ve=this[U+--oe];for(;oe>0&&(pe*=256);)ve+=this[U+--oe]*pe;return pe*=128,ve>=pe&&(ve-=Math.pow(2,8*N)),ve},a.prototype.readInt8=function(U,N){return U=U>>>0,N||H(U,1,this.length),this[U]&128?(255-this[U]+1)*-1:this[U]},a.prototype.readInt16LE=function(U,N){U=U>>>0,N||H(U,2,this.length);const K=this[U]|this[U+1]<<8;return K&32768?K|4294901760:K},a.prototype.readInt16BE=function(U,N){U=U>>>0,N||H(U,2,this.length);const K=this[U+1]|this[U]<<8;return K&32768?K|4294901760:K},a.prototype.readInt32LE=function(U,N){return U=U>>>0,N||H(U,4,this.length),this[U]|this[U+1]<<8|this[U+2]<<16|this[U+3]<<24},a.prototype.readInt32BE=function(U,N){return U=U>>>0,N||H(U,4,this.length),this[U]<<24|this[U+1]<<16|this[U+2]<<8|this[U+3]},a.prototype.readBigInt64LE=ae(function(U){U=U>>>0,se(U,"offset");const N=this[U],K=this[U+7];(N===void 0||K===void 0)&&Q(U,this.length-8);const oe=this[U+4]+this[U+5]*2**8+this[U+6]*2**16+(K<<24);return(BigInt(oe)<>>0,se(U,"offset");const N=this[U],K=this[U+7];(N===void 0||K===void 0)&&Q(U,this.length-8);const oe=(N<<24)+this[++U]*2**16+this[++U]*2**8+this[++U];return(BigInt(oe)<>>0,N||H(U,4,this.length),t.read(this,U,!0,23,4)},a.prototype.readFloatBE=function(U,N){return U=U>>>0,N||H(U,4,this.length),t.read(this,U,!1,23,4)},a.prototype.readDoubleLE=function(U,N){return U=U>>>0,N||H(U,8,this.length),t.read(this,U,!0,52,8)},a.prototype.readDoubleBE=function(U,N){return U=U>>>0,N||H(U,8,this.length),t.read(this,U,!1,52,8)};function C(V,U,N,K,oe,pe){if(!a.isBuffer(V))throw new TypeError('"buffer" argument must be a Buffer instance');if(U>oe||UV.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(U,N,K,oe){if(U=+U,N=N>>>0,K=K>>>0,!oe){const Ce=Math.pow(2,8*K)-1;C(this,U,N,K,Ce,0)}let pe=1,ve=0;for(this[N]=U&255;++ve>>0,K=K>>>0,!oe){const Ce=Math.pow(2,8*K)-1;C(this,U,N,K,Ce,0)}let pe=K-1,ve=1;for(this[N+pe]=U&255;--pe>=0&&(ve*=256);)this[N+pe]=U/ve&255;return N+K},a.prototype.writeUint8=a.prototype.writeUInt8=function(U,N,K){return U=+U,N=N>>>0,K||C(this,U,N,1,255,0),this[N]=U&255,N+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(U,N,K){return U=+U,N=N>>>0,K||C(this,U,N,2,65535,0),this[N]=U&255,this[N+1]=U>>>8,N+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(U,N,K){return U=+U,N=N>>>0,K||C(this,U,N,2,65535,0),this[N]=U>>>8,this[N+1]=U&255,N+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(U,N,K){return U=+U,N=N>>>0,K||C(this,U,N,4,4294967295,0),this[N+3]=U>>>24,this[N+2]=U>>>16,this[N+1]=U>>>8,this[N]=U&255,N+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(U,N,K){return U=+U,N=N>>>0,K||C(this,U,N,4,4294967295,0),this[N]=U>>>24,this[N+1]=U>>>16,this[N+2]=U>>>8,this[N+3]=U&255,N+4};function W(V,U,N,K,oe){_e(U,K,oe,V,N,7);let pe=Number(U&BigInt(4294967295));V[N++]=pe,pe=pe>>8,V[N++]=pe,pe=pe>>8,V[N++]=pe,pe=pe>>8,V[N++]=pe;let ve=Number(U>>BigInt(32)&BigInt(4294967295));return V[N++]=ve,ve=ve>>8,V[N++]=ve,ve=ve>>8,V[N++]=ve,ve=ve>>8,V[N++]=ve,N}function ee(V,U,N,K,oe){_e(U,K,oe,V,N,7);let pe=Number(U&BigInt(4294967295));V[N+7]=pe,pe=pe>>8,V[N+6]=pe,pe=pe>>8,V[N+5]=pe,pe=pe>>8,V[N+4]=pe;let ve=Number(U>>BigInt(32)&BigInt(4294967295));return V[N+3]=ve,ve=ve>>8,V[N+2]=ve,ve=ve>>8,V[N+1]=ve,ve=ve>>8,V[N]=ve,N+8}a.prototype.writeBigUInt64LE=ae(function(U,N=0){return W(this,U,N,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=ae(function(U,N=0){return ee(this,U,N,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(U,N,K,oe){if(U=+U,N=N>>>0,!oe){const Le=Math.pow(2,8*K-1);C(this,U,N,K,Le-1,-Le)}let pe=0,ve=1,Ce=0;for(this[N]=U&255;++pe>0)-Ce&255;return N+K},a.prototype.writeIntBE=function(U,N,K,oe){if(U=+U,N=N>>>0,!oe){const Le=Math.pow(2,8*K-1);C(this,U,N,K,Le-1,-Le)}let pe=K-1,ve=1,Ce=0;for(this[N+pe]=U&255;--pe>=0&&(ve*=256);)U<0&&Ce===0&&this[N+pe+1]!==0&&(Ce=1),this[N+pe]=(U/ve>>0)-Ce&255;return N+K},a.prototype.writeInt8=function(U,N,K){return U=+U,N=N>>>0,K||C(this,U,N,1,127,-128),U<0&&(U=255+U+1),this[N]=U&255,N+1},a.prototype.writeInt16LE=function(U,N,K){return U=+U,N=N>>>0,K||C(this,U,N,2,32767,-32768),this[N]=U&255,this[N+1]=U>>>8,N+2},a.prototype.writeInt16BE=function(U,N,K){return U=+U,N=N>>>0,K||C(this,U,N,2,32767,-32768),this[N]=U>>>8,this[N+1]=U&255,N+2},a.prototype.writeInt32LE=function(U,N,K){return U=+U,N=N>>>0,K||C(this,U,N,4,2147483647,-2147483648),this[N]=U&255,this[N+1]=U>>>8,this[N+2]=U>>>16,this[N+3]=U>>>24,N+4},a.prototype.writeInt32BE=function(U,N,K){return U=+U,N=N>>>0,K||C(this,U,N,4,2147483647,-2147483648),U<0&&(U=4294967295+U+1),this[N]=U>>>24,this[N+1]=U>>>16,this[N+2]=U>>>8,this[N+3]=U&255,N+4},a.prototype.writeBigInt64LE=ae(function(U,N=0){return W(this,U,N,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=ae(function(U,N=0){return ee(this,U,N,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function P(V,U,N,K,oe,pe){if(N+K>V.length)throw new RangeError("Index out of range");if(N<0)throw new RangeError("Index out of range")}function re(V,U,N,K,oe){return U=+U,N=N>>>0,oe||P(V,U,N,4),t.write(V,U,N,K,23,4),N+4}a.prototype.writeFloatLE=function(U,N,K){return re(this,U,N,!0,K)},a.prototype.writeFloatBE=function(U,N,K){return re(this,U,N,!1,K)};function ue(V,U,N,K,oe){return U=+U,N=N>>>0,oe||P(V,U,N,8),t.write(V,U,N,K,52,8),N+8}a.prototype.writeDoubleLE=function(U,N,K){return ue(this,U,N,!0,K)},a.prototype.writeDoubleBE=function(U,N,K){return ue(this,U,N,!1,K)},a.prototype.copy=function(U,N,K,oe){if(!a.isBuffer(U))throw new TypeError("argument should be a Buffer");if(K||(K=0),!oe&&oe!==0&&(oe=this.length),N>=U.length&&(N=U.length),N||(N=0),oe>0&&oe=this.length)throw new RangeError("Index out of range");if(oe<0)throw new RangeError("sourceEnd out of bounds");oe>this.length&&(oe=this.length),U.length-N>>0,K=K===void 0?this.length:K>>>0,U||(U=0);let pe;if(typeof U=="number")for(pe=N;pe2**32?oe=ie(String(N)):typeof N=="bigint"&&(oe=String(N),(N>BigInt(2)**BigInt(32)||N<-(BigInt(2)**BigInt(32)))&&(oe=ie(oe)),oe+="n"),K+=` It must be ${U}. Received ${oe}`,K},RangeError);function ie(V){let U="",N=V.length;const K=V[0]==="-"?1:0;for(;N>=K+4;N-=3)U=`_${V.slice(N-3,N)}${U}`;return`${V.slice(0,N)}${U}`}function ge(V,U,N){se(U,"offset"),(V[U]===void 0||V[U+N]===void 0)&&Q(U,V.length-(N+1))}function _e(V,U,N,K,oe,pe){if(V>N||V3?U===0||U===BigInt(0)?Ce=`>= 0${ve} and < 2${ve} ** ${(pe+1)*8}${ve}`:Ce=`>= -(2${ve} ** ${(pe+1)*8-1}${ve}) and < 2 ** ${(pe+1)*8-1}${ve}`:Ce=`>= ${U}${ve} and <= ${N}${ve}`,new le.ERR_OUT_OF_RANGE("value",Ce,V)}ge(K,oe,pe)}function se(V,U){if(typeof V!="number")throw new le.ERR_INVALID_ARG_TYPE(U,"number",V)}function Q(V,U,N){throw Math.floor(V)!==V?(se(V,N),new le.ERR_OUT_OF_RANGE(N||"offset","an integer",V)):U<0?new le.ERR_BUFFER_OUT_OF_BOUNDS:new le.ERR_OUT_OF_RANGE(N||"offset",`>= ${N?1:0} and <= ${U}`,V)}const fe=/[^+/0-9A-Za-z-_]/g;function Ae(V){if(V=V.split("=")[0],V=V.trim().replace(fe,""),V.length<2)return"";for(;V.length%4!==0;)V=V+"=";return V}function Z(V,U){U=U||1/0;let N;const K=V.length;let oe=null;const pe=[];for(let ve=0;ve55295&&N<57344){if(!oe){if(N>56319){(U-=3)>-1&&pe.push(239,191,189);continue}else if(ve+1===K){(U-=3)>-1&&pe.push(239,191,189);continue}oe=N;continue}if(N<56320){(U-=3)>-1&&pe.push(239,191,189),oe=N;continue}N=(oe-55296<<10|N-56320)+65536}else oe&&(U-=3)>-1&&pe.push(239,191,189);if(oe=null,N<128){if((U-=1)<0)break;pe.push(N)}else if(N<2048){if((U-=2)<0)break;pe.push(N>>6|192,N&63|128)}else if(N<65536){if((U-=3)<0)break;pe.push(N>>12|224,N>>6&63|128,N&63|128)}else if(N<1114112){if((U-=4)<0)break;pe.push(N>>18|240,N>>12&63|128,N>>6&63|128,N&63|128)}else throw new Error("Invalid code point")}return pe}function q(V){const U=[];for(let N=0;N>8,oe=N%256,pe.push(oe),pe.push(K);return pe}function X(V){return e.toByteArray(Ae(V))}function G(V,U,N,K){let oe;for(oe=0;oe=U.length||oe>=V.length);++oe)U[oe+N]=V[oe];return oe}function ne(V,U){return V instanceof U||V!=null&&V.constructor!=null&&V.constructor.name!=null&&V.constructor.name===U.name}function Y(V){return V!==V}const de=function(){const V="0123456789abcdef",U=new Array(256);for(let N=0;N<16;++N){const K=N*16;for(let oe=0;oe<16;++oe)U[K+oe]=V[N]+V[oe]}return U}();function ae(V){return typeof BigInt>"u"?Ee:V}function Ee(){throw new Error("BigInt not supported")}})(a8);/*! + */(function(n){const e=w1,t=JR,r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;n.Buffer=a,n.SlowBuffer=v,n.INSPECT_MAX_BYTES=50;const i=2147483647;n.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=s(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{const V=new Uint8Array(1),U={foo:function(){return 42}};return Object.setPrototypeOf(U,Uint8Array.prototype),Object.setPrototypeOf(V,U),V.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function o(V){if(V>i)throw new RangeError('The value "'+V+'" is invalid for option "size"');const U=new Uint8Array(V);return Object.setPrototypeOf(U,a.prototype),U}function a(V,U,N){if(typeof V=="number"){if(typeof U=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return u(V)}return l(V,U,N)}a.poolSize=8192;function l(V,U,N){if(typeof V=="string")return f(V,U);if(ArrayBuffer.isView(V))return d(V);if(V==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof V);if(ne(V,ArrayBuffer)||V&&ne(V.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ne(V,SharedArrayBuffer)||V&&ne(V.buffer,SharedArrayBuffer)))return m(V,U,N);if(typeof V=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const K=V.valueOf&&V.valueOf();if(K!=null&&K!==V)return a.from(K,U,N);const oe=g(V);if(oe)return oe;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof V[Symbol.toPrimitive]=="function")return a.from(V[Symbol.toPrimitive]("string"),U,N);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof V)}a.from=function(V,U,N){return l(V,U,N)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function c(V){if(typeof V!="number")throw new TypeError('"size" argument must be of type number');if(V<0)throw new RangeError('The value "'+V+'" is invalid for option "size"')}function A(V,U,N){return c(V),V<=0?o(V):U!==void 0?typeof N=="string"?o(V).fill(U,N):o(V).fill(U):o(V)}a.alloc=function(V,U,N){return A(V,U,N)};function u(V){return c(V),o(V<0?0:p(V)|0)}a.allocUnsafe=function(V){return u(V)},a.allocUnsafeSlow=function(V){return u(V)};function f(V,U){if((typeof U!="string"||U==="")&&(U="utf8"),!a.isEncoding(U))throw new TypeError("Unknown encoding: "+U);const N=w(V,U)|0;let K=o(N);const oe=K.write(V,U);return oe!==N&&(K=K.slice(0,oe)),K}function h(V){const U=V.length<0?0:p(V.length)|0,N=o(U);for(let K=0;K=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return V|0}function v(V){return+V!=V&&(V=0),a.alloc(+V)}a.isBuffer=function(U){return U!=null&&U._isBuffer===!0&&U!==a.prototype},a.compare=function(U,N){if(ne(U,Uint8Array)&&(U=a.from(U,U.offset,U.byteLength)),ne(N,Uint8Array)&&(N=a.from(N,N.offset,N.byteLength)),!a.isBuffer(U)||!a.isBuffer(N))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(U===N)return 0;let K=U.length,oe=N.length;for(let pe=0,ve=Math.min(K,oe);peoe.length?(a.isBuffer(ve)||(ve=a.from(ve)),ve.copy(oe,pe)):Uint8Array.prototype.set.call(oe,ve,pe);else if(a.isBuffer(ve))ve.copy(oe,pe);else throw new TypeError('"list" argument must be an Array of Buffers');pe+=ve.length}return oe};function w(V,U){if(a.isBuffer(V))return V.length;if(ArrayBuffer.isView(V)||ne(V,ArrayBuffer))return V.byteLength;if(typeof V!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof V);const N=V.length,K=arguments.length>2&&arguments[2]===!0;if(!K&&N===0)return 0;let oe=!1;for(;;)switch(U){case"ascii":case"latin1":case"binary":return N;case"utf8":case"utf-8":return J(V).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N*2;case"hex":return N>>>1;case"base64":return X(V).length;default:if(oe)return K?-1:J(V).length;U=(""+U).toLowerCase(),oe=!0}}a.byteLength=w;function _(V,U,N){let K=!1;if((U===void 0||U<0)&&(U=0),U>this.length||((N===void 0||N>this.length)&&(N=this.length),N<=0)||(N>>>=0,U>>>=0,N<=U))return"";for(V||(V="utf8");;)switch(V){case"hex":return z(this,U,N);case"utf8":case"utf-8":return y(this,U,N);case"ascii":return F(this,U,N);case"latin1":case"binary":return O(this,U,N);case"base64":return T(this,U,N);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,U,N);default:if(K)throw new TypeError("Unknown encoding: "+V);V=(V+"").toLowerCase(),K=!0}}a.prototype._isBuffer=!0;function x(V,U,N){const K=V[U];V[U]=V[N],V[N]=K}a.prototype.swap16=function(){const U=this.length;if(U%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let N=0;NN&&(U+=" ... "),""},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(U,N,K,oe,pe){if(ne(U,Uint8Array)&&(U=a.from(U,U.offset,U.byteLength)),!a.isBuffer(U))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof U);if(N===void 0&&(N=0),K===void 0&&(K=U?U.length:0),oe===void 0&&(oe=0),pe===void 0&&(pe=this.length),N<0||K>U.length||oe<0||pe>this.length)throw new RangeError("out of range index");if(oe>=pe&&N>=K)return 0;if(oe>=pe)return-1;if(N>=K)return 1;if(N>>>=0,K>>>=0,oe>>>=0,pe>>>=0,this===U)return 0;let ve=pe-oe,Ce=K-N;const Le=Math.min(ve,Ce),Re=this.slice(oe,pe),$e=U.slice(N,K);for(let ce=0;ce2147483647?N=2147483647:N<-2147483648&&(N=-2147483648),N=+N,Y(N)&&(N=oe?0:V.length-1),N<0&&(N=V.length+N),N>=V.length){if(oe)return-1;N=V.length-1}else if(N<0)if(oe)N=0;else return-1;if(typeof U=="string"&&(U=a.from(U,K)),a.isBuffer(U))return U.length===0?-1:B(V,U,N,K,oe);if(typeof U=="number")return U=U&255,typeof Uint8Array.prototype.indexOf=="function"?oe?Uint8Array.prototype.indexOf.call(V,U,N):Uint8Array.prototype.lastIndexOf.call(V,U,N):B(V,[U],N,K,oe);throw new TypeError("val must be string, number or Buffer")}function B(V,U,N,K,oe){let pe=1,ve=V.length,Ce=U.length;if(K!==void 0&&(K=String(K).toLowerCase(),K==="ucs2"||K==="ucs-2"||K==="utf16le"||K==="utf-16le")){if(V.length<2||U.length<2)return-1;pe=2,ve/=2,Ce/=2,N/=2}function Le($e,ce){return pe===1?$e[ce]:$e.readUInt16BE(ce*pe)}let Re;if(oe){let $e=-1;for(Re=N;Reve&&(N=ve-Ce),Re=N;Re>=0;Re--){let $e=!0;for(let ce=0;ceoe&&(K=oe)):K=oe;const pe=U.length;K>pe/2&&(K=pe/2);let ve;for(ve=0;ve>>0,isFinite(K)?(K=K>>>0,oe===void 0&&(oe="utf8")):(oe=K,K=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const pe=this.length-N;if((K===void 0||K>pe)&&(K=pe),U.length>0&&(K<0||N<0)||N>this.length)throw new RangeError("Attempt to write outside buffer bounds");oe||(oe="utf8");let ve=!1;for(;;)switch(oe){case"hex":return S(this,U,N,K);case"utf8":case"utf-8":return I(this,U,N,K);case"ascii":case"latin1":case"binary":return M(this,U,N,K);case"base64":return L(this,U,N,K);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,U,N,K);default:if(ve)throw new TypeError("Unknown encoding: "+oe);oe=(""+oe).toLowerCase(),ve=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(V,U,N){return U===0&&N===V.length?e.fromByteArray(V):e.fromByteArray(V.slice(U,N))}function y(V,U,N){N=Math.min(V.length,N);const K=[];let oe=U;for(;oe239?4:pe>223?3:pe>191?2:1;if(oe+Ce<=N){let Le,Re,$e,ce;switch(Ce){case 1:pe<128&&(ve=pe);break;case 2:Le=V[oe+1],(Le&192)===128&&(ce=(pe&31)<<6|Le&63,ce>127&&(ve=ce));break;case 3:Le=V[oe+1],Re=V[oe+2],(Le&192)===128&&(Re&192)===128&&(ce=(pe&15)<<12|(Le&63)<<6|Re&63,ce>2047&&(ce<55296||ce>57343)&&(ve=ce));break;case 4:Le=V[oe+1],Re=V[oe+2],$e=V[oe+3],(Le&192)===128&&(Re&192)===128&&($e&192)===128&&(ce=(pe&15)<<18|(Le&63)<<12|(Re&63)<<6|$e&63,ce>65535&&ce<1114112&&(ve=ce))}}ve===null?(ve=65533,Ce=1):ve>65535&&(ve-=65536,K.push(ve>>>10&1023|55296),ve=56320|ve&1023),K.push(ve),oe+=Ce}return R(K)}const E=4096;function R(V){const U=V.length;if(U<=E)return String.fromCharCode.apply(String,V);let N="",K=0;for(;KK)&&(N=K);let oe="";for(let pe=U;peK&&(U=K),N<0?(N+=K,N<0&&(N=0)):N>K&&(N=K),NN)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(U,N,K){U=U>>>0,N=N>>>0,K||Q(U,N,this.length);let oe=this[U],pe=1,ve=0;for(;++ve>>0,N=N>>>0,K||Q(U,N,this.length);let oe=this[U+--N],pe=1;for(;N>0&&(pe*=256);)oe+=this[U+--N]*pe;return oe},a.prototype.readUint8=a.prototype.readUInt8=function(U,N){return U=U>>>0,N||Q(U,1,this.length),this[U]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(U,N){return U=U>>>0,N||Q(U,2,this.length),this[U]|this[U+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(U,N){return U=U>>>0,N||Q(U,2,this.length),this[U]<<8|this[U+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(U,N){return U=U>>>0,N||Q(U,4,this.length),(this[U]|this[U+1]<<8|this[U+2]<<16)+this[U+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(U,N){return U=U>>>0,N||Q(U,4,this.length),this[U]*16777216+(this[U+1]<<16|this[U+2]<<8|this[U+3])},a.prototype.readBigUInt64LE=ae(function(U){U=U>>>0,se(U,"offset");const N=this[U],K=this[U+7];(N===void 0||K===void 0)&&H(U,this.length-8);const oe=N+this[++U]*2**8+this[++U]*2**16+this[++U]*2**24,pe=this[++U]+this[++U]*2**8+this[++U]*2**16+K*2**24;return BigInt(oe)+(BigInt(pe)<>>0,se(U,"offset");const N=this[U],K=this[U+7];(N===void 0||K===void 0)&&H(U,this.length-8);const oe=N*2**24+this[++U]*2**16+this[++U]*2**8+this[++U],pe=this[++U]*2**24+this[++U]*2**16+this[++U]*2**8+K;return(BigInt(oe)<>>0,N=N>>>0,K||Q(U,N,this.length);let oe=this[U],pe=1,ve=0;for(;++ve=pe&&(oe-=Math.pow(2,8*N)),oe},a.prototype.readIntBE=function(U,N,K){U=U>>>0,N=N>>>0,K||Q(U,N,this.length);let oe=N,pe=1,ve=this[U+--oe];for(;oe>0&&(pe*=256);)ve+=this[U+--oe]*pe;return pe*=128,ve>=pe&&(ve-=Math.pow(2,8*N)),ve},a.prototype.readInt8=function(U,N){return U=U>>>0,N||Q(U,1,this.length),this[U]&128?(255-this[U]+1)*-1:this[U]},a.prototype.readInt16LE=function(U,N){U=U>>>0,N||Q(U,2,this.length);const K=this[U]|this[U+1]<<8;return K&32768?K|4294901760:K},a.prototype.readInt16BE=function(U,N){U=U>>>0,N||Q(U,2,this.length);const K=this[U+1]|this[U]<<8;return K&32768?K|4294901760:K},a.prototype.readInt32LE=function(U,N){return U=U>>>0,N||Q(U,4,this.length),this[U]|this[U+1]<<8|this[U+2]<<16|this[U+3]<<24},a.prototype.readInt32BE=function(U,N){return U=U>>>0,N||Q(U,4,this.length),this[U]<<24|this[U+1]<<16|this[U+2]<<8|this[U+3]},a.prototype.readBigInt64LE=ae(function(U){U=U>>>0,se(U,"offset");const N=this[U],K=this[U+7];(N===void 0||K===void 0)&&H(U,this.length-8);const oe=this[U+4]+this[U+5]*2**8+this[U+6]*2**16+(K<<24);return(BigInt(oe)<>>0,se(U,"offset");const N=this[U],K=this[U+7];(N===void 0||K===void 0)&&H(U,this.length-8);const oe=(N<<24)+this[++U]*2**16+this[++U]*2**8+this[++U];return(BigInt(oe)<>>0,N||Q(U,4,this.length),t.read(this,U,!0,23,4)},a.prototype.readFloatBE=function(U,N){return U=U>>>0,N||Q(U,4,this.length),t.read(this,U,!1,23,4)},a.prototype.readDoubleLE=function(U,N){return U=U>>>0,N||Q(U,8,this.length),t.read(this,U,!0,52,8)},a.prototype.readDoubleBE=function(U,N){return U=U>>>0,N||Q(U,8,this.length),t.read(this,U,!1,52,8)};function C(V,U,N,K,oe,pe){if(!a.isBuffer(V))throw new TypeError('"buffer" argument must be a Buffer instance');if(U>oe||UV.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(U,N,K,oe){if(U=+U,N=N>>>0,K=K>>>0,!oe){const Ce=Math.pow(2,8*K)-1;C(this,U,N,K,Ce,0)}let pe=1,ve=0;for(this[N]=U&255;++ve>>0,K=K>>>0,!oe){const Ce=Math.pow(2,8*K)-1;C(this,U,N,K,Ce,0)}let pe=K-1,ve=1;for(this[N+pe]=U&255;--pe>=0&&(ve*=256);)this[N+pe]=U/ve&255;return N+K},a.prototype.writeUint8=a.prototype.writeUInt8=function(U,N,K){return U=+U,N=N>>>0,K||C(this,U,N,1,255,0),this[N]=U&255,N+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(U,N,K){return U=+U,N=N>>>0,K||C(this,U,N,2,65535,0),this[N]=U&255,this[N+1]=U>>>8,N+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(U,N,K){return U=+U,N=N>>>0,K||C(this,U,N,2,65535,0),this[N]=U>>>8,this[N+1]=U&255,N+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(U,N,K){return U=+U,N=N>>>0,K||C(this,U,N,4,4294967295,0),this[N+3]=U>>>24,this[N+2]=U>>>16,this[N+1]=U>>>8,this[N]=U&255,N+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(U,N,K){return U=+U,N=N>>>0,K||C(this,U,N,4,4294967295,0),this[N]=U>>>24,this[N+1]=U>>>16,this[N+2]=U>>>8,this[N+3]=U&255,N+4};function W(V,U,N,K,oe){_e(U,K,oe,V,N,7);let pe=Number(U&BigInt(4294967295));V[N++]=pe,pe=pe>>8,V[N++]=pe,pe=pe>>8,V[N++]=pe,pe=pe>>8,V[N++]=pe;let ve=Number(U>>BigInt(32)&BigInt(4294967295));return V[N++]=ve,ve=ve>>8,V[N++]=ve,ve=ve>>8,V[N++]=ve,ve=ve>>8,V[N++]=ve,N}function ee(V,U,N,K,oe){_e(U,K,oe,V,N,7);let pe=Number(U&BigInt(4294967295));V[N+7]=pe,pe=pe>>8,V[N+6]=pe,pe=pe>>8,V[N+5]=pe,pe=pe>>8,V[N+4]=pe;let ve=Number(U>>BigInt(32)&BigInt(4294967295));return V[N+3]=ve,ve=ve>>8,V[N+2]=ve,ve=ve>>8,V[N+1]=ve,ve=ve>>8,V[N]=ve,N+8}a.prototype.writeBigUInt64LE=ae(function(U,N=0){return W(this,U,N,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=ae(function(U,N=0){return ee(this,U,N,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(U,N,K,oe){if(U=+U,N=N>>>0,!oe){const Le=Math.pow(2,8*K-1);C(this,U,N,K,Le-1,-Le)}let pe=0,ve=1,Ce=0;for(this[N]=U&255;++pe>0)-Ce&255;return N+K},a.prototype.writeIntBE=function(U,N,K,oe){if(U=+U,N=N>>>0,!oe){const Le=Math.pow(2,8*K-1);C(this,U,N,K,Le-1,-Le)}let pe=K-1,ve=1,Ce=0;for(this[N+pe]=U&255;--pe>=0&&(ve*=256);)U<0&&Ce===0&&this[N+pe+1]!==0&&(Ce=1),this[N+pe]=(U/ve>>0)-Ce&255;return N+K},a.prototype.writeInt8=function(U,N,K){return U=+U,N=N>>>0,K||C(this,U,N,1,127,-128),U<0&&(U=255+U+1),this[N]=U&255,N+1},a.prototype.writeInt16LE=function(U,N,K){return U=+U,N=N>>>0,K||C(this,U,N,2,32767,-32768),this[N]=U&255,this[N+1]=U>>>8,N+2},a.prototype.writeInt16BE=function(U,N,K){return U=+U,N=N>>>0,K||C(this,U,N,2,32767,-32768),this[N]=U>>>8,this[N+1]=U&255,N+2},a.prototype.writeInt32LE=function(U,N,K){return U=+U,N=N>>>0,K||C(this,U,N,4,2147483647,-2147483648),this[N]=U&255,this[N+1]=U>>>8,this[N+2]=U>>>16,this[N+3]=U>>>24,N+4},a.prototype.writeInt32BE=function(U,N,K){return U=+U,N=N>>>0,K||C(this,U,N,4,2147483647,-2147483648),U<0&&(U=4294967295+U+1),this[N]=U>>>24,this[N+1]=U>>>16,this[N+2]=U>>>8,this[N+3]=U&255,N+4},a.prototype.writeBigInt64LE=ae(function(U,N=0){return W(this,U,N,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=ae(function(U,N=0){return ee(this,U,N,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function P(V,U,N,K,oe,pe){if(N+K>V.length)throw new RangeError("Index out of range");if(N<0)throw new RangeError("Index out of range")}function re(V,U,N,K,oe){return U=+U,N=N>>>0,oe||P(V,U,N,4),t.write(V,U,N,K,23,4),N+4}a.prototype.writeFloatLE=function(U,N,K){return re(this,U,N,!0,K)},a.prototype.writeFloatBE=function(U,N,K){return re(this,U,N,!1,K)};function ue(V,U,N,K,oe){return U=+U,N=N>>>0,oe||P(V,U,N,8),t.write(V,U,N,K,52,8),N+8}a.prototype.writeDoubleLE=function(U,N,K){return ue(this,U,N,!0,K)},a.prototype.writeDoubleBE=function(U,N,K){return ue(this,U,N,!1,K)},a.prototype.copy=function(U,N,K,oe){if(!a.isBuffer(U))throw new TypeError("argument should be a Buffer");if(K||(K=0),!oe&&oe!==0&&(oe=this.length),N>=U.length&&(N=U.length),N||(N=0),oe>0&&oe=this.length)throw new RangeError("Index out of range");if(oe<0)throw new RangeError("sourceEnd out of bounds");oe>this.length&&(oe=this.length),U.length-N>>0,K=K===void 0?this.length:K>>>0,U||(U=0);let pe;if(typeof U=="number")for(pe=N;pe2**32?oe=ie(String(N)):typeof N=="bigint"&&(oe=String(N),(N>BigInt(2)**BigInt(32)||N<-(BigInt(2)**BigInt(32)))&&(oe=ie(oe)),oe+="n"),K+=` It must be ${U}. Received ${oe}`,K},RangeError);function ie(V){let U="",N=V.length;const K=V[0]==="-"?1:0;for(;N>=K+4;N-=3)U=`_${V.slice(N-3,N)}${U}`;return`${V.slice(0,N)}${U}`}function ge(V,U,N){se(U,"offset"),(V[U]===void 0||V[U+N]===void 0)&&H(U,V.length-(N+1))}function _e(V,U,N,K,oe,pe){if(V>N||V3?U===0||U===BigInt(0)?Ce=`>= 0${ve} and < 2${ve} ** ${(pe+1)*8}${ve}`:Ce=`>= -(2${ve} ** ${(pe+1)*8-1}${ve}) and < 2 ** ${(pe+1)*8-1}${ve}`:Ce=`>= ${U}${ve} and <= ${N}${ve}`,new le.ERR_OUT_OF_RANGE("value",Ce,V)}ge(K,oe,pe)}function se(V,U){if(typeof V!="number")throw new le.ERR_INVALID_ARG_TYPE(U,"number",V)}function H(V,U,N){throw Math.floor(V)!==V?(se(V,N),new le.ERR_OUT_OF_RANGE(N||"offset","an integer",V)):U<0?new le.ERR_BUFFER_OUT_OF_BOUNDS:new le.ERR_OUT_OF_RANGE(N||"offset",`>= ${N?1:0} and <= ${U}`,V)}const fe=/[^+/0-9A-Za-z-_]/g;function Ae(V){if(V=V.split("=")[0],V=V.trim().replace(fe,""),V.length<2)return"";for(;V.length%4!==0;)V=V+"=";return V}function J(V,U){U=U||1/0;let N;const K=V.length;let oe=null;const pe=[];for(let ve=0;ve55295&&N<57344){if(!oe){if(N>56319){(U-=3)>-1&&pe.push(239,191,189);continue}else if(ve+1===K){(U-=3)>-1&&pe.push(239,191,189);continue}oe=N;continue}if(N<56320){(U-=3)>-1&&pe.push(239,191,189),oe=N;continue}N=(oe-55296<<10|N-56320)+65536}else oe&&(U-=3)>-1&&pe.push(239,191,189);if(oe=null,N<128){if((U-=1)<0)break;pe.push(N)}else if(N<2048){if((U-=2)<0)break;pe.push(N>>6|192,N&63|128)}else if(N<65536){if((U-=3)<0)break;pe.push(N>>12|224,N>>6&63|128,N&63|128)}else if(N<1114112){if((U-=4)<0)break;pe.push(N>>18|240,N>>12&63|128,N>>6&63|128,N&63|128)}else throw new Error("Invalid code point")}return pe}function q(V){const U=[];for(let N=0;N>8,oe=N%256,pe.push(oe),pe.push(K);return pe}function X(V){return e.toByteArray(Ae(V))}function G(V,U,N,K){let oe;for(oe=0;oe=U.length||oe>=V.length);++oe)U[oe+N]=V[oe];return oe}function ne(V,U){return V instanceof U||V!=null&&V.constructor!=null&&V.constructor.name!=null&&V.constructor.name===U.name}function Y(V){return V!==V}const de=function(){const V="0123456789abcdef",U=new Array(256);for(let N=0;N<16;++N){const K=N*16;for(let oe=0;oe<16;++oe)U[K+oe]=V[N]+V[oe]}return U}();function ae(V){return typeof BigInt>"u"?Ee:V}function Ee(){throw new Error("BigInt not supported")}})(l8);/*! * html2canvas 1.4.1 * Copyright (c) 2022 Niklas von Hertzen * Released under MIT License @@ -3942,14 +3942,14 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var kC=function(n,e){return kC=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])},kC(n,e)};function ca(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");kC(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function qs(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})}function gs(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(A){return l([c,A])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]=55296&&i<=56319&&t>10)+55296,o%1024+56320)),(i+1===t||r.length>16384)&&(s+=String.fromCharCode.apply(String,r),r.length=0)}return s},OD="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ule=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Kv=0;Kv"u"?[]:new Uint8Array(256);for(var Xv=0;Xv>4,A[i++]=(o&15)<<4|a>>2,A[i++]=(a&3)<<6|l&63;return c},Ple=function(n){for(var e=n.length,t=[],r=0;r>bu,Nle=1<>bu,kle=c8+Ole,Hle=kle,Qle=32,zle=Hle+Qle,Gle=65536>>qR,Vle=1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>bu],t=(t<>bu)],t=(t<>qR),t=this.index[t],t+=e>>bu&jle,t=this.index[t],t=(t<"u"?[]:new Uint8Array(256);for(var Yv=0;YvzD?(i.push(!0),a-=zD):i.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(s)!==-1)return r.push(o),t.push(zC);if(a===Jle||a===HC){if(o===0)return r.push(o),t.push(lu);var l=t[o-1];return oce.indexOf(l)===-1?(r.push(r[o-1]),t.push(l)):(r.push(o),t.push(lu))}if(r.push(o),a===rce)return t.push(e==="strict"?GC:Xg);if(a===h8||a===nce)return t.push(lu);if(a===ice)return s>=131072&&s<=196605||s>=196608&&s<=262141?t.push(Xg):t.push(lu);t.push(a)}),[r,t,i]},pB=function(n,e,t,r){var i=r[t];if(Array.isArray(n)?n.indexOf(i)!==-1:n===i)for(var s=t;s<=r.length;){s++;var o=r[s];if(o===e)return!0;if(o!==$c)break}if(i===$c)for(var s=t;s>0;){s--;var a=r[s];if(Array.isArray(n)?n.indexOf(a)!==-1:n===a)for(var l=t;l<=r.length;){l++;var o=r[l];if(o===e)return!0;if(o!==$c)break}if(a!==$c)break}return!1},YD=function(n,e){for(var t=n;t>=0;){var r=e[t];if(r===$c)t--;else return r}return 0},cce=function(n,e,t,r,i){if(t[r]===0)return Ot;var s=r-1;if(Array.isArray(i)&&i[s]===!0)return Ot;var o=s-1,a=s+1,l=e[s],c=o>=0?e[o]:0,A=e[a];if(l===A8&&A===u8)return Ot;if(YC.indexOf(l)!==-1)return d8;if(YC.indexOf(A)!==-1||p8.indexOf(A)!==-1)return Ot;if(YD(s,e)===f8)return qv;if(XC.get(n[s])===HC||(l===Zv||l===Jv)&&XC.get(n[a])===HC||l===GD||A===GD||l===VD||[$c,QC,Em].indexOf(l)===-1&&A===VD||[$v,Hp,tce,Bf,Sf].indexOf(A)!==-1||YD(s,e)===Qp||pB(hB,Qp,s,e)||pB([$v,Hp],GC,s,e)||pB(jD,jD,s,e))return Ot;if(l===$c)return qv;if(l===hB||A===hB)return Ot;if(A===zC||l===zC)return qv;if([QC,Em,GC].indexOf(A)!==-1||l===ece||c===WC&&ace.indexOf(l)!==-1||l===Sf&&A===WC||A===WD||vl.indexOf(A)!==-1&&l===vs||vl.indexOf(l)!==-1&&A===vs||l===Sm&&[Xg,Zv,Jv].indexOf(A)!==-1||[Xg,Zv,Jv].indexOf(l)!==-1&&A===Bm||vl.indexOf(l)!==-1&&KD.indexOf(A)!==-1||KD.indexOf(l)!==-1&&vl.indexOf(A)!==-1||[Sm,Bm].indexOf(l)!==-1&&(A===vs||[Qp,Em].indexOf(A)!==-1&&e[a+1]===vs)||[Qp,Em].indexOf(l)!==-1&&A===vs||l===vs&&[vs,Sf,Bf].indexOf(A)!==-1)return Ot;if([vs,Sf,Bf,$v,Hp].indexOf(A)!==-1)for(var u=s;u>=0;){var f=e[u];if(f===vs)return Ot;if([Sf,Bf].indexOf(f)!==-1)u--;else break}if([Sm,Bm].indexOf(A)!==-1)for(var u=[$v,Hp].indexOf(l)!==-1?o:s;u>=0;){var f=e[u];if(f===vs)return Ot;if([Sf,Bf].indexOf(f)!==-1)u--;else break}if(KC===l&&[KC,Cw,VC,jC].indexOf(A)!==-1||[Cw,VC].indexOf(l)!==-1&&[Cw,Tw].indexOf(A)!==-1||[Tw,jC].indexOf(l)!==-1&&A===Tw||XD.indexOf(l)!==-1&&[WD,Bm].indexOf(A)!==-1||XD.indexOf(A)!==-1&&l===Sm||vl.indexOf(l)!==-1&&vl.indexOf(A)!==-1||l===Bf&&vl.indexOf(A)!==-1||vl.concat(vs).indexOf(l)!==-1&&A===Qp&&sce.indexOf(n[a])===-1||vl.concat(vs).indexOf(A)!==-1&&l===Hp)return Ot;if(l===dB&&A===dB){for(var h=t[s],d=1;h>0&&(h--,e[h]===dB);)d++;if(d%2!==0)return Ot}return l===Zv&&A===Jv?Ot:qv},Ace=function(n,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=lce(n,e.lineBreak),r=t[0],i=t[1],s=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(i=i.map(function(a){return[vs,lu,h8].indexOf(a)!==-1?Xg:a}));var o=e.wordBreak==="keep-all"?s.map(function(a,l){return a&&n[l]>=19968&&n[l]<=40959}):void 0;return[r,i,o]},uce=function(){function n(e,t,r,i){this.codePoints=e,this.required=t===d8,this.start=r,this.end=i}return n.prototype.slice=function(){return Ar.apply(void 0,this.codePoints.slice(this.start,this.end))},n}(),fce=function(n,e){var t=y1(n),r=Ace(t,e),i=r[0],s=r[1],o=r[2],a=t.length,l=0,c=0;return{next:function(){if(c>=a)return{done:!0,value:null};for(var A=Ot;c=m8&&n<=57},Wce=function(n){return n>=55296&&n<=57343},Mf=function(n){return gi(n)||n>=y8&&n<=_8||n>=g8&&n<=Qce},Kce=function(n){return n>=g8&&n<=Gce},Xce=function(n){return n>=y8&&n<=jce},Yce=function(n){return Kce(n)||Xce(n)},$ce=function(n){return n>=Rce},iy=function(n){return n===Q_||n===pce||n===mce},z_=function(n){return Yce(n)||$ce(n)||n===wce},eN=function(n){return z_(n)||gi(n)||n===Xi},Zce=function(n){return n>=Lce&&n<=Dce||n===Nce||n>=Oce&&n<=kce||n===Hce},Nc=function(n,e){return n!==ng?!1:e!==Q_},sy=function(n,e,t){return n===Xi?z_(e)||Nc(e,t):z_(n)?!0:!!(n===ng&&Nc(n,e))},gB=function(n,e,t){return n===hu||n===Xi?gi(e)?!0:e===Yg&&gi(t):gi(n===Yg?e:n)},Jce=function(n){var e=0,t=1;(n[e]===hu||n[e]===Xi)&&(n[e]===Xi&&(t=-1),e++);for(var r=[];gi(n[e]);)r.push(n[e++]);var i=r.length?parseInt(Ar.apply(void 0,r),10):0;n[e]===Yg&&e++;for(var s=[];gi(n[e]);)s.push(n[e++]);var o=s.length,a=o?parseInt(Ar.apply(void 0,s),10):0;(n[e]===w8||n[e]===v8)&&e++;var l=1;(n[e]===hu||n[e]===Xi)&&(n[e]===Xi&&(l=-1),e++);for(var c=[];gi(n[e]);)c.push(n[e++]);var A=c.length?parseInt(Ar.apply(void 0,c),10):0;return t*(i+a*Math.pow(10,-o))*Math.pow(10,l*A)},qce={type:2},eAe={type:3},tAe={type:4},nAe={type:13},rAe={type:8},iAe={type:21},sAe={type:9},oAe={type:10},aAe={type:11},lAe={type:12},cAe={type:14},oy={type:23},AAe={type:1},uAe={type:25},fAe={type:24},hAe={type:26},dAe={type:27},pAe={type:28},mAe={type:29},gAe={type:31},$C={type:32},x8=function(){function n(){this._value=[]}return n.prototype.write=function(e){this._value=this._value.concat(y1(e))},n.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==$C;)e.push(t),t=this.consumeToken();return e},n.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case ey:return this.consumeStringToken(ey);case gce:var t=this.peekCodePoint(0),r=this.peekCodePoint(1),i=this.peekCodePoint(2);if(eN(t)||Nc(r,i)){var s=sy(t,r,i)?dce:hce,o=this.consumeName();return{type:5,value:o,flags:s}}break;case vce:if(this.peekCodePoint(0)===zp)return this.consumeCodePoint(),nAe;break;case ty:return this.consumeStringToken(ty);case ny:return qce;case Gp:return eAe;case mB:if(this.peekCodePoint(0)===zp)return this.consumeCodePoint(),cAe;break;case hu:if(gB(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Uce:return tAe;case Xi:var a=e,l=this.peekCodePoint(0),c=this.peekCodePoint(1);if(gB(a,l,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(sy(a,l,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===Xi&&c===bce)return this.consumeCodePoint(),this.consumeCodePoint(),fAe;break;case Yg:if(gB(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case ZD:if(this.peekCodePoint(0)===mB)for(this.consumeCodePoint();;){var A=this.consumeCodePoint();if(A===mB&&(A=this.consumeCodePoint(),A===ZD))return this.consumeToken();if(A===ma)return this.consumeToken()}break;case Fce:return hAe;case Pce:return dAe;case xce:if(this.peekCodePoint(0)===_ce&&this.peekCodePoint(1)===Xi&&this.peekCodePoint(2)===Xi)return this.consumeCodePoint(),this.consumeCodePoint(),uAe;break;case Ece:var u=this.peekCodePoint(0),f=this.peekCodePoint(1),h=this.peekCodePoint(2);if(sy(u,f,h)){var o=this.consumeName();return{type:7,value:o}}break;case Bce:return pAe;case ng:if(Nc(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case Sce:return mAe;case Mce:if(this.peekCodePoint(0)===zp)return this.consumeCodePoint(),rAe;break;case Cce:return aAe;case Tce:return lAe;case zce:case Vce:var d=this.peekCodePoint(0),m=this.peekCodePoint(1);return d===hu&&(Mf(m)||m===ry)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case JD:if(this.peekCodePoint(0)===zp)return this.consumeCodePoint(),sAe;if(this.peekCodePoint(0)===JD)return this.consumeCodePoint(),iAe;break;case Ice:if(this.peekCodePoint(0)===zp)return this.consumeCodePoint(),oAe;break;case ma:return $C}return iy(e)?(this.consumeWhiteSpace(),gAe):gi(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):z_(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Ar(e)}},n.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},n.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},n.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},n.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();Mf(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var r=!1;t===ry&&e.length<6;)e.push(t),t=this.consumeCodePoint(),r=!0;if(r){var i=parseInt(Ar.apply(void 0,e.map(function(l){return l===ry?m8:l})),16),s=parseInt(Ar.apply(void 0,e.map(function(l){return l===ry?_8:l})),16);return{type:30,start:i,end:s}}var o=parseInt(Ar.apply(void 0,e),16);if(this.peekCodePoint(0)===Xi&&Mf(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var a=[];Mf(t)&&a.length<6;)a.push(t),t=this.consumeCodePoint();var s=parseInt(Ar.apply(void 0,a),16);return{type:30,start:o,end:s}}else return{type:30,start:o,end:o}},n.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===ny?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===ny?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},n.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===ma)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===ty||t===ey){var r=this.consumeStringToken(this.consumeCodePoint());return r.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===ma||this.peekCodePoint(0)===Gp)?(this.consumeCodePoint(),{type:22,value:r.value}):(this.consumeBadUrlRemnants(),oy)}for(;;){var i=this.consumeCodePoint();if(i===ma||i===Gp)return{type:22,value:Ar.apply(void 0,e)};if(iy(i))return this.consumeWhiteSpace(),this.peekCodePoint(0)===ma||this.peekCodePoint(0)===Gp?(this.consumeCodePoint(),{type:22,value:Ar.apply(void 0,e)}):(this.consumeBadUrlRemnants(),oy);if(i===ey||i===ty||i===ny||Zce(i))return this.consumeBadUrlRemnants(),oy;if(i===ng)if(Nc(i,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),oy;else e.push(i)}},n.prototype.consumeWhiteSpace=function(){for(;iy(this.peekCodePoint(0));)this.consumeCodePoint()},n.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===Gp||e===ma)return;Nc(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},n.prototype.consumeStringSlice=function(e){for(var t=5e4,r="";e>0;){var i=Math.min(t,e);r+=Ar.apply(void 0,this._value.splice(0,i)),e-=i}return this._value.shift(),r},n.prototype.consumeStringToken=function(e){var t="",r=0;do{var i=this._value[r];if(i===ma||i===void 0||i===e)return t+=this.consumeStringSlice(r),{type:0,value:t};if(i===Q_)return this._value.splice(0,r),AAe;if(i===ng){var s=this._value[r+1];s!==ma&&s!==void 0&&(s===Q_?(t+=this.consumeStringSlice(r),r=-1,this._value.shift()):Nc(i,s)&&(t+=this.consumeStringSlice(r),t+=Ar(this.consumeEscapedCodePoint()),r=-1))}r++}while(!0)},n.prototype.consumeNumber=function(){var e=[],t=x0,r=this.peekCodePoint(0);for((r===hu||r===Xi)&&e.push(this.consumeCodePoint());gi(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0);var i=this.peekCodePoint(1);if(r===Yg&&gi(i))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=$D;gi(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0),i=this.peekCodePoint(1);var s=this.peekCodePoint(2);if((r===w8||r===v8)&&((i===hu||i===Xi)&&gi(s)||gi(i)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=$D;gi(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[Jce(e),t]},n.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],r=e[1],i=this.peekCodePoint(0),s=this.peekCodePoint(1),o=this.peekCodePoint(2);if(sy(i,s,o)){var a=this.consumeName();return{type:15,number:t,flags:r,unit:a}}return i===yce?(this.consumeCodePoint(),{type:16,number:t,flags:r}):{type:17,number:t,flags:r}},n.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Mf(e)){for(var t=Ar(e);Mf(this.peekCodePoint(0))&&t.length<6;)t+=Ar(this.consumeCodePoint());iy(this.peekCodePoint(0))&&this.consumeCodePoint();var r=parseInt(t,16);return r===0||Wce(r)||r>1114111?qD:r}return e===ma?qD:e},n.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(eN(t))e+=Ar(t);else if(Nc(t,this.peekCodePoint(0)))e+=Ar(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},n}(),b8=function(){function n(e){this._tokens=e}return n.create=function(e){var t=new x8;return t.write(e),new n(t.read())},n.parseValue=function(e){return n.create(e).parseComponentValue()},n.parseValues=function(e){return n.create(e).parseComponentValues()},n.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},n.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},n.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},n.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},r=this.consumeToken();;){if(r.type===32||vAe(r,e))return t;this.reconsumeToken(r),t.values.push(this.consumeComponentValue()),r=this.consumeToken()}},n.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var r=this.consumeToken();if(r.type===32||r.type===3)return t;this.reconsumeToken(r),t.values.push(this.consumeComponentValue())}},n.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?$C:e},n.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},n}(),b0=function(n){return n.type===15},w1=function(n){return n.type===17},ir=function(n){return n.type===20},ZC=function(n,e){return ir(n)&&n.value===e},_1=function(n){return n.type!==31&&n.type!==4},ll=function(n){var e=[],t=[];return n.forEach(function(r){if(r.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}r.type!==31&&t.push(r)}),t.length&&e.push(t),e},vAe=function(n,e){return e===11&&n.type===12||e===28&&n.type===29?!0:e===2&&n.type===3},wA=function(n){return n.type===17||n.type===15},br=function(n){return n.type===16||wA(n)},E8=function(n){return n.length>1?[n[0],n[1]]:[n[0]]},ii={type:17,number:0,flags:x0},e2={type:16,number:50,flags:x0},Zc={type:16,number:100,flags:x0},Mm=function(n,e,t){var r=n[0],i=n[1];return[bn(r,e),bn(typeof i<"u"?i:r,t)]},bn=function(n,e){if(n.type===16)return n.number/100*e;if(b0(n))switch(n.unit){case"rem":case"em":return 16*n.number;case"px":default:return n.number}return n.number},B8="deg",S8="grad",M8="rad",C8="turn",x1={name:"angle",parse:function(n,e){if(e.type===15)switch(e.unit){case B8:return Math.PI*e.number/180;case S8:return Math.PI/200*e.number;case M8:return e.number;case C8:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},T8=function(n){return n.type===15&&(n.unit===B8||n.unit===S8||n.unit===M8||n.unit===C8)},I8=function(n){var e=n.filter(ir).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[ii,ii];case"to top":case"bottom":return fo(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[ii,Zc];case"to right":case"left":return fo(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[Zc,Zc];case"to bottom":case"top":return fo(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[Zc,ii];case"to left":case"right":return fo(270)}return 0},fo=function(n){return Math.PI*n/180},fA={name:"color",parse:function(n,e){if(e.type===18){var t=yAe[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return t(n,e.values)}if(e.type===5){if(e.value.length===3){var r=e.value.substring(0,1),i=e.value.substring(1,2),s=e.value.substring(2,3);return Jc(parseInt(r+r,16),parseInt(i+i,16),parseInt(s+s,16),1)}if(e.value.length===4){var r=e.value.substring(0,1),i=e.value.substring(1,2),s=e.value.substring(2,3),o=e.value.substring(3,4);return Jc(parseInt(r+r,16),parseInt(i+i,16),parseInt(s+s,16),parseInt(o+o,16)/255)}if(e.value.length===6){var r=e.value.substring(0,2),i=e.value.substring(2,4),s=e.value.substring(4,6);return Jc(parseInt(r,16),parseInt(i,16),parseInt(s,16),1)}if(e.value.length===8){var r=e.value.substring(0,2),i=e.value.substring(2,4),s=e.value.substring(4,6),o=e.value.substring(6,8);return Jc(parseInt(r,16),parseInt(i,16),parseInt(s,16),parseInt(o,16)/255)}}if(e.type===20){var a=$g[e.value.toUpperCase()];if(typeof a<"u")return a}return $g.TRANSPARENT}},ld=function(n){return(255&n)===0},Qr=function(n){var e=255&n,t=255&n>>8,r=255&n>>16,i=255&n>>24;return e<255?"rgba("+i+","+r+","+t+","+e/255+")":"rgb("+i+","+r+","+t+")"},Jc=function(n,e,t,r){return(n<<24|e<<16|t<<8|Math.round(r*255)<<0)>>>0},tN=function(n,e){if(n.type===17)return n.number;if(n.type===16){var t=e===3?1:255;return e===3?n.number/100*t:Math.round(n.number/100*t)}return 0},nN=function(n,e){var t=e.filter(_1);if(t.length===3){var r=t.map(tN),i=r[0],s=r[1],o=r[2];return Jc(i,s,o,1)}if(t.length===4){var a=t.map(tN),i=a[0],s=a[1],o=a[2],l=a[3];return Jc(i,s,o,l)}return 0};function vB(n,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-n)*t*6+n:t<1/2?e:t<2/3?(e-n)*6*(2/3-t)+n:n}var rN=function(n,e){var t=e.filter(_1),r=t[0],i=t[1],s=t[2],o=t[3],a=(r.type===17?fo(r.number):x1.parse(n,r))/(Math.PI*2),l=br(i)?i.number/100:0,c=br(s)?s.number/100:0,A=typeof o<"u"&&br(o)?bn(o,1):1;if(l===0)return Jc(c*255,c*255,c*255,1);var u=c<=.5?c*(l+1):c+l-c*l,f=c*2-u,h=vB(f,u,a+1/3),d=vB(f,u,a),m=vB(f,u,a-1/3);return Jc(h*255,d*255,m*255,A)},yAe={hsl:rN,hsla:rN,rgb:nN,rgba:nN},iN=function(n,e){return fA.parse(n,b8.create(e).parseComponentValue())},$g={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},wAe={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(ir(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},_Ae={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},b1=function(n,e){var t=fA.parse(n,e[0]),r=e[1];return r&&br(r)?{color:t,stop:r}:{color:t,stop:null}},sN=function(n,e){var t=n[0],r=n[n.length-1];t.stop===null&&(t.stop=ii),r.stop===null&&(r.stop=Zc);for(var i=[],s=0,o=0;os?i.push(l):i.push(s),s=l}else i.push(null)}for(var c=null,o=0;oo.optimumDistance)?{optimumCorner:a,optimumDistance:A}:o},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},EAe=function(n,e,t,r,i){var s=0,o=0;switch(n.size){case 0:n.shape===0?s=o=Math.min(Math.abs(e),Math.abs(e-r),Math.abs(t),Math.abs(t-i)):n.shape===1&&(s=Math.min(Math.abs(e),Math.abs(e-r)),o=Math.min(Math.abs(t),Math.abs(t-i)));break;case 2:if(n.shape===0)s=o=Math.min(Qo(e,t),Qo(e,t-i),Qo(e-r,t),Qo(e-r,t-i));else if(n.shape===1){var a=Math.min(Math.abs(t),Math.abs(t-i))/Math.min(Math.abs(e),Math.abs(e-r)),l=oN(r,i,e,t,!0),c=l[0],A=l[1];s=Qo(c-e,(A-t)/a),o=a*s}break;case 1:n.shape===0?s=o=Math.max(Math.abs(e),Math.abs(e-r),Math.abs(t),Math.abs(t-i)):n.shape===1&&(s=Math.max(Math.abs(e),Math.abs(e-r)),o=Math.max(Math.abs(t),Math.abs(t-i)));break;case 3:if(n.shape===0)s=o=Math.max(Qo(e,t),Qo(e,t-i),Qo(e-r,t),Qo(e-r,t-i));else if(n.shape===1){var a=Math.max(Math.abs(t),Math.abs(t-i))/Math.max(Math.abs(e),Math.abs(e-r)),u=oN(r,i,e,t,!1),c=u[0],A=u[1];s=Qo(c-e,(A-t)/a),o=a*s}break}return Array.isArray(n.size)&&(s=bn(n.size[0],r),o=n.size.length===2?bn(n.size[1],i):s),[s,o]},BAe=function(n,e){var t=fo(180),r=[];return ll(e).forEach(function(i,s){if(s===0){var o=i[0];if(o.type===20&&o.value==="to"){t=I8(i);return}else if(T8(o)){t=x1.parse(n,o);return}}var a=b1(n,i);r.push(a)}),{angle:t,stops:r,type:1}},ay=function(n,e){var t=fo(180),r=[];return ll(e).forEach(function(i,s){if(s===0){var o=i[0];if(o.type===20&&["top","left","right","bottom"].indexOf(o.value)!==-1){t=I8(i);return}else if(T8(o)){t=(x1.parse(n,o)+fo(270))%fo(360);return}}var a=b1(n,i);r.push(a)}),{angle:t,stops:r,type:1}},SAe=function(n,e){var t=fo(180),r=[],i=1,s=0,o=3,a=[];return ll(e).forEach(function(l,c){var A=l[0];if(c===0){if(ir(A)&&A.value==="linear"){i=1;return}else if(ir(A)&&A.value==="radial"){i=2;return}}if(A.type===18){if(A.name==="from"){var u=fA.parse(n,A.values[0]);r.push({stop:ii,color:u})}else if(A.name==="to"){var u=fA.parse(n,A.values[0]);r.push({stop:Zc,color:u})}else if(A.name==="color-stop"){var f=A.values.filter(_1);if(f.length===2){var u=fA.parse(n,f[1]),h=f[0];w1(h)&&r.push({stop:{type:16,number:h.number*100,flags:h.flags},color:u})}}}}),i===1?{angle:(t+fo(180))%fo(360),stops:r,type:i}:{size:o,shape:s,stops:r,position:a,type:i}},R8="closest-side",U8="farthest-side",F8="closest-corner",P8="farthest-corner",L8="circle",D8="ellipse",N8="cover",O8="contain",MAe=function(n,e){var t=0,r=3,i=[],s=[];return ll(e).forEach(function(o,a){var l=!0;if(a===0){var c=!1;l=o.reduce(function(u,f){if(c)if(ir(f))switch(f.value){case"center":return s.push(e2),u;case"top":case"left":return s.push(ii),u;case"right":case"bottom":return s.push(Zc),u}else(br(f)||wA(f))&&s.push(f);else if(ir(f))switch(f.value){case L8:return t=0,!1;case D8:return t=1,!1;case"at":return c=!0,!1;case R8:return r=0,!1;case N8:case U8:return r=1,!1;case O8:case F8:return r=2,!1;case P8:return r=3,!1}else if(wA(f)||br(f))return Array.isArray(r)||(r=[]),r.push(f),!1;return u},l)}if(l){var A=b1(n,o);i.push(A)}}),{size:r,shape:t,stops:i,position:s,type:2}},ly=function(n,e){var t=0,r=3,i=[],s=[];return ll(e).forEach(function(o,a){var l=!0;if(a===0?l=o.reduce(function(A,u){if(ir(u))switch(u.value){case"center":return s.push(e2),!1;case"top":case"left":return s.push(ii),!1;case"right":case"bottom":return s.push(Zc),!1}else if(br(u)||wA(u))return s.push(u),!1;return A},l):a===1&&(l=o.reduce(function(A,u){if(ir(u))switch(u.value){case L8:return t=0,!1;case D8:return t=1,!1;case O8:case R8:return r=0,!1;case U8:return r=1,!1;case F8:return r=2,!1;case N8:case P8:return r=3,!1}else if(wA(u)||br(u))return Array.isArray(r)||(r=[]),r.push(u),!1;return A},l)),l){var c=b1(n,o);i.push(c)}}),{size:r,shape:t,stops:i,position:s,type:2}},CAe=function(n){return n.type===1},TAe=function(n){return n.type===2},t2={name:"image",parse:function(n,e){if(e.type===22){var t={url:e.value,type:0};return n.cache.addImage(e.value),t}if(e.type===18){var r=k8[e.name];if(typeof r>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return r(n,e.values)}throw new Error("Unsupported image type "+e.type)}};function IAe(n){return!(n.type===20&&n.value==="none")&&(n.type!==18||!!k8[n.name])}var k8={"linear-gradient":BAe,"-moz-linear-gradient":ay,"-ms-linear-gradient":ay,"-o-linear-gradient":ay,"-webkit-linear-gradient":ay,"radial-gradient":MAe,"-moz-radial-gradient":ly,"-ms-radial-gradient":ly,"-o-radial-gradient":ly,"-webkit-radial-gradient":ly,"-webkit-gradient":SAe},RAe={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(n,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(r){return _1(r)&&IAe(r)}).map(function(r){return t2.parse(n,r)})}},UAe={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(ir(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},FAe={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(n,e){return ll(e).map(function(t){return t.filter(br)}).map(E8)}},PAe={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(n,e){return ll(e).map(function(t){return t.filter(ir).map(function(r){return r.value}).join(" ")}).map(LAe)}},LAe=function(n){switch(n){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},cd;(function(n){n.AUTO="auto",n.CONTAIN="contain",n.COVER="cover"})(cd||(cd={}));var DAe={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(n,e){return ll(e).map(function(t){return t.filter(NAe)})}},NAe=function(n){return ir(n)||br(n)},E1=function(n){return{name:"border-"+n+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},OAe=E1("top"),kAe=E1("right"),HAe=E1("bottom"),QAe=E1("left"),B1=function(n){return{name:"border-radius-"+n,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return E8(t.filter(br))}}},zAe=B1("top-left"),GAe=B1("top-right"),VAe=B1("bottom-right"),jAe=B1("bottom-left"),S1=function(n){return{name:"border-"+n+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},WAe=S1("top"),KAe=S1("right"),XAe=S1("bottom"),YAe=S1("left"),M1=function(n){return{name:"border-"+n+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return b0(t)?t.number:0}}},$Ae=M1("top"),ZAe=M1("right"),JAe=M1("bottom"),qAe=M1("left"),eue={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},tue={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(n,e){switch(e){case"rtl":return 1;case"ltr":default:return 0}}},nue={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(n,e){return e.filter(ir).reduce(function(t,r){return t|rue(r.value)},0)}},rue=function(n){switch(n){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},iue={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},sue={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(n,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},G_;(function(n){n.NORMAL="normal",n.STRICT="strict"})(G_||(G_={}));var oue={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"strict":return G_.STRICT;case"normal":default:return G_.NORMAL}}},aue={name:"line-height",initialValue:"normal",prefix:!1,type:4},aN=function(n,e){return ir(n)&&n.value==="normal"?1.2*e:n.type===17?e*n.number:br(n)?bn(n,e):e},lue={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(n,e){return e.type===20&&e.value==="none"?null:t2.parse(n,e)}},cue={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(n,e){switch(e){case"inside":return 0;case"outside":default:return 1}}},Aue={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},C1=function(n){return{name:"margin-"+n,initialValue:"0",prefix:!1,type:4}},uue=C1("top"),fue=C1("right"),hue=C1("bottom"),due=C1("left"),pue={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(n,e){return e.filter(ir).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},mue={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"break-word":return"break-word";case"normal":default:return"normal"}}},T1=function(n){return{name:"padding-"+n,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},gue=T1("top"),vue=T1("right"),yue=T1("bottom"),wue=T1("left"),_ue={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(n,e){switch(e){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},xue={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(n,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},bue={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&ZC(e[0],"none")?[]:ll(e).map(function(t){for(var r={color:$g.TRANSPARENT,offsetX:ii,offsetY:ii,blur:ii},i=0,s=0;s"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},Sue=function(n){var e=n.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},Mue=function(n){var e=n.filter(function(l){return l.type===17}).map(function(l){return l.number}),t=e[0],r=e[1];e[2],e[3];var i=e[4],s=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var o=e[12],a=e[13];return e[14],e[15],e.length===16?[t,r,i,s,o,a]:null},Cue={matrix:Sue,matrix3d:Mue},lN={type:16,number:50,flags:x0},Tue=[lN,lN],Iue={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(n,e){var t=e.filter(br);return t.length!==2?Tue:[t[0],t[1]]}},Rue={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},rg;(function(n){n.NORMAL="normal",n.BREAK_ALL="break-all",n.KEEP_ALL="keep-all"})(rg||(rg={}));var Uue={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"break-all":return rg.BREAK_ALL;case"keep-all":return rg.KEEP_ALL;case"normal":default:return rg.NORMAL}}},Fue={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(n,e){if(e.type===20)return{auto:!0,order:0};if(w1(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},H8={name:"time",parse:function(n,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},Pue={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(n,e){return w1(e)?e.number:1}},Lue={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Due={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(n,e){return e.filter(ir).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return t!==0})}},Nue={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(n,e){var t=[],r=[];return e.forEach(function(i){switch(i.type){case 20:case 0:t.push(i.value);break;case 17:t.push(i.number.toString());break;case 4:r.push(t.join(" ")),t.length=0;break}}),t.length&&r.push(t.join(" ")),r.map(function(i){return i.indexOf(" ")===-1?i:"'"+i+"'"})}},Oue={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},kue={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(n,e){if(w1(e))return e.number;if(ir(e))switch(e.value){case"bold":return 700;case"normal":default:return 400}return 400}},Hue={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.filter(ir).map(function(t){return t.value})}},Que={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},Pr=function(n,e){return(n&e)!==0},zue={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(n,e){return e.filter(b0).map(function(t){return H8.parse(n,t)})}},Gue={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&ZC(e[0],"none")?[]:ll(e).map(function(t){for(var r={color:255,offsetX:ii,offsetY:ii,blur:ii,spread:ii,inset:!1},i=0,s=0;s1?1:0],this.overflowWrap=et(e,mue,t.overflowWrap),this.paddingTop=et(e,gue,t.paddingTop),this.paddingRight=et(e,vue,t.paddingRight),this.paddingBottom=et(e,yue,t.paddingBottom),this.paddingLeft=et(e,wue,t.paddingLeft),this.paintOrder=et(e,Vue,t.paintOrder),this.position=et(e,xue,t.position),this.textAlign=et(e,_ue,t.textAlign),this.textDecorationColor=et(e,Lue,(r=t.textDecorationColor)!==null&&r!==void 0?r:t.color),this.textDecorationLine=et(e,Due,(i=t.textDecorationLine)!==null&&i!==void 0?i:t.textDecoration),this.textShadow=et(e,bue,t.textShadow),this.textTransform=et(e,Eue,t.textTransform),this.transform=et(e,Bue,t.transform),this.transformOrigin=et(e,Iue,t.transformOrigin),this.visibility=et(e,Rue,t.visibility),this.webkitTextStrokeColor=et(e,jue,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=et(e,Wue,t.webkitTextStrokeWidth),this.wordBreak=et(e,Uue,t.wordBreak),this.zIndex=et(e,Fue,t.zIndex)}return n.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},n.prototype.isTransparent=function(){return ld(this.backgroundColor)},n.prototype.isTransformed=function(){return this.transform!==null},n.prototype.isPositioned=function(){return this.position!==0},n.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},n.prototype.isFloating=function(){return this.float!==0},n.prototype.isInlineLevel=function(){return Pr(this.display,4)||Pr(this.display,33554432)||Pr(this.display,268435456)||Pr(this.display,536870912)||Pr(this.display,67108864)||Pr(this.display,134217728)},n}(),et=function(n,e,t){var r=new x8,i=t!==null&&typeof t<"u"?t.toString():e.initialValue;r.write(i);var s=new b8(r.read());switch(e.type){case 2:var o=s.parseComponentValue();return e.parse(n,ir(o)?o.value:e.initialValue);case 0:return e.parse(n,s.parseComponentValue());case 1:return e.parse(n,s.parseComponentValues());case 4:return s.parseComponentValue();case 3:switch(e.format){case"angle":return x1.parse(n,s.parseComponentValue());case"color":return fA.parse(n,s.parseComponentValue());case"image":return t2.parse(n,s.parseComponentValue());case"length":var a=s.parseComponentValue();return wA(a)?a:ii;case"length-percentage":var l=s.parseComponentValue();return br(l)?l:ii;case"time":return H8.parse(n,s.parseComponentValue())}break}},Xue="data-html2canvas-debug",Yue=function(n){var e=n.getAttribute(Xue);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},cN=function(n,e){var t=Yue(n);return t===1||e===t},cl=function(){function n(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,cN(t,3))debugger;this.styles=new Kue(e,window.getComputedStyle(t,null)),Yfe(t)&&(this.styles.animationDuration.some(function(r){return r>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=JR(this.context,t),cN(t,4)&&(this.flags|=16)}return n}(),$ue="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",AN="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cm=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var cy=0;cy>4,A[i++]=(o&15)<<4|a>>2,A[i++]=(a&3)<<6|l&63;return c},Jue=function(n){for(var e=n.length,t=[],r=0;r>Eu,tfe=1<>Eu,rfe=Q8+nfe,ife=rfe,sfe=32,ofe=ife+sfe,afe=65536>>n2,lfe=1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Eu],t=(t<>Eu)],t=(t<>n2),t=this.index[t],t+=e>>Eu&cfe,t=this.index[t],t=(t<"u"?[]:new Uint8Array(256);for(var Ay=0;Ay=55296&&i<=56319&&t>10)+55296,o%1024+56320)),(i+1===t||r.length>16384)&&(s+=String.fromCharCode.apply(String,r),r.length=0)}return s},vfe=ufe($ue),ro="×",SB="÷",yfe=function(n){return vfe.get(n)},wfe=function(n,e,t){var r=t-2,i=e[r],s=e[t-1],o=e[t];if(s===_B&&o===xB)return ro;if(s===_B||s===xB||s===hN||o===_B||o===xB||o===hN)return SB;if(s===pN&&[pN,bB,mN,gN].indexOf(o)!==-1||(s===mN||s===bB)&&(o===bB||o===EB)||(s===gN||s===EB)&&o===EB||o===vN||o===dN||o===pfe||s===dfe)return ro;if(s===vN&&o===yN){for(;i===dN;)i=e[--r];if(i===yN)return ro}if(s===BB&&o===BB){for(var a=0;i===BB;)a++,i=e[--r];if(a%2===0)return ro}return SB},_fe=function(n){var e=mfe(n),t=e.length,r=0,i=0,s=e.map(yfe);return{next:function(){if(r>=t)return{done:!0,value:null};for(var o=ro;ro.x||A.y>o.y;return o=A,c===0?!0:u});return n.body.removeChild(e),a},Bfe=function(){return typeof new Image().crossOrigin<"u"},Sfe=function(){return typeof new XMLHttpRequest().responseType=="string"},Mfe=function(n){var e=new Image,t=n.createElement("canvas"),r=t.getContext("2d");if(!r)return!1;e.src="data:image/svg+xml,";try{r.drawImage(e,0,0),t.toDataURL()}catch{return!1}return!0},wN=function(n){return n[0]===0&&n[1]===255&&n[2]===0&&n[3]===255},Cfe=function(n){var e=n.createElement("canvas"),t=100;e.width=t,e.height=t;var r=e.getContext("2d");if(!r)return Promise.reject(!1);r.fillStyle="rgb(0, 255, 0)",r.fillRect(0,0,t,t);var i=new Image,s=e.toDataURL();i.src=s;var o=JC(t,t,0,0,i);return r.fillStyle="red",r.fillRect(0,0,t,t),_N(o).then(function(a){r.drawImage(a,0,0);var l=r.getImageData(0,0,t,t).data;r.fillStyle="red",r.fillRect(0,0,t,t);var c=n.createElement("div");return c.style.backgroundImage="url("+s+")",c.style.height=t+"px",wN(l)?_N(JC(t,t,0,0,c)):Promise.reject(!1)}).then(function(a){return r.drawImage(a,0,0),wN(r.getImageData(0,0,t,t).data)}).catch(function(){return!1})},JC=function(n,e,t,r,i){var s="http://www.w3.org/2000/svg",o=document.createElementNS(s,"svg"),a=document.createElementNS(s,"foreignObject");return o.setAttributeNS(null,"width",n.toString()),o.setAttributeNS(null,"height",e.toString()),a.setAttributeNS(null,"width","100%"),a.setAttributeNS(null,"height","100%"),a.setAttributeNS(null,"x",t.toString()),a.setAttributeNS(null,"y",r.toString()),a.setAttributeNS(null,"externalResourcesRequired","true"),o.appendChild(a),a.appendChild(i),o},_N=function(n){return new Promise(function(e,t){var r=new Image;r.onload=function(){return e(r)},r.onerror=t,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(n))})},_s={get SUPPORT_RANGE_BOUNDS(){var n=bfe(document);return Object.defineProperty(_s,"SUPPORT_RANGE_BOUNDS",{value:n}),n},get SUPPORT_WORD_BREAKING(){var n=_s.SUPPORT_RANGE_BOUNDS&&Efe(document);return Object.defineProperty(_s,"SUPPORT_WORD_BREAKING",{value:n}),n},get SUPPORT_SVG_DRAWING(){var n=Mfe(document);return Object.defineProperty(_s,"SUPPORT_SVG_DRAWING",{value:n}),n},get SUPPORT_FOREIGNOBJECT_DRAWING(){var n=typeof Array.from=="function"&&typeof window.fetch=="function"?Cfe(document):Promise.resolve(!1);return Object.defineProperty(_s,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:n}),n},get SUPPORT_CORS_IMAGES(){var n=Bfe();return Object.defineProperty(_s,"SUPPORT_CORS_IMAGES",{value:n}),n},get SUPPORT_RESPONSE_TYPE(){var n=Sfe();return Object.defineProperty(_s,"SUPPORT_RESPONSE_TYPE",{value:n}),n},get SUPPORT_CORS_XHR(){var n="withCredentials"in new XMLHttpRequest;return Object.defineProperty(_s,"SUPPORT_CORS_XHR",{value:n}),n},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var n=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(_s,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:n}),n}},ig=function(){function n(e,t){this.text=e,this.bounds=t}return n}(),Tfe=function(n,e,t,r){var i=Ufe(e,t),s=[],o=0;return i.forEach(function(a){if(t.textDecorationLine.length||a.trim().length>0)if(_s.SUPPORT_RANGE_BOUNDS){var l=xN(r,o,a.length).getClientRects();if(l.length>1){var c=r2(a),A=0;c.forEach(function(f){s.push(new ig(f,Ou.fromDOMRectList(n,xN(r,A+o,f.length).getClientRects()))),A+=f.length})}else s.push(new ig(a,Ou.fromDOMRectList(n,l)))}else{var u=r.splitText(a.length);s.push(new ig(a,Ife(n,r))),r=u}else _s.SUPPORT_RANGE_BOUNDS||(r=r.splitText(a.length));o+=a.length}),s},Ife=function(n,e){var t=e.ownerDocument;if(t){var r=t.createElement("html2canvaswrapper");r.appendChild(e.cloneNode(!0));var i=e.parentNode;if(i){i.replaceChild(r,e);var s=JR(n,r);return r.firstChild&&i.replaceChild(r.firstChild,r),s}}return Ou.EMPTY},xN=function(n,e,t){var r=n.ownerDocument;if(!r)throw new Error("Node has no owner document");var i=r.createRange();return i.setStart(n,e),i.setEnd(n,e+t),i},r2=function(n){if(_s.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(n)).map(function(t){return t.segment})}return xfe(n)},Rfe=function(n,e){if(_s.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(n)).map(function(r){return r.segment})}return Pfe(n,e)},Ufe=function(n,e){return e.letterSpacing!==0?r2(n):Rfe(n,e)},Ffe=[32,160,4961,65792,65793,4153,4241],Pfe=function(n,e){for(var t=fce(n,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),r=[],i,s=function(){if(i.value){var o=i.value.slice(),a=y1(o),l="";a.forEach(function(c){Ffe.indexOf(c)===-1?l+=Ar(c):(l.length&&r.push(l),r.push(Ar(c)),l="")}),l.length&&r.push(l)}};!(i=t.next()).done;)s();return r},Lfe=function(){function n(e,t,r){this.text=Dfe(t.data,r.textTransform),this.textBounds=Tfe(e,this.text,r,t)}return n}(),Dfe=function(n,e){switch(e){case 1:return n.toLowerCase();case 3:return n.replace(Nfe,Ofe);case 2:return n.toUpperCase();default:return n}},Nfe=/(^|\s|:|-|\(|\))([a-z])/g,Ofe=function(n,e,t){return n.length>0?e+t.toUpperCase():n},z8=function(n){ca(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.src=r.currentSrc||r.src,i.intrinsicWidth=r.naturalWidth,i.intrinsicHeight=r.naturalHeight,i.context.cache.addImage(i.src),i}return e}(cl),G8=function(n){ca(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.canvas=r,i.intrinsicWidth=r.width,i.intrinsicHeight=r.height,i}return e}(cl),V8=function(n){ca(e,n);function e(t,r){var i=n.call(this,t,r)||this,s=new XMLSerializer,o=JR(t,r);return r.setAttribute("width",o.width+"px"),r.setAttribute("height",o.height+"px"),i.svg="data:image/svg+xml,"+encodeURIComponent(s.serializeToString(r)),i.intrinsicWidth=r.width.baseVal.value,i.intrinsicHeight=r.height.baseVal.value,i.context.cache.addImage(i.svg),i}return e}(cl),j8=function(n){ca(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.value=r.value,i}return e}(cl),qC=function(n){ca(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.start=r.start,i.reversed=typeof r.reversed=="boolean"&&r.reversed===!0,i}return e}(cl),kfe=[{type:15,flags:0,unit:"px",number:3}],Hfe=[{type:16,flags:0,number:50}],Qfe=function(n){return n.width>n.height?new Ou(n.left+(n.width-n.height)/2,n.top,n.height,n.height):n.width0)t.textNodes.push(new Lfe(n,i,t.styles));else if($8(i))if(ihe(i)&&i.assignedNodes)i.assignedNodes().forEach(function(a){return Iw(n,a,t,r)});else{var o=Y8(n,i);o.styles.isVisible()&&(Wfe(i,o,r)?o.flags|=4:Kfe(o.styles)&&(o.flags|=2),Vfe.indexOf(i.tagName)!==-1&&(o.flags|=8),t.elements.push(o),i.slot,i.shadowRoot?Iw(n,i.shadowRoot,o,r):!J8(i)&&!Z8(i)&&!q8(i)&&Iw(n,i,o,r))}},Y8=function(n,e){return nhe(e)?new z8(n,e):the(e)?new G8(n,e):Z8(e)?new V8(n,e):Zfe(e)?new j8(n,e):Jfe(e)?new qC(n,e):qfe(e)?new i2(n,e):q8(e)?new W8(n,e):J8(e)?new K8(n,e):rhe(e)?new X8(n,e):new cl(n,e)},jfe=function(n,e){var t=Y8(n,e);return t.flags|=4,Iw(n,e,t,t),t},Wfe=function(n,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||ehe(n)&&t.styles.isTransparent()},Kfe=function(n){return n.isPositioned()||n.isFloating()},Xfe=function(n){return n.nodeType===Node.TEXT_NODE},$8=function(n){return n.nodeType===Node.ELEMENT_NODE},Yfe=function(n){return $8(n)&&typeof n.style<"u"&&!$fe(n)},$fe=function(n){return typeof n.className=="object"},Zfe=function(n){return n.tagName==="LI"},Jfe=function(n){return n.tagName==="OL"},qfe=function(n){return n.tagName==="INPUT"},Z8=function(n){return n.tagName==="svg"},ehe=function(n){return n.tagName==="BODY"},the=function(n){return n.tagName==="CANVAS"},nhe=function(n){return n.tagName==="IMG"},rhe=function(n){return n.tagName==="IFRAME"},J8=function(n){return n.tagName==="TEXTAREA"},q8=function(n){return n.tagName==="SELECT"},ihe=function(n){return n.tagName==="SLOT"},EN={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},BN={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},she={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},ohe={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Cf=function(n,e,t,r,i,s){return nt?s2(n,i,s.length>0):r.integers.reduce(function(o,a,l){for(;n>=a;)n-=a,o+=r.values[l];return o},"")+s},eG=function(n,e,t,r){var i="";do t||n--,i=r(n)+i,n/=e;while(n*e>=e);return i},lr=function(n,e,t,r,i){var s=t-e+1;return(n<0?"-":"")+(eG(Math.abs(n),s,r,function(o){return Ar(Math.floor(o%s)+e)})+i)},jA=function(n,e,t){t===void 0&&(t=". ");var r=e.length;return eG(Math.abs(n),r,!1,function(i){return e[Math.floor(i%r)]})+t},Wf=1,Fc=2,Pc=4,Tm=8,yl=function(n,e,t,r,i,s){if(n<-9999||n>9999)return s2(n,4,i.length>0);var o=Math.abs(n),a=i;if(o===0)return e[0]+a;for(var l=0;o>0&&l<=4;l++){var c=o%10;c===0&&Pr(s,Wf)&&a!==""?a=e[c]+a:c>1||c===1&&l===0||c===1&&l===1&&Pr(s,Fc)||c===1&&l===1&&Pr(s,Pc)&&n>100||c===1&&l>1&&Pr(s,Tm)?a=e[c]+(l>0?t[l-1]:"")+a:c===1&&l>0&&(a=t[l-1]+a),o=Math.floor(o/10)}return(n<0?r:"")+a},SN="十百千萬",MN="拾佰仟萬",CN="マイナス",MB="마이너스",s2=function(n,e,t){var r=t?". ":"",i=t?"、":"",s=t?", ":"",o=t?" ":"";switch(e){case 0:return"•"+o;case 1:return"◦"+o;case 2:return"◾"+o;case 5:var a=lr(n,48,57,!0,r);return a.length<4?"0"+a:a;case 4:return jA(n,"〇一二三四五六七八九",i);case 6:return Cf(n,1,3999,EN,3,r).toLowerCase();case 7:return Cf(n,1,3999,EN,3,r);case 8:return lr(n,945,969,!1,r);case 9:return lr(n,97,122,!1,r);case 10:return lr(n,65,90,!1,r);case 11:return lr(n,1632,1641,!0,r);case 12:case 49:return Cf(n,1,9999,BN,3,r);case 35:return Cf(n,1,9999,BN,3,r).toLowerCase();case 13:return lr(n,2534,2543,!0,r);case 14:case 30:return lr(n,6112,6121,!0,r);case 15:return jA(n,"子丑寅卯辰巳午未申酉戌亥",i);case 16:return jA(n,"甲乙丙丁戊己庚辛壬癸",i);case 17:case 48:return yl(n,"零一二三四五六七八九",SN,"負",i,Fc|Pc|Tm);case 47:return yl(n,"零壹貳參肆伍陸柒捌玖",MN,"負",i,Wf|Fc|Pc|Tm);case 42:return yl(n,"零一二三四五六七八九",SN,"负",i,Fc|Pc|Tm);case 41:return yl(n,"零壹贰叁肆伍陆柒捌玖",MN,"负",i,Wf|Fc|Pc|Tm);case 26:return yl(n,"〇一二三四五六七八九","十百千万",CN,i,0);case 25:return yl(n,"零壱弐参四伍六七八九","拾百千万",CN,i,Wf|Fc|Pc);case 31:return yl(n,"영일이삼사오육칠팔구","십백천만",MB,s,Wf|Fc|Pc);case 33:return yl(n,"零一二三四五六七八九","十百千萬",MB,s,0);case 32:return yl(n,"零壹貳參四五六七八九","拾百千",MB,s,Wf|Fc|Pc);case 18:return lr(n,2406,2415,!0,r);case 20:return Cf(n,1,19999,ohe,3,r);case 21:return lr(n,2790,2799,!0,r);case 22:return lr(n,2662,2671,!0,r);case 22:return Cf(n,1,10999,she,3,r);case 23:return jA(n,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return jA(n,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return lr(n,3302,3311,!0,r);case 28:return jA(n,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",i);case 29:return jA(n,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",i);case 34:return lr(n,3792,3801,!0,r);case 37:return lr(n,6160,6169,!0,r);case 38:return lr(n,4160,4169,!0,r);case 39:return lr(n,2918,2927,!0,r);case 40:return lr(n,1776,1785,!0,r);case 43:return lr(n,3046,3055,!0,r);case 44:return lr(n,3174,3183,!0,r);case 45:return lr(n,3664,3673,!0,r);case 46:return lr(n,3872,3881,!0,r);case 3:default:return lr(n,48,57,!0,r)}},TN;(function(n){n[n.BEFORE=0]="BEFORE",n[n.AFTER=1]="AFTER"})(TN||(TN={}));var ahe=function(){function n(){}return n.getOrigin=function(e){var t=n._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},n.isSameOrigin=function(e){return n.getOrigin(e)===n._origin},n.setContext=function(e){n._link=e.document.createElement("a"),n._origin=n.getOrigin(e.location.href)},n._origin="about:blank",n}(),Ye=function(){function n(e,t){this.type=0,this.x=e,this.y=t}return n.prototype.add=function(e,t){return new n(this.x+e,this.y+t)},n}(),Tf=function(n,e,t){return new Ye(n.x+(e.x-n.x)*t,n.y+(e.y-n.y)*t)},uy=function(){function n(e,t,r,i){this.type=1,this.start=e,this.startControl=t,this.endControl=r,this.end=i}return n.prototype.subdivide=function(e,t){var r=Tf(this.start,this.startControl,e),i=Tf(this.startControl,this.endControl,e),s=Tf(this.endControl,this.end,e),o=Tf(r,i,e),a=Tf(i,s,e),l=Tf(o,a,e);return t?new n(this.start,r,o,l):new n(l,a,s,this.end)},n.prototype.add=function(e,t){return new n(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},n.prototype.reverse=function(){return new n(this.end,this.endControl,this.startControl,this.start)},n}(),oo=function(n){return n.type===1},lhe=function(){function n(e){var t=e.styles,r=e.bounds,i=Mm(t.borderTopLeftRadius,r.width,r.height),s=i[0],o=i[1],a=Mm(t.borderTopRightRadius,r.width,r.height),l=a[0],c=a[1],A=Mm(t.borderBottomRightRadius,r.width,r.height),u=A[0],f=A[1],h=Mm(t.borderBottomLeftRadius,r.width,r.height),d=h[0],m=h[1],g=[];g.push((s+l)/r.width),g.push((d+u)/r.width),g.push((o+m)/r.height),g.push((c+f)/r.height);var p=Math.max.apply(Math,g);p>1&&(s/=p,o/=p,l/=p,c/=p,u/=p,f/=p,d/=p,m/=p);var v=r.width-l,w=r.height-f,_=r.width-u,x=r.height-m,b=t.borderTopWidth,B=t.borderRightWidth,M=t.borderBottomWidth,I=t.borderLeftWidth,S=bn(t.paddingTop,e.bounds.width),L=bn(t.paddingRight,e.bounds.width),D=bn(t.paddingBottom,e.bounds.width),T=bn(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||o>0?Ln(r.left+I/3,r.top+b/3,s-I/3,o-b/3,ln.TOP_LEFT):new Ye(r.left+I/3,r.top+b/3),this.topRightBorderDoubleOuterBox=s>0||o>0?Ln(r.left+v,r.top+b/3,l-B/3,c-b/3,ln.TOP_RIGHT):new Ye(r.left+r.width-B/3,r.top+b/3),this.bottomRightBorderDoubleOuterBox=u>0||f>0?Ln(r.left+_,r.top+w,u-B/3,f-M/3,ln.BOTTOM_RIGHT):new Ye(r.left+r.width-B/3,r.top+r.height-M/3),this.bottomLeftBorderDoubleOuterBox=d>0||m>0?Ln(r.left+I/3,r.top+x,d-I/3,m-M/3,ln.BOTTOM_LEFT):new Ye(r.left+I/3,r.top+r.height-M/3),this.topLeftBorderDoubleInnerBox=s>0||o>0?Ln(r.left+I*2/3,r.top+b*2/3,s-I*2/3,o-b*2/3,ln.TOP_LEFT):new Ye(r.left+I*2/3,r.top+b*2/3),this.topRightBorderDoubleInnerBox=s>0||o>0?Ln(r.left+v,r.top+b*2/3,l-B*2/3,c-b*2/3,ln.TOP_RIGHT):new Ye(r.left+r.width-B*2/3,r.top+b*2/3),this.bottomRightBorderDoubleInnerBox=u>0||f>0?Ln(r.left+_,r.top+w,u-B*2/3,f-M*2/3,ln.BOTTOM_RIGHT):new Ye(r.left+r.width-B*2/3,r.top+r.height-M*2/3),this.bottomLeftBorderDoubleInnerBox=d>0||m>0?Ln(r.left+I*2/3,r.top+x,d-I*2/3,m-M*2/3,ln.BOTTOM_LEFT):new Ye(r.left+I*2/3,r.top+r.height-M*2/3),this.topLeftBorderStroke=s>0||o>0?Ln(r.left+I/2,r.top+b/2,s-I/2,o-b/2,ln.TOP_LEFT):new Ye(r.left+I/2,r.top+b/2),this.topRightBorderStroke=s>0||o>0?Ln(r.left+v,r.top+b/2,l-B/2,c-b/2,ln.TOP_RIGHT):new Ye(r.left+r.width-B/2,r.top+b/2),this.bottomRightBorderStroke=u>0||f>0?Ln(r.left+_,r.top+w,u-B/2,f-M/2,ln.BOTTOM_RIGHT):new Ye(r.left+r.width-B/2,r.top+r.height-M/2),this.bottomLeftBorderStroke=d>0||m>0?Ln(r.left+I/2,r.top+x,d-I/2,m-M/2,ln.BOTTOM_LEFT):new Ye(r.left+I/2,r.top+r.height-M/2),this.topLeftBorderBox=s>0||o>0?Ln(r.left,r.top,s,o,ln.TOP_LEFT):new Ye(r.left,r.top),this.topRightBorderBox=l>0||c>0?Ln(r.left+v,r.top,l,c,ln.TOP_RIGHT):new Ye(r.left+r.width,r.top),this.bottomRightBorderBox=u>0||f>0?Ln(r.left+_,r.top+w,u,f,ln.BOTTOM_RIGHT):new Ye(r.left+r.width,r.top+r.height),this.bottomLeftBorderBox=d>0||m>0?Ln(r.left,r.top+x,d,m,ln.BOTTOM_LEFT):new Ye(r.left,r.top+r.height),this.topLeftPaddingBox=s>0||o>0?Ln(r.left+I,r.top+b,Math.max(0,s-I),Math.max(0,o-b),ln.TOP_LEFT):new Ye(r.left+I,r.top+b),this.topRightPaddingBox=l>0||c>0?Ln(r.left+Math.min(v,r.width-B),r.top+b,v>r.width+B?0:Math.max(0,l-B),Math.max(0,c-b),ln.TOP_RIGHT):new Ye(r.left+r.width-B,r.top+b),this.bottomRightPaddingBox=u>0||f>0?Ln(r.left+Math.min(_,r.width-I),r.top+Math.min(w,r.height-M),Math.max(0,u-B),Math.max(0,f-M),ln.BOTTOM_RIGHT):new Ye(r.left+r.width-B,r.top+r.height-M),this.bottomLeftPaddingBox=d>0||m>0?Ln(r.left+I,r.top+Math.min(x,r.height-M),Math.max(0,d-I),Math.max(0,m-M),ln.BOTTOM_LEFT):new Ye(r.left+I,r.top+r.height-M),this.topLeftContentBox=s>0||o>0?Ln(r.left+I+T,r.top+b+S,Math.max(0,s-(I+T)),Math.max(0,o-(b+S)),ln.TOP_LEFT):new Ye(r.left+I+T,r.top+b+S),this.topRightContentBox=l>0||c>0?Ln(r.left+Math.min(v,r.width+I+T),r.top+b+S,v>r.width+I+T?0:l-I+T,c-(b+S),ln.TOP_RIGHT):new Ye(r.left+r.width-(B+L),r.top+b+S),this.bottomRightContentBox=u>0||f>0?Ln(r.left+Math.min(_,r.width-(I+T)),r.top+Math.min(w,r.height+b+S),Math.max(0,u-(B+L)),f-(M+D),ln.BOTTOM_RIGHT):new Ye(r.left+r.width-(B+L),r.top+r.height-(M+D)),this.bottomLeftContentBox=d>0||m>0?Ln(r.left+I+T,r.top+x,Math.max(0,d-(I+T)),m-(M+D),ln.BOTTOM_LEFT):new Ye(r.left+I+T,r.top+r.height-(M+D))}return n}(),ln;(function(n){n[n.TOP_LEFT=0]="TOP_LEFT",n[n.TOP_RIGHT=1]="TOP_RIGHT",n[n.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",n[n.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(ln||(ln={}));var Ln=function(n,e,t,r,i){var s=4*((Math.sqrt(2)-1)/3),o=t*s,a=r*s,l=n+t,c=e+r;switch(i){case ln.TOP_LEFT:return new uy(new Ye(n,c),new Ye(n,c-a),new Ye(l-o,e),new Ye(l,e));case ln.TOP_RIGHT:return new uy(new Ye(n,e),new Ye(n+o,e),new Ye(l,c-a),new Ye(l,c));case ln.BOTTOM_RIGHT:return new uy(new Ye(l,e),new Ye(l,e+a),new Ye(n+o,c),new Ye(n,c));case ln.BOTTOM_LEFT:default:return new uy(new Ye(l,c),new Ye(l-o,c),new Ye(n,e+a),new Ye(n,e))}},W_=function(n){return[n.topLeftBorderBox,n.topRightBorderBox,n.bottomRightBorderBox,n.bottomLeftBorderBox]},che=function(n){return[n.topLeftContentBox,n.topRightContentBox,n.bottomRightContentBox,n.bottomLeftContentBox]},K_=function(n){return[n.topLeftPaddingBox,n.topRightPaddingBox,n.bottomRightPaddingBox,n.bottomLeftPaddingBox]},Ahe=function(){function n(e,t,r){this.offsetX=e,this.offsetY=t,this.matrix=r,this.type=0,this.target=6}return n}(),fy=function(){function n(e,t){this.path=e,this.target=t,this.type=1}return n}(),uhe=function(){function n(e){this.opacity=e,this.type=2,this.target=6}return n}(),fhe=function(n){return n.type===0},tG=function(n){return n.type===1},hhe=function(n){return n.type===2},IN=function(n,e){return n.length===e.length?n.some(function(t,r){return t===e[r]}):!1},dhe=function(n,e,t,r,i){return n.map(function(s,o){switch(o){case 0:return s.add(e,t);case 1:return s.add(e+r,t);case 2:return s.add(e+r,t+i);case 3:return s.add(e,t+i)}return s})},nG=function(){function n(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return n}(),rG=function(){function n(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new lhe(this.container),this.container.styles.opacity<1&&this.effects.push(new uhe(this.container.styles.opacity)),this.container.styles.transform!==null){var r=this.container.bounds.left+this.container.styles.transformOrigin[0].number,i=this.container.bounds.top+this.container.styles.transformOrigin[1].number,s=this.container.styles.transform;this.effects.push(new Ahe(r,i,s))}if(this.container.styles.overflowX!==0){var o=W_(this.curves),a=K_(this.curves);IN(o,a)?this.effects.push(new fy(o,6)):(this.effects.push(new fy(o,2)),this.effects.push(new fy(a,4)))}}return n.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,r=this.parent,i=this.effects.slice(0);r;){var s=r.effects.filter(function(l){return!tG(l)});if(t||r.container.styles.position!==0||!r.parent){if(i.unshift.apply(i,s),t=[2,3].indexOf(r.container.styles.position)===-1,r.container.styles.overflowX!==0){var o=W_(r.curves),a=K_(r.curves);IN(o,a)||i.unshift(new fy(a,6))}}else i.unshift.apply(i,s);r=r.parent}return i.filter(function(l){return Pr(l.target,e)})},n}(),eT=function(n,e,t,r){n.container.elements.forEach(function(i){var s=Pr(i.flags,4),o=Pr(i.flags,2),a=new rG(i,n);Pr(i.styles.display,2048)&&r.push(a);var l=Pr(i.flags,8)?[]:r;if(s||o){var c=s||i.styles.isPositioned()?t:e,A=new nG(a);if(i.styles.isPositioned()||i.styles.opacity<1||i.styles.isTransformed()){var u=i.styles.zIndex.order;if(u<0){var f=0;c.negativeZIndex.some(function(d,m){return u>d.element.container.styles.zIndex.order?(f=m,!1):f>0}),c.negativeZIndex.splice(f,0,A)}else if(u>0){var h=0;c.positiveZIndex.some(function(d,m){return u>=d.element.container.styles.zIndex.order?(h=m+1,!1):h>0}),c.positiveZIndex.splice(h,0,A)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(A)}else i.styles.isFloating()?c.nonPositionedFloats.push(A):c.nonPositionedInlineLevel.push(A);eT(a,A,s?A:t,l)}else i.styles.isInlineLevel()?e.inlineLevel.push(a):e.nonInlineLevel.push(a),eT(a,e,t,l);Pr(i.flags,8)&&iG(i,l)})},iG=function(n,e){for(var t=n instanceof qC?n.start:1,r=n instanceof qC?n.reversed:!1,i=0;i"u"?n[0]:t},xhe=function(n,e,t,r,i){var s=e[0],o=e[1],a=t[0],l=t[1];switch(n){case 2:return[new Ye(Math.round(r.left),Math.round(r.top+o)),new Ye(Math.round(r.left+r.width),Math.round(r.top+o)),new Ye(Math.round(r.left+r.width),Math.round(l+r.top+o)),new Ye(Math.round(r.left),Math.round(l+r.top+o))];case 3:return[new Ye(Math.round(r.left+s),Math.round(r.top)),new Ye(Math.round(r.left+s+a),Math.round(r.top)),new Ye(Math.round(r.left+s+a),Math.round(r.height+r.top)),new Ye(Math.round(r.left+s),Math.round(r.height+r.top))];case 1:return[new Ye(Math.round(r.left+s),Math.round(r.top+o)),new Ye(Math.round(r.left+s+a),Math.round(r.top+o)),new Ye(Math.round(r.left+s+a),Math.round(r.top+o+l)),new Ye(Math.round(r.left+s),Math.round(r.top+o+l))];default:return[new Ye(Math.round(i.left),Math.round(i.top)),new Ye(Math.round(i.left+i.width),Math.round(i.top)),new Ye(Math.round(i.left+i.width),Math.round(i.height+i.top)),new Ye(Math.round(i.left),Math.round(i.height+i.top))]}},bhe="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",UN="Hidden Text",Ehe=function(){function n(e){this._data={},this._document=e}return n.prototype.parseMetrics=function(e,t){var r=this._document.createElement("div"),i=this._document.createElement("img"),s=this._document.createElement("span"),o=this._document.body;r.style.visibility="hidden",r.style.fontFamily=e,r.style.fontSize=t,r.style.margin="0",r.style.padding="0",r.style.whiteSpace="nowrap",o.appendChild(r),i.src=bhe,i.width=1,i.height=1,i.style.margin="0",i.style.padding="0",i.style.verticalAlign="baseline",s.style.fontFamily=e,s.style.fontSize=t,s.style.margin="0",s.style.padding="0",s.appendChild(this._document.createTextNode(UN)),r.appendChild(s),r.appendChild(i);var a=i.offsetTop-s.offsetTop+2;r.removeChild(s),r.appendChild(this._document.createTextNode(UN)),r.style.lineHeight="normal",i.style.verticalAlign="super";var l=i.offsetTop-r.offsetTop+2;return o.removeChild(r),{baseline:a,middle:l}},n.prototype.getMetrics=function(e,t){var r=e+" "+t;return typeof this._data[r]>"u"&&(this._data[r]=this.parseMetrics(e,t)),this._data[r]},n}(),oG=function(){function n(e,t){this.context=e,this.options=t}return n}(),Bhe=1e4;(function(n){ca(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i._activeEffects=[],i.canvas=r.canvas?r.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),r.canvas||(i.canvas.width=Math.floor(r.width*r.scale),i.canvas.height=Math.floor(r.height*r.scale),i.canvas.style.width=r.width+"px",i.canvas.style.height=r.height+"px"),i.fontMetrics=new Ehe(document),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-r.x,-r.y),i.ctx.textBaseline="bottom",i._activeEffects=[],i.context.logger.debug("Canvas renderer initialized ("+r.width+"x"+r.height+") with scale "+r.scale),i}return e.prototype.applyEffects=function(t){for(var r=this;this._activeEffects.length;)this.popEffect();t.forEach(function(i){return r.applyEffect(i)})},e.prototype.applyEffect=function(t){this.ctx.save(),hhe(t)&&(this.ctx.globalAlpha=t.opacity),fhe(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),tG(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return qs(this,void 0,void 0,function(){var r;return gs(this,function(i){switch(i.label){case 0:return r=t.element.container.styles,r.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return qs(this,void 0,void 0,function(){return gs(this,function(r){switch(r.label){case 0:if(Pr(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return r.sent(),[4,this.renderNodeContent(t)];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,r,i){var s=this;if(r===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+i);else{var o=r2(t.text);o.reduce(function(a,l){return s.ctx.fillText(l,a,t.bounds.top+i),a+s.ctx.measureText(l).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var r=t.fontVariant.filter(function(o){return o==="normal"||o==="small-caps"}).join(""),i=Ihe(t.fontFamily).join(", "),s=b0(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,r,t.fontWeight,s,i].join(" "),i,s]},e.prototype.renderTextNode=function(t,r){return qs(this,void 0,void 0,function(){var i,s,o,a,l,c,A,u,f=this;return gs(this,function(h){return i=this.createFontStyle(r),s=i[0],o=i[1],a=i[2],this.ctx.font=s,this.ctx.direction=r.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",l=this.fontMetrics.getMetrics(o,a),c=l.baseline,A=l.middle,u=r.paintOrder,t.textBounds.forEach(function(d){u.forEach(function(m){switch(m){case 0:f.ctx.fillStyle=Qr(r.color),f.renderTextWithLetterSpacing(d,r.letterSpacing,c);var g=r.textShadow;g.length&&d.text.trim().length&&(g.slice(0).reverse().forEach(function(p){f.ctx.shadowColor=Qr(p.color),f.ctx.shadowOffsetX=p.offsetX.number*f.options.scale,f.ctx.shadowOffsetY=p.offsetY.number*f.options.scale,f.ctx.shadowBlur=p.blur.number,f.renderTextWithLetterSpacing(d,r.letterSpacing,c)}),f.ctx.shadowColor="",f.ctx.shadowOffsetX=0,f.ctx.shadowOffsetY=0,f.ctx.shadowBlur=0),r.textDecorationLine.length&&(f.ctx.fillStyle=Qr(r.textDecorationColor||r.color),r.textDecorationLine.forEach(function(p){switch(p){case 1:f.ctx.fillRect(d.bounds.left,Math.round(d.bounds.top+c),d.bounds.width,1);break;case 2:f.ctx.fillRect(d.bounds.left,Math.round(d.bounds.top),d.bounds.width,1);break;case 3:f.ctx.fillRect(d.bounds.left,Math.ceil(d.bounds.top+A),d.bounds.width,1);break}}));break;case 1:r.webkitTextStrokeWidth&&d.text.trim().length&&(f.ctx.strokeStyle=Qr(r.webkitTextStrokeColor),f.ctx.lineWidth=r.webkitTextStrokeWidth,f.ctx.lineJoin=window.chrome?"miter":"round",f.ctx.strokeText(d.text,d.bounds.left,d.bounds.top+c)),f.ctx.strokeStyle="",f.ctx.lineWidth=0,f.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,r,i){if(i&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var s=X_(t),o=K_(r);this.path(o),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(i,0,0,t.intrinsicWidth,t.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return qs(this,void 0,void 0,function(){var r,i,s,o,a,l,v,v,c,A,u,f,_,h,d,x,m,g,p,v,w,_,x;return gs(this,function(b){switch(b.label){case 0:this.applyEffects(t.getEffects(4)),r=t.container,i=t.curves,s=r.styles,o=0,a=r.textNodes,b.label=1;case 1:return o0&&y>0&&(M=s.ctx.createPattern(x,"repeat"),s.renderRepeat(S,M,R,F))):TAe(A)&&(I=CB(t,r,[null,null,null]),S=I[0],L=I[1],D=I[2],T=I[3],y=I[4],E=A.position.length===0?[e2]:A.position,R=bn(E[0],T),F=bn(E[E.length-1],y),O=EAe(A,R,F,T,y),z=O[0],j=O[1],z>0&&j>0&&(H=s.ctx.createRadialGradient(L+R,D+F,0,L+R,D+F,z),sN(A.stops,z*2).forEach(function(ue){return H.addColorStop(ue.stop,Qr(ue.color))}),s.path(S),s.ctx.fillStyle=H,z!==j?(C=t.bounds.left+.5*t.bounds.width,W=t.bounds.top+.5*t.bounds.height,ee=j/z,P=1/ee,s.ctx.save(),s.ctx.translate(C,W),s.ctx.transform(1,0,0,ee,0,0),s.ctx.translate(-C,-W),s.ctx.fillRect(L,P*(D-W)+W,T,y*P),s.ctx.restore()):s.ctx.fill())),re.label=6;case 6:return r--,[2]}})},s=this,o=0,a=t.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return o0?A.style!==2?[3,5]:[4,this.renderDashedDottedBorder(A.color,A.width,a,t.curves,2)]:[3,11]):[3,13];case 4:return f.sent(),[3,11];case 5:return A.style!==3?[3,7]:[4,this.renderDashedDottedBorder(A.color,A.width,a,t.curves,3)];case 6:return f.sent(),[3,11];case 7:return A.style!==4?[3,9]:[4,this.renderDoubleBorder(A.color,A.width,a,t.curves)];case 8:return f.sent(),[3,11];case 9:return[4,this.renderSolidBorder(A.color,a,t.curves)];case 10:f.sent(),f.label=11;case 11:a++,f.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,r,i,s,o){return qs(this,void 0,void 0,function(){var a,l,c,A,u,f,h,d,m,g,p,v,w,_,x,b,x,b;return gs(this,function(B){return this.ctx.save(),a=vhe(s,i),l=RN(s,i),o===2&&(this.path(l),this.ctx.clip()),oo(l[0])?(c=l[0].start.x,A=l[0].start.y):(c=l[0].x,A=l[0].y),oo(l[1])?(u=l[1].end.x,f=l[1].end.y):(u=l[1].x,f=l[1].y),i===0||i===2?h=Math.abs(c-u):h=Math.abs(A-f),this.ctx.beginPath(),o===3?this.formatPath(a):this.formatPath(l.slice(0,2)),d=r<3?r*3:r*2,m=r<3?r*2:r,o===3&&(d=r,m=r),g=!0,h<=d*2?g=!1:h<=d*2+m?(p=h/(2*d+m),d*=p,m*=p):(v=Math.floor((h+m)/(d+m)),w=(h-v*d)/(v-1),_=(h-(v+1)*d)/v,m=_<=0||Math.abs(m-w)0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]=55296&&i<=56319&&t>10)+55296,o%1024+56320)),(i+1===t||r.length>16384)&&(s+=String.fromCharCode.apply(String,r),r.length=0)}return s},kD="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ile=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Xv=0;Xv"u"?[]:new Uint8Array(256);for(var Yv=0;Yv>4,A[i++]=(o&15)<<4|a>>2,A[i++]=(a&3)<<6|l&63;return c},Ule=function(n){for(var e=n.length,t=[],r=0;r>Bu,Lle=1<>Bu,Nle=A8+Dle,Ole=Nle,kle=32,Qle=Ole+kle,Hle=65536>>e2,zle=1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Bu],t=(t<>Bu)],t=(t<>e2),t=this.index[t],t+=e>>Bu&Gle,t=this.index[t],t=(t<"u"?[]:new Uint8Array(256);for(var $v=0;$vGD?(i.push(!0),a-=GD):i.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(s)!==-1)return r.push(o),t.push(VC);if(a===$le||a===zC){if(o===0)return r.push(o),t.push(cu);var l=t[o-1];return ice.indexOf(l)===-1?(r.push(r[o-1]),t.push(l)):(r.push(o),t.push(cu))}if(r.push(o),a===tce)return t.push(e==="strict"?jC:Yg);if(a===d8||a===ece)return t.push(cu);if(a===nce)return s>=131072&&s<=196605||s>=196608&&s<=262141?t.push(Yg):t.push(cu);t.push(a)}),[r,t,i]},gB=function(n,e,t,r){var i=r[t];if(Array.isArray(n)?n.indexOf(i)!==-1:n===i)for(var s=t;s<=r.length;){s++;var o=r[s];if(o===e)return!0;if(o!==Zc)break}if(i===Zc)for(var s=t;s>0;){s--;var a=r[s];if(Array.isArray(n)?n.indexOf(a)!==-1:n===a)for(var l=t;l<=r.length;){l++;var o=r[l];if(o===e)return!0;if(o!==Zc)break}if(a!==Zc)break}return!1},$D=function(n,e){for(var t=n;t>=0;){var r=e[t];if(r===Zc)t--;else return r}return 0},ace=function(n,e,t,r,i){if(t[r]===0)return Ot;var s=r-1;if(Array.isArray(i)&&i[s]===!0)return Ot;var o=s-1,a=s+1,l=e[s],c=o>=0?e[o]:0,A=e[a];if(l===u8&&A===f8)return Ot;if(ZC.indexOf(l)!==-1)return p8;if(ZC.indexOf(A)!==-1||m8.indexOf(A)!==-1)return Ot;if($D(s,e)===h8)return ey;if($C.get(n[s])===zC||(l===Jv||l===qv)&&$C.get(n[a])===zC||l===VD||A===VD||l===jD||[Zc,GC,Bm].indexOf(l)===-1&&A===jD||[Zv,Hp,qle,Sf,Cf].indexOf(A)!==-1||$D(s,e)===zp||gB(pB,zp,s,e)||gB([Zv,Hp],jC,s,e)||gB(WD,WD,s,e))return Ot;if(l===Zc)return ey;if(l===pB||A===pB)return Ot;if(A===VC||l===VC)return ey;if([GC,Bm,jC].indexOf(A)!==-1||l===Jle||c===XC&&sce.indexOf(l)!==-1||l===Cf&&A===XC||A===KD||vl.indexOf(A)!==-1&&l===vs||vl.indexOf(l)!==-1&&A===vs||l===Sm&&[Yg,Jv,qv].indexOf(A)!==-1||[Yg,Jv,qv].indexOf(l)!==-1&&A===Mm||vl.indexOf(l)!==-1&&XD.indexOf(A)!==-1||XD.indexOf(l)!==-1&&vl.indexOf(A)!==-1||[Sm,Mm].indexOf(l)!==-1&&(A===vs||[zp,Bm].indexOf(A)!==-1&&e[a+1]===vs)||[zp,Bm].indexOf(l)!==-1&&A===vs||l===vs&&[vs,Cf,Sf].indexOf(A)!==-1)return Ot;if([vs,Cf,Sf,Zv,Hp].indexOf(A)!==-1)for(var u=s;u>=0;){var f=e[u];if(f===vs)return Ot;if([Cf,Sf].indexOf(f)!==-1)u--;else break}if([Sm,Mm].indexOf(A)!==-1)for(var u=[Zv,Hp].indexOf(l)!==-1?o:s;u>=0;){var f=e[u];if(f===vs)return Ot;if([Cf,Sf].indexOf(f)!==-1)u--;else break}if(YC===l&&[YC,Tw,WC,KC].indexOf(A)!==-1||[Tw,WC].indexOf(l)!==-1&&[Tw,Iw].indexOf(A)!==-1||[Iw,KC].indexOf(l)!==-1&&A===Iw||YD.indexOf(l)!==-1&&[KD,Mm].indexOf(A)!==-1||YD.indexOf(A)!==-1&&l===Sm||vl.indexOf(l)!==-1&&vl.indexOf(A)!==-1||l===Sf&&vl.indexOf(A)!==-1||vl.concat(vs).indexOf(l)!==-1&&A===zp&&rce.indexOf(n[a])===-1||vl.concat(vs).indexOf(A)!==-1&&l===Hp)return Ot;if(l===mB&&A===mB){for(var h=t[s],d=1;h>0&&(h--,e[h]===mB);)d++;if(d%2!==0)return Ot}return l===Jv&&A===qv?Ot:ey},lce=function(n,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=oce(n,e.lineBreak),r=t[0],i=t[1],s=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(i=i.map(function(a){return[vs,cu,d8].indexOf(a)!==-1?Yg:a}));var o=e.wordBreak==="keep-all"?s.map(function(a,l){return a&&n[l]>=19968&&n[l]<=40959}):void 0;return[r,i,o]},cce=function(){function n(e,t,r,i){this.codePoints=e,this.required=t===p8,this.start=r,this.end=i}return n.prototype.slice=function(){return Ar.apply(void 0,this.codePoints.slice(this.start,this.end))},n}(),Ace=function(n,e){var t=_1(n),r=lce(t,e),i=r[0],s=r[1],o=r[2],a=t.length,l=0,c=0;return{next:function(){if(c>=a)return{done:!0,value:null};for(var A=Ot;c=g8&&n<=57},Vce=function(n){return n>=55296&&n<=57343},Tf=function(n){return gi(n)||n>=w8&&n<=x8||n>=v8&&n<=kce},jce=function(n){return n>=v8&&n<=Hce},Wce=function(n){return n>=w8&&n<=Gce},Kce=function(n){return jce(n)||Wce(n)},Xce=function(n){return n>=Tce},sy=function(n){return n===z_||n===hce||n===dce},G_=function(n){return Kce(n)||Xce(n)||n===vce},tN=function(n){return G_(n)||gi(n)||n===Xi},Yce=function(n){return n>=Fce&&n<=Pce||n===Lce||n>=Dce&&n<=Nce||n===Oce},Oc=function(n,e){return n!==rg?!1:e!==z_},oy=function(n,e,t){return n===Xi?G_(e)||Oc(e,t):G_(n)?!0:!!(n===rg&&Oc(n,e))},yB=function(n,e,t){return n===du||n===Xi?gi(e)?!0:e===$g&&gi(t):gi(n===$g?e:n)},$ce=function(n){var e=0,t=1;(n[e]===du||n[e]===Xi)&&(n[e]===Xi&&(t=-1),e++);for(var r=[];gi(n[e]);)r.push(n[e++]);var i=r.length?parseInt(Ar.apply(void 0,r),10):0;n[e]===$g&&e++;for(var s=[];gi(n[e]);)s.push(n[e++]);var o=s.length,a=o?parseInt(Ar.apply(void 0,s),10):0;(n[e]===_8||n[e]===y8)&&e++;var l=1;(n[e]===du||n[e]===Xi)&&(n[e]===Xi&&(l=-1),e++);for(var c=[];gi(n[e]);)c.push(n[e++]);var A=c.length?parseInt(Ar.apply(void 0,c),10):0;return t*(i+a*Math.pow(10,-o))*Math.pow(10,l*A)},Zce={type:2},Jce={type:3},qce={type:4},eAe={type:13},tAe={type:8},nAe={type:21},rAe={type:9},iAe={type:10},sAe={type:11},oAe={type:12},aAe={type:14},ay={type:23},lAe={type:1},cAe={type:25},AAe={type:24},uAe={type:26},fAe={type:27},hAe={type:28},dAe={type:29},pAe={type:31},JC={type:32},b8=function(){function n(){this._value=[]}return n.prototype.write=function(e){this._value=this._value.concat(_1(e))},n.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==JC;)e.push(t),t=this.consumeToken();return e},n.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case ty:return this.consumeStringToken(ty);case pce:var t=this.peekCodePoint(0),r=this.peekCodePoint(1),i=this.peekCodePoint(2);if(tN(t)||Oc(r,i)){var s=oy(t,r,i)?fce:uce,o=this.consumeName();return{type:5,value:o,flags:s}}break;case mce:if(this.peekCodePoint(0)===Gp)return this.consumeCodePoint(),eAe;break;case ny:return this.consumeStringToken(ny);case ry:return Zce;case Vp:return Jce;case vB:if(this.peekCodePoint(0)===Gp)return this.consumeCodePoint(),aAe;break;case du:if(yB(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Ice:return qce;case Xi:var a=e,l=this.peekCodePoint(0),c=this.peekCodePoint(1);if(yB(a,l,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(oy(a,l,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===Xi&&c===_ce)return this.consumeCodePoint(),this.consumeCodePoint(),AAe;break;case $g:if(yB(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case JD:if(this.peekCodePoint(0)===vB)for(this.consumeCodePoint();;){var A=this.consumeCodePoint();if(A===vB&&(A=this.consumeCodePoint(),A===JD))return this.consumeToken();if(A===va)return this.consumeToken()}break;case Rce:return uAe;case Uce:return fAe;case wce:if(this.peekCodePoint(0)===yce&&this.peekCodePoint(1)===Xi&&this.peekCodePoint(2)===Xi)return this.consumeCodePoint(),this.consumeCodePoint(),cAe;break;case xce:var u=this.peekCodePoint(0),f=this.peekCodePoint(1),h=this.peekCodePoint(2);if(oy(u,f,h)){var o=this.consumeName();return{type:7,value:o}}break;case bce:return hAe;case rg:if(Oc(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case Ece:return dAe;case Bce:if(this.peekCodePoint(0)===Gp)return this.consumeCodePoint(),tAe;break;case Mce:return sAe;case Sce:return oAe;case Qce:case zce:var d=this.peekCodePoint(0),m=this.peekCodePoint(1);return d===du&&(Tf(m)||m===iy)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case qD:if(this.peekCodePoint(0)===Gp)return this.consumeCodePoint(),rAe;if(this.peekCodePoint(0)===qD)return this.consumeCodePoint(),nAe;break;case Cce:if(this.peekCodePoint(0)===Gp)return this.consumeCodePoint(),iAe;break;case va:return JC}return sy(e)?(this.consumeWhiteSpace(),pAe):gi(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):G_(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Ar(e)}},n.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},n.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},n.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},n.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();Tf(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var r=!1;t===iy&&e.length<6;)e.push(t),t=this.consumeCodePoint(),r=!0;if(r){var i=parseInt(Ar.apply(void 0,e.map(function(l){return l===iy?g8:l})),16),s=parseInt(Ar.apply(void 0,e.map(function(l){return l===iy?x8:l})),16);return{type:30,start:i,end:s}}var o=parseInt(Ar.apply(void 0,e),16);if(this.peekCodePoint(0)===Xi&&Tf(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var a=[];Tf(t)&&a.length<6;)a.push(t),t=this.consumeCodePoint();var s=parseInt(Ar.apply(void 0,a),16);return{type:30,start:o,end:s}}else return{type:30,start:o,end:o}},n.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===ry?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===ry?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},n.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===va)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===ny||t===ty){var r=this.consumeStringToken(this.consumeCodePoint());return r.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===va||this.peekCodePoint(0)===Vp)?(this.consumeCodePoint(),{type:22,value:r.value}):(this.consumeBadUrlRemnants(),ay)}for(;;){var i=this.consumeCodePoint();if(i===va||i===Vp)return{type:22,value:Ar.apply(void 0,e)};if(sy(i))return this.consumeWhiteSpace(),this.peekCodePoint(0)===va||this.peekCodePoint(0)===Vp?(this.consumeCodePoint(),{type:22,value:Ar.apply(void 0,e)}):(this.consumeBadUrlRemnants(),ay);if(i===ty||i===ny||i===ry||Yce(i))return this.consumeBadUrlRemnants(),ay;if(i===rg)if(Oc(i,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),ay;else e.push(i)}},n.prototype.consumeWhiteSpace=function(){for(;sy(this.peekCodePoint(0));)this.consumeCodePoint()},n.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===Vp||e===va)return;Oc(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},n.prototype.consumeStringSlice=function(e){for(var t=5e4,r="";e>0;){var i=Math.min(t,e);r+=Ar.apply(void 0,this._value.splice(0,i)),e-=i}return this._value.shift(),r},n.prototype.consumeStringToken=function(e){var t="",r=0;do{var i=this._value[r];if(i===va||i===void 0||i===e)return t+=this.consumeStringSlice(r),{type:0,value:t};if(i===z_)return this._value.splice(0,r),lAe;if(i===rg){var s=this._value[r+1];s!==va&&s!==void 0&&(s===z_?(t+=this.consumeStringSlice(r),r=-1,this._value.shift()):Oc(i,s)&&(t+=this.consumeStringSlice(r),t+=Ar(this.consumeEscapedCodePoint()),r=-1))}r++}while(!0)},n.prototype.consumeNumber=function(){var e=[],t=b0,r=this.peekCodePoint(0);for((r===du||r===Xi)&&e.push(this.consumeCodePoint());gi(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0);var i=this.peekCodePoint(1);if(r===$g&&gi(i))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=ZD;gi(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0),i=this.peekCodePoint(1);var s=this.peekCodePoint(2);if((r===_8||r===y8)&&((i===du||i===Xi)&&gi(s)||gi(i)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=ZD;gi(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[$ce(e),t]},n.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],r=e[1],i=this.peekCodePoint(0),s=this.peekCodePoint(1),o=this.peekCodePoint(2);if(oy(i,s,o)){var a=this.consumeName();return{type:15,number:t,flags:r,unit:a}}return i===gce?(this.consumeCodePoint(),{type:16,number:t,flags:r}):{type:17,number:t,flags:r}},n.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Tf(e)){for(var t=Ar(e);Tf(this.peekCodePoint(0))&&t.length<6;)t+=Ar(this.consumeCodePoint());sy(this.peekCodePoint(0))&&this.consumeCodePoint();var r=parseInt(t,16);return r===0||Vce(r)||r>1114111?eN:r}return e===va?eN:e},n.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(tN(t))e+=Ar(t);else if(Oc(t,this.peekCodePoint(0)))e+=Ar(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},n}(),E8=function(){function n(e){this._tokens=e}return n.create=function(e){var t=new b8;return t.write(e),new n(t.read())},n.parseValue=function(e){return n.create(e).parseComponentValue()},n.parseValues=function(e){return n.create(e).parseComponentValues()},n.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},n.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},n.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},n.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},r=this.consumeToken();;){if(r.type===32||mAe(r,e))return t;this.reconsumeToken(r),t.values.push(this.consumeComponentValue()),r=this.consumeToken()}},n.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var r=this.consumeToken();if(r.type===32||r.type===3)return t;this.reconsumeToken(r),t.values.push(this.consumeComponentValue())}},n.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?JC:e},n.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},n}(),E0=function(n){return n.type===15},x1=function(n){return n.type===17},sr=function(n){return n.type===20},qC=function(n,e){return sr(n)&&n.value===e},b1=function(n){return n.type!==31&&n.type!==4},ll=function(n){var e=[],t=[];return n.forEach(function(r){if(r.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}r.type!==31&&t.push(r)}),t.length&&e.push(t),e},mAe=function(n,e){return e===11&&n.type===12||e===28&&n.type===29?!0:e===2&&n.type===3},_A=function(n){return n.type===17||n.type===15},br=function(n){return n.type===16||_A(n)},B8=function(n){return n.length>1?[n[0],n[1]]:[n[0]]},ii={type:17,number:0,flags:b0},t2={type:16,number:50,flags:b0},Jc={type:16,number:100,flags:b0},Cm=function(n,e,t){var r=n[0],i=n[1];return[bn(r,e),bn(typeof i<"u"?i:r,t)]},bn=function(n,e){if(n.type===16)return n.number/100*e;if(E0(n))switch(n.unit){case"rem":case"em":return 16*n.number;case"px":default:return n.number}return n.number},M8="deg",S8="grad",C8="rad",T8="turn",E1={name:"angle",parse:function(n,e){if(e.type===15)switch(e.unit){case M8:return Math.PI*e.number/180;case S8:return Math.PI/200*e.number;case C8:return e.number;case T8:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},I8=function(n){return n.type===15&&(n.unit===M8||n.unit===S8||n.unit===C8||n.unit===T8)},R8=function(n){var e=n.filter(sr).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[ii,ii];case"to top":case"bottom":return fo(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[ii,Jc];case"to right":case"left":return fo(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[Jc,Jc];case"to bottom":case"top":return fo(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[Jc,ii];case"to left":case"right":return fo(270)}return 0},fo=function(n){return Math.PI*n/180},hA={name:"color",parse:function(n,e){if(e.type===18){var t=gAe[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return t(n,e.values)}if(e.type===5){if(e.value.length===3){var r=e.value.substring(0,1),i=e.value.substring(1,2),s=e.value.substring(2,3);return qc(parseInt(r+r,16),parseInt(i+i,16),parseInt(s+s,16),1)}if(e.value.length===4){var r=e.value.substring(0,1),i=e.value.substring(1,2),s=e.value.substring(2,3),o=e.value.substring(3,4);return qc(parseInt(r+r,16),parseInt(i+i,16),parseInt(s+s,16),parseInt(o+o,16)/255)}if(e.value.length===6){var r=e.value.substring(0,2),i=e.value.substring(2,4),s=e.value.substring(4,6);return qc(parseInt(r,16),parseInt(i,16),parseInt(s,16),1)}if(e.value.length===8){var r=e.value.substring(0,2),i=e.value.substring(2,4),s=e.value.substring(4,6),o=e.value.substring(6,8);return qc(parseInt(r,16),parseInt(i,16),parseInt(s,16),parseInt(o,16)/255)}}if(e.type===20){var a=Zg[e.value.toUpperCase()];if(typeof a<"u")return a}return Zg.TRANSPARENT}},cd=function(n){return(255&n)===0},Hr=function(n){var e=255&n,t=255&n>>8,r=255&n>>16,i=255&n>>24;return e<255?"rgba("+i+","+r+","+t+","+e/255+")":"rgb("+i+","+r+","+t+")"},qc=function(n,e,t,r){return(n<<24|e<<16|t<<8|Math.round(r*255)<<0)>>>0},nN=function(n,e){if(n.type===17)return n.number;if(n.type===16){var t=e===3?1:255;return e===3?n.number/100*t:Math.round(n.number/100*t)}return 0},rN=function(n,e){var t=e.filter(b1);if(t.length===3){var r=t.map(nN),i=r[0],s=r[1],o=r[2];return qc(i,s,o,1)}if(t.length===4){var a=t.map(nN),i=a[0],s=a[1],o=a[2],l=a[3];return qc(i,s,o,l)}return 0};function wB(n,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-n)*t*6+n:t<1/2?e:t<2/3?(e-n)*6*(2/3-t)+n:n}var iN=function(n,e){var t=e.filter(b1),r=t[0],i=t[1],s=t[2],o=t[3],a=(r.type===17?fo(r.number):E1.parse(n,r))/(Math.PI*2),l=br(i)?i.number/100:0,c=br(s)?s.number/100:0,A=typeof o<"u"&&br(o)?bn(o,1):1;if(l===0)return qc(c*255,c*255,c*255,1);var u=c<=.5?c*(l+1):c+l-c*l,f=c*2-u,h=wB(f,u,a+1/3),d=wB(f,u,a),m=wB(f,u,a-1/3);return qc(h*255,d*255,m*255,A)},gAe={hsl:iN,hsla:iN,rgb:rN,rgba:rN},sN=function(n,e){return hA.parse(n,E8.create(e).parseComponentValue())},Zg={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},vAe={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(sr(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},yAe={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},B1=function(n,e){var t=hA.parse(n,e[0]),r=e[1];return r&&br(r)?{color:t,stop:r}:{color:t,stop:null}},oN=function(n,e){var t=n[0],r=n[n.length-1];t.stop===null&&(t.stop=ii),r.stop===null&&(r.stop=Jc);for(var i=[],s=0,o=0;os?i.push(l):i.push(s),s=l}else i.push(null)}for(var c=null,o=0;oo.optimumDistance)?{optimumCorner:a,optimumDistance:A}:o},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},xAe=function(n,e,t,r,i){var s=0,o=0;switch(n.size){case 0:n.shape===0?s=o=Math.min(Math.abs(e),Math.abs(e-r),Math.abs(t),Math.abs(t-i)):n.shape===1&&(s=Math.min(Math.abs(e),Math.abs(e-r)),o=Math.min(Math.abs(t),Math.abs(t-i)));break;case 2:if(n.shape===0)s=o=Math.min(Ho(e,t),Ho(e,t-i),Ho(e-r,t),Ho(e-r,t-i));else if(n.shape===1){var a=Math.min(Math.abs(t),Math.abs(t-i))/Math.min(Math.abs(e),Math.abs(e-r)),l=aN(r,i,e,t,!0),c=l[0],A=l[1];s=Ho(c-e,(A-t)/a),o=a*s}break;case 1:n.shape===0?s=o=Math.max(Math.abs(e),Math.abs(e-r),Math.abs(t),Math.abs(t-i)):n.shape===1&&(s=Math.max(Math.abs(e),Math.abs(e-r)),o=Math.max(Math.abs(t),Math.abs(t-i)));break;case 3:if(n.shape===0)s=o=Math.max(Ho(e,t),Ho(e,t-i),Ho(e-r,t),Ho(e-r,t-i));else if(n.shape===1){var a=Math.max(Math.abs(t),Math.abs(t-i))/Math.max(Math.abs(e),Math.abs(e-r)),u=aN(r,i,e,t,!1),c=u[0],A=u[1];s=Ho(c-e,(A-t)/a),o=a*s}break}return Array.isArray(n.size)&&(s=bn(n.size[0],r),o=n.size.length===2?bn(n.size[1],i):s),[s,o]},bAe=function(n,e){var t=fo(180),r=[];return ll(e).forEach(function(i,s){if(s===0){var o=i[0];if(o.type===20&&o.value==="to"){t=R8(i);return}else if(I8(o)){t=E1.parse(n,o);return}}var a=B1(n,i);r.push(a)}),{angle:t,stops:r,type:1}},ly=function(n,e){var t=fo(180),r=[];return ll(e).forEach(function(i,s){if(s===0){var o=i[0];if(o.type===20&&["top","left","right","bottom"].indexOf(o.value)!==-1){t=R8(i);return}else if(I8(o)){t=(E1.parse(n,o)+fo(270))%fo(360);return}}var a=B1(n,i);r.push(a)}),{angle:t,stops:r,type:1}},EAe=function(n,e){var t=fo(180),r=[],i=1,s=0,o=3,a=[];return ll(e).forEach(function(l,c){var A=l[0];if(c===0){if(sr(A)&&A.value==="linear"){i=1;return}else if(sr(A)&&A.value==="radial"){i=2;return}}if(A.type===18){if(A.name==="from"){var u=hA.parse(n,A.values[0]);r.push({stop:ii,color:u})}else if(A.name==="to"){var u=hA.parse(n,A.values[0]);r.push({stop:Jc,color:u})}else if(A.name==="color-stop"){var f=A.values.filter(b1);if(f.length===2){var u=hA.parse(n,f[1]),h=f[0];x1(h)&&r.push({stop:{type:16,number:h.number*100,flags:h.flags},color:u})}}}}),i===1?{angle:(t+fo(180))%fo(360),stops:r,type:i}:{size:o,shape:s,stops:r,position:a,type:i}},U8="closest-side",F8="farthest-side",P8="closest-corner",L8="farthest-corner",D8="circle",N8="ellipse",O8="cover",k8="contain",BAe=function(n,e){var t=0,r=3,i=[],s=[];return ll(e).forEach(function(o,a){var l=!0;if(a===0){var c=!1;l=o.reduce(function(u,f){if(c)if(sr(f))switch(f.value){case"center":return s.push(t2),u;case"top":case"left":return s.push(ii),u;case"right":case"bottom":return s.push(Jc),u}else(br(f)||_A(f))&&s.push(f);else if(sr(f))switch(f.value){case D8:return t=0,!1;case N8:return t=1,!1;case"at":return c=!0,!1;case U8:return r=0,!1;case O8:case F8:return r=1,!1;case k8:case P8:return r=2,!1;case L8:return r=3,!1}else if(_A(f)||br(f))return Array.isArray(r)||(r=[]),r.push(f),!1;return u},l)}if(l){var A=B1(n,o);i.push(A)}}),{size:r,shape:t,stops:i,position:s,type:2}},cy=function(n,e){var t=0,r=3,i=[],s=[];return ll(e).forEach(function(o,a){var l=!0;if(a===0?l=o.reduce(function(A,u){if(sr(u))switch(u.value){case"center":return s.push(t2),!1;case"top":case"left":return s.push(ii),!1;case"right":case"bottom":return s.push(Jc),!1}else if(br(u)||_A(u))return s.push(u),!1;return A},l):a===1&&(l=o.reduce(function(A,u){if(sr(u))switch(u.value){case D8:return t=0,!1;case N8:return t=1,!1;case k8:case U8:return r=0,!1;case F8:return r=1,!1;case P8:return r=2,!1;case O8:case L8:return r=3,!1}else if(_A(u)||br(u))return Array.isArray(r)||(r=[]),r.push(u),!1;return A},l)),l){var c=B1(n,o);i.push(c)}}),{size:r,shape:t,stops:i,position:s,type:2}},MAe=function(n){return n.type===1},SAe=function(n){return n.type===2},n2={name:"image",parse:function(n,e){if(e.type===22){var t={url:e.value,type:0};return n.cache.addImage(e.value),t}if(e.type===18){var r=Q8[e.name];if(typeof r>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return r(n,e.values)}throw new Error("Unsupported image type "+e.type)}};function CAe(n){return!(n.type===20&&n.value==="none")&&(n.type!==18||!!Q8[n.name])}var Q8={"linear-gradient":bAe,"-moz-linear-gradient":ly,"-ms-linear-gradient":ly,"-o-linear-gradient":ly,"-webkit-linear-gradient":ly,"radial-gradient":BAe,"-moz-radial-gradient":cy,"-ms-radial-gradient":cy,"-o-radial-gradient":cy,"-webkit-radial-gradient":cy,"-webkit-gradient":EAe},TAe={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(n,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(r){return b1(r)&&CAe(r)}).map(function(r){return n2.parse(n,r)})}},IAe={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(sr(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},RAe={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(n,e){return ll(e).map(function(t){return t.filter(br)}).map(B8)}},UAe={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(n,e){return ll(e).map(function(t){return t.filter(sr).map(function(r){return r.value}).join(" ")}).map(FAe)}},FAe=function(n){switch(n){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},Ad;(function(n){n.AUTO="auto",n.CONTAIN="contain",n.COVER="cover"})(Ad||(Ad={}));var PAe={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(n,e){return ll(e).map(function(t){return t.filter(LAe)})}},LAe=function(n){return sr(n)||br(n)},M1=function(n){return{name:"border-"+n+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},DAe=M1("top"),NAe=M1("right"),OAe=M1("bottom"),kAe=M1("left"),S1=function(n){return{name:"border-radius-"+n,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return B8(t.filter(br))}}},QAe=S1("top-left"),HAe=S1("top-right"),zAe=S1("bottom-right"),GAe=S1("bottom-left"),C1=function(n){return{name:"border-"+n+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},VAe=C1("top"),jAe=C1("right"),WAe=C1("bottom"),KAe=C1("left"),T1=function(n){return{name:"border-"+n+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return E0(t)?t.number:0}}},XAe=T1("top"),YAe=T1("right"),$Ae=T1("bottom"),ZAe=T1("left"),JAe={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},qAe={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(n,e){switch(e){case"rtl":return 1;case"ltr":default:return 0}}},eue={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(n,e){return e.filter(sr).reduce(function(t,r){return t|tue(r.value)},0)}},tue=function(n){switch(n){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},nue={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},rue={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(n,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},V_;(function(n){n.NORMAL="normal",n.STRICT="strict"})(V_||(V_={}));var iue={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"strict":return V_.STRICT;case"normal":default:return V_.NORMAL}}},sue={name:"line-height",initialValue:"normal",prefix:!1,type:4},lN=function(n,e){return sr(n)&&n.value==="normal"?1.2*e:n.type===17?e*n.number:br(n)?bn(n,e):e},oue={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(n,e){return e.type===20&&e.value==="none"?null:n2.parse(n,e)}},aue={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(n,e){switch(e){case"inside":return 0;case"outside":default:return 1}}},lue={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},I1=function(n){return{name:"margin-"+n,initialValue:"0",prefix:!1,type:4}},cue=I1("top"),Aue=I1("right"),uue=I1("bottom"),fue=I1("left"),hue={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(n,e){return e.filter(sr).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},due={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"break-word":return"break-word";case"normal":default:return"normal"}}},R1=function(n){return{name:"padding-"+n,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},pue=R1("top"),mue=R1("right"),gue=R1("bottom"),vue=R1("left"),yue={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(n,e){switch(e){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},wue={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(n,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},_ue={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&qC(e[0],"none")?[]:ll(e).map(function(t){for(var r={color:Zg.TRANSPARENT,offsetX:ii,offsetY:ii,blur:ii},i=0,s=0;s"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},Eue=function(n){var e=n.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},Bue=function(n){var e=n.filter(function(l){return l.type===17}).map(function(l){return l.number}),t=e[0],r=e[1];e[2],e[3];var i=e[4],s=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var o=e[12],a=e[13];return e[14],e[15],e.length===16?[t,r,i,s,o,a]:null},Mue={matrix:Eue,matrix3d:Bue},cN={type:16,number:50,flags:b0},Sue=[cN,cN],Cue={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(n,e){var t=e.filter(br);return t.length!==2?Sue:[t[0],t[1]]}},Tue={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},ig;(function(n){n.NORMAL="normal",n.BREAK_ALL="break-all",n.KEEP_ALL="keep-all"})(ig||(ig={}));var Iue={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"break-all":return ig.BREAK_ALL;case"keep-all":return ig.KEEP_ALL;case"normal":default:return ig.NORMAL}}},Rue={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(n,e){if(e.type===20)return{auto:!0,order:0};if(x1(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},H8={name:"time",parse:function(n,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},Uue={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(n,e){return x1(e)?e.number:1}},Fue={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Pue={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(n,e){return e.filter(sr).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return t!==0})}},Lue={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(n,e){var t=[],r=[];return e.forEach(function(i){switch(i.type){case 20:case 0:t.push(i.value);break;case 17:t.push(i.number.toString());break;case 4:r.push(t.join(" ")),t.length=0;break}}),t.length&&r.push(t.join(" ")),r.map(function(i){return i.indexOf(" ")===-1?i:"'"+i+"'"})}},Due={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},Nue={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(n,e){if(x1(e))return e.number;if(sr(e))switch(e.value){case"bold":return 700;case"normal":default:return 400}return 400}},Oue={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.filter(sr).map(function(t){return t.value})}},kue={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},Pr=function(n,e){return(n&e)!==0},Que={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(n,e){return e.filter(E0).map(function(t){return H8.parse(n,t)})}},Hue={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&qC(e[0],"none")?[]:ll(e).map(function(t){for(var r={color:255,offsetX:ii,offsetY:ii,blur:ii,spread:ii,inset:!1},i=0,s=0;s1?1:0],this.overflowWrap=et(e,due,t.overflowWrap),this.paddingTop=et(e,pue,t.paddingTop),this.paddingRight=et(e,mue,t.paddingRight),this.paddingBottom=et(e,gue,t.paddingBottom),this.paddingLeft=et(e,vue,t.paddingLeft),this.paintOrder=et(e,zue,t.paintOrder),this.position=et(e,wue,t.position),this.textAlign=et(e,yue,t.textAlign),this.textDecorationColor=et(e,Fue,(r=t.textDecorationColor)!==null&&r!==void 0?r:t.color),this.textDecorationLine=et(e,Pue,(i=t.textDecorationLine)!==null&&i!==void 0?i:t.textDecoration),this.textShadow=et(e,_ue,t.textShadow),this.textTransform=et(e,xue,t.textTransform),this.transform=et(e,bue,t.transform),this.transformOrigin=et(e,Cue,t.transformOrigin),this.visibility=et(e,Tue,t.visibility),this.webkitTextStrokeColor=et(e,Gue,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=et(e,Vue,t.webkitTextStrokeWidth),this.wordBreak=et(e,Iue,t.wordBreak),this.zIndex=et(e,Rue,t.zIndex)}return n.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},n.prototype.isTransparent=function(){return cd(this.backgroundColor)},n.prototype.isTransformed=function(){return this.transform!==null},n.prototype.isPositioned=function(){return this.position!==0},n.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},n.prototype.isFloating=function(){return this.float!==0},n.prototype.isInlineLevel=function(){return Pr(this.display,4)||Pr(this.display,33554432)||Pr(this.display,268435456)||Pr(this.display,536870912)||Pr(this.display,67108864)||Pr(this.display,134217728)},n}(),et=function(n,e,t){var r=new b8,i=t!==null&&typeof t<"u"?t.toString():e.initialValue;r.write(i);var s=new E8(r.read());switch(e.type){case 2:var o=s.parseComponentValue();return e.parse(n,sr(o)?o.value:e.initialValue);case 0:return e.parse(n,s.parseComponentValue());case 1:return e.parse(n,s.parseComponentValues());case 4:return s.parseComponentValue();case 3:switch(e.format){case"angle":return E1.parse(n,s.parseComponentValue());case"color":return hA.parse(n,s.parseComponentValue());case"image":return n2.parse(n,s.parseComponentValue());case"length":var a=s.parseComponentValue();return _A(a)?a:ii;case"length-percentage":var l=s.parseComponentValue();return br(l)?l:ii;case"time":return H8.parse(n,s.parseComponentValue())}break}},Wue="data-html2canvas-debug",Kue=function(n){var e=n.getAttribute(Wue);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},AN=function(n,e){var t=Kue(n);return t===1||e===t},cl=function(){function n(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,AN(t,3))debugger;this.styles=new jue(e,window.getComputedStyle(t,null)),Kfe(t)&&(this.styles.animationDuration.some(function(r){return r>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=qR(this.context,t),AN(t,4)&&(this.flags|=16)}return n}(),Xue="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",uN="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Tm=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Ay=0;Ay>4,A[i++]=(o&15)<<4|a>>2,A[i++]=(a&3)<<6|l&63;return c},$ue=function(n){for(var e=n.length,t=[],r=0;r>Mu,que=1<>Mu,tfe=z8+efe,nfe=tfe,rfe=32,ife=nfe+rfe,sfe=65536>>r2,ofe=1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Mu],t=(t<<_B)+(e&xB),this.data[t];if(e<=65535)return t=this.index[z8+(e-55296>>Mu)],t=(t<<_B)+(e&xB),this.data[t];if(e>r2),t=this.index[t],t+=e>>Mu&afe,t=this.index[t],t=(t<<_B)+(e&xB),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},n}(),hN="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ufe=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var uy=0;uy=55296&&i<=56319&&t>10)+55296,o%1024+56320)),(i+1===t||r.length>16384)&&(s+=String.fromCharCode.apply(String,r),r.length=0)}return s},mfe=cfe(Xue),ro="×",CB="÷",gfe=function(n){return mfe.get(n)},vfe=function(n,e,t){var r=t-2,i=e[r],s=e[t-1],o=e[t];if(s===bB&&o===EB)return ro;if(s===bB||s===EB||s===dN||o===bB||o===EB||o===dN)return CB;if(s===mN&&[mN,BB,gN,vN].indexOf(o)!==-1||(s===gN||s===BB)&&(o===BB||o===MB)||(s===vN||s===MB)&&o===MB||o===yN||o===pN||o===hfe||s===ffe)return ro;if(s===yN&&o===wN){for(;i===pN;)i=e[--r];if(i===wN)return ro}if(s===SB&&o===SB){for(var a=0;i===SB;)a++,i=e[--r];if(a%2===0)return ro}return CB},yfe=function(n){var e=dfe(n),t=e.length,r=0,i=0,s=e.map(gfe);return{next:function(){if(r>=t)return{done:!0,value:null};for(var o=ro;ro.x||A.y>o.y;return o=A,c===0?!0:u});return n.body.removeChild(e),a},bfe=function(){return typeof new Image().crossOrigin<"u"},Efe=function(){return typeof new XMLHttpRequest().responseType=="string"},Bfe=function(n){var e=new Image,t=n.createElement("canvas"),r=t.getContext("2d");if(!r)return!1;e.src="data:image/svg+xml,";try{r.drawImage(e,0,0),t.toDataURL()}catch{return!1}return!0},_N=function(n){return n[0]===0&&n[1]===255&&n[2]===0&&n[3]===255},Mfe=function(n){var e=n.createElement("canvas"),t=100;e.width=t,e.height=t;var r=e.getContext("2d");if(!r)return Promise.reject(!1);r.fillStyle="rgb(0, 255, 0)",r.fillRect(0,0,t,t);var i=new Image,s=e.toDataURL();i.src=s;var o=eT(t,t,0,0,i);return r.fillStyle="red",r.fillRect(0,0,t,t),xN(o).then(function(a){r.drawImage(a,0,0);var l=r.getImageData(0,0,t,t).data;r.fillStyle="red",r.fillRect(0,0,t,t);var c=n.createElement("div");return c.style.backgroundImage="url("+s+")",c.style.height=t+"px",_N(l)?xN(eT(t,t,0,0,c)):Promise.reject(!1)}).then(function(a){return r.drawImage(a,0,0),_N(r.getImageData(0,0,t,t).data)}).catch(function(){return!1})},eT=function(n,e,t,r,i){var s="http://www.w3.org/2000/svg",o=document.createElementNS(s,"svg"),a=document.createElementNS(s,"foreignObject");return o.setAttributeNS(null,"width",n.toString()),o.setAttributeNS(null,"height",e.toString()),a.setAttributeNS(null,"width","100%"),a.setAttributeNS(null,"height","100%"),a.setAttributeNS(null,"x",t.toString()),a.setAttributeNS(null,"y",r.toString()),a.setAttributeNS(null,"externalResourcesRequired","true"),o.appendChild(a),a.appendChild(i),o},xN=function(n){return new Promise(function(e,t){var r=new Image;r.onload=function(){return e(r)},r.onerror=t,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(n))})},_s={get SUPPORT_RANGE_BOUNDS(){var n=_fe(document);return Object.defineProperty(_s,"SUPPORT_RANGE_BOUNDS",{value:n}),n},get SUPPORT_WORD_BREAKING(){var n=_s.SUPPORT_RANGE_BOUNDS&&xfe(document);return Object.defineProperty(_s,"SUPPORT_WORD_BREAKING",{value:n}),n},get SUPPORT_SVG_DRAWING(){var n=Bfe(document);return Object.defineProperty(_s,"SUPPORT_SVG_DRAWING",{value:n}),n},get SUPPORT_FOREIGNOBJECT_DRAWING(){var n=typeof Array.from=="function"&&typeof window.fetch=="function"?Mfe(document):Promise.resolve(!1);return Object.defineProperty(_s,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:n}),n},get SUPPORT_CORS_IMAGES(){var n=bfe();return Object.defineProperty(_s,"SUPPORT_CORS_IMAGES",{value:n}),n},get SUPPORT_RESPONSE_TYPE(){var n=Efe();return Object.defineProperty(_s,"SUPPORT_RESPONSE_TYPE",{value:n}),n},get SUPPORT_CORS_XHR(){var n="withCredentials"in new XMLHttpRequest;return Object.defineProperty(_s,"SUPPORT_CORS_XHR",{value:n}),n},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var n=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(_s,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:n}),n}},sg=function(){function n(e,t){this.text=e,this.bounds=t}return n}(),Sfe=function(n,e,t,r){var i=Ife(e,t),s=[],o=0;return i.forEach(function(a){if(t.textDecorationLine.length||a.trim().length>0)if(_s.SUPPORT_RANGE_BOUNDS){var l=bN(r,o,a.length).getClientRects();if(l.length>1){var c=i2(a),A=0;c.forEach(function(f){s.push(new sg(f,Qu.fromDOMRectList(n,bN(r,A+o,f.length).getClientRects()))),A+=f.length})}else s.push(new sg(a,Qu.fromDOMRectList(n,l)))}else{var u=r.splitText(a.length);s.push(new sg(a,Cfe(n,r))),r=u}else _s.SUPPORT_RANGE_BOUNDS||(r=r.splitText(a.length));o+=a.length}),s},Cfe=function(n,e){var t=e.ownerDocument;if(t){var r=t.createElement("html2canvaswrapper");r.appendChild(e.cloneNode(!0));var i=e.parentNode;if(i){i.replaceChild(r,e);var s=qR(n,r);return r.firstChild&&i.replaceChild(r.firstChild,r),s}}return Qu.EMPTY},bN=function(n,e,t){var r=n.ownerDocument;if(!r)throw new Error("Node has no owner document");var i=r.createRange();return i.setStart(n,e),i.setEnd(n,e+t),i},i2=function(n){if(_s.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(n)).map(function(t){return t.segment})}return wfe(n)},Tfe=function(n,e){if(_s.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(n)).map(function(r){return r.segment})}return Ufe(n,e)},Ife=function(n,e){return e.letterSpacing!==0?i2(n):Tfe(n,e)},Rfe=[32,160,4961,65792,65793,4153,4241],Ufe=function(n,e){for(var t=Ace(n,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),r=[],i,s=function(){if(i.value){var o=i.value.slice(),a=_1(o),l="";a.forEach(function(c){Rfe.indexOf(c)===-1?l+=Ar(c):(l.length&&r.push(l),r.push(Ar(c)),l="")}),l.length&&r.push(l)}};!(i=t.next()).done;)s();return r},Ffe=function(){function n(e,t,r){this.text=Pfe(t.data,r.textTransform),this.textBounds=Sfe(e,this.text,r,t)}return n}(),Pfe=function(n,e){switch(e){case 1:return n.toLowerCase();case 3:return n.replace(Lfe,Dfe);case 2:return n.toUpperCase();default:return n}},Lfe=/(^|\s|:|-|\(|\))([a-z])/g,Dfe=function(n,e,t){return n.length>0?e+t.toUpperCase():n},G8=function(n){ua(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.src=r.currentSrc||r.src,i.intrinsicWidth=r.naturalWidth,i.intrinsicHeight=r.naturalHeight,i.context.cache.addImage(i.src),i}return e}(cl),V8=function(n){ua(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.canvas=r,i.intrinsicWidth=r.width,i.intrinsicHeight=r.height,i}return e}(cl),j8=function(n){ua(e,n);function e(t,r){var i=n.call(this,t,r)||this,s=new XMLSerializer,o=qR(t,r);return r.setAttribute("width",o.width+"px"),r.setAttribute("height",o.height+"px"),i.svg="data:image/svg+xml,"+encodeURIComponent(s.serializeToString(r)),i.intrinsicWidth=r.width.baseVal.value,i.intrinsicHeight=r.height.baseVal.value,i.context.cache.addImage(i.svg),i}return e}(cl),W8=function(n){ua(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.value=r.value,i}return e}(cl),tT=function(n){ua(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.start=r.start,i.reversed=typeof r.reversed=="boolean"&&r.reversed===!0,i}return e}(cl),Nfe=[{type:15,flags:0,unit:"px",number:3}],Ofe=[{type:16,flags:0,number:50}],kfe=function(n){return n.width>n.height?new Qu(n.left+(n.width-n.height)/2,n.top,n.height,n.height):n.width0)t.textNodes.push(new Ffe(n,i,t.styles));else if(Z8(i))if(nhe(i)&&i.assignedNodes)i.assignedNodes().forEach(function(a){return Rw(n,a,t,r)});else{var o=$8(n,i);o.styles.isVisible()&&(Vfe(i,o,r)?o.flags|=4:jfe(o.styles)&&(o.flags|=2),zfe.indexOf(i.tagName)!==-1&&(o.flags|=8),t.elements.push(o),i.slot,i.shadowRoot?Rw(n,i.shadowRoot,o,r):!q8(i)&&!J8(i)&&!eG(i)&&Rw(n,i,o,r))}},$8=function(n,e){return ehe(e)?new G8(n,e):qfe(e)?new V8(n,e):J8(e)?new j8(n,e):Yfe(e)?new W8(n,e):$fe(e)?new tT(n,e):Zfe(e)?new s2(n,e):eG(e)?new K8(n,e):q8(e)?new X8(n,e):the(e)?new Y8(n,e):new cl(n,e)},Gfe=function(n,e){var t=$8(n,e);return t.flags|=4,Rw(n,e,t,t),t},Vfe=function(n,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Jfe(n)&&t.styles.isTransparent()},jfe=function(n){return n.isPositioned()||n.isFloating()},Wfe=function(n){return n.nodeType===Node.TEXT_NODE},Z8=function(n){return n.nodeType===Node.ELEMENT_NODE},Kfe=function(n){return Z8(n)&&typeof n.style<"u"&&!Xfe(n)},Xfe=function(n){return typeof n.className=="object"},Yfe=function(n){return n.tagName==="LI"},$fe=function(n){return n.tagName==="OL"},Zfe=function(n){return n.tagName==="INPUT"},J8=function(n){return n.tagName==="svg"},Jfe=function(n){return n.tagName==="BODY"},qfe=function(n){return n.tagName==="CANVAS"},ehe=function(n){return n.tagName==="IMG"},the=function(n){return n.tagName==="IFRAME"},q8=function(n){return n.tagName==="TEXTAREA"},eG=function(n){return n.tagName==="SELECT"},nhe=function(n){return n.tagName==="SLOT"},BN={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},MN={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},rhe={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},ihe={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},If=function(n,e,t,r,i,s){return nt?o2(n,i,s.length>0):r.integers.reduce(function(o,a,l){for(;n>=a;)n-=a,o+=r.values[l];return o},"")+s},tG=function(n,e,t,r){var i="";do t||n--,i=r(n)+i,n/=e;while(n*e>=e);return i},lr=function(n,e,t,r,i){var s=t-e+1;return(n<0?"-":"")+(tG(Math.abs(n),s,r,function(o){return Ar(Math.floor(o%s)+e)})+i)},WA=function(n,e,t){t===void 0&&(t=". ");var r=e.length;return tG(Math.abs(n),r,!1,function(i){return e[Math.floor(i%r)]})+t},Xf=1,Pc=2,Lc=4,Im=8,yl=function(n,e,t,r,i,s){if(n<-9999||n>9999)return o2(n,4,i.length>0);var o=Math.abs(n),a=i;if(o===0)return e[0]+a;for(var l=0;o>0&&l<=4;l++){var c=o%10;c===0&&Pr(s,Xf)&&a!==""?a=e[c]+a:c>1||c===1&&l===0||c===1&&l===1&&Pr(s,Pc)||c===1&&l===1&&Pr(s,Lc)&&n>100||c===1&&l>1&&Pr(s,Im)?a=e[c]+(l>0?t[l-1]:"")+a:c===1&&l>0&&(a=t[l-1]+a),o=Math.floor(o/10)}return(n<0?r:"")+a},SN="十百千萬",CN="拾佰仟萬",TN="マイナス",TB="마이너스",o2=function(n,e,t){var r=t?". ":"",i=t?"、":"",s=t?", ":"",o=t?" ":"";switch(e){case 0:return"•"+o;case 1:return"◦"+o;case 2:return"◾"+o;case 5:var a=lr(n,48,57,!0,r);return a.length<4?"0"+a:a;case 4:return WA(n,"〇一二三四五六七八九",i);case 6:return If(n,1,3999,BN,3,r).toLowerCase();case 7:return If(n,1,3999,BN,3,r);case 8:return lr(n,945,969,!1,r);case 9:return lr(n,97,122,!1,r);case 10:return lr(n,65,90,!1,r);case 11:return lr(n,1632,1641,!0,r);case 12:case 49:return If(n,1,9999,MN,3,r);case 35:return If(n,1,9999,MN,3,r).toLowerCase();case 13:return lr(n,2534,2543,!0,r);case 14:case 30:return lr(n,6112,6121,!0,r);case 15:return WA(n,"子丑寅卯辰巳午未申酉戌亥",i);case 16:return WA(n,"甲乙丙丁戊己庚辛壬癸",i);case 17:case 48:return yl(n,"零一二三四五六七八九",SN,"負",i,Pc|Lc|Im);case 47:return yl(n,"零壹貳參肆伍陸柒捌玖",CN,"負",i,Xf|Pc|Lc|Im);case 42:return yl(n,"零一二三四五六七八九",SN,"负",i,Pc|Lc|Im);case 41:return yl(n,"零壹贰叁肆伍陆柒捌玖",CN,"负",i,Xf|Pc|Lc|Im);case 26:return yl(n,"〇一二三四五六七八九","十百千万",TN,i,0);case 25:return yl(n,"零壱弐参四伍六七八九","拾百千万",TN,i,Xf|Pc|Lc);case 31:return yl(n,"영일이삼사오육칠팔구","십백천만",TB,s,Xf|Pc|Lc);case 33:return yl(n,"零一二三四五六七八九","十百千萬",TB,s,0);case 32:return yl(n,"零壹貳參四五六七八九","拾百千",TB,s,Xf|Pc|Lc);case 18:return lr(n,2406,2415,!0,r);case 20:return If(n,1,19999,ihe,3,r);case 21:return lr(n,2790,2799,!0,r);case 22:return lr(n,2662,2671,!0,r);case 22:return If(n,1,10999,rhe,3,r);case 23:return WA(n,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return WA(n,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return lr(n,3302,3311,!0,r);case 28:return WA(n,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",i);case 29:return WA(n,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",i);case 34:return lr(n,3792,3801,!0,r);case 37:return lr(n,6160,6169,!0,r);case 38:return lr(n,4160,4169,!0,r);case 39:return lr(n,2918,2927,!0,r);case 40:return lr(n,1776,1785,!0,r);case 43:return lr(n,3046,3055,!0,r);case 44:return lr(n,3174,3183,!0,r);case 45:return lr(n,3664,3673,!0,r);case 46:return lr(n,3872,3881,!0,r);case 3:default:return lr(n,48,57,!0,r)}},IN;(function(n){n[n.BEFORE=0]="BEFORE",n[n.AFTER=1]="AFTER"})(IN||(IN={}));var she=function(){function n(){}return n.getOrigin=function(e){var t=n._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},n.isSameOrigin=function(e){return n.getOrigin(e)===n._origin},n.setContext=function(e){n._link=e.document.createElement("a"),n._origin=n.getOrigin(e.location.href)},n._origin="about:blank",n}(),Ye=function(){function n(e,t){this.type=0,this.x=e,this.y=t}return n.prototype.add=function(e,t){return new n(this.x+e,this.y+t)},n}(),Rf=function(n,e,t){return new Ye(n.x+(e.x-n.x)*t,n.y+(e.y-n.y)*t)},fy=function(){function n(e,t,r,i){this.type=1,this.start=e,this.startControl=t,this.endControl=r,this.end=i}return n.prototype.subdivide=function(e,t){var r=Rf(this.start,this.startControl,e),i=Rf(this.startControl,this.endControl,e),s=Rf(this.endControl,this.end,e),o=Rf(r,i,e),a=Rf(i,s,e),l=Rf(o,a,e);return t?new n(this.start,r,o,l):new n(l,a,s,this.end)},n.prototype.add=function(e,t){return new n(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},n.prototype.reverse=function(){return new n(this.end,this.endControl,this.startControl,this.start)},n}(),oo=function(n){return n.type===1},ohe=function(){function n(e){var t=e.styles,r=e.bounds,i=Cm(t.borderTopLeftRadius,r.width,r.height),s=i[0],o=i[1],a=Cm(t.borderTopRightRadius,r.width,r.height),l=a[0],c=a[1],A=Cm(t.borderBottomRightRadius,r.width,r.height),u=A[0],f=A[1],h=Cm(t.borderBottomLeftRadius,r.width,r.height),d=h[0],m=h[1],g=[];g.push((s+l)/r.width),g.push((d+u)/r.width),g.push((o+m)/r.height),g.push((c+f)/r.height);var p=Math.max.apply(Math,g);p>1&&(s/=p,o/=p,l/=p,c/=p,u/=p,f/=p,d/=p,m/=p);var v=r.width-l,w=r.height-f,_=r.width-u,x=r.height-m,b=t.borderTopWidth,B=t.borderRightWidth,S=t.borderBottomWidth,I=t.borderLeftWidth,M=bn(t.paddingTop,e.bounds.width),L=bn(t.paddingRight,e.bounds.width),D=bn(t.paddingBottom,e.bounds.width),T=bn(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||o>0?Ln(r.left+I/3,r.top+b/3,s-I/3,o-b/3,ln.TOP_LEFT):new Ye(r.left+I/3,r.top+b/3),this.topRightBorderDoubleOuterBox=s>0||o>0?Ln(r.left+v,r.top+b/3,l-B/3,c-b/3,ln.TOP_RIGHT):new Ye(r.left+r.width-B/3,r.top+b/3),this.bottomRightBorderDoubleOuterBox=u>0||f>0?Ln(r.left+_,r.top+w,u-B/3,f-S/3,ln.BOTTOM_RIGHT):new Ye(r.left+r.width-B/3,r.top+r.height-S/3),this.bottomLeftBorderDoubleOuterBox=d>0||m>0?Ln(r.left+I/3,r.top+x,d-I/3,m-S/3,ln.BOTTOM_LEFT):new Ye(r.left+I/3,r.top+r.height-S/3),this.topLeftBorderDoubleInnerBox=s>0||o>0?Ln(r.left+I*2/3,r.top+b*2/3,s-I*2/3,o-b*2/3,ln.TOP_LEFT):new Ye(r.left+I*2/3,r.top+b*2/3),this.topRightBorderDoubleInnerBox=s>0||o>0?Ln(r.left+v,r.top+b*2/3,l-B*2/3,c-b*2/3,ln.TOP_RIGHT):new Ye(r.left+r.width-B*2/3,r.top+b*2/3),this.bottomRightBorderDoubleInnerBox=u>0||f>0?Ln(r.left+_,r.top+w,u-B*2/3,f-S*2/3,ln.BOTTOM_RIGHT):new Ye(r.left+r.width-B*2/3,r.top+r.height-S*2/3),this.bottomLeftBorderDoubleInnerBox=d>0||m>0?Ln(r.left+I*2/3,r.top+x,d-I*2/3,m-S*2/3,ln.BOTTOM_LEFT):new Ye(r.left+I*2/3,r.top+r.height-S*2/3),this.topLeftBorderStroke=s>0||o>0?Ln(r.left+I/2,r.top+b/2,s-I/2,o-b/2,ln.TOP_LEFT):new Ye(r.left+I/2,r.top+b/2),this.topRightBorderStroke=s>0||o>0?Ln(r.left+v,r.top+b/2,l-B/2,c-b/2,ln.TOP_RIGHT):new Ye(r.left+r.width-B/2,r.top+b/2),this.bottomRightBorderStroke=u>0||f>0?Ln(r.left+_,r.top+w,u-B/2,f-S/2,ln.BOTTOM_RIGHT):new Ye(r.left+r.width-B/2,r.top+r.height-S/2),this.bottomLeftBorderStroke=d>0||m>0?Ln(r.left+I/2,r.top+x,d-I/2,m-S/2,ln.BOTTOM_LEFT):new Ye(r.left+I/2,r.top+r.height-S/2),this.topLeftBorderBox=s>0||o>0?Ln(r.left,r.top,s,o,ln.TOP_LEFT):new Ye(r.left,r.top),this.topRightBorderBox=l>0||c>0?Ln(r.left+v,r.top,l,c,ln.TOP_RIGHT):new Ye(r.left+r.width,r.top),this.bottomRightBorderBox=u>0||f>0?Ln(r.left+_,r.top+w,u,f,ln.BOTTOM_RIGHT):new Ye(r.left+r.width,r.top+r.height),this.bottomLeftBorderBox=d>0||m>0?Ln(r.left,r.top+x,d,m,ln.BOTTOM_LEFT):new Ye(r.left,r.top+r.height),this.topLeftPaddingBox=s>0||o>0?Ln(r.left+I,r.top+b,Math.max(0,s-I),Math.max(0,o-b),ln.TOP_LEFT):new Ye(r.left+I,r.top+b),this.topRightPaddingBox=l>0||c>0?Ln(r.left+Math.min(v,r.width-B),r.top+b,v>r.width+B?0:Math.max(0,l-B),Math.max(0,c-b),ln.TOP_RIGHT):new Ye(r.left+r.width-B,r.top+b),this.bottomRightPaddingBox=u>0||f>0?Ln(r.left+Math.min(_,r.width-I),r.top+Math.min(w,r.height-S),Math.max(0,u-B),Math.max(0,f-S),ln.BOTTOM_RIGHT):new Ye(r.left+r.width-B,r.top+r.height-S),this.bottomLeftPaddingBox=d>0||m>0?Ln(r.left+I,r.top+Math.min(x,r.height-S),Math.max(0,d-I),Math.max(0,m-S),ln.BOTTOM_LEFT):new Ye(r.left+I,r.top+r.height-S),this.topLeftContentBox=s>0||o>0?Ln(r.left+I+T,r.top+b+M,Math.max(0,s-(I+T)),Math.max(0,o-(b+M)),ln.TOP_LEFT):new Ye(r.left+I+T,r.top+b+M),this.topRightContentBox=l>0||c>0?Ln(r.left+Math.min(v,r.width+I+T),r.top+b+M,v>r.width+I+T?0:l-I+T,c-(b+M),ln.TOP_RIGHT):new Ye(r.left+r.width-(B+L),r.top+b+M),this.bottomRightContentBox=u>0||f>0?Ln(r.left+Math.min(_,r.width-(I+T)),r.top+Math.min(w,r.height+b+M),Math.max(0,u-(B+L)),f-(S+D),ln.BOTTOM_RIGHT):new Ye(r.left+r.width-(B+L),r.top+r.height-(S+D)),this.bottomLeftContentBox=d>0||m>0?Ln(r.left+I+T,r.top+x,Math.max(0,d-(I+T)),m-(S+D),ln.BOTTOM_LEFT):new Ye(r.left+I+T,r.top+r.height-(S+D))}return n}(),ln;(function(n){n[n.TOP_LEFT=0]="TOP_LEFT",n[n.TOP_RIGHT=1]="TOP_RIGHT",n[n.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",n[n.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(ln||(ln={}));var Ln=function(n,e,t,r,i){var s=4*((Math.sqrt(2)-1)/3),o=t*s,a=r*s,l=n+t,c=e+r;switch(i){case ln.TOP_LEFT:return new fy(new Ye(n,c),new Ye(n,c-a),new Ye(l-o,e),new Ye(l,e));case ln.TOP_RIGHT:return new fy(new Ye(n,e),new Ye(n+o,e),new Ye(l,c-a),new Ye(l,c));case ln.BOTTOM_RIGHT:return new fy(new Ye(l,e),new Ye(l,e+a),new Ye(n+o,c),new Ye(n,c));case ln.BOTTOM_LEFT:default:return new fy(new Ye(l,c),new Ye(l-o,c),new Ye(n,e+a),new Ye(n,e))}},K_=function(n){return[n.topLeftBorderBox,n.topRightBorderBox,n.bottomRightBorderBox,n.bottomLeftBorderBox]},ahe=function(n){return[n.topLeftContentBox,n.topRightContentBox,n.bottomRightContentBox,n.bottomLeftContentBox]},X_=function(n){return[n.topLeftPaddingBox,n.topRightPaddingBox,n.bottomRightPaddingBox,n.bottomLeftPaddingBox]},lhe=function(){function n(e,t,r){this.offsetX=e,this.offsetY=t,this.matrix=r,this.type=0,this.target=6}return n}(),hy=function(){function n(e,t){this.path=e,this.target=t,this.type=1}return n}(),che=function(){function n(e){this.opacity=e,this.type=2,this.target=6}return n}(),Ahe=function(n){return n.type===0},nG=function(n){return n.type===1},uhe=function(n){return n.type===2},RN=function(n,e){return n.length===e.length?n.some(function(t,r){return t===e[r]}):!1},fhe=function(n,e,t,r,i){return n.map(function(s,o){switch(o){case 0:return s.add(e,t);case 1:return s.add(e+r,t);case 2:return s.add(e+r,t+i);case 3:return s.add(e,t+i)}return s})},rG=function(){function n(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return n}(),iG=function(){function n(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new ohe(this.container),this.container.styles.opacity<1&&this.effects.push(new che(this.container.styles.opacity)),this.container.styles.transform!==null){var r=this.container.bounds.left+this.container.styles.transformOrigin[0].number,i=this.container.bounds.top+this.container.styles.transformOrigin[1].number,s=this.container.styles.transform;this.effects.push(new lhe(r,i,s))}if(this.container.styles.overflowX!==0){var o=K_(this.curves),a=X_(this.curves);RN(o,a)?this.effects.push(new hy(o,6)):(this.effects.push(new hy(o,2)),this.effects.push(new hy(a,4)))}}return n.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,r=this.parent,i=this.effects.slice(0);r;){var s=r.effects.filter(function(l){return!nG(l)});if(t||r.container.styles.position!==0||!r.parent){if(i.unshift.apply(i,s),t=[2,3].indexOf(r.container.styles.position)===-1,r.container.styles.overflowX!==0){var o=K_(r.curves),a=X_(r.curves);RN(o,a)||i.unshift(new hy(a,6))}}else i.unshift.apply(i,s);r=r.parent}return i.filter(function(l){return Pr(l.target,e)})},n}(),nT=function(n,e,t,r){n.container.elements.forEach(function(i){var s=Pr(i.flags,4),o=Pr(i.flags,2),a=new iG(i,n);Pr(i.styles.display,2048)&&r.push(a);var l=Pr(i.flags,8)?[]:r;if(s||o){var c=s||i.styles.isPositioned()?t:e,A=new rG(a);if(i.styles.isPositioned()||i.styles.opacity<1||i.styles.isTransformed()){var u=i.styles.zIndex.order;if(u<0){var f=0;c.negativeZIndex.some(function(d,m){return u>d.element.container.styles.zIndex.order?(f=m,!1):f>0}),c.negativeZIndex.splice(f,0,A)}else if(u>0){var h=0;c.positiveZIndex.some(function(d,m){return u>=d.element.container.styles.zIndex.order?(h=m+1,!1):h>0}),c.positiveZIndex.splice(h,0,A)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(A)}else i.styles.isFloating()?c.nonPositionedFloats.push(A):c.nonPositionedInlineLevel.push(A);nT(a,A,s?A:t,l)}else i.styles.isInlineLevel()?e.inlineLevel.push(a):e.nonInlineLevel.push(a),nT(a,e,t,l);Pr(i.flags,8)&&sG(i,l)})},sG=function(n,e){for(var t=n instanceof tT?n.start:1,r=n instanceof tT?n.reversed:!1,i=0;i"u"?n[0]:t},whe=function(n,e,t,r,i){var s=e[0],o=e[1],a=t[0],l=t[1];switch(n){case 2:return[new Ye(Math.round(r.left),Math.round(r.top+o)),new Ye(Math.round(r.left+r.width),Math.round(r.top+o)),new Ye(Math.round(r.left+r.width),Math.round(l+r.top+o)),new Ye(Math.round(r.left),Math.round(l+r.top+o))];case 3:return[new Ye(Math.round(r.left+s),Math.round(r.top)),new Ye(Math.round(r.left+s+a),Math.round(r.top)),new Ye(Math.round(r.left+s+a),Math.round(r.height+r.top)),new Ye(Math.round(r.left+s),Math.round(r.height+r.top))];case 1:return[new Ye(Math.round(r.left+s),Math.round(r.top+o)),new Ye(Math.round(r.left+s+a),Math.round(r.top+o)),new Ye(Math.round(r.left+s+a),Math.round(r.top+o+l)),new Ye(Math.round(r.left+s),Math.round(r.top+o+l))];default:return[new Ye(Math.round(i.left),Math.round(i.top)),new Ye(Math.round(i.left+i.width),Math.round(i.top)),new Ye(Math.round(i.left+i.width),Math.round(i.height+i.top)),new Ye(Math.round(i.left),Math.round(i.height+i.top))]}},_he="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",FN="Hidden Text",xhe=function(){function n(e){this._data={},this._document=e}return n.prototype.parseMetrics=function(e,t){var r=this._document.createElement("div"),i=this._document.createElement("img"),s=this._document.createElement("span"),o=this._document.body;r.style.visibility="hidden",r.style.fontFamily=e,r.style.fontSize=t,r.style.margin="0",r.style.padding="0",r.style.whiteSpace="nowrap",o.appendChild(r),i.src=_he,i.width=1,i.height=1,i.style.margin="0",i.style.padding="0",i.style.verticalAlign="baseline",s.style.fontFamily=e,s.style.fontSize=t,s.style.margin="0",s.style.padding="0",s.appendChild(this._document.createTextNode(FN)),r.appendChild(s),r.appendChild(i);var a=i.offsetTop-s.offsetTop+2;r.removeChild(s),r.appendChild(this._document.createTextNode(FN)),r.style.lineHeight="normal",i.style.verticalAlign="super";var l=i.offsetTop-r.offsetTop+2;return o.removeChild(r),{baseline:a,middle:l}},n.prototype.getMetrics=function(e,t){var r=e+" "+t;return typeof this._data[r]>"u"&&(this._data[r]=this.parseMetrics(e,t)),this._data[r]},n}(),aG=function(){function n(e,t){this.context=e,this.options=t}return n}(),bhe=1e4;(function(n){ua(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i._activeEffects=[],i.canvas=r.canvas?r.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),r.canvas||(i.canvas.width=Math.floor(r.width*r.scale),i.canvas.height=Math.floor(r.height*r.scale),i.canvas.style.width=r.width+"px",i.canvas.style.height=r.height+"px"),i.fontMetrics=new xhe(document),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-r.x,-r.y),i.ctx.textBaseline="bottom",i._activeEffects=[],i.context.logger.debug("Canvas renderer initialized ("+r.width+"x"+r.height+") with scale "+r.scale),i}return e.prototype.applyEffects=function(t){for(var r=this;this._activeEffects.length;)this.popEffect();t.forEach(function(i){return r.applyEffect(i)})},e.prototype.applyEffect=function(t){this.ctx.save(),uhe(t)&&(this.ctx.globalAlpha=t.opacity),Ahe(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),nG(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return qs(this,void 0,void 0,function(){var r;return gs(this,function(i){switch(i.label){case 0:return r=t.element.container.styles,r.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return qs(this,void 0,void 0,function(){return gs(this,function(r){switch(r.label){case 0:if(Pr(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return r.sent(),[4,this.renderNodeContent(t)];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,r,i){var s=this;if(r===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+i);else{var o=i2(t.text);o.reduce(function(a,l){return s.ctx.fillText(l,a,t.bounds.top+i),a+s.ctx.measureText(l).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var r=t.fontVariant.filter(function(o){return o==="normal"||o==="small-caps"}).join(""),i=Che(t.fontFamily).join(", "),s=E0(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,r,t.fontWeight,s,i].join(" "),i,s]},e.prototype.renderTextNode=function(t,r){return qs(this,void 0,void 0,function(){var i,s,o,a,l,c,A,u,f=this;return gs(this,function(h){return i=this.createFontStyle(r),s=i[0],o=i[1],a=i[2],this.ctx.font=s,this.ctx.direction=r.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",l=this.fontMetrics.getMetrics(o,a),c=l.baseline,A=l.middle,u=r.paintOrder,t.textBounds.forEach(function(d){u.forEach(function(m){switch(m){case 0:f.ctx.fillStyle=Hr(r.color),f.renderTextWithLetterSpacing(d,r.letterSpacing,c);var g=r.textShadow;g.length&&d.text.trim().length&&(g.slice(0).reverse().forEach(function(p){f.ctx.shadowColor=Hr(p.color),f.ctx.shadowOffsetX=p.offsetX.number*f.options.scale,f.ctx.shadowOffsetY=p.offsetY.number*f.options.scale,f.ctx.shadowBlur=p.blur.number,f.renderTextWithLetterSpacing(d,r.letterSpacing,c)}),f.ctx.shadowColor="",f.ctx.shadowOffsetX=0,f.ctx.shadowOffsetY=0,f.ctx.shadowBlur=0),r.textDecorationLine.length&&(f.ctx.fillStyle=Hr(r.textDecorationColor||r.color),r.textDecorationLine.forEach(function(p){switch(p){case 1:f.ctx.fillRect(d.bounds.left,Math.round(d.bounds.top+c),d.bounds.width,1);break;case 2:f.ctx.fillRect(d.bounds.left,Math.round(d.bounds.top),d.bounds.width,1);break;case 3:f.ctx.fillRect(d.bounds.left,Math.ceil(d.bounds.top+A),d.bounds.width,1);break}}));break;case 1:r.webkitTextStrokeWidth&&d.text.trim().length&&(f.ctx.strokeStyle=Hr(r.webkitTextStrokeColor),f.ctx.lineWidth=r.webkitTextStrokeWidth,f.ctx.lineJoin=window.chrome?"miter":"round",f.ctx.strokeText(d.text,d.bounds.left,d.bounds.top+c)),f.ctx.strokeStyle="",f.ctx.lineWidth=0,f.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,r,i){if(i&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var s=Y_(t),o=X_(r);this.path(o),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(i,0,0,t.intrinsicWidth,t.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return qs(this,void 0,void 0,function(){var r,i,s,o,a,l,v,v,c,A,u,f,_,h,d,x,m,g,p,v,w,_,x;return gs(this,function(b){switch(b.label){case 0:this.applyEffects(t.getEffects(4)),r=t.container,i=t.curves,s=r.styles,o=0,a=r.textNodes,b.label=1;case 1:return o0&&y>0&&(S=s.ctx.createPattern(x,"repeat"),s.renderRepeat(M,S,R,F))):SAe(A)&&(I=IB(t,r,[null,null,null]),M=I[0],L=I[1],D=I[2],T=I[3],y=I[4],E=A.position.length===0?[t2]:A.position,R=bn(E[0],T),F=bn(E[E.length-1],y),O=xAe(A,R,F,T,y),z=O[0],j=O[1],z>0&&j>0&&(Q=s.ctx.createRadialGradient(L+R,D+F,0,L+R,D+F,z),oN(A.stops,z*2).forEach(function(ue){return Q.addColorStop(ue.stop,Hr(ue.color))}),s.path(M),s.ctx.fillStyle=Q,z!==j?(C=t.bounds.left+.5*t.bounds.width,W=t.bounds.top+.5*t.bounds.height,ee=j/z,P=1/ee,s.ctx.save(),s.ctx.translate(C,W),s.ctx.transform(1,0,0,ee,0,0),s.ctx.translate(-C,-W),s.ctx.fillRect(L,P*(D-W)+W,T,y*P),s.ctx.restore()):s.ctx.fill())),re.label=6;case 6:return r--,[2]}})},s=this,o=0,a=t.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return o0?A.style!==2?[3,5]:[4,this.renderDashedDottedBorder(A.color,A.width,a,t.curves,2)]:[3,11]):[3,13];case 4:return f.sent(),[3,11];case 5:return A.style!==3?[3,7]:[4,this.renderDashedDottedBorder(A.color,A.width,a,t.curves,3)];case 6:return f.sent(),[3,11];case 7:return A.style!==4?[3,9]:[4,this.renderDoubleBorder(A.color,A.width,a,t.curves)];case 8:return f.sent(),[3,11];case 9:return[4,this.renderSolidBorder(A.color,a,t.curves)];case 10:f.sent(),f.label=11;case 11:a++,f.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,r,i,s,o){return qs(this,void 0,void 0,function(){var a,l,c,A,u,f,h,d,m,g,p,v,w,_,x,b,x,b;return gs(this,function(B){return this.ctx.save(),a=mhe(s,i),l=UN(s,i),o===2&&(this.path(l),this.ctx.clip()),oo(l[0])?(c=l[0].start.x,A=l[0].start.y):(c=l[0].x,A=l[0].y),oo(l[1])?(u=l[1].end.x,f=l[1].end.y):(u=l[1].x,f=l[1].y),i===0||i===2?h=Math.abs(c-u):h=Math.abs(A-f),this.ctx.beginPath(),o===3?this.formatPath(a):this.formatPath(l.slice(0,2)),d=r<3?r*3:r*2,m=r<3?r*2:r,o===3&&(d=r,m=r),g=!0,h<=d*2?g=!1:h<=d*2+m?(p=h/(2*d+m),d*=p,m*=p):(v=Math.floor((h+m)/(d+m)),w=(h-v*d)/(v-1),_=(h-(v+1)*d)/v,m=_<=0||Math.abs(m-w)new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),$t=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),Y_=class extends Lt{constructor(n){super(),this.weight=0,this.isBinary=!1,this.overrideBlink="none",this.overrideLookAt="none",this.overrideMouth="none",this._binds=[],this.name=`VRMExpression_${n}`,this.expressionName=n,this.type="VRMExpression",this.visible=!1}get overrideBlinkAmount(){return this.overrideBlink==="block"?0.5?1:0:this.weight}addBind(n){this._binds.push(n)}applyWeight(n){var e;let t=this.outputWeight;t*=(e=n==null?void 0:n.multiplier)!=null?e:1,this.isBinary&&t<1&&(t=0),this._binds.forEach(r=>r.applyWeight(t))}clearAppliedWeight(){this._binds.forEach(n=>n.clearAppliedWeight())}};function aG(n,e,t){var r,i;const s=n.parser.json,o=(r=s.nodes)==null?void 0:r[e];if(o==null)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${e}] of glTF but the node doesn't exist`),null;const a=o.mesh;if(a==null)return null;const l=(i=s.meshes)==null?void 0:i[a];if(l==null)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${a}] of glTF but the mesh doesn't exist`),null;const c=l.primitives.length,A=[];return t.traverse(u=>{A.length{const s=aG(n,i,r);s!=null&&t.set(i,s)}),t})}var ni={Aa:"aa",Ih:"ih",Ou:"ou",Ee:"ee",Oh:"oh",Blink:"blink",Happy:"happy",Angry:"angry",Sad:"sad",Relaxed:"relaxed",LookUp:"lookUp",Surprised:"surprised",LookDown:"lookDown",LookLeft:"lookLeft",LookRight:"lookRight",BlinkLeft:"blinkLeft",BlinkRight:"blinkRight",Neutral:"neutral"};function lG(n){return Math.max(Math.min(n,1),0)}var $_=class cG{constructor(){this.blinkExpressionNames=["blink","blinkLeft","blinkRight"],this.lookAtExpressionNames=["lookLeft","lookRight","lookUp","lookDown"],this.mouthExpressionNames=["aa","ee","ih","oh","ou"],this._expressions=[],this._expressionMap={}}get expressions(){return this._expressions.concat()}get expressionMap(){return Object.assign({},this._expressionMap)}get presetExpressionMap(){const e={},t=new Set(Object.values(ni));return Object.entries(this._expressionMap).forEach(([r,i])=>{t.has(r)&&(e[r]=i)}),e}get customExpressionMap(){const e={},t=new Set(Object.values(ni));return Object.entries(this._expressionMap).forEach(([r,i])=>{t.has(r)||(e[r]=i)}),e}copy(e){return this._expressions.concat().forEach(r=>{this.unregisterExpression(r)}),e._expressions.forEach(r=>{this.registerExpression(r)}),this.blinkExpressionNames=e.blinkExpressionNames.concat(),this.lookAtExpressionNames=e.lookAtExpressionNames.concat(),this.mouthExpressionNames=e.mouthExpressionNames.concat(),this}clone(){return new cG().copy(this)}getExpression(e){var t;return(t=this._expressionMap[e])!=null?t:null}registerExpression(e){this._expressions.push(e),this._expressionMap[e.expressionName]=e}unregisterExpression(e){const t=this._expressions.indexOf(e);t===-1&&console.warn("VRMExpressionManager: The specified expressions is not registered"),this._expressions.splice(t,1),delete this._expressionMap[e.expressionName]}getValue(e){var t;const r=this.getExpression(e);return(t=r==null?void 0:r.weight)!=null?t:null}setValue(e,t){const r=this.getExpression(e);r&&(r.weight=lG(t))}resetValues(){this._expressions.forEach(e=>{e.weight=0})}getExpressionTrackName(e){const t=this.getExpression(e);return t?`${t.name}.weight`:null}update(){const e=this._calculateWeightMultipliers();this._expressions.forEach(t=>{t.clearAppliedWeight()}),this._expressions.forEach(t=>{let r=1;const i=t.expressionName;this.blinkExpressionNames.indexOf(i)!==-1&&(r*=e.blink),this.lookAtExpressionNames.indexOf(i)!==-1&&(r*=e.lookAt),this.mouthExpressionNames.indexOf(i)!==-1&&(r*=e.mouth),t.applyWeight({multiplier:r})})}_calculateWeightMultipliers(){let e=1,t=1,r=1;return this._expressions.forEach(i=>{e-=i.overrideBlinkAmount,t-=i.overrideLookAtAmount,r-=i.overrideMouthAmount}),e=Math.max(0,e),t=Math.max(0,t),r=Math.max(0,r),{blink:e,lookAt:t,mouth:r}}},Vp={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",MatcapColor:"matcapColor",RimColor:"rimColor",OutlineColor:"outlineColor"},Uhe={_Color:Vp.Color,_EmissionColor:Vp.EmissionColor,_ShadeColor:Vp.ShadeColor,_RimColor:Vp.RimColor,_OutlineColor:Vp.OutlineColor},Fhe=new ke,AG=class uG{constructor({material:e,type:t,targetValue:r,targetAlpha:i}){this.material=e,this.type=t,this.targetValue=r,this.targetAlpha=i??1;const s=this._initColorBindState(),o=this._initAlphaBindState();this._state={color:s,alpha:o}}applyWeight(e){const{color:t,alpha:r}=this._state;if(t!=null){const{propertyName:i,deltaValue:s}=t,o=this.material[i];o!=null&&o.add(Fhe.copy(s).multiplyScalar(e))}if(r!=null){const{propertyName:i,deltaValue:s}=r;this.material[i]!=null&&(this.material[i]+=s*e)}}clearAppliedWeight(){const{color:e,alpha:t}=this._state;if(e!=null){const{propertyName:r,initialValue:i}=e,s=this.material[r];s!=null&&s.copy(i)}if(t!=null){const{propertyName:r,initialValue:i}=t;this.material[r]!=null&&(this.material[r]=i)}}_initColorBindState(){var e,t,r;const{material:i,type:s,targetValue:o}=this,a=this._getPropertyNameMap(),l=(t=(e=a==null?void 0:a[s])==null?void 0:e[0])!=null?t:null;if(l==null)return console.warn(`Tried to add a material color bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type is not supported.`),null;const A=i[l].clone(),u=new ke(o.r-A.r,o.g-A.g,o.b-A.b);return{propertyName:l,initialValue:A,deltaValue:u}}_initAlphaBindState(){var e,t,r;const{material:i,type:s,targetAlpha:o}=this,a=this._getPropertyNameMap(),l=(t=(e=a==null?void 0:a[s])==null?void 0:e[1])!=null?t:null;if(l==null&&o!==1)return console.warn(`Tried to add a material alpha bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type does not support alpha.`),null;if(l==null)return null;const c=i[l],A=o-c;return{propertyName:l,initialValue:c,deltaValue:A}}_getPropertyNameMap(){var e,t;return(t=(e=Object.entries(uG._propertyNameMapMap).find(([r])=>this.material[r]===!0))==null?void 0:e[1])!=null?t:null}};AG._propertyNameMapMap={isMeshStandardMaterial:{color:["color","opacity"],emissionColor:["emissive",null]},isMeshBasicMaterial:{color:["color","opacity"]},isMToonMaterial:{color:["color","opacity"],emissionColor:["emissive",null],outlineColor:["outlineColorFactor",null],matcapColor:["matcapFactor",null],rimColor:["parametricRimColorFactor",null],shadeColor:["shadeColorFactor",null]}};var LN=AG,tT=class{constructor({primitives:n,index:e,weight:t}){this.primitives=n,this.index=e,this.weight=t}applyWeight(n){this.primitives.forEach(e=>{var t;((t=e.morphTargetInfluences)==null?void 0:t[this.index])!=null&&(e.morphTargetInfluences[this.index]+=this.weight*n)})}clearAppliedWeight(){this.primitives.forEach(n=>{var e;((e=n.morphTargetInfluences)==null?void 0:e[this.index])!=null&&(n.morphTargetInfluences[this.index]=0)})}},DN=new je,fG=class hG{constructor({material:e,scale:t,offset:r}){var i,s;this.material=e,this.scale=t,this.offset=r;const o=(i=Object.entries(hG._propertyNamesMap).find(([a])=>e[a]===!0))==null?void 0:i[1];o==null?(console.warn(`Tried to add a texture transform bind to the material ${(s=e.name)!=null?s:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],o.forEach(a=>{var l;const c=(l=e[a])==null?void 0:l.clone();if(!c)return null;e[a]=c;const A=c.offset.clone(),u=c.repeat.clone(),f=r.clone().sub(A),h=t.clone().sub(u);this._properties.push({name:a,initialOffset:A,deltaOffset:f,initialScale:u,deltaScale:h})}))}applyWeight(e){this._properties.forEach(t=>{const r=this.material[t.name];r!==void 0&&(r.offset.add(DN.copy(t.deltaOffset).multiplyScalar(e)),r.repeat.add(DN.copy(t.deltaScale).multiplyScalar(e)))})}clearAppliedWeight(){this._properties.forEach(e=>{const t=this.material[e.name];t!==void 0&&(t.offset.copy(e.initialOffset),t.repeat.copy(e.initialScale))})}};fG._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};var NN=fG,Phe=new Set(["1.0","1.0-beta"]),dG=class pG{get name(){return"VRMExpressionLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return $t(this,null,function*(){e.userData.vrmExpressionManager=yield this._import(e)})}_import(e){return $t(this,null,function*(){const t=yield this._v1Import(e);if(t)return t;const r=yield this._v0Import(e);return r||null})}_v1Import(e){return $t(this,null,function*(){var t,r;const i=this.parser.json;if(!(((t=i.extensionsUsed)==null?void 0:t.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!Phe.has(a))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.expressions;if(!l)return null;const c=new Set(Object.values(ni)),A=new Map;l.preset!=null&&Object.entries(l.preset).forEach(([f,h])=>{if(h!=null){if(!c.has(f)){console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${f}" detected. Ignoring the expression`);return}A.set(f,h)}}),l.custom!=null&&Object.entries(l.custom).forEach(([f,h])=>{if(c.has(f)){console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${f}". Ignoring the expression`);return}A.set(f,h)});const u=new $_;return yield Promise.all(Array.from(A.entries()).map(f=>$t(this,[f],function*([h,d]){var m,g,p,v,w,_,x;const b=new Y_(h);if(e.scene.add(b),b.isBinary=(m=d.isBinary)!=null?m:!1,b.overrideBlink=(g=d.overrideBlink)!=null?g:"none",b.overrideLookAt=(p=d.overrideLookAt)!=null?p:"none",b.overrideMouth=(v=d.overrideMouth)!=null?v:"none",(w=d.morphTargetBinds)==null||w.forEach(B=>$t(this,null,function*(){var M;if(B.node===void 0||B.index===void 0)return;const I=yield FN(e,B.node),S=B.index;if(!I.every(L=>Array.isArray(L.morphTargetInfluences)&&S{const I=M.material;I&&B.push(I)}),(_=d.materialColorBinds)==null||_.forEach(M=>$t(this,null,function*(){B.filter(S=>{var L;const D=(L=this.parser.associations.get(S))==null?void 0:L.materials;return M.material===D}).forEach(S=>{b.addBind(new LN({material:S,type:M.type,targetValue:new ke().fromArray(M.targetValue),targetAlpha:M.targetValue[3]}))})})),(x=d.textureTransformBinds)==null||x.forEach(M=>$t(this,null,function*(){B.filter(S=>{var L;const D=(L=this.parser.associations.get(S))==null?void 0:L.materials;return M.material===D}).forEach(S=>{var L,D;b.addBind(new NN({material:S,offset:new je().fromArray((L=M.offset)!=null?L:[0,0]),scale:new je().fromArray((D=M.scale)!=null?D:[1,1])}))})}))}u.registerExpression(b)}))),u})}_v0Import(e){return $t(this,null,function*(){var t;const r=this.parser.json,i=(t=r.extensions)==null?void 0:t.VRM;if(!i)return null;const s=i.blendShapeMaster;if(!s)return null;const o=new $_,a=s.blendShapeGroups;if(!a)return o;const l=new Set;return yield Promise.all(a.map(c=>$t(this,null,function*(){var A;const u=c.presetName,f=u!=null&&pG.v0v1PresetNameMap[u]||null,h=f??c.name;if(h==null){console.warn("VRMExpressionLoaderPlugin: One of custom expressions has no name. Ignoring the expression");return}if(l.has(h)){console.warn(`VRMExpressionLoaderPlugin: An expression preset ${u} has duplicated entries. Ignoring the expression`);return}l.add(h);const d=new Y_(h);e.scene.add(d),d.isBinary=(A=c.isBinary)!=null?A:!1,c.binds&&c.binds.forEach(g=>$t(this,null,function*(){var p;if(g.mesh===void 0||g.index===void 0)return;const v=[];(p=r.nodes)==null||p.forEach((_,x)=>{_.mesh===g.mesh&&v.push(x)});const w=g.index;yield Promise.all(v.map(_=>$t(this,null,function*(){var x;const b=yield FN(e,_);if(!b.every(B=>Array.isArray(B.morphTargetInfluences)&&w{if(g.materialName===void 0||g.propertyName===void 0||g.targetValue===void 0)return;const p=[];e.scene.traverse(w=>{if(w.material){const _=w.material;Array.isArray(_)?p.push(..._.filter(x=>(x.name===g.materialName||x.name===g.materialName+" (Outline)")&&p.indexOf(x)===-1)):_.name===g.materialName&&p.indexOf(_)===-1&&p.push(_)}});const v=g.propertyName;p.forEach(w=>{if(v==="_MainTex_ST"){const x=new je(g.targetValue[0],g.targetValue[1]),b=new je(g.targetValue[2],g.targetValue[3]);b.y=1-b.y-x.y,d.addBind(new NN({material:w,scale:x,offset:b}));return}const _=Uhe[v];if(_){d.addBind(new LN({material:w,type:_,targetValue:new ke().fromArray(g.targetValue),targetAlpha:g.targetValue[3]}));return}console.warn(v+" is not supported")})}),o.registerExpression(d)}))),o})}};dG.v0v1PresetNameMap={a:"aa",e:"ee",i:"ih",o:"oh",u:"ou",blink:"blink",joy:"happy",angry:"angry",sorrow:"sad",fun:"relaxed",lookup:"lookUp",lookdown:"lookDown",lookleft:"lookLeft",lookright:"lookRight",blink_l:"blinkLeft",blink_r:"blinkRight",neutral:"neutral"};var Lhe=dG,o2=class Xf{constructor(e,t){this._firstPersonOnlyLayer=Xf.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=Xf.DEFAULT_THIRDPERSON_ONLY_LAYER,this._initializedLayers=!1,this.humanoid=e,this.meshAnnotations=t}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMFirstPerson: humanoid must be same in order to copy");return this.meshAnnotations=e.meshAnnotations.map(t=>({meshes:t.meshes.concat(),type:t.type})),this}clone(){return new Xf(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:e=Xf.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:t=Xf.DEFAULT_THIRDPERSON_ONLY_LAYER}={}){this._initializedLayers||(this._firstPersonOnlyLayer=e,this._thirdPersonOnlyLayer=t,this.meshAnnotations.forEach(r=>{r.meshes.forEach(i=>{r.type==="firstPersonOnly"?(i.layers.set(this._firstPersonOnlyLayer),i.traverse(s=>s.layers.set(this._firstPersonOnlyLayer))):r.type==="thirdPersonOnly"?(i.layers.set(this._thirdPersonOnlyLayer),i.traverse(s=>s.layers.set(this._thirdPersonOnlyLayer))):r.type==="auto"&&this._createHeadlessModel(i)})}),this._initializedLayers=!0)}_excludeTriangles(e,t,r,i){let s=0;if(t!=null&&t.length>0)for(let o=0;o0&&i.includes(u[0])||A[1]>0&&i.includes(u[1])||A[2]>0&&i.includes(u[2])||A[3]>0&&i.includes(u[3]))continue;const f=t[l],h=r[l];if(f[0]>0&&i.includes(h[0])||f[1]>0&&i.includes(h[1])||f[2]>0&&i.includes(h[2])||f[3]>0&&i.includes(h[3]))continue;const d=t[c],m=r[c];d[0]>0&&i.includes(m[0])||d[1]>0&&i.includes(m[1])||d[2]>0&&i.includes(m[2])||d[3]>0&&i.includes(m[3])||(e[s++]=a,e[s++]=l,e[s++]=c)}return s}_createErasedMesh(e,t){const r=new ia(e.geometry.clone(),e.material);r.name=`${e.name}(erase)`,r.frustumCulled=e.frustumCulled,r.layers.set(this._firstPersonOnlyLayer);const i=r.geometry,s=i.getAttribute("skinIndex"),o=s instanceof vD?[]:s.array,a=[];for(let m=0;m{this._isEraseTarget(s)&&r.push(o)}),!r.length){t.layers.enable(this._thirdPersonOnlyLayer),t.layers.enable(this._firstPersonOnlyLayer);return}t.layers.set(this._thirdPersonOnlyLayer);const i=this._createErasedMesh(t,r);e.add(i)}_createHeadlessModel(e){if(e.type==="Group")if(e.layers.set(this._thirdPersonOnlyLayer),this._isEraseTarget(e))e.traverse(t=>t.layers.set(this._thirdPersonOnlyLayer));else{const t=new ri;t.name=`_headless_${e.name}`,t.layers.set(this._firstPersonOnlyLayer),e.parent.add(t),e.children.filter(r=>r.type==="SkinnedMesh").forEach(r=>{const i=r;this._createHeadlessModelForSkinnedMesh(t,i)})}else if(e.type==="SkinnedMesh"){const t=e;this._createHeadlessModelForSkinnedMesh(e.parent,t)}else this._isEraseTarget(e)&&(e.layers.set(this._thirdPersonOnlyLayer),e.traverse(t=>t.layers.set(this._thirdPersonOnlyLayer)))}_isEraseTarget(e){return e===this.humanoid.getRawBoneNode("head")?!0:e.parent?this._isEraseTarget(e.parent):!1}};o2.DEFAULT_FIRSTPERSON_ONLY_LAYER=9;o2.DEFAULT_THIRDPERSON_ONLY_LAYER=10;var ON=o2,Dhe=new Set(["1.0","1.0-beta"]),Nhe=class{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(n){this.parser=n}afterRoot(n){return $t(this,null,function*(){const e=n.userData.vrmHumanoid;if(e!==null){if(e===void 0)throw new Error("VRMFirstPersonLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");n.userData.vrmFirstPerson=yield this._import(n,e)}})}_import(n,e){return $t(this,null,function*(){if(e==null)return null;const t=yield this._v1Import(n,e);if(t)return t;const r=yield this._v0Import(n,e);return r||null})}_v1Import(n,e){return $t(this,null,function*(){var t,r;const i=this.parser.json;if(!(((t=i.extensionsUsed)==null?void 0:t.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!Dhe.has(a))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.firstPerson;if(!l)return null;const c=[],A=yield PN(n);return Array.from(A.entries()).forEach(([u,f])=>{var h;const d=l.meshAnnotations?l.meshAnnotations.find(m=>m.node===u):void 0;c.push({meshes:f,type:(h=d==null?void 0:d.type)!=null?h:"both"})}),new ON(e,c)})}_v0Import(n,e){return $t(this,null,function*(){var t;const r=this.parser.json,i=(t=r.extensions)==null?void 0:t.VRM;if(!i)return null;const s=i.firstPerson;if(!s)return null;const o=[],a=yield PN(n);return Array.from(a.entries()).forEach(([l,c])=>{const A=r.nodes[l],u=s.meshAnnotations?s.meshAnnotations.find(f=>f.mesh===A.mesh):void 0;o.push({meshes:c,type:this._convertV0FlagToV1Type(u==null?void 0:u.firstPersonFlag)})}),new ON(e,o)})}_convertV0FlagToV1Type(n){return n==="FirstPersonOnly"?"firstPersonOnly":n==="ThirdPersonOnly"?"thirdPersonOnly":n==="Auto"?"auto":"both"}},kN=new $,HN=new $,Ohe=new nt,QN=class extends ri{constructor(n){super(),this.vrmHumanoid=n,this._boneAxesMap=new Map,Object.values(n.humanBones).forEach(e=>{const t=new boe(1);t.matrixAutoUpdate=!1,t.material.depthTest=!1,t.material.depthWrite=!1,this.add(t),this._boneAxesMap.set(e,t)})}dispose(){Array.from(this._boneAxesMap.values()).forEach(n=>{n.geometry.dispose(),n.material.dispose()})}updateMatrixWorld(n){Array.from(this._boneAxesMap.entries()).forEach(([e,t])=>{e.node.updateWorldMatrix(!0,!1),e.node.matrixWorld.decompose(kN,Ohe,HN);const r=kN.set(.1,.1,.1).divide(HN);t.matrix.copy(e.node.matrixWorld).scale(r)}),super.updateMatrixWorld(n)}},TB=["hips","spine","chest","upperChest","neck","head","leftEye","rightEye","jaw","leftUpperLeg","leftLowerLeg","leftFoot","leftToes","rightUpperLeg","rightLowerLeg","rightFoot","rightToes","leftShoulder","leftUpperArm","leftLowerArm","leftHand","rightShoulder","rightUpperArm","rightLowerArm","rightHand","leftThumbMetacarpal","leftThumbProximal","leftThumbDistal","leftIndexProximal","leftIndexIntermediate","leftIndexDistal","leftMiddleProximal","leftMiddleIntermediate","leftMiddleDistal","leftRingProximal","leftRingIntermediate","leftRingDistal","leftLittleProximal","leftLittleIntermediate","leftLittleDistal","rightThumbMetacarpal","rightThumbProximal","rightThumbDistal","rightIndexProximal","rightIndexIntermediate","rightIndexDistal","rightMiddleProximal","rightMiddleIntermediate","rightMiddleDistal","rightRingProximal","rightRingIntermediate","rightRingDistal","rightLittleProximal","rightLittleIntermediate","rightLittleDistal"],Zg={Hips:"hips",Spine:"spine",Chest:"chest",UpperChest:"upperChest",Neck:"neck",Head:"head",LeftEye:"leftEye",RightEye:"rightEye",Jaw:"jaw",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",LeftToes:"leftToes",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",RightToes:"rightToes",LeftShoulder:"leftShoulder",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightShoulder:"rightShoulder",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand",LeftThumbMetacarpal:"leftThumbMetacarpal",LeftThumbProximal:"leftThumbProximal",LeftThumbDistal:"leftThumbDistal",LeftIndexProximal:"leftIndexProximal",LeftIndexIntermediate:"leftIndexIntermediate",LeftIndexDistal:"leftIndexDistal",LeftMiddleProximal:"leftMiddleProximal",LeftMiddleIntermediate:"leftMiddleIntermediate",LeftMiddleDistal:"leftMiddleDistal",LeftRingProximal:"leftRingProximal",LeftRingIntermediate:"leftRingIntermediate",LeftRingDistal:"leftRingDistal",LeftLittleProximal:"leftLittleProximal",LeftLittleIntermediate:"leftLittleIntermediate",LeftLittleDistal:"leftLittleDistal",RightThumbMetacarpal:"rightThumbMetacarpal",RightThumbProximal:"rightThumbProximal",RightThumbDistal:"rightThumbDistal",RightIndexProximal:"rightIndexProximal",RightIndexIntermediate:"rightIndexIntermediate",RightIndexDistal:"rightIndexDistal",RightMiddleProximal:"rightMiddleProximal",RightMiddleIntermediate:"rightMiddleIntermediate",RightMiddleDistal:"rightMiddleDistal",RightRingProximal:"rightRingProximal",RightRingIntermediate:"rightRingIntermediate",RightRingDistal:"rightRingDistal",RightLittleProximal:"rightLittleProximal",RightLittleIntermediate:"rightLittleIntermediate",RightLittleDistal:"rightLittleDistal"},khe={hips:null,spine:"hips",chest:"spine",upperChest:"chest",neck:"upperChest",head:"neck",leftEye:"head",rightEye:"head",jaw:"head",leftUpperLeg:"hips",leftLowerLeg:"leftUpperLeg",leftFoot:"leftLowerLeg",leftToes:"leftFoot",rightUpperLeg:"hips",rightLowerLeg:"rightUpperLeg",rightFoot:"rightLowerLeg",rightToes:"rightFoot",leftShoulder:"upperChest",leftUpperArm:"leftShoulder",leftLowerArm:"leftUpperArm",leftHand:"leftLowerArm",rightShoulder:"upperChest",rightUpperArm:"rightShoulder",rightLowerArm:"rightUpperArm",rightHand:"rightLowerArm",leftThumbMetacarpal:"leftHand",leftThumbProximal:"leftThumbMetacarpal",leftThumbDistal:"leftThumbProximal",leftIndexProximal:"leftHand",leftIndexIntermediate:"leftIndexProximal",leftIndexDistal:"leftIndexIntermediate",leftMiddleProximal:"leftHand",leftMiddleIntermediate:"leftMiddleProximal",leftMiddleDistal:"leftMiddleIntermediate",leftRingProximal:"leftHand",leftRingIntermediate:"leftRingProximal",leftRingDistal:"leftRingIntermediate",leftLittleProximal:"leftHand",leftLittleIntermediate:"leftLittleProximal",leftLittleDistal:"leftLittleIntermediate",rightThumbMetacarpal:"rightHand",rightThumbProximal:"rightThumbMetacarpal",rightThumbDistal:"rightThumbProximal",rightIndexProximal:"rightHand",rightIndexIntermediate:"rightIndexProximal",rightIndexDistal:"rightIndexIntermediate",rightMiddleProximal:"rightHand",rightMiddleIntermediate:"rightMiddleProximal",rightMiddleDistal:"rightMiddleIntermediate",rightRingProximal:"rightHand",rightRingIntermediate:"rightRingProximal",rightRingDistal:"rightRingIntermediate",rightLittleProximal:"rightHand",rightLittleIntermediate:"rightLittleProximal",rightLittleDistal:"rightLittleIntermediate"};function mG(n){return n.invert?n.invert():n.inverse(),n}var WA=new $,KA=new nt,nT=class{constructor(n){this.humanBones=n,this.restPose=this.getAbsolutePose()}getAbsolutePose(){const n={};return Object.keys(this.humanBones).forEach(e=>{const t=e,r=this.getBoneNode(t);r&&(WA.copy(r.position),KA.copy(r.quaternion),n[t]={position:WA.toArray(),rotation:KA.toArray()})}),n}getPose(){const n={};return Object.keys(this.humanBones).forEach(e=>{const t=e,r=this.getBoneNode(t);if(!r)return;WA.set(0,0,0),KA.identity();const i=this.restPose[t];i!=null&&i.position&&WA.fromArray(i.position).negate(),i!=null&&i.rotation&&mG(KA.fromArray(i.rotation)),WA.add(r.position),KA.premultiply(r.quaternion),n[t]={position:WA.toArray(),rotation:KA.toArray()}}),n}setPose(n){Object.entries(n).forEach(([e,t])=>{const r=e,i=this.getBoneNode(r);if(!i)return;const s=this.restPose[r];s&&(t!=null&&t.position&&(i.position.fromArray(t.position),s.position&&i.position.add(WA.fromArray(s.position))),t!=null&&t.rotation&&(i.quaternion.fromArray(t.rotation),s.rotation&&i.quaternion.multiply(KA.fromArray(s.rotation))))})}resetPose(){Object.entries(this.restPose).forEach(([n,e])=>{const t=this.getBoneNode(n);t&&(e!=null&&e.position&&t.position.fromArray(e.position),e!=null&&e.rotation&&t.quaternion.fromArray(e.rotation))})}getBone(n){var e;return(e=this.humanBones[n])!=null?e:void 0}getBoneNode(n){var e,t;return(t=(e=this.humanBones[n])==null?void 0:e.node)!=null?t:null}},IB=new $,Hhe=new nt,Qhe=new $,zN=class gG extends nT{static _setupTransforms(e){const t=new Lt;t.name="VRMHumanoidRig";const r={},i={},s={};TB.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const A=new $,u=new nt;c.updateWorldMatrix(!0,!1),c.matrixWorld.decompose(A,u,IB),r[a]=A,i[a]=c.quaternion.clone();const f=new nt;(l=c.parent)==null||l.matrixWorld.decompose(IB,f,IB),s[a]=f}});const o={};return TB.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const A=r[a];let u=a,f;for(;f==null&&(u=khe[u],u!=null);)f=r[u];const h=new Lt;h.name="Normalized_"+c.name,(u?(l=o[u])==null?void 0:l.node:t).add(h),h.position.copy(A),f&&h.position.sub(f),o[a]={node:h}}}),{rigBones:o,root:t,parentWorldRotations:s,boneRotations:i}}constructor(e){const{rigBones:t,root:r,parentWorldRotations:i,boneRotations:s}=gG._setupTransforms(e);super(t),this.original=e,this.root=r,this._parentWorldRotations=i,this._boneRotations=s}update(){TB.forEach(e=>{const t=this.original.getBoneNode(e);if(t!=null){const r=this.getBoneNode(e),i=this._parentWorldRotations[e],s=Hhe.copy(i).invert(),o=this._boneRotations[e];if(t.quaternion.copy(r.quaternion).multiply(i).premultiply(s).multiply(o),e==="hips"){const a=r.getWorldPosition(Qhe);t.parent.updateWorldMatrix(!0,!1);const l=t.parent.matrixWorld,c=a.applyMatrix4(l.invert());t.position.copy(c)}}})}},GN=class vG{get restPose(){return console.warn("VRMHumanoid: restPose is deprecated. Use either rawRestPose or normalizedRestPose instead."),this.rawRestPose}get rawRestPose(){return this._rawHumanBones.restPose}get normalizedRestPose(){return this._normalizedHumanBones.restPose}get humanBones(){return this._rawHumanBones.humanBones}get rawHumanBones(){return this._rawHumanBones.humanBones}get normalizedHumanBones(){return this._normalizedHumanBones.humanBones}get normalizedHumanBonesRoot(){return this._normalizedHumanBones.root}constructor(e,t){var r;this.autoUpdateHumanBones=(r=t==null?void 0:t.autoUpdateHumanBones)!=null?r:!0,this._rawHumanBones=new nT(e),this._normalizedHumanBones=new zN(this._rawHumanBones)}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new nT(e.humanBones),this._normalizedHumanBones=new zN(this._rawHumanBones),this}clone(){return new vG(this.humanBones,{autoUpdateHumanBones:this.autoUpdateHumanBones}).copy(this)}getAbsolutePose(){return console.warn("VRMHumanoid: getAbsolutePose() is deprecated. Use either getRawAbsolutePose() or getNormalizedAbsolutePose() instead."),this.getRawAbsolutePose()}getRawAbsolutePose(){return this._rawHumanBones.getAbsolutePose()}getNormalizedAbsolutePose(){return this._normalizedHumanBones.getAbsolutePose()}getPose(){return console.warn("VRMHumanoid: getPose() is deprecated. Use either getRawPose() or getNormalizedPose() instead."),this.getRawPose()}getRawPose(){return this._rawHumanBones.getPose()}getNormalizedPose(){return this._normalizedHumanBones.getPose()}setPose(e){return console.warn("VRMHumanoid: setPose() is deprecated. Use either setRawPose() or setNormalizedPose() instead."),this.setRawPose(e)}setRawPose(e){return this._rawHumanBones.setPose(e)}setNormalizedPose(e){return this._normalizedHumanBones.setPose(e)}resetPose(){return console.warn("VRMHumanoid: resetPose() is deprecated. Use either resetRawPose() or resetNormalizedPose() instead."),this.resetRawPose()}resetRawPose(){return this._rawHumanBones.resetPose()}resetNormalizedPose(){return this._normalizedHumanBones.resetPose()}getBone(e){return console.warn("VRMHumanoid: getBone() is deprecated. Use either getRawBone() or getNormalizedBone() instead."),this.getRawBone(e)}getRawBone(e){return this._rawHumanBones.getBone(e)}getNormalizedBone(e){return this._normalizedHumanBones.getBone(e)}getBoneNode(e){return console.warn("VRMHumanoid: getBoneNode() is deprecated. Use either getRawBoneNode() or getNormalizedBoneNode() instead."),this.getRawBoneNode(e)}getRawBoneNode(e){return this._rawHumanBones.getBoneNode(e)}getNormalizedBoneNode(e){return this._normalizedHumanBones.getBoneNode(e)}update(){this.autoUpdateHumanBones&&this._normalizedHumanBones.update()}},zhe={Hips:"hips",Spine:"spine",Head:"head",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand"},Ghe=new Set(["1.0","1.0-beta"]),VN={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},Vhe=class{get name(){return"VRMHumanoidLoaderPlugin"}constructor(n,e){this.parser=n,this.helperRoot=e==null?void 0:e.helperRoot,this.autoUpdateHumanBones=e==null?void 0:e.autoUpdateHumanBones}afterRoot(n){return $t(this,null,function*(){n.userData.vrmHumanoid=yield this._import(n)})}_import(n){return $t(this,null,function*(){const e=yield this._v1Import(n);if(e)return e;const t=yield this._v0Import(n);return t||null})}_v1Import(n){return $t(this,null,function*(){var e,t;const r=this.parser.json;if(!(((e=r.extensionsUsed)==null?void 0:e.indexOf("VRMC_vrm"))!==-1))return null;const s=(t=r.extensions)==null?void 0:t.VRMC_vrm;if(!s)return null;const o=s.specVersion;if(!Ghe.has(o))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const a=s.humanoid;if(!a)return null;const l=a.humanBones.leftThumbIntermediate!=null||a.humanBones.rightThumbIntermediate!=null,c={};a.humanBones!=null&&(yield Promise.all(Object.entries(a.humanBones).map(u=>$t(this,[u],function*([f,h]){let d=f;const m=h.node;if(l){const p=VN[d];p!=null&&(d=p)}const g=yield this.parser.getDependency("node",m);if(g==null){console.warn(`A glTF node bound to the humanoid bone ${d} (index = ${m}) does not exist`);return}c[d]={node:g}}))));const A=new GN(this._ensureRequiredBonesExist(c),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(n.scene.add(A.normalizedHumanBonesRoot),this.helperRoot){const u=new QN(A);this.helperRoot.add(u),u.renderOrder=this.helperRoot.renderOrder}return A})}_v0Import(n){return $t(this,null,function*(){var e;const r=(e=this.parser.json.extensions)==null?void 0:e.VRM;if(!r)return null;const i=r.humanoid;if(!i)return null;const s={};i.humanBones!=null&&(yield Promise.all(i.humanBones.map(a=>$t(this,null,function*(){const l=a.bone,c=a.node;if(l==null||c==null)return;const A=yield this.parser.getDependency("node",c);if(A==null){console.warn(`A glTF node bound to the humanoid bone ${l} (index = ${c}) does not exist`);return}const u=VN[l],f=u??l;if(s[f]!=null){console.warn(`Multiple bone entries for ${f} detected (index = ${c}), ignoring duplicated entries.`);return}s[f]={node:A}}))));const o=new GN(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(n.scene.add(o.normalizedHumanBonesRoot),this.helperRoot){const a=new QN(o);this.helperRoot.add(a),a.renderOrder=this.helperRoot.renderOrder}return o})}_ensureRequiredBonesExist(n){const e=Object.values(zhe).filter(t=>n[t]==null);if(e.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${e.join(", ")}`);return n}},jN=class extends Jt{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new ct(new Float32Array(65*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new ct(new Uint16Array(3*63),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;this._currentTheta!==this.theta&&(this._currentTheta=this.theta,n=!0),this._currentRadius!==this.radius&&(this._currentRadius=this.radius,n=!0),n&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,0,0,0);for(let n=0;n<64;n++){const e=n/63*this._currentTheta;this._attrPos.setXYZ(n+1,this._currentRadius*Math.sin(e),0,this._currentRadius*Math.cos(e))}this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<63;n++)this._attrIndex.setXYZ(n*3,0,n+1,n+2);this._attrIndex.needsUpdate=!0}},jhe=class extends Jt{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new $,this._currentTail=new $,this._attrPos=new ct(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new ct(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;this._currentRadius!==this.radius&&(this._currentRadius=this.radius,n=!0),this._currentTail.equals(this.tail)||(this._currentTail.copy(this.tail),n=!0),n&&this._buildPosition()}_buildPosition(){for(let n=0;n<32;n++){const e=n/16*Math.PI;this._attrPos.setXYZ(n,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+n,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+n,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(64+n*2,32+n,32+e),this._attrIndex.setXY(128+n*2,64+n,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},my=new nt,WN=new nt,jp=new $,KN=new $,XN=Math.sqrt(2)/2,Whe=new nt(0,0,-XN,XN),Khe=new $(0,1,0),Xhe=class extends ri{constructor(n){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=n;{const e=new jN;e.radius=.5;const t=new qi({color:65280,transparent:!0,opacity:.5,side:_i,depthTest:!1,depthWrite:!1});this._meshPitch=new dn(e,t),this.add(this._meshPitch)}{const e=new jN;e.radius=.5;const t=new qi({color:16711680,transparent:!0,opacity:.5,side:_i,depthTest:!1,depthWrite:!1});this._meshYaw=new dn(e,t),this.add(this._meshYaw)}{const e=new jhe;e.radius=.1;const t=new Ac({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new y0(e,t),this._lineTarget.frustumCulled=!1,this.add(this._lineTarget)}}dispose(){this._meshYaw.geometry.dispose(),this._meshYaw.material.dispose(),this._meshPitch.geometry.dispose(),this._meshPitch.material.dispose(),this._lineTarget.geometry.dispose(),this._lineTarget.material.dispose()}updateMatrixWorld(n){const e=Bt.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=e,this._meshYaw.geometry.update();const t=Bt.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=t,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition(jp),this.vrmLookAt.getLookAtWorldQuaternion(my),my.multiply(this.vrmLookAt.getFaceFrontQuaternion(WN)),this._meshYaw.position.copy(jp),this._meshYaw.quaternion.copy(my),this._meshPitch.position.copy(jp),this._meshPitch.quaternion.copy(my),this._meshPitch.quaternion.multiply(WN.setFromAxisAngle(Khe,e)),this._meshPitch.quaternion.multiply(Whe);const{target:r,autoUpdate:i}=this.vrmLookAt;r!=null&&i&&(r.getWorldPosition(KN).sub(jp),this._lineTarget.geometry.tail.copy(KN),this._lineTarget.geometry.update(),this._lineTarget.position.copy(jp)),super.updateMatrixWorld(n)}},Yhe=new $,$he=new $;function rT(n,e){return n.matrixWorld.decompose(Yhe,e,$he),e}function Rw(n){return[Math.atan2(-n.z,n.x),Math.atan2(n.y,Math.sqrt(n.x*n.x+n.z*n.z))]}function YN(n){const e=Math.round(n/2/Math.PI);return n-2*Math.PI*e}var $N=new $(0,0,1),Zhe=new $,Jhe=new $,qhe=new $,ede=new nt,RB=new nt,ZN=new nt,tde=new nt,UB=new tr,yG=class wG{constructor(e,t){this.offsetFromHeadBone=new $,this.autoUpdate=!0,this.faceFront=new $(0,0,1),this.humanoid=e,this.applier=t,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new nt)}get yaw(){return this._yaw}set yaw(e){this._yaw=e,this._needsUpdate=!0}get pitch(){return this._pitch}set pitch(e){this._pitch=e,this._needsUpdate=!0}get euler(){return console.warn("VRMLookAt: euler is deprecated. use getEuler() instead."),this.getEuler(new tr)}getEuler(e){return e.set(Bt.DEG2RAD*this._pitch,Bt.DEG2RAD*this._yaw,0,"YXZ")}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMLookAt: humanoid must be same in order to copy");return this.offsetFromHeadBone.copy(e.offsetFromHeadBone),this.applier=e.applier,this.autoUpdate=e.autoUpdate,this.target=e.target,this.faceFront.copy(e.faceFront),this}clone(){return new wG(this.humanoid,this.applier).copy(this)}reset(){this._yaw=0,this._pitch=0,this._needsUpdate=!0}getLookAtWorldPosition(e){const t=this.humanoid.getRawBoneNode("head");return e.copy(this.offsetFromHeadBone).applyMatrix4(t.matrixWorld)}getLookAtWorldQuaternion(e){const t=this.humanoid.getRawBoneNode("head");return rT(t,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared($N)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[t,r]=Rw(this.faceFront);return UB.set(0,.5*Math.PI+t,r,"YZX"),e.setFromEuler(UB).premultiply(tde.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(RB),this.getFaceFrontQuaternion(ZN),e.copy($N).applyQuaternion(RB).applyQuaternion(ZN).applyEuler(this.getEuler(UB))}lookAt(e){const t=ede.copy(this._restHeadWorldQuaternion).multiply(mG(this.getLookAtWorldQuaternion(RB))),r=this.getLookAtWorldPosition(Jhe),i=qhe.copy(e).sub(r).applyQuaternion(t).normalize(),[s,o]=Rw(this.faceFront),[a,l]=Rw(i),c=YN(a-s),A=YN(o-l);this._yaw=Bt.RAD2DEG*c,this._pitch=Bt.RAD2DEG*A,this._needsUpdate=!0}update(e){this.target!=null&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(Zhe)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};yG.EULER_ORDER="YXZ";var nde=yG,rde=new $(0,0,1),ga=new nt,Rf=new nt,Zs=new tr(0,0,0,"YXZ"),Uw=class{constructor(n,e,t,r,i){this.humanoid=n,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=t,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i,this.faceFront=new $(0,0,1),this._restQuatLeftEye=new nt,this._restQuatRightEye=new nt,this._restLeftEyeParentWorldQuat=new nt,this._restRightEyeParentWorldQuat=new nt;const s=this.humanoid.getRawBoneNode("leftEye"),o=this.humanoid.getRawBoneNode("rightEye");s&&(this._restQuatLeftEye.copy(s.quaternion),rT(s.parent,this._restLeftEyeParentWorldQuat)),o&&(this._restQuatRightEye.copy(o.quaternion),rT(o.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(n,e){const t=this.humanoid.getRawBoneNode("leftEye"),r=this.humanoid.getRawBoneNode("rightEye"),i=this.humanoid.getNormalizedBoneNode("leftEye"),s=this.humanoid.getNormalizedBoneNode("rightEye");t&&(e<0?Zs.x=-Bt.DEG2RAD*this.rangeMapVerticalDown.map(-e):Zs.x=Bt.DEG2RAD*this.rangeMapVerticalUp.map(e),n<0?Zs.y=-Bt.DEG2RAD*this.rangeMapHorizontalInner.map(-n):Zs.y=Bt.DEG2RAD*this.rangeMapHorizontalOuter.map(n),ga.setFromEuler(Zs),this._getWorldFaceFrontQuat(Rf),i.quaternion.copy(Rf).multiply(ga).multiply(Rf.invert()),ga.copy(this._restLeftEyeParentWorldQuat),t.quaternion.copy(i.quaternion).multiply(ga).premultiply(ga.invert()).multiply(this._restQuatLeftEye)),r&&(e<0?Zs.x=-Bt.DEG2RAD*this.rangeMapVerticalDown.map(-e):Zs.x=Bt.DEG2RAD*this.rangeMapVerticalUp.map(e),n<0?Zs.y=-Bt.DEG2RAD*this.rangeMapHorizontalOuter.map(-n):Zs.y=Bt.DEG2RAD*this.rangeMapHorizontalInner.map(n),ga.setFromEuler(Zs),this._getWorldFaceFrontQuat(Rf),s.quaternion.copy(Rf).multiply(ga).multiply(Rf.invert()),ga.copy(this._restRightEyeParentWorldQuat),r.quaternion.copy(s.quaternion).multiply(ga).premultiply(ga.invert()).multiply(this._restQuatRightEye))}lookAt(n){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=Bt.RAD2DEG*n.y,t=Bt.RAD2DEG*n.x;this.applyYawPitch(e,t)}_getWorldFaceFrontQuat(n){if(this.faceFront.distanceToSquared(rde)<.01)return n.identity();const[e,t]=Rw(this.faceFront);return Zs.set(0,.5*Math.PI+e,t,"YZX"),n.setFromEuler(Zs)}};Uw.type="bone";var iT=class{constructor(n,e,t,r,i){this.expressions=n,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=t,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i}applyYawPitch(n,e){e<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-e))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(e))),n<0?(this.expressions.setValue("lookLeft",0),this.expressions.setValue("lookRight",this.rangeMapHorizontalOuter.map(-n))):(this.expressions.setValue("lookRight",0),this.expressions.setValue("lookLeft",this.rangeMapHorizontalOuter.map(n)))}lookAt(n){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=Bt.RAD2DEG*n.y,t=Bt.RAD2DEG*n.x;this.applyYawPitch(e,t)}};iT.type="expression";var JN=class{constructor(n,e){this.inputMaxValue=n,this.outputScale=e}map(n){return this.outputScale*lG(n/this.inputMaxValue)}},ide=new Set(["1.0","1.0-beta"]),gy=.01,sde=class{get name(){return"VRMLookAtLoaderPlugin"}constructor(n,e){this.parser=n,this.helperRoot=e==null?void 0:e.helperRoot}afterRoot(n){return $t(this,null,function*(){const e=n.userData.vrmHumanoid;if(e===null)return;if(e===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");const t=n.userData.vrmExpressionManager;if(t!==null){if(t===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmExpressionManager is undefined. VRMExpressionLoaderPlugin have to be used first");n.userData.vrmLookAt=yield this._import(n,e,t)}})}_import(n,e,t){return $t(this,null,function*(){if(e==null||t==null)return null;const r=yield this._v1Import(n,e,t);if(r)return r;const i=yield this._v0Import(n,e,t);return i||null})}_v1Import(n,e,t){return $t(this,null,function*(){var r,i,s;const o=this.parser.json;if(!(((r=o.extensionsUsed)==null?void 0:r.indexOf("VRMC_vrm"))!==-1))return null;const l=(i=o.extensions)==null?void 0:i.VRMC_vrm;if(!l)return null;const c=l.specVersion;if(!ide.has(c))return console.warn(`VRMLookAtLoaderPlugin: Unknown VRMC_vrm specVersion "${c}"`),null;const A=l.lookAt;if(!A)return null;const u=A.type==="expression"?1:10,f=this._v1ImportRangeMap(A.rangeMapHorizontalInner,u),h=this._v1ImportRangeMap(A.rangeMapHorizontalOuter,u),d=this._v1ImportRangeMap(A.rangeMapVerticalDown,u),m=this._v1ImportRangeMap(A.rangeMapVerticalUp,u);let g;A.type==="expression"?g=new iT(t,f,h,d,m):g=new Uw(e,f,h,d,m);const p=this._importLookAt(e,g);return p.offsetFromHeadBone.fromArray((s=A.offsetFromHeadBone)!=null?s:[0,.06,0]),p})}_v1ImportRangeMap(n,e){var t,r;let i=(t=n==null?void 0:n.inputMaxValue)!=null?t:90;const s=(r=n==null?void 0:n.outputScale)!=null?r:e;return i(console.error(o),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}},cde=class{constructor(n){this.scene=n.scene,this.meta=n.meta,this.humanoid=n.humanoid,this.expressionManager=n.expressionManager,this.firstPerson=n.firstPerson,this.lookAt=n.lookAt}update(n){this.humanoid.update(),this.lookAt&&this.lookAt.update(n),this.expressionManager&&this.expressionManager.update()}},Ade=class extends cde{constructor(n){super(n),this.materials=n.materials,this.springBoneManager=n.springBoneManager,this.nodeConstraintManager=n.nodeConstraintManager}update(n){super.update(n),this.nodeConstraintManager&&this.nodeConstraintManager.update(),this.springBoneManager&&this.springBoneManager.update(n),this.materials&&this.materials.forEach(e=>{e.update&&e.update(n)})}},ude=Object.defineProperty,qN=Object.getOwnPropertySymbols,fde=Object.prototype.hasOwnProperty,hde=Object.prototype.propertyIsEnumerable,eO=(n,e,t)=>e in n?ude(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,tO=(n,e)=>{for(var t in e||(e={}))fde.call(e,t)&&eO(n,t,e[t]);if(qN)for(var t of qN(e))hde.call(e,t)&&eO(n,t,e[t]);return n},du=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),dde={"":3e3,srgb:3001};function pde(n,e){parseInt(nc,10)>=152?n.colorSpace=e:n.encoding=dde[e]}var mde=class{get pending(){return Promise.all(this._pendings)}constructor(n,e){this._parser=n,this._materialParams=e,this._pendings=[]}assignPrimitive(n,e){e!=null&&(this._materialParams[n]=e)}assignColor(n,e,t){e!=null&&(this._materialParams[n]=new ke().fromArray(e),t&&this._materialParams[n].convertSRGBToLinear())}assignTexture(n,e,t){return du(this,null,function*(){const r=(()=>du(this,null,function*(){e!=null&&(yield this._parser.assignTexture(this._materialParams,n,e),t&&pde(this._materialParams[n],"srgb"))}))();return this._pendings.push(r),r})}assignTextureByIndex(n,e,t){return du(this,null,function*(){return this.assignTexture(n,e!=null?{index:e}:void 0,t)})}},gde=`// #define PHONG + */var my=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),$t=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),$_=class extends Lt{constructor(n){super(),this.weight=0,this.isBinary=!1,this.overrideBlink="none",this.overrideLookAt="none",this.overrideMouth="none",this._binds=[],this.name=`VRMExpression_${n}`,this.expressionName=n,this.type="VRMExpression",this.visible=!1}get overrideBlinkAmount(){return this.overrideBlink==="block"?0.5?1:0:this.weight}addBind(n){this._binds.push(n)}applyWeight(n){var e;let t=this.outputWeight;t*=(e=n==null?void 0:n.multiplier)!=null?e:1,this.isBinary&&t<1&&(t=0),this._binds.forEach(r=>r.applyWeight(t))}clearAppliedWeight(){this._binds.forEach(n=>n.clearAppliedWeight())}};function lG(n,e,t){var r,i;const s=n.parser.json,o=(r=s.nodes)==null?void 0:r[e];if(o==null)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${e}] of glTF but the node doesn't exist`),null;const a=o.mesh;if(a==null)return null;const l=(i=s.meshes)==null?void 0:i[a];if(l==null)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${a}] of glTF but the mesh doesn't exist`),null;const c=l.primitives.length,A=[];return t.traverse(u=>{A.length{const s=lG(n,i,r);s!=null&&t.set(i,s)}),t})}var Wr={Aa:"aa",Ih:"ih",Ou:"ou",Ee:"ee",Oh:"oh",Blink:"blink",Happy:"happy",Angry:"angry",Sad:"sad",Relaxed:"relaxed",LookUp:"lookUp",Surprised:"surprised",LookDown:"lookDown",LookLeft:"lookLeft",LookRight:"lookRight",BlinkLeft:"blinkLeft",BlinkRight:"blinkRight",Neutral:"neutral"};function cG(n){return Math.max(Math.min(n,1),0)}var Z_=class AG{constructor(){this.blinkExpressionNames=["blink","blinkLeft","blinkRight"],this.lookAtExpressionNames=["lookLeft","lookRight","lookUp","lookDown"],this.mouthExpressionNames=["aa","ee","ih","oh","ou"],this._expressions=[],this._expressionMap={}}get expressions(){return this._expressions.concat()}get expressionMap(){return Object.assign({},this._expressionMap)}get presetExpressionMap(){const e={},t=new Set(Object.values(Wr));return Object.entries(this._expressionMap).forEach(([r,i])=>{t.has(r)&&(e[r]=i)}),e}get customExpressionMap(){const e={},t=new Set(Object.values(Wr));return Object.entries(this._expressionMap).forEach(([r,i])=>{t.has(r)||(e[r]=i)}),e}copy(e){return this._expressions.concat().forEach(r=>{this.unregisterExpression(r)}),e._expressions.forEach(r=>{this.registerExpression(r)}),this.blinkExpressionNames=e.blinkExpressionNames.concat(),this.lookAtExpressionNames=e.lookAtExpressionNames.concat(),this.mouthExpressionNames=e.mouthExpressionNames.concat(),this}clone(){return new AG().copy(this)}getExpression(e){var t;return(t=this._expressionMap[e])!=null?t:null}registerExpression(e){this._expressions.push(e),this._expressionMap[e.expressionName]=e}unregisterExpression(e){const t=this._expressions.indexOf(e);t===-1&&console.warn("VRMExpressionManager: The specified expressions is not registered"),this._expressions.splice(t,1),delete this._expressionMap[e.expressionName]}getValue(e){var t;const r=this.getExpression(e);return(t=r==null?void 0:r.weight)!=null?t:null}setValue(e,t){const r=this.getExpression(e);r&&(r.weight=cG(t))}resetValues(){this._expressions.forEach(e=>{e.weight=0})}getExpressionTrackName(e){const t=this.getExpression(e);return t?`${t.name}.weight`:null}update(){const e=this._calculateWeightMultipliers();this._expressions.forEach(t=>{t.clearAppliedWeight()}),this._expressions.forEach(t=>{let r=1;const i=t.expressionName;this.blinkExpressionNames.indexOf(i)!==-1&&(r*=e.blink),this.lookAtExpressionNames.indexOf(i)!==-1&&(r*=e.lookAt),this.mouthExpressionNames.indexOf(i)!==-1&&(r*=e.mouth),t.applyWeight({multiplier:r})})}_calculateWeightMultipliers(){let e=1,t=1,r=1;return this._expressions.forEach(i=>{e-=i.overrideBlinkAmount,t-=i.overrideLookAtAmount,r-=i.overrideMouthAmount}),e=Math.max(0,e),t=Math.max(0,t),r=Math.max(0,r),{blink:e,lookAt:t,mouth:r}}},jp={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",MatcapColor:"matcapColor",RimColor:"rimColor",OutlineColor:"outlineColor"},Ihe={_Color:jp.Color,_EmissionColor:jp.EmissionColor,_ShadeColor:jp.ShadeColor,_RimColor:jp.RimColor,_OutlineColor:jp.OutlineColor},Rhe=new Qe,uG=class fG{constructor({material:e,type:t,targetValue:r,targetAlpha:i}){this.material=e,this.type=t,this.targetValue=r,this.targetAlpha=i??1;const s=this._initColorBindState(),o=this._initAlphaBindState();this._state={color:s,alpha:o}}applyWeight(e){const{color:t,alpha:r}=this._state;if(t!=null){const{propertyName:i,deltaValue:s}=t,o=this.material[i];o!=null&&o.add(Rhe.copy(s).multiplyScalar(e))}if(r!=null){const{propertyName:i,deltaValue:s}=r;this.material[i]!=null&&(this.material[i]+=s*e)}}clearAppliedWeight(){const{color:e,alpha:t}=this._state;if(e!=null){const{propertyName:r,initialValue:i}=e,s=this.material[r];s!=null&&s.copy(i)}if(t!=null){const{propertyName:r,initialValue:i}=t;this.material[r]!=null&&(this.material[r]=i)}}_initColorBindState(){var e,t,r;const{material:i,type:s,targetValue:o}=this,a=this._getPropertyNameMap(),l=(t=(e=a==null?void 0:a[s])==null?void 0:e[0])!=null?t:null;if(l==null)return console.warn(`Tried to add a material color bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type is not supported.`),null;const A=i[l].clone(),u=new Qe(o.r-A.r,o.g-A.g,o.b-A.b);return{propertyName:l,initialValue:A,deltaValue:u}}_initAlphaBindState(){var e,t,r;const{material:i,type:s,targetAlpha:o}=this,a=this._getPropertyNameMap(),l=(t=(e=a==null?void 0:a[s])==null?void 0:e[1])!=null?t:null;if(l==null&&o!==1)return console.warn(`Tried to add a material alpha bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type does not support alpha.`),null;if(l==null)return null;const c=i[l],A=o-c;return{propertyName:l,initialValue:c,deltaValue:A}}_getPropertyNameMap(){var e,t;return(t=(e=Object.entries(fG._propertyNameMapMap).find(([r])=>this.material[r]===!0))==null?void 0:e[1])!=null?t:null}};uG._propertyNameMapMap={isMeshStandardMaterial:{color:["color","opacity"],emissionColor:["emissive",null]},isMeshBasicMaterial:{color:["color","opacity"]},isMToonMaterial:{color:["color","opacity"],emissionColor:["emissive",null],outlineColor:["outlineColorFactor",null],matcapColor:["matcapFactor",null],rimColor:["parametricRimColorFactor",null],shadeColor:["shadeColorFactor",null]}};var DN=uG,rT=class{constructor({primitives:n,index:e,weight:t}){this.primitives=n,this.index=e,this.weight=t}applyWeight(n){this.primitives.forEach(e=>{var t;((t=e.morphTargetInfluences)==null?void 0:t[this.index])!=null&&(e.morphTargetInfluences[this.index]+=this.weight*n)})}clearAppliedWeight(){this.primitives.forEach(n=>{var e;((e=n.morphTargetInfluences)==null?void 0:e[this.index])!=null&&(n.morphTargetInfluences[this.index]=0)})}},NN=new We,hG=class dG{constructor({material:e,scale:t,offset:r}){var i,s;this.material=e,this.scale=t,this.offset=r;const o=(i=Object.entries(dG._propertyNamesMap).find(([a])=>e[a]===!0))==null?void 0:i[1];o==null?(console.warn(`Tried to add a texture transform bind to the material ${(s=e.name)!=null?s:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],o.forEach(a=>{var l;const c=(l=e[a])==null?void 0:l.clone();if(!c)return null;e[a]=c;const A=c.offset.clone(),u=c.repeat.clone(),f=r.clone().sub(A),h=t.clone().sub(u);this._properties.push({name:a,initialOffset:A,deltaOffset:f,initialScale:u,deltaScale:h})}))}applyWeight(e){this._properties.forEach(t=>{const r=this.material[t.name];r!==void 0&&(r.offset.add(NN.copy(t.deltaOffset).multiplyScalar(e)),r.repeat.add(NN.copy(t.deltaScale).multiplyScalar(e)))})}clearAppliedWeight(){this._properties.forEach(e=>{const t=this.material[e.name];t!==void 0&&(t.offset.copy(e.initialOffset),t.repeat.copy(e.initialScale))})}};hG._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};var ON=hG,Uhe=new Set(["1.0","1.0-beta"]),pG=class mG{get name(){return"VRMExpressionLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return $t(this,null,function*(){e.userData.vrmExpressionManager=yield this._import(e)})}_import(e){return $t(this,null,function*(){const t=yield this._v1Import(e);if(t)return t;const r=yield this._v0Import(e);return r||null})}_v1Import(e){return $t(this,null,function*(){var t,r;const i=this.parser.json;if(!(((t=i.extensionsUsed)==null?void 0:t.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!Uhe.has(a))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.expressions;if(!l)return null;const c=new Set(Object.values(Wr)),A=new Map;l.preset!=null&&Object.entries(l.preset).forEach(([f,h])=>{if(h!=null){if(!c.has(f)){console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${f}" detected. Ignoring the expression`);return}A.set(f,h)}}),l.custom!=null&&Object.entries(l.custom).forEach(([f,h])=>{if(c.has(f)){console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${f}". Ignoring the expression`);return}A.set(f,h)});const u=new Z_;return yield Promise.all(Array.from(A.entries()).map(f=>$t(this,[f],function*([h,d]){var m,g,p,v,w,_,x;const b=new $_(h);if(e.scene.add(b),b.isBinary=(m=d.isBinary)!=null?m:!1,b.overrideBlink=(g=d.overrideBlink)!=null?g:"none",b.overrideLookAt=(p=d.overrideLookAt)!=null?p:"none",b.overrideMouth=(v=d.overrideMouth)!=null?v:"none",(w=d.morphTargetBinds)==null||w.forEach(B=>$t(this,null,function*(){var S;if(B.node===void 0||B.index===void 0)return;const I=yield PN(e,B.node),M=B.index;if(!I.every(L=>Array.isArray(L.morphTargetInfluences)&&M{const I=S.material;I&&B.push(I)}),(_=d.materialColorBinds)==null||_.forEach(S=>$t(this,null,function*(){B.filter(M=>{var L;const D=(L=this.parser.associations.get(M))==null?void 0:L.materials;return S.material===D}).forEach(M=>{b.addBind(new DN({material:M,type:S.type,targetValue:new Qe().fromArray(S.targetValue),targetAlpha:S.targetValue[3]}))})})),(x=d.textureTransformBinds)==null||x.forEach(S=>$t(this,null,function*(){B.filter(M=>{var L;const D=(L=this.parser.associations.get(M))==null?void 0:L.materials;return S.material===D}).forEach(M=>{var L,D;b.addBind(new ON({material:M,offset:new We().fromArray((L=S.offset)!=null?L:[0,0]),scale:new We().fromArray((D=S.scale)!=null?D:[1,1])}))})}))}u.registerExpression(b)}))),u})}_v0Import(e){return $t(this,null,function*(){var t;const r=this.parser.json,i=(t=r.extensions)==null?void 0:t.VRM;if(!i)return null;const s=i.blendShapeMaster;if(!s)return null;const o=new Z_,a=s.blendShapeGroups;if(!a)return o;const l=new Set;return yield Promise.all(a.map(c=>$t(this,null,function*(){var A;const u=c.presetName,f=u!=null&&mG.v0v1PresetNameMap[u]||null,h=f??c.name;if(h==null){console.warn("VRMExpressionLoaderPlugin: One of custom expressions has no name. Ignoring the expression");return}if(l.has(h)){console.warn(`VRMExpressionLoaderPlugin: An expression preset ${u} has duplicated entries. Ignoring the expression`);return}l.add(h);const d=new $_(h);e.scene.add(d),d.isBinary=(A=c.isBinary)!=null?A:!1,c.binds&&c.binds.forEach(g=>$t(this,null,function*(){var p;if(g.mesh===void 0||g.index===void 0)return;const v=[];(p=r.nodes)==null||p.forEach((_,x)=>{_.mesh===g.mesh&&v.push(x)});const w=g.index;yield Promise.all(v.map(_=>$t(this,null,function*(){var x;const b=yield PN(e,_);if(!b.every(B=>Array.isArray(B.morphTargetInfluences)&&w{if(g.materialName===void 0||g.propertyName===void 0||g.targetValue===void 0)return;const p=[];e.scene.traverse(w=>{if(w.material){const _=w.material;Array.isArray(_)?p.push(..._.filter(x=>(x.name===g.materialName||x.name===g.materialName+" (Outline)")&&p.indexOf(x)===-1)):_.name===g.materialName&&p.indexOf(_)===-1&&p.push(_)}});const v=g.propertyName;p.forEach(w=>{if(v==="_MainTex_ST"){const x=new We(g.targetValue[0],g.targetValue[1]),b=new We(g.targetValue[2],g.targetValue[3]);b.y=1-b.y-x.y,d.addBind(new ON({material:w,scale:x,offset:b}));return}const _=Ihe[v];if(_){d.addBind(new DN({material:w,type:_,targetValue:new Qe().fromArray(g.targetValue),targetAlpha:g.targetValue[3]}));return}console.warn(v+" is not supported")})}),o.registerExpression(d)}))),o})}};pG.v0v1PresetNameMap={a:"aa",e:"ee",i:"ih",o:"oh",u:"ou",blink:"blink",joy:"happy",angry:"angry",sorrow:"sad",fun:"relaxed",lookup:"lookUp",lookdown:"lookDown",lookleft:"lookLeft",lookright:"lookRight",blink_l:"blinkLeft",blink_r:"blinkRight",neutral:"neutral"};var Fhe=pG,a2=class $f{constructor(e,t){this._firstPersonOnlyLayer=$f.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=$f.DEFAULT_THIRDPERSON_ONLY_LAYER,this._initializedLayers=!1,this.humanoid=e,this.meshAnnotations=t}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMFirstPerson: humanoid must be same in order to copy");return this.meshAnnotations=e.meshAnnotations.map(t=>({meshes:t.meshes.concat(),type:t.type})),this}clone(){return new $f(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:e=$f.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:t=$f.DEFAULT_THIRDPERSON_ONLY_LAYER}={}){this._initializedLayers||(this._firstPersonOnlyLayer=e,this._thirdPersonOnlyLayer=t,this.meshAnnotations.forEach(r=>{r.meshes.forEach(i=>{r.type==="firstPersonOnly"?(i.layers.set(this._firstPersonOnlyLayer),i.traverse(s=>s.layers.set(this._firstPersonOnlyLayer))):r.type==="thirdPersonOnly"?(i.layers.set(this._thirdPersonOnlyLayer),i.traverse(s=>s.layers.set(this._thirdPersonOnlyLayer))):r.type==="auto"&&this._createHeadlessModel(i)})}),this._initializedLayers=!0)}_excludeTriangles(e,t,r,i){let s=0;if(t!=null&&t.length>0)for(let o=0;o0&&i.includes(u[0])||A[1]>0&&i.includes(u[1])||A[2]>0&&i.includes(u[2])||A[3]>0&&i.includes(u[3]))continue;const f=t[l],h=r[l];if(f[0]>0&&i.includes(h[0])||f[1]>0&&i.includes(h[1])||f[2]>0&&i.includes(h[2])||f[3]>0&&i.includes(h[3]))continue;const d=t[c],m=r[c];d[0]>0&&i.includes(m[0])||d[1]>0&&i.includes(m[1])||d[2]>0&&i.includes(m[2])||d[3]>0&&i.includes(m[3])||(e[s++]=a,e[s++]=l,e[s++]=c)}return s}_createErasedMesh(e,t){const r=new sa(e.geometry.clone(),e.material);r.name=`${e.name}(erase)`,r.frustumCulled=e.frustumCulled,r.layers.set(this._firstPersonOnlyLayer);const i=r.geometry,s=i.getAttribute("skinIndex"),o=s instanceof yD?[]:s.array,a=[];for(let m=0;m{this._isEraseTarget(s)&&r.push(o)}),!r.length){t.layers.enable(this._thirdPersonOnlyLayer),t.layers.enable(this._firstPersonOnlyLayer);return}t.layers.set(this._thirdPersonOnlyLayer);const i=this._createErasedMesh(t,r);e.add(i)}_createHeadlessModel(e){if(e.type==="Group")if(e.layers.set(this._thirdPersonOnlyLayer),this._isEraseTarget(e))e.traverse(t=>t.layers.set(this._thirdPersonOnlyLayer));else{const t=new ri;t.name=`_headless_${e.name}`,t.layers.set(this._firstPersonOnlyLayer),e.parent.add(t),e.children.filter(r=>r.type==="SkinnedMesh").forEach(r=>{const i=r;this._createHeadlessModelForSkinnedMesh(t,i)})}else if(e.type==="SkinnedMesh"){const t=e;this._createHeadlessModelForSkinnedMesh(e.parent,t)}else this._isEraseTarget(e)&&(e.layers.set(this._thirdPersonOnlyLayer),e.traverse(t=>t.layers.set(this._thirdPersonOnlyLayer)))}_isEraseTarget(e){return e===this.humanoid.getRawBoneNode("head")?!0:e.parent?this._isEraseTarget(e.parent):!1}};a2.DEFAULT_FIRSTPERSON_ONLY_LAYER=9;a2.DEFAULT_THIRDPERSON_ONLY_LAYER=10;var kN=a2,Phe=new Set(["1.0","1.0-beta"]),Lhe=class{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(n){this.parser=n}afterRoot(n){return $t(this,null,function*(){const e=n.userData.vrmHumanoid;if(e!==null){if(e===void 0)throw new Error("VRMFirstPersonLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");n.userData.vrmFirstPerson=yield this._import(n,e)}})}_import(n,e){return $t(this,null,function*(){if(e==null)return null;const t=yield this._v1Import(n,e);if(t)return t;const r=yield this._v0Import(n,e);return r||null})}_v1Import(n,e){return $t(this,null,function*(){var t,r;const i=this.parser.json;if(!(((t=i.extensionsUsed)==null?void 0:t.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!Phe.has(a))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.firstPerson;if(!l)return null;const c=[],A=yield LN(n);return Array.from(A.entries()).forEach(([u,f])=>{var h;const d=l.meshAnnotations?l.meshAnnotations.find(m=>m.node===u):void 0;c.push({meshes:f,type:(h=d==null?void 0:d.type)!=null?h:"both"})}),new kN(e,c)})}_v0Import(n,e){return $t(this,null,function*(){var t;const r=this.parser.json,i=(t=r.extensions)==null?void 0:t.VRM;if(!i)return null;const s=i.firstPerson;if(!s)return null;const o=[],a=yield LN(n);return Array.from(a.entries()).forEach(([l,c])=>{const A=r.nodes[l],u=s.meshAnnotations?s.meshAnnotations.find(f=>f.mesh===A.mesh):void 0;o.push({meshes:c,type:this._convertV0FlagToV1Type(u==null?void 0:u.firstPersonFlag)})}),new kN(e,o)})}_convertV0FlagToV1Type(n){return n==="FirstPersonOnly"?"firstPersonOnly":n==="ThirdPersonOnly"?"thirdPersonOnly":n==="Auto"?"auto":"both"}},QN=new $,HN=new $,Dhe=new nt,zN=class extends ri{constructor(n){super(),this.vrmHumanoid=n,this._boneAxesMap=new Map,Object.values(n.humanBones).forEach(e=>{const t=new _oe(1);t.matrixAutoUpdate=!1,t.material.depthTest=!1,t.material.depthWrite=!1,this.add(t),this._boneAxesMap.set(e,t)})}dispose(){Array.from(this._boneAxesMap.values()).forEach(n=>{n.geometry.dispose(),n.material.dispose()})}updateMatrixWorld(n){Array.from(this._boneAxesMap.entries()).forEach(([e,t])=>{e.node.updateWorldMatrix(!0,!1),e.node.matrixWorld.decompose(QN,Dhe,HN);const r=QN.set(.1,.1,.1).divide(HN);t.matrix.copy(e.node.matrixWorld).scale(r)}),super.updateMatrixWorld(n)}},RB=["hips","spine","chest","upperChest","neck","head","leftEye","rightEye","jaw","leftUpperLeg","leftLowerLeg","leftFoot","leftToes","rightUpperLeg","rightLowerLeg","rightFoot","rightToes","leftShoulder","leftUpperArm","leftLowerArm","leftHand","rightShoulder","rightUpperArm","rightLowerArm","rightHand","leftThumbMetacarpal","leftThumbProximal","leftThumbDistal","leftIndexProximal","leftIndexIntermediate","leftIndexDistal","leftMiddleProximal","leftMiddleIntermediate","leftMiddleDistal","leftRingProximal","leftRingIntermediate","leftRingDistal","leftLittleProximal","leftLittleIntermediate","leftLittleDistal","rightThumbMetacarpal","rightThumbProximal","rightThumbDistal","rightIndexProximal","rightIndexIntermediate","rightIndexDistal","rightMiddleProximal","rightMiddleIntermediate","rightMiddleDistal","rightRingProximal","rightRingIntermediate","rightRingDistal","rightLittleProximal","rightLittleIntermediate","rightLittleDistal"],Jg={Hips:"hips",Spine:"spine",Chest:"chest",UpperChest:"upperChest",Neck:"neck",Head:"head",LeftEye:"leftEye",RightEye:"rightEye",Jaw:"jaw",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",LeftToes:"leftToes",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",RightToes:"rightToes",LeftShoulder:"leftShoulder",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightShoulder:"rightShoulder",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand",LeftThumbMetacarpal:"leftThumbMetacarpal",LeftThumbProximal:"leftThumbProximal",LeftThumbDistal:"leftThumbDistal",LeftIndexProximal:"leftIndexProximal",LeftIndexIntermediate:"leftIndexIntermediate",LeftIndexDistal:"leftIndexDistal",LeftMiddleProximal:"leftMiddleProximal",LeftMiddleIntermediate:"leftMiddleIntermediate",LeftMiddleDistal:"leftMiddleDistal",LeftRingProximal:"leftRingProximal",LeftRingIntermediate:"leftRingIntermediate",LeftRingDistal:"leftRingDistal",LeftLittleProximal:"leftLittleProximal",LeftLittleIntermediate:"leftLittleIntermediate",LeftLittleDistal:"leftLittleDistal",RightThumbMetacarpal:"rightThumbMetacarpal",RightThumbProximal:"rightThumbProximal",RightThumbDistal:"rightThumbDistal",RightIndexProximal:"rightIndexProximal",RightIndexIntermediate:"rightIndexIntermediate",RightIndexDistal:"rightIndexDistal",RightMiddleProximal:"rightMiddleProximal",RightMiddleIntermediate:"rightMiddleIntermediate",RightMiddleDistal:"rightMiddleDistal",RightRingProximal:"rightRingProximal",RightRingIntermediate:"rightRingIntermediate",RightRingDistal:"rightRingDistal",RightLittleProximal:"rightLittleProximal",RightLittleIntermediate:"rightLittleIntermediate",RightLittleDistal:"rightLittleDistal"},Nhe={hips:null,spine:"hips",chest:"spine",upperChest:"chest",neck:"upperChest",head:"neck",leftEye:"head",rightEye:"head",jaw:"head",leftUpperLeg:"hips",leftLowerLeg:"leftUpperLeg",leftFoot:"leftLowerLeg",leftToes:"leftFoot",rightUpperLeg:"hips",rightLowerLeg:"rightUpperLeg",rightFoot:"rightLowerLeg",rightToes:"rightFoot",leftShoulder:"upperChest",leftUpperArm:"leftShoulder",leftLowerArm:"leftUpperArm",leftHand:"leftLowerArm",rightShoulder:"upperChest",rightUpperArm:"rightShoulder",rightLowerArm:"rightUpperArm",rightHand:"rightLowerArm",leftThumbMetacarpal:"leftHand",leftThumbProximal:"leftThumbMetacarpal",leftThumbDistal:"leftThumbProximal",leftIndexProximal:"leftHand",leftIndexIntermediate:"leftIndexProximal",leftIndexDistal:"leftIndexIntermediate",leftMiddleProximal:"leftHand",leftMiddleIntermediate:"leftMiddleProximal",leftMiddleDistal:"leftMiddleIntermediate",leftRingProximal:"leftHand",leftRingIntermediate:"leftRingProximal",leftRingDistal:"leftRingIntermediate",leftLittleProximal:"leftHand",leftLittleIntermediate:"leftLittleProximal",leftLittleDistal:"leftLittleIntermediate",rightThumbMetacarpal:"rightHand",rightThumbProximal:"rightThumbMetacarpal",rightThumbDistal:"rightThumbProximal",rightIndexProximal:"rightHand",rightIndexIntermediate:"rightIndexProximal",rightIndexDistal:"rightIndexIntermediate",rightMiddleProximal:"rightHand",rightMiddleIntermediate:"rightMiddleProximal",rightMiddleDistal:"rightMiddleIntermediate",rightRingProximal:"rightHand",rightRingIntermediate:"rightRingProximal",rightRingDistal:"rightRingIntermediate",rightLittleProximal:"rightHand",rightLittleIntermediate:"rightLittleProximal",rightLittleDistal:"rightLittleIntermediate"};function gG(n){return n.invert?n.invert():n.inverse(),n}var KA=new $,XA=new nt,iT=class{constructor(n){this.humanBones=n,this.restPose=this.getAbsolutePose()}getAbsolutePose(){const n={};return Object.keys(this.humanBones).forEach(e=>{const t=e,r=this.getBoneNode(t);r&&(KA.copy(r.position),XA.copy(r.quaternion),n[t]={position:KA.toArray(),rotation:XA.toArray()})}),n}getPose(){const n={};return Object.keys(this.humanBones).forEach(e=>{const t=e,r=this.getBoneNode(t);if(!r)return;KA.set(0,0,0),XA.identity();const i=this.restPose[t];i!=null&&i.position&&KA.fromArray(i.position).negate(),i!=null&&i.rotation&&gG(XA.fromArray(i.rotation)),KA.add(r.position),XA.premultiply(r.quaternion),n[t]={position:KA.toArray(),rotation:XA.toArray()}}),n}setPose(n){Object.entries(n).forEach(([e,t])=>{const r=e,i=this.getBoneNode(r);if(!i)return;const s=this.restPose[r];s&&(t!=null&&t.position&&(i.position.fromArray(t.position),s.position&&i.position.add(KA.fromArray(s.position))),t!=null&&t.rotation&&(i.quaternion.fromArray(t.rotation),s.rotation&&i.quaternion.multiply(XA.fromArray(s.rotation))))})}resetPose(){Object.entries(this.restPose).forEach(([n,e])=>{const t=this.getBoneNode(n);t&&(e!=null&&e.position&&t.position.fromArray(e.position),e!=null&&e.rotation&&t.quaternion.fromArray(e.rotation))})}getBone(n){var e;return(e=this.humanBones[n])!=null?e:void 0}getBoneNode(n){var e,t;return(t=(e=this.humanBones[n])==null?void 0:e.node)!=null?t:null}},UB=new $,Ohe=new nt,khe=new $,GN=class vG extends iT{static _setupTransforms(e){const t=new Lt;t.name="VRMHumanoidRig";const r={},i={},s={};RB.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const A=new $,u=new nt;c.updateWorldMatrix(!0,!1),c.matrixWorld.decompose(A,u,UB),r[a]=A,i[a]=c.quaternion.clone();const f=new nt;(l=c.parent)==null||l.matrixWorld.decompose(UB,f,UB),s[a]=f}});const o={};return RB.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const A=r[a];let u=a,f;for(;f==null&&(u=Nhe[u],u!=null);)f=r[u];const h=new Lt;h.name="Normalized_"+c.name,(u?(l=o[u])==null?void 0:l.node:t).add(h),h.position.copy(A),f&&h.position.sub(f),o[a]={node:h}}}),{rigBones:o,root:t,parentWorldRotations:s,boneRotations:i}}constructor(e){const{rigBones:t,root:r,parentWorldRotations:i,boneRotations:s}=vG._setupTransforms(e);super(t),this.original=e,this.root=r,this._parentWorldRotations=i,this._boneRotations=s}update(){RB.forEach(e=>{const t=this.original.getBoneNode(e);if(t!=null){const r=this.getBoneNode(e),i=this._parentWorldRotations[e],s=Ohe.copy(i).invert(),o=this._boneRotations[e];if(t.quaternion.copy(r.quaternion).multiply(i).premultiply(s).multiply(o),e==="hips"){const a=r.getWorldPosition(khe);t.parent.updateWorldMatrix(!0,!1);const l=t.parent.matrixWorld,c=a.applyMatrix4(l.invert());t.position.copy(c)}}})}},VN=class yG{get restPose(){return console.warn("VRMHumanoid: restPose is deprecated. Use either rawRestPose or normalizedRestPose instead."),this.rawRestPose}get rawRestPose(){return this._rawHumanBones.restPose}get normalizedRestPose(){return this._normalizedHumanBones.restPose}get humanBones(){return this._rawHumanBones.humanBones}get rawHumanBones(){return this._rawHumanBones.humanBones}get normalizedHumanBones(){return this._normalizedHumanBones.humanBones}get normalizedHumanBonesRoot(){return this._normalizedHumanBones.root}constructor(e,t){var r;this.autoUpdateHumanBones=(r=t==null?void 0:t.autoUpdateHumanBones)!=null?r:!0,this._rawHumanBones=new iT(e),this._normalizedHumanBones=new GN(this._rawHumanBones)}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new iT(e.humanBones),this._normalizedHumanBones=new GN(this._rawHumanBones),this}clone(){return new yG(this.humanBones,{autoUpdateHumanBones:this.autoUpdateHumanBones}).copy(this)}getAbsolutePose(){return console.warn("VRMHumanoid: getAbsolutePose() is deprecated. Use either getRawAbsolutePose() or getNormalizedAbsolutePose() instead."),this.getRawAbsolutePose()}getRawAbsolutePose(){return this._rawHumanBones.getAbsolutePose()}getNormalizedAbsolutePose(){return this._normalizedHumanBones.getAbsolutePose()}getPose(){return console.warn("VRMHumanoid: getPose() is deprecated. Use either getRawPose() or getNormalizedPose() instead."),this.getRawPose()}getRawPose(){return this._rawHumanBones.getPose()}getNormalizedPose(){return this._normalizedHumanBones.getPose()}setPose(e){return console.warn("VRMHumanoid: setPose() is deprecated. Use either setRawPose() or setNormalizedPose() instead."),this.setRawPose(e)}setRawPose(e){return this._rawHumanBones.setPose(e)}setNormalizedPose(e){return this._normalizedHumanBones.setPose(e)}resetPose(){return console.warn("VRMHumanoid: resetPose() is deprecated. Use either resetRawPose() or resetNormalizedPose() instead."),this.resetRawPose()}resetRawPose(){return this._rawHumanBones.resetPose()}resetNormalizedPose(){return this._normalizedHumanBones.resetPose()}getBone(e){return console.warn("VRMHumanoid: getBone() is deprecated. Use either getRawBone() or getNormalizedBone() instead."),this.getRawBone(e)}getRawBone(e){return this._rawHumanBones.getBone(e)}getNormalizedBone(e){return this._normalizedHumanBones.getBone(e)}getBoneNode(e){return console.warn("VRMHumanoid: getBoneNode() is deprecated. Use either getRawBoneNode() or getNormalizedBoneNode() instead."),this.getRawBoneNode(e)}getRawBoneNode(e){return this._rawHumanBones.getBoneNode(e)}getNormalizedBoneNode(e){return this._normalizedHumanBones.getBoneNode(e)}update(){this.autoUpdateHumanBones&&this._normalizedHumanBones.update()}},Qhe={Hips:"hips",Spine:"spine",Head:"head",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand"},Hhe=new Set(["1.0","1.0-beta"]),jN={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},zhe=class{get name(){return"VRMHumanoidLoaderPlugin"}constructor(n,e){this.parser=n,this.helperRoot=e==null?void 0:e.helperRoot,this.autoUpdateHumanBones=e==null?void 0:e.autoUpdateHumanBones}afterRoot(n){return $t(this,null,function*(){n.userData.vrmHumanoid=yield this._import(n)})}_import(n){return $t(this,null,function*(){const e=yield this._v1Import(n);if(e)return e;const t=yield this._v0Import(n);return t||null})}_v1Import(n){return $t(this,null,function*(){var e,t;const r=this.parser.json;if(!(((e=r.extensionsUsed)==null?void 0:e.indexOf("VRMC_vrm"))!==-1))return null;const s=(t=r.extensions)==null?void 0:t.VRMC_vrm;if(!s)return null;const o=s.specVersion;if(!Hhe.has(o))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const a=s.humanoid;if(!a)return null;const l=a.humanBones.leftThumbIntermediate!=null||a.humanBones.rightThumbIntermediate!=null,c={};a.humanBones!=null&&(yield Promise.all(Object.entries(a.humanBones).map(u=>$t(this,[u],function*([f,h]){let d=f;const m=h.node;if(l){const p=jN[d];p!=null&&(d=p)}const g=yield this.parser.getDependency("node",m);if(g==null){console.warn(`A glTF node bound to the humanoid bone ${d} (index = ${m}) does not exist`);return}c[d]={node:g}}))));const A=new VN(this._ensureRequiredBonesExist(c),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(n.scene.add(A.normalizedHumanBonesRoot),this.helperRoot){const u=new zN(A);this.helperRoot.add(u),u.renderOrder=this.helperRoot.renderOrder}return A})}_v0Import(n){return $t(this,null,function*(){var e;const r=(e=this.parser.json.extensions)==null?void 0:e.VRM;if(!r)return null;const i=r.humanoid;if(!i)return null;const s={};i.humanBones!=null&&(yield Promise.all(i.humanBones.map(a=>$t(this,null,function*(){const l=a.bone,c=a.node;if(l==null||c==null)return;const A=yield this.parser.getDependency("node",c);if(A==null){console.warn(`A glTF node bound to the humanoid bone ${l} (index = ${c}) does not exist`);return}const u=jN[l],f=u??l;if(s[f]!=null){console.warn(`Multiple bone entries for ${f} detected (index = ${c}), ignoring duplicated entries.`);return}s[f]={node:A}}))));const o=new VN(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(n.scene.add(o.normalizedHumanBonesRoot),this.helperRoot){const a=new zN(o);this.helperRoot.add(a),a.renderOrder=this.helperRoot.renderOrder}return o})}_ensureRequiredBonesExist(n){const e=Object.values(Qhe).filter(t=>n[t]==null);if(e.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${e.join(", ")}`);return n}},WN=class extends Jt{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new ct(new Float32Array(65*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new ct(new Uint16Array(3*63),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;this._currentTheta!==this.theta&&(this._currentTheta=this.theta,n=!0),this._currentRadius!==this.radius&&(this._currentRadius=this.radius,n=!0),n&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,0,0,0);for(let n=0;n<64;n++){const e=n/63*this._currentTheta;this._attrPos.setXYZ(n+1,this._currentRadius*Math.sin(e),0,this._currentRadius*Math.cos(e))}this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<63;n++)this._attrIndex.setXYZ(n*3,0,n+1,n+2);this._attrIndex.needsUpdate=!0}},Ghe=class extends Jt{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new $,this._currentTail=new $,this._attrPos=new ct(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new ct(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;this._currentRadius!==this.radius&&(this._currentRadius=this.radius,n=!0),this._currentTail.equals(this.tail)||(this._currentTail.copy(this.tail),n=!0),n&&this._buildPosition()}_buildPosition(){for(let n=0;n<32;n++){const e=n/16*Math.PI;this._attrPos.setXYZ(n,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+n,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+n,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(64+n*2,32+n,32+e),this._attrIndex.setXY(128+n*2,64+n,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},gy=new nt,KN=new nt,Wp=new $,XN=new $,YN=Math.sqrt(2)/2,Vhe=new nt(0,0,-YN,YN),jhe=new $(0,1,0),Whe=class extends ri{constructor(n){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=n;{const e=new WN;e.radius=.5;const t=new qi({color:65280,transparent:!0,opacity:.5,side:_i,depthTest:!1,depthWrite:!1});this._meshPitch=new dn(e,t),this.add(this._meshPitch)}{const e=new WN;e.radius=.5;const t=new qi({color:16711680,transparent:!0,opacity:.5,side:_i,depthTest:!1,depthWrite:!1});this._meshYaw=new dn(e,t),this.add(this._meshYaw)}{const e=new Ghe;e.radius=.1;const t=new Ac({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new w0(e,t),this._lineTarget.frustumCulled=!1,this.add(this._lineTarget)}}dispose(){this._meshYaw.geometry.dispose(),this._meshYaw.material.dispose(),this._meshPitch.geometry.dispose(),this._meshPitch.material.dispose(),this._lineTarget.geometry.dispose(),this._lineTarget.material.dispose()}updateMatrixWorld(n){const e=Bt.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=e,this._meshYaw.geometry.update();const t=Bt.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=t,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition(Wp),this.vrmLookAt.getLookAtWorldQuaternion(gy),gy.multiply(this.vrmLookAt.getFaceFrontQuaternion(KN)),this._meshYaw.position.copy(Wp),this._meshYaw.quaternion.copy(gy),this._meshPitch.position.copy(Wp),this._meshPitch.quaternion.copy(gy),this._meshPitch.quaternion.multiply(KN.setFromAxisAngle(jhe,e)),this._meshPitch.quaternion.multiply(Vhe);const{target:r,autoUpdate:i}=this.vrmLookAt;r!=null&&i&&(r.getWorldPosition(XN).sub(Wp),this._lineTarget.geometry.tail.copy(XN),this._lineTarget.geometry.update(),this._lineTarget.position.copy(Wp)),super.updateMatrixWorld(n)}},Khe=new $,Xhe=new $;function sT(n,e){return n.matrixWorld.decompose(Khe,e,Xhe),e}function Uw(n){return[Math.atan2(-n.z,n.x),Math.atan2(n.y,Math.sqrt(n.x*n.x+n.z*n.z))]}function $N(n){const e=Math.round(n/2/Math.PI);return n-2*Math.PI*e}var ZN=new $(0,0,1),Yhe=new $,$he=new $,Zhe=new $,Jhe=new nt,FB=new nt,JN=new nt,qhe=new nt,PB=new nr,wG=class _G{constructor(e,t){this.offsetFromHeadBone=new $,this.autoUpdate=!0,this.faceFront=new $(0,0,1),this.humanoid=e,this.applier=t,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new nt)}get yaw(){return this._yaw}set yaw(e){this._yaw=e,this._needsUpdate=!0}get pitch(){return this._pitch}set pitch(e){this._pitch=e,this._needsUpdate=!0}get euler(){return console.warn("VRMLookAt: euler is deprecated. use getEuler() instead."),this.getEuler(new nr)}getEuler(e){return e.set(Bt.DEG2RAD*this._pitch,Bt.DEG2RAD*this._yaw,0,"YXZ")}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMLookAt: humanoid must be same in order to copy");return this.offsetFromHeadBone.copy(e.offsetFromHeadBone),this.applier=e.applier,this.autoUpdate=e.autoUpdate,this.target=e.target,this.faceFront.copy(e.faceFront),this}clone(){return new _G(this.humanoid,this.applier).copy(this)}reset(){this._yaw=0,this._pitch=0,this._needsUpdate=!0}getLookAtWorldPosition(e){const t=this.humanoid.getRawBoneNode("head");return e.copy(this.offsetFromHeadBone).applyMatrix4(t.matrixWorld)}getLookAtWorldQuaternion(e){const t=this.humanoid.getRawBoneNode("head");return sT(t,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(ZN)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[t,r]=Uw(this.faceFront);return PB.set(0,.5*Math.PI+t,r,"YZX"),e.setFromEuler(PB).premultiply(qhe.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(FB),this.getFaceFrontQuaternion(JN),e.copy(ZN).applyQuaternion(FB).applyQuaternion(JN).applyEuler(this.getEuler(PB))}lookAt(e){const t=Jhe.copy(this._restHeadWorldQuaternion).multiply(gG(this.getLookAtWorldQuaternion(FB))),r=this.getLookAtWorldPosition($he),i=Zhe.copy(e).sub(r).applyQuaternion(t).normalize(),[s,o]=Uw(this.faceFront),[a,l]=Uw(i),c=$N(a-s),A=$N(o-l);this._yaw=Bt.RAD2DEG*c,this._pitch=Bt.RAD2DEG*A,this._needsUpdate=!0}update(e){this.target!=null&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(Yhe)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};wG.EULER_ORDER="YXZ";var ede=wG,tde=new $(0,0,1),ya=new nt,Ff=new nt,Zs=new nr(0,0,0,"YXZ"),Fw=class{constructor(n,e,t,r,i){this.humanoid=n,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=t,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i,this.faceFront=new $(0,0,1),this._restQuatLeftEye=new nt,this._restQuatRightEye=new nt,this._restLeftEyeParentWorldQuat=new nt,this._restRightEyeParentWorldQuat=new nt;const s=this.humanoid.getRawBoneNode("leftEye"),o=this.humanoid.getRawBoneNode("rightEye");s&&(this._restQuatLeftEye.copy(s.quaternion),sT(s.parent,this._restLeftEyeParentWorldQuat)),o&&(this._restQuatRightEye.copy(o.quaternion),sT(o.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(n,e){const t=this.humanoid.getRawBoneNode("leftEye"),r=this.humanoid.getRawBoneNode("rightEye"),i=this.humanoid.getNormalizedBoneNode("leftEye"),s=this.humanoid.getNormalizedBoneNode("rightEye");t&&(e<0?Zs.x=-Bt.DEG2RAD*this.rangeMapVerticalDown.map(-e):Zs.x=Bt.DEG2RAD*this.rangeMapVerticalUp.map(e),n<0?Zs.y=-Bt.DEG2RAD*this.rangeMapHorizontalInner.map(-n):Zs.y=Bt.DEG2RAD*this.rangeMapHorizontalOuter.map(n),ya.setFromEuler(Zs),this._getWorldFaceFrontQuat(Ff),i.quaternion.copy(Ff).multiply(ya).multiply(Ff.invert()),ya.copy(this._restLeftEyeParentWorldQuat),t.quaternion.copy(i.quaternion).multiply(ya).premultiply(ya.invert()).multiply(this._restQuatLeftEye)),r&&(e<0?Zs.x=-Bt.DEG2RAD*this.rangeMapVerticalDown.map(-e):Zs.x=Bt.DEG2RAD*this.rangeMapVerticalUp.map(e),n<0?Zs.y=-Bt.DEG2RAD*this.rangeMapHorizontalOuter.map(-n):Zs.y=Bt.DEG2RAD*this.rangeMapHorizontalInner.map(n),ya.setFromEuler(Zs),this._getWorldFaceFrontQuat(Ff),s.quaternion.copy(Ff).multiply(ya).multiply(Ff.invert()),ya.copy(this._restRightEyeParentWorldQuat),r.quaternion.copy(s.quaternion).multiply(ya).premultiply(ya.invert()).multiply(this._restQuatRightEye))}lookAt(n){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=Bt.RAD2DEG*n.y,t=Bt.RAD2DEG*n.x;this.applyYawPitch(e,t)}_getWorldFaceFrontQuat(n){if(this.faceFront.distanceToSquared(tde)<.01)return n.identity();const[e,t]=Uw(this.faceFront);return Zs.set(0,.5*Math.PI+e,t,"YZX"),n.setFromEuler(Zs)}};Fw.type="bone";var oT=class{constructor(n,e,t,r,i){this.expressions=n,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=t,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i}applyYawPitch(n,e){e<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-e))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(e))),n<0?(this.expressions.setValue("lookLeft",0),this.expressions.setValue("lookRight",this.rangeMapHorizontalOuter.map(-n))):(this.expressions.setValue("lookRight",0),this.expressions.setValue("lookLeft",this.rangeMapHorizontalOuter.map(n)))}lookAt(n){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=Bt.RAD2DEG*n.y,t=Bt.RAD2DEG*n.x;this.applyYawPitch(e,t)}};oT.type="expression";var qN=class{constructor(n,e){this.inputMaxValue=n,this.outputScale=e}map(n){return this.outputScale*cG(n/this.inputMaxValue)}},nde=new Set(["1.0","1.0-beta"]),vy=.01,rde=class{get name(){return"VRMLookAtLoaderPlugin"}constructor(n,e){this.parser=n,this.helperRoot=e==null?void 0:e.helperRoot}afterRoot(n){return $t(this,null,function*(){const e=n.userData.vrmHumanoid;if(e===null)return;if(e===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");const t=n.userData.vrmExpressionManager;if(t!==null){if(t===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmExpressionManager is undefined. VRMExpressionLoaderPlugin have to be used first");n.userData.vrmLookAt=yield this._import(n,e,t)}})}_import(n,e,t){return $t(this,null,function*(){if(e==null||t==null)return null;const r=yield this._v1Import(n,e,t);if(r)return r;const i=yield this._v0Import(n,e,t);return i||null})}_v1Import(n,e,t){return $t(this,null,function*(){var r,i,s;const o=this.parser.json;if(!(((r=o.extensionsUsed)==null?void 0:r.indexOf("VRMC_vrm"))!==-1))return null;const l=(i=o.extensions)==null?void 0:i.VRMC_vrm;if(!l)return null;const c=l.specVersion;if(!nde.has(c))return console.warn(`VRMLookAtLoaderPlugin: Unknown VRMC_vrm specVersion "${c}"`),null;const A=l.lookAt;if(!A)return null;const u=A.type==="expression"?1:10,f=this._v1ImportRangeMap(A.rangeMapHorizontalInner,u),h=this._v1ImportRangeMap(A.rangeMapHorizontalOuter,u),d=this._v1ImportRangeMap(A.rangeMapVerticalDown,u),m=this._v1ImportRangeMap(A.rangeMapVerticalUp,u);let g;A.type==="expression"?g=new oT(t,f,h,d,m):g=new Fw(e,f,h,d,m);const p=this._importLookAt(e,g);return p.offsetFromHeadBone.fromArray((s=A.offsetFromHeadBone)!=null?s:[0,.06,0]),p})}_v1ImportRangeMap(n,e){var t,r;let i=(t=n==null?void 0:n.inputMaxValue)!=null?t:90;const s=(r=n==null?void 0:n.outputScale)!=null?r:e;return i(console.error(o),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}},ade=class{constructor(n){this.scene=n.scene,this.meta=n.meta,this.humanoid=n.humanoid,this.expressionManager=n.expressionManager,this.firstPerson=n.firstPerson,this.lookAt=n.lookAt}update(n){this.humanoid.update(),this.lookAt&&this.lookAt.update(n),this.expressionManager&&this.expressionManager.update()}},lde=class extends ade{constructor(n){super(n),this.materials=n.materials,this.springBoneManager=n.springBoneManager,this.nodeConstraintManager=n.nodeConstraintManager}update(n){super.update(n),this.nodeConstraintManager&&this.nodeConstraintManager.update(),this.springBoneManager&&this.springBoneManager.update(n),this.materials&&this.materials.forEach(e=>{e.update&&e.update(n)})}},cde=Object.defineProperty,eO=Object.getOwnPropertySymbols,Ade=Object.prototype.hasOwnProperty,ude=Object.prototype.propertyIsEnumerable,tO=(n,e,t)=>e in n?cde(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,nO=(n,e)=>{for(var t in e||(e={}))Ade.call(e,t)&&tO(n,t,e[t]);if(eO)for(var t of eO(e))ude.call(e,t)&&tO(n,t,e[t]);return n},pu=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),fde={"":3e3,srgb:3001};function hde(n,e){parseInt(nc,10)>=152?n.colorSpace=e:n.encoding=fde[e]}var dde=class{get pending(){return Promise.all(this._pendings)}constructor(n,e){this._parser=n,this._materialParams=e,this._pendings=[]}assignPrimitive(n,e){e!=null&&(this._materialParams[n]=e)}assignColor(n,e,t){e!=null&&(this._materialParams[n]=new Qe().fromArray(e),t&&this._materialParams[n].convertSRGBToLinear())}assignTexture(n,e,t){return pu(this,null,function*(){const r=(()=>pu(this,null,function*(){e!=null&&(yield this._parser.assignTexture(this._materialParams,n,e),t&&hde(this._materialParams[n],"srgb"))}))();return this._pendings.push(r),r})}assignTextureByIndex(n,e,t){return pu(this,null,function*(){return this.assignTexture(n,e!=null?{index:e}:void 0,t)})}},pde=`// #define PHONG varying vec3 vViewPosition; @@ -4067,7 +4067,7 @@ void main() { #include #include -}`,vde=`// #define PHONG +}`,mde=`// #define PHONG uniform vec3 litFactor; @@ -4869,9 +4869,9 @@ void main() { gl_FragColor = vec4( col, diffuseColor.a ); postCorrection(); } -`,yde={None:"none",Normal:"normal",LitShadeRate:"litShadeRate",UV:"uv"},nO={None:"none",WorldCoordinates:"worldCoordinates",ScreenCoordinates:"screenCoordinates"},wde={3e3:"",3001:"srgb"};function FB(n){return parseInt(nc,10)>=152?n.colorSpace:wde[n.encoding]}var _G=class extends mr{constructor(n={}){var e;super({vertexShader:gde,fragmentShader:vde}),this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.fog=!0,this.normalMapType=Kd,this._ignoreVertexColor=!0,this._v0CompatShade=!1,this._debugMode=yde.None,this._outlineWidthMode=nO.None,this._isOutline=!1,n.transparentWithZWrite&&(n.depthWrite=!0),delete n.transparentWithZWrite,n.fog=!0,n.lights=!0,n.clipping=!0,this.uniforms=NR.merge([ze.common,ze.normalmap,ze.emissivemap,ze.fog,ze.lights,{litFactor:{value:new ke(1,1,1)},mapUvTransform:{value:new dt},colorAlpha:{value:1},normalMapUvTransform:{value:new dt},shadeColorFactor:{value:new ke(0,0,0)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new dt},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new dt},shadingShiftTextureScale:{value:1},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new ke(1,1,1)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new dt},parametricRimColorFactor:{value:new ke(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new dt},rimLightingMixFactor:{value:1},parametricRimFresnelPowerFactor:{value:5},parametricRimLiftFactor:{value:0},emissive:{value:new ke(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new dt},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new dt},outlineWidthFactor:{value:0},outlineColorFactor:{value:new ke(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new dt},uvAnimationScrollXOffset:{value:0},uvAnimationScrollYOffset:{value:0},uvAnimationRotationPhase:{value:0}},(e=n.uniforms)!=null?e:{}]),this.setValues(n),this._uploadUniformsWorkaround(),this.customProgramCacheKey=()=>[...Object.entries(this._generateDefines()).map(([t,r])=>`${t}:${r}`),this.matcapTexture?`matcapTextureColorSpace:${FB(this.matcapTexture)}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureColorSpace:${FB(this.shadeMultiplyTexture)}`:"",this.rimMultiplyTexture?`rimMultiplyTextureColorSpace:${FB(this.rimMultiplyTexture)}`:""].join(","),this.onBeforeCompile=t=>{const r=parseInt(nc,10),i=Object.entries(tO(tO({},this._generateDefines()),this.defines)).filter(([s,o])=>!!o).map(([s,o])=>`#define ${s} ${o}`).join(` +`,gde={None:"none",Normal:"normal",LitShadeRate:"litShadeRate",UV:"uv"},rO={None:"none",WorldCoordinates:"worldCoordinates",ScreenCoordinates:"screenCoordinates"},vde={3e3:"",3001:"srgb"};function LB(n){return parseInt(nc,10)>=152?n.colorSpace:vde[n.encoding]}var xG=class extends mr{constructor(n={}){var e;super({vertexShader:pde,fragmentShader:mde}),this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.fog=!0,this.normalMapType=Kd,this._ignoreVertexColor=!0,this._v0CompatShade=!1,this._debugMode=gde.None,this._outlineWidthMode=rO.None,this._isOutline=!1,n.transparentWithZWrite&&(n.depthWrite=!0),delete n.transparentWithZWrite,n.fog=!0,n.lights=!0,n.clipping=!0,this.uniforms=kR.merge([Ge.common,Ge.normalmap,Ge.emissivemap,Ge.fog,Ge.lights,{litFactor:{value:new Qe(1,1,1)},mapUvTransform:{value:new dt},colorAlpha:{value:1},normalMapUvTransform:{value:new dt},shadeColorFactor:{value:new Qe(0,0,0)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new dt},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new dt},shadingShiftTextureScale:{value:1},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new Qe(1,1,1)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new dt},parametricRimColorFactor:{value:new Qe(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new dt},rimLightingMixFactor:{value:1},parametricRimFresnelPowerFactor:{value:5},parametricRimLiftFactor:{value:0},emissive:{value:new Qe(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new dt},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new dt},outlineWidthFactor:{value:0},outlineColorFactor:{value:new Qe(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new dt},uvAnimationScrollXOffset:{value:0},uvAnimationScrollYOffset:{value:0},uvAnimationRotationPhase:{value:0}},(e=n.uniforms)!=null?e:{}]),this.setValues(n),this._uploadUniformsWorkaround(),this.customProgramCacheKey=()=>[...Object.entries(this._generateDefines()).map(([t,r])=>`${t}:${r}`),this.matcapTexture?`matcapTextureColorSpace:${LB(this.matcapTexture)}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureColorSpace:${LB(this.shadeMultiplyTexture)}`:"",this.rimMultiplyTexture?`rimMultiplyTextureColorSpace:${LB(this.rimMultiplyTexture)}`:""].join(","),this.onBeforeCompile=t=>{const r=parseInt(nc,10),i=Object.entries(nO(nO({},this._generateDefines()),this.defines)).filter(([s,o])=>!!o).map(([s,o])=>`#define ${s} ${o}`).join(` `)+` -`;t.vertexShader=i+t.vertexShader,t.fragmentShader=i+t.fragmentShader,r<154&&(t.fragmentShader=t.fragmentShader.replace("#include ","#include "))}}get color(){return this.uniforms.litFactor.value}set color(n){this.uniforms.litFactor.value=n}get map(){return this.uniforms.map.value}set map(n){this.uniforms.map.value=n}get normalMap(){return this.uniforms.normalMap.value}set normalMap(n){this.uniforms.normalMap.value=n}get normalScale(){return this.uniforms.normalScale.value}set normalScale(n){this.uniforms.normalScale.value=n}get emissive(){return this.uniforms.emissive.value}set emissive(n){this.uniforms.emissive.value=n}get emissiveIntensity(){return this.uniforms.emissiveIntensity.value}set emissiveIntensity(n){this.uniforms.emissiveIntensity.value=n}get emissiveMap(){return this.uniforms.emissiveMap.value}set emissiveMap(n){this.uniforms.emissiveMap.value=n}get shadeColorFactor(){return this.uniforms.shadeColorFactor.value}set shadeColorFactor(n){this.uniforms.shadeColorFactor.value=n}get shadeMultiplyTexture(){return this.uniforms.shadeMultiplyTexture.value}set shadeMultiplyTexture(n){this.uniforms.shadeMultiplyTexture.value=n}get shadingShiftFactor(){return this.uniforms.shadingShiftFactor.value}set shadingShiftFactor(n){this.uniforms.shadingShiftFactor.value=n}get shadingShiftTexture(){return this.uniforms.shadingShiftTexture.value}set shadingShiftTexture(n){this.uniforms.shadingShiftTexture.value=n}get shadingShiftTextureScale(){return this.uniforms.shadingShiftTextureScale.value}set shadingShiftTextureScale(n){this.uniforms.shadingShiftTextureScale.value=n}get shadingToonyFactor(){return this.uniforms.shadingToonyFactor.value}set shadingToonyFactor(n){this.uniforms.shadingToonyFactor.value=n}get giEqualizationFactor(){return this.uniforms.giEqualizationFactor.value}set giEqualizationFactor(n){this.uniforms.giEqualizationFactor.value=n}get matcapFactor(){return this.uniforms.matcapFactor.value}set matcapFactor(n){this.uniforms.matcapFactor.value=n}get matcapTexture(){return this.uniforms.matcapTexture.value}set matcapTexture(n){this.uniforms.matcapTexture.value=n}get parametricRimColorFactor(){return this.uniforms.parametricRimColorFactor.value}set parametricRimColorFactor(n){this.uniforms.parametricRimColorFactor.value=n}get rimMultiplyTexture(){return this.uniforms.rimMultiplyTexture.value}set rimMultiplyTexture(n){this.uniforms.rimMultiplyTexture.value=n}get rimLightingMixFactor(){return this.uniforms.rimLightingMixFactor.value}set rimLightingMixFactor(n){this.uniforms.rimLightingMixFactor.value=n}get parametricRimFresnelPowerFactor(){return this.uniforms.parametricRimFresnelPowerFactor.value}set parametricRimFresnelPowerFactor(n){this.uniforms.parametricRimFresnelPowerFactor.value=n}get parametricRimLiftFactor(){return this.uniforms.parametricRimLiftFactor.value}set parametricRimLiftFactor(n){this.uniforms.parametricRimLiftFactor.value=n}get outlineWidthMultiplyTexture(){return this.uniforms.outlineWidthMultiplyTexture.value}set outlineWidthMultiplyTexture(n){this.uniforms.outlineWidthMultiplyTexture.value=n}get outlineWidthFactor(){return this.uniforms.outlineWidthFactor.value}set outlineWidthFactor(n){this.uniforms.outlineWidthFactor.value=n}get outlineColorFactor(){return this.uniforms.outlineColorFactor.value}set outlineColorFactor(n){this.uniforms.outlineColorFactor.value=n}get outlineLightingMixFactor(){return this.uniforms.outlineLightingMixFactor.value}set outlineLightingMixFactor(n){this.uniforms.outlineLightingMixFactor.value=n}get uvAnimationMaskTexture(){return this.uniforms.uvAnimationMaskTexture.value}set uvAnimationMaskTexture(n){this.uniforms.uvAnimationMaskTexture.value=n}get uvAnimationScrollXOffset(){return this.uniforms.uvAnimationScrollXOffset.value}set uvAnimationScrollXOffset(n){this.uniforms.uvAnimationScrollXOffset.value=n}get uvAnimationScrollYOffset(){return this.uniforms.uvAnimationScrollYOffset.value}set uvAnimationScrollYOffset(n){this.uniforms.uvAnimationScrollYOffset.value=n}get uvAnimationRotationPhase(){return this.uniforms.uvAnimationRotationPhase.value}set uvAnimationRotationPhase(n){this.uniforms.uvAnimationRotationPhase.value=n}get ignoreVertexColor(){return this._ignoreVertexColor}set ignoreVertexColor(n){this._ignoreVertexColor=n,this.needsUpdate=!0}get v0CompatShade(){return this._v0CompatShade}set v0CompatShade(n){this._v0CompatShade=n,this.needsUpdate=!0}get debugMode(){return this._debugMode}set debugMode(n){this._debugMode=n,this.needsUpdate=!0}get outlineWidthMode(){return this._outlineWidthMode}set outlineWidthMode(n){this._outlineWidthMode=n,this.needsUpdate=!0}get isOutline(){return this._isOutline}set isOutline(n){this._isOutline=n,this.needsUpdate=!0}get isMToonMaterial(){return!0}update(n){this._uploadUniformsWorkaround(),this._updateUVAnimation(n)}copy(n){return super.copy(n),this.map=n.map,this.normalMap=n.normalMap,this.emissiveMap=n.emissiveMap,this.shadeMultiplyTexture=n.shadeMultiplyTexture,this.shadingShiftTexture=n.shadingShiftTexture,this.matcapTexture=n.matcapTexture,this.rimMultiplyTexture=n.rimMultiplyTexture,this.outlineWidthMultiplyTexture=n.outlineWidthMultiplyTexture,this.uvAnimationMaskTexture=n.uvAnimationMaskTexture,this.normalMapType=n.normalMapType,this.uvAnimationScrollXSpeedFactor=n.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=n.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=n.uvAnimationRotationSpeedFactor,this.ignoreVertexColor=n.ignoreVertexColor,this.v0CompatShade=n.v0CompatShade,this.debugMode=n.debugMode,this.outlineWidthMode=n.outlineWidthMode,this.isOutline=n.isOutline,this.needsUpdate=!0,this}_updateUVAnimation(n){this.uniforms.uvAnimationScrollXOffset.value+=n*this.uvAnimationScrollXSpeedFactor,this.uniforms.uvAnimationScrollYOffset.value+=n*this.uvAnimationScrollYSpeedFactor,this.uniforms.uvAnimationRotationPhase.value+=n*this.uvAnimationRotationSpeedFactor,this.uniforms.alphaTest.value=this.alphaTest,this.uniformsNeedUpdate=!0}_uploadUniformsWorkaround(){this.uniforms.opacity.value=this.opacity,this._updateTextureMatrix(this.uniforms.map,this.uniforms.mapUvTransform),this._updateTextureMatrix(this.uniforms.normalMap,this.uniforms.normalMapUvTransform),this._updateTextureMatrix(this.uniforms.emissiveMap,this.uniforms.emissiveMapUvTransform),this._updateTextureMatrix(this.uniforms.shadeMultiplyTexture,this.uniforms.shadeMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.shadingShiftTexture,this.uniforms.shadingShiftTextureUvTransform),this._updateTextureMatrix(this.uniforms.matcapTexture,this.uniforms.matcapTextureUvTransform),this._updateTextureMatrix(this.uniforms.rimMultiplyTexture,this.uniforms.rimMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.outlineWidthMultiplyTexture,this.uniforms.outlineWidthMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.uvAnimationMaskTexture,this.uniforms.uvAnimationMaskTextureUvTransform),this.uniformsNeedUpdate=!0}_generateDefines(){const n=parseInt(nc,10),e=this.outlineWidthMultiplyTexture!==null,t=this.map!==null||this.normalMap!==null||this.emissiveMap!==null||this.shadeMultiplyTexture!==null||this.shadingShiftTexture!==null||this.rimMultiplyTexture!==null||this.uvAnimationMaskTexture!==null;return{THREE_VRM_THREE_REVISION:n,OUTLINE:this._isOutline,MTOON_USE_UV:e||t,MTOON_UVS_VERTEX_ONLY:e&&!t,V0_COMPAT_SHADE:this._v0CompatShade,USE_SHADEMULTIPLYTEXTURE:this.shadeMultiplyTexture!==null,USE_SHADINGSHIFTTEXTURE:this.shadingShiftTexture!==null,USE_MATCAPTEXTURE:this.matcapTexture!==null,USE_RIMMULTIPLYTEXTURE:this.rimMultiplyTexture!==null,USE_OUTLINEWIDTHMULTIPLYTEXTURE:this._isOutline&&this.outlineWidthMultiplyTexture!==null,USE_UVANIMATIONMASKTEXTURE:this.uvAnimationMaskTexture!==null,IGNORE_VERTEX_COLOR:this._ignoreVertexColor===!0,DEBUG_NORMAL:this._debugMode==="normal",DEBUG_LITSHADERATE:this._debugMode==="litShadeRate",DEBUG_UV:this._debugMode==="uv",OUTLINE_WIDTH_SCREEN:this._isOutline&&this._outlineWidthMode===nO.ScreenCoordinates}}_updateTextureMatrix(n,e){n.value&&(n.value.matrixAutoUpdate&&n.value.updateMatrix(),e.value.copy(n.value.matrix))}},_de=new Set(["1.0","1.0-beta"]),xG=class Fw{get name(){return Fw.EXTENSION_NAME}constructor(e,t={}){var r,i,s,o;this.parser=e,this.materialType=(r=t.materialType)!=null?r:_G,this.renderOrderOffset=(i=t.renderOrderOffset)!=null?i:0,this.v0CompatShade=(s=t.v0CompatShade)!=null?s:!1,this.debugMode=(o=t.debugMode)!=null?o:"none",this._mToonMaterialSet=new Set}beforeRoot(){return du(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return du(this,null,function*(){e.userData.vrmMToonMaterials=Array.from(this._mToonMaterialSet)})}getMaterialType(e){return this._getMToonExtension(e)?this.materialType:null}extendMaterialParams(e,t){const r=this._getMToonExtension(e);return r?this._extendMaterialParams(r,t):null}loadMesh(e){return du(this,null,function*(){var t;const r=this.parser,s=(t=r.json.meshes)==null?void 0:t[e];if(s==null)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${e}] of glTF but the mesh doesn't exist`);const o=s.primitives,a=yield r.loadMesh(e);if(o.length===1){const l=a,c=o[0].material;c!=null&&this._setupPrimitive(l,c)}else{const l=a;for(let c=0;c{var o;this._getMToonExtension(s)&&((o=i.extensions)!=null&&o.KHR_materials_unlit)&&delete i.extensions.KHR_materials_unlit})}_getMToonExtension(e){var t,r;const o=(t=this.parser.json.materials)==null?void 0:t[e];if(o==null){console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[Fw.EXTENSION_NAME];if(a==null)return;const l=a.specVersion;if(!_de.has(l)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${Fw.EXTENSION_NAME} specVersion "${l}"`);return}return a}_extendMaterialParams(e,t){return du(this,null,function*(){var r;delete t.metalness,delete t.roughness;const i=new mde(this.parser,t);i.assignPrimitive("transparentWithZWrite",e.transparentWithZWrite),i.assignColor("shadeColorFactor",e.shadeColorFactor),i.assignTexture("shadeMultiplyTexture",e.shadeMultiplyTexture,!0),i.assignPrimitive("shadingShiftFactor",e.shadingShiftFactor),i.assignTexture("shadingShiftTexture",e.shadingShiftTexture,!0),i.assignPrimitive("shadingShiftTextureScale",(r=e.shadingShiftTexture)==null?void 0:r.scale),i.assignPrimitive("shadingToonyFactor",e.shadingToonyFactor),i.assignPrimitive("giEqualizationFactor",e.giEqualizationFactor),i.assignColor("matcapFactor",e.matcapFactor),i.assignTexture("matcapTexture",e.matcapTexture,!0),i.assignColor("parametricRimColorFactor",e.parametricRimColorFactor),i.assignTexture("rimMultiplyTexture",e.rimMultiplyTexture,!0),i.assignPrimitive("rimLightingMixFactor",e.rimLightingMixFactor),i.assignPrimitive("parametricRimFresnelPowerFactor",e.parametricRimFresnelPowerFactor),i.assignPrimitive("parametricRimLiftFactor",e.parametricRimLiftFactor),i.assignPrimitive("outlineWidthMode",e.outlineWidthMode),i.assignPrimitive("outlineWidthFactor",e.outlineWidthFactor),i.assignTexture("outlineWidthMultiplyTexture",e.outlineWidthMultiplyTexture,!1),i.assignColor("outlineColorFactor",e.outlineColorFactor),i.assignPrimitive("outlineLightingMixFactor",e.outlineLightingMixFactor),i.assignTexture("uvAnimationMaskTexture",e.uvAnimationMaskTexture,!1),i.assignPrimitive("uvAnimationScrollXSpeedFactor",e.uvAnimationScrollXSpeedFactor),i.assignPrimitive("uvAnimationScrollYSpeedFactor",e.uvAnimationScrollYSpeedFactor),i.assignPrimitive("uvAnimationRotationSpeedFactor",e.uvAnimationRotationSpeedFactor),i.assignPrimitive("v0CompatShade",this.v0CompatShade),i.assignPrimitive("debugMode",this.debugMode),yield i.pending})}_setupPrimitive(e,t){const r=this._getMToonExtension(t);if(r){const i=this._parseRenderOrder(r);e.renderOrder=i+this.renderOrderOffset,this._generateOutline(e),this._addToMaterialSet(e);return}}_shouldGenerateOutline(e){return typeof e.outlineWidthMode=="string"&&e.outlineWidthMode!=="none"&&typeof e.outlineWidthFactor=="number"&&e.outlineWidthFactor>0}_generateOutline(e){const t=e.material;if(!(t instanceof as)||!this._shouldGenerateOutline(t))return;e.material=[t];const r=t.clone();r.name+=" (Outline)",r.isOutline=!0,r.side=oi,e.material.push(r);const i=e.geometry,s=i.index?i.index.count:i.attributes.position.count/3;i.addGroup(0,s,0),i.addGroup(0,s,1)}_addToMaterialSet(e){const t=e.material,r=new Set;Array.isArray(t)?t.forEach(i=>r.add(i)):r.add(t);for(const i of r)this._mToonMaterialSet.add(i)}_parseRenderOrder(e){var t;return(e.transparentWithZWrite?0:19)+((t=e.renderQueueOffsetNumber)!=null?t:0)}};xG.EXTENSION_NAME="VRMC_materials_mtoon";var xde=xG,bde=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),bG=class sT{get name(){return sT.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,t){return bde(this,null,function*(){const r=this._getHDREmissiveMultiplierExtension(e);if(r==null)return;console.warn("VRMMaterialsHDREmissiveMultiplierLoaderPlugin: `VRMC_materials_hdr_emissiveMultiplier` is archived. Use `KHR_materials_emissive_strength` instead.");const i=r.emissiveMultiplier;t.emissiveIntensity=i})}_getHDREmissiveMultiplierExtension(e){var t,r;const o=(t=this.parser.json.materials)==null?void 0:t[e];if(o==null){console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[sT.EXTENSION_NAME];if(a!=null)return a}};bG.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var Ede=bG,Bde=Object.defineProperty,Sde=Object.defineProperties,Mde=Object.getOwnPropertyDescriptors,rO=Object.getOwnPropertySymbols,Cde=Object.prototype.hasOwnProperty,Tde=Object.prototype.propertyIsEnumerable,iO=(n,e,t)=>e in n?Bde(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,va=(n,e)=>{for(var t in e||(e={}))Cde.call(e,t)&&iO(n,t,e[t]);if(rO)for(var t of rO(e))Tde.call(e,t)&&iO(n,t,e[t]);return n},sO=(n,e)=>Sde(n,Mde(e)),Ide=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())});function Uf(n){return Math.pow(n,2.2)}var Rde=class{get name(){return"VRMMaterialsV0CompatPlugin"}constructor(n){var e;this.parser=n,this._renderQueueMapTransparent=new Map,this._renderQueueMapTransparentZWrite=new Map;const t=this.parser.json;t.extensionsUsed=(e=t.extensionsUsed)!=null?e:[],t.extensionsUsed.indexOf("KHR_texture_transform")===-1&&t.extensionsUsed.push("KHR_texture_transform")}beforeRoot(){return Ide(this,null,function*(){var n;const e=this.parser.json,t=(n=e.extensions)==null?void 0:n.VRM,r=t==null?void 0:t.materialProperties;r&&(this._populateRenderQueueMap(r),r.forEach((i,s)=>{var o,a;const l=(o=e.materials)==null?void 0:o[s];if(l==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${s}] of glTF but the material doesn't exist`);return}if(i.shader==="VRM/MToon"){const c=this._parseV0MToonProperties(i,l);e.materials[s]=c}else if((a=i.shader)!=null&&a.startsWith("VRM/Unlit")){const c=this._parseV0UnlitProperties(i,l);e.materials[s]=c}else i.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${i.shader}`)}))})}_parseV0MToonProperties(n,e){var t,r,i,s,o,a,l,c,A,u,f,h,d,m,g,p,v,w,_,x,b,B,M,I,S,L,D,T,y,E,R,F,O,z,j,H,C,W,ee,P,re,ue,le,me,ie,ge,_e,se,Q,fe,Ae,Z,q,he,X;const G=(r=(t=n.keywordMap)==null?void 0:t._ALPHABLEND_ON)!=null?r:!1,Y=((i=n.floatProperties)==null?void 0:i._ZWrite)===1&&G,de=this._v0ParseRenderQueue(n),ae=(o=(s=n.keywordMap)==null?void 0:s._ALPHATEST_ON)!=null?o:!1,Ee=G?"BLEND":ae?"MASK":"OPAQUE",V=ae?(l=(a=n.floatProperties)==null?void 0:a._Cutoff)!=null?l:.5:void 0,N=((A=(c=n.floatProperties)==null?void 0:c._CullMode)!=null?A:2)===0,K=this._portTextureTransform(n),oe=((f=(u=n.vectorProperties)==null?void 0:u._Color)!=null?f:[1,1,1,1]).map((Oe,Xe)=>Xe===3?Oe:Uf(Oe)),pe=(h=n.textureProperties)==null?void 0:h._MainTex,ve=pe!=null?{index:pe,extensions:va({},K)}:void 0,Ce=(m=(d=n.floatProperties)==null?void 0:d._BumpScale)!=null?m:1,Le=(g=n.textureProperties)==null?void 0:g._BumpMap,Re=Le!=null?{index:Le,scale:Ce,extensions:va({},K)}:void 0,$e=((v=(p=n.vectorProperties)==null?void 0:p._EmissionColor)!=null?v:[0,0,0,1]).map(Uf),ce=(w=n.textureProperties)==null?void 0:w._EmissionMap,Pe=ce!=null?{index:ce,extensions:va({},K)}:void 0,Me=((x=(_=n.vectorProperties)==null?void 0:_._ShadeColor)!=null?x:[.97,.81,.86,1]).map(Uf),Te=(b=n.textureProperties)==null?void 0:b._ShadeTexture,Fe=Te!=null?{index:Te,extensions:va({},K)}:void 0;let De=(M=(B=n.floatProperties)==null?void 0:B._ShadeShift)!=null?M:0,Ze=(S=(I=n.floatProperties)==null?void 0:I._ShadeToony)!=null?S:.9;Ze=Bt.lerp(Ze,1,.5+.5*De),De=-De-(1-Ze);const At=(D=(L=n.floatProperties)==null?void 0:L._IndirectLightIntensity)!=null?D:.1,Pn=At?1-At:void 0,rt=(T=n.textureProperties)==null?void 0:T._SphereAdd,xt=rt!=null?[1,1,1]:void 0,Tr=rt!=null?{index:rt}:void 0,tn=(E=(y=n.floatProperties)==null?void 0:y._RimLightingMix)!=null?E:0,qt=(R=n.textureProperties)==null?void 0:R._RimTexture,Zr=qt!=null?{index:qt,extensions:va({},K)}:void 0,en=((O=(F=n.vectorProperties)==null?void 0:F._RimColor)!=null?O:[0,0,0,1]).map(Uf),nn=(j=(z=n.floatProperties)==null?void 0:z._RimFresnelPower)!=null?j:1,Ks=(C=(H=n.floatProperties)==null?void 0:H._RimLift)!=null?C:0,Xt=["none","worldCoordinates","screenCoordinates"][(ee=(W=n.floatProperties)==null?void 0:W._OutlineWidthMode)!=null?ee:0];let Yt=(re=(P=n.floatProperties)==null?void 0:P._OutlineWidth)!=null?re:0;Yt=.01*Yt;const Ii=(ue=n.textureProperties)==null?void 0:ue._OutlineWidthTexture,rn=Ii!=null?{index:Ii,extensions:va({},K)}:void 0,sn=((me=(le=n.vectorProperties)==null?void 0:le._OutlineColor)!=null?me:[0,0,0]).map(Uf),un=((ge=(ie=n.floatProperties)==null?void 0:ie._OutlineColorMode)!=null?ge:0)===1?(se=(_e=n.floatProperties)==null?void 0:_e._OutlineLightingMix)!=null?se:1:0,on=(Q=n.textureProperties)==null?void 0:Q._UvAnimMaskTexture,te=on!=null?{index:on,extensions:va({},K)}:void 0,ye=(Ae=(fe=n.floatProperties)==null?void 0:fe._UvAnimScrollX)!=null?Ae:0;let Be=(q=(Z=n.floatProperties)==null?void 0:Z._UvAnimScrollY)!=null?q:0;Be!=null&&(Be=-Be);const Se=(X=(he=n.floatProperties)==null?void 0:he._UvAnimRotation)!=null?X:0,we={specVersion:"1.0",transparentWithZWrite:Y,renderQueueOffsetNumber:de,shadeColorFactor:Me,shadeMultiplyTexture:Fe,shadingShiftFactor:De,shadingToonyFactor:Ze,giEqualizationFactor:Pn,matcapFactor:xt,matcapTexture:Tr,rimLightingMixFactor:tn,rimMultiplyTexture:Zr,parametricRimColorFactor:en,parametricRimFresnelPowerFactor:nn,parametricRimLiftFactor:Ks,outlineWidthMode:Xt,outlineWidthFactor:Yt,outlineWidthMultiplyTexture:rn,outlineColorFactor:sn,outlineLightingMixFactor:un,uvAnimationMaskTexture:te,uvAnimationScrollXSpeedFactor:ye,uvAnimationScrollYSpeedFactor:Be,uvAnimationRotationSpeedFactor:Se};return sO(va({},e),{pbrMetallicRoughness:{baseColorFactor:oe,baseColorTexture:ve},normalTexture:Re,emissiveTexture:Pe,emissiveFactor:$e,alphaMode:Ee,alphaCutoff:V,doubleSided:N,extensions:{VRMC_materials_mtoon:we}})}_parseV0UnlitProperties(n,e){var t,r,i,s,o;const a=n.shader==="VRM/UnlitTransparentZWrite",l=n.shader==="VRM/UnlitTransparent"||a,c=this._v0ParseRenderQueue(n),A=n.shader==="VRM/UnlitCutout",u=l?"BLEND":A?"MASK":"OPAQUE",f=A?(r=(t=n.floatProperties)==null?void 0:t._Cutoff)!=null?r:.5:void 0,h=this._portTextureTransform(n),d=((s=(i=n.vectorProperties)==null?void 0:i._Color)!=null?s:[1,1,1,1]).map(Uf),m=(o=n.textureProperties)==null?void 0:o._MainTex,g=m!=null?{index:m,extensions:va({},h)}:void 0,p={specVersion:"1.0",transparentWithZWrite:a,renderQueueOffsetNumber:c,shadeColorFactor:d,shadeMultiplyTexture:g};return sO(va({},e),{pbrMetallicRoughness:{baseColorFactor:d,baseColorTexture:g},alphaMode:u,alphaCutoff:f,extensions:{VRMC_materials_mtoon:p}})}_portTextureTransform(n){var e,t,r,i,s;const o=(e=n.vectorProperties)==null?void 0:e._MainTex;if(o==null)return{};const a=[(t=o==null?void 0:o[0])!=null?t:0,(r=o==null?void 0:o[1])!=null?r:0],l=[(i=o==null?void 0:o[2])!=null?i:1,(s=o==null?void 0:o[3])!=null?s:1];return a[1]=1-l[1]-a[1],{KHR_texture_transform:{offset:a,scale:l}}}_v0ParseRenderQueue(n){var e,t;const r=n.shader==="VRM/UnlitTransparentZWrite",i=((e=n.keywordMap)==null?void 0:e._ALPHABLEND_ON)!=null||n.shader==="VRM/UnlitTransparent"||r,s=((t=n.floatProperties)==null?void 0:t._ZWrite)===1||r;let o=0;if(i){const a=n.renderQueue;a!=null&&(s?o=this._renderQueueMapTransparentZWrite.get(a):o=this._renderQueueMapTransparent.get(a))}return o}_populateRenderQueueMap(n){const e=new Set,t=new Set;n.forEach(r=>{var i,s;const o=r.shader==="VRM/UnlitTransparentZWrite",a=((i=r.keywordMap)==null?void 0:i._ALPHABLEND_ON)!=null||r.shader==="VRM/UnlitTransparent"||o,l=((s=r.floatProperties)==null?void 0:s._ZWrite)===1||o;if(a){const c=r.renderQueue;c!=null&&(l?t.add(c):e.add(c))}}),e.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${e.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),t.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${t.size} render queues for TransparentZWrite materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),Array.from(e).sort().forEach((r,i)=>{const s=Math.min(Math.max(i-e.size+1,-9),0);this._renderQueueMapTransparent.set(r,s)}),Array.from(t).sort().forEach((r,i)=>{const s=Math.min(Math.max(i,0),9);this._renderQueueMapTransparentZWrite.set(r,s)})}},oO=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),Cc=new $,PB=class extends ri{constructor(n){super(),this._attrPosition=new ct(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(Nq);const e=new Jt;e.setAttribute("position",this._attrPosition);const t=new Ac({color:16711935,depthTest:!1,depthWrite:!1});this._line=new Yd(e,t),this.add(this._line),this.constraint=n}updateMatrixWorld(n){Cc.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,Cc.x,Cc.y,Cc.z),this.constraint.source&&Cc.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,Cc.x,Cc.y,Cc.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(n)}};function aO(n,e){return e.set(n.elements[12],n.elements[13],n.elements[14])}var Ude=new $,Fde=new $;function Pde(n,e){return n.decompose(Ude,e,Fde),e}function Z_(n){return n.invert?n.invert():n.inverse(),n}var a2=class{constructor(n,e){this.destination=n,this.source=e,this.weight=1}},Lde=new $,Dde=new $,Nde=new $,Ode=new nt,kde=new nt,Hde=new nt,Qde=class extends a2{get aimAxis(){return this._aimAxis}set aimAxis(n){this._aimAxis=n,this._v3AimAxis.set(n==="PositiveX"?1:n==="NegativeX"?-1:0,n==="PositiveY"?1:n==="NegativeY"?-1:0,n==="PositiveZ"?1:n==="NegativeZ"?-1:0)}get dependencies(){const n=new Set([this.source]);return this.destination.parent&&n.add(this.destination.parent),n}constructor(n,e){super(n,e),this._aimAxis="PositiveX",this._v3AimAxis=new $(1,0,0),this._dstRestQuat=new nt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);const n=Ode.identity(),e=kde.identity();this.destination.parent&&(Pde(this.destination.parent.matrixWorld,n),Z_(e.copy(n)));const t=Lde.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(n),r=aO(this.source.matrixWorld,Dde).sub(aO(this.destination.matrixWorld,Nde)).normalize(),i=Hde.setFromUnitVectors(t,r).premultiply(e).multiply(n).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}};function zde(n,e){const t=[n];let r=n.parent;for(;r!==null;)t.unshift(r),r=r.parent;t.forEach(i=>{e(i)})}var Gde=class{constructor(){this._constraints=new Set,this._objectConstraintsMap=new Map}get constraints(){return this._constraints}addConstraint(n){this._constraints.add(n);let e=this._objectConstraintsMap.get(n.destination);e==null&&(e=new Set,this._objectConstraintsMap.set(n.destination,e)),e.add(n)}deleteConstraint(n){this._constraints.delete(n),this._objectConstraintsMap.get(n.destination).delete(n)}setInitState(){const n=new Set,e=new Set;for(const t of this._constraints)this._processConstraint(t,n,e,r=>r.setInitState())}update(){const n=new Set,e=new Set;for(const t of this._constraints)this._processConstraint(t,n,e,r=>r.update())}_processConstraint(n,e,t,r){if(t.has(n))return;if(e.has(n))throw new Error("VRMNodeConstraintManager: Circular dependency detected while updating constraints");e.add(n);const i=n.dependencies;for(const s of i)zde(s,o=>{const a=this._objectConstraintsMap.get(o);if(a)for(const l of a)this._processConstraint(l,e,t,r)});r(n),t.add(n)}},Vde=new nt,jde=new nt,Wde=class extends a2{get dependencies(){return new Set([this.source])}constructor(n,e){super(n,e),this._dstRestQuat=new nt,this._invSrcRestQuat=new nt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),Z_(this._invSrcRestQuat.copy(this.source.quaternion))}update(){const n=Vde.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=jde.copy(this._dstRestQuat).multiply(n);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},Kde=new $,Xde=new nt,Yde=new nt,$de=class extends a2{get rollAxis(){return this._rollAxis}set rollAxis(n){this._rollAxis=n,this._v3RollAxis.set(n==="X"?1:0,n==="Y"?1:0,n==="Z"?1:0)}get dependencies(){return new Set([this.source])}constructor(n,e){super(n,e),this._rollAxis="X",this._v3RollAxis=new $(1,0,0),this._dstRestQuat=new nt,this._invDstRestQuat=new nt,this._invSrcRestQuatMulDstRestQuat=new nt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),Z_(this._invDstRestQuat.copy(this._dstRestQuat)),Z_(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){const n=Xde.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=Kde.copy(this._v3RollAxis).applyQuaternion(n),r=Yde.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(n);this.destination.quaternion.copy(this._dstRestQuat).slerp(r,this.weight)}},Zde=new Set(["1.0","1.0-beta"]),EG=class Im{get name(){return Im.EXTENSION_NAME}constructor(e,t){this.parser=e,this.helperRoot=t==null?void 0:t.helperRoot}afterRoot(e){return oO(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return oO(this,null,function*(){var t;const r=this.parser.json;if(!(((t=r.extensionsUsed)==null?void 0:t.indexOf(Im.EXTENSION_NAME))!==-1))return null;const s=new Gde,o=yield this.parser.getDependencies("node");return o.forEach((a,l)=>{var c;const A=r.nodes[l],u=(c=A==null?void 0:A.extensions)==null?void 0:c[Im.EXTENSION_NAME];if(u==null)return;const f=u.specVersion;if(!Zde.has(f)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${Im.EXTENSION_NAME} specVersion "${f}"`);return}const h=u.constraint;if(h.roll!=null){const d=this._importRollConstraint(a,o,h.roll);s.addConstraint(d)}else if(h.aim!=null){const d=this._importAimConstraint(a,o,h.aim);s.addConstraint(d)}else if(h.rotation!=null){const d=this._importRotationConstraint(a,o,h.rotation);s.addConstraint(d)}}),e.scene.updateMatrixWorld(),s.setInitState(),s})}_importRollConstraint(e,t,r){const{source:i,rollAxis:s,weight:o}=r,a=t[i],l=new $de(e,a);if(s!=null&&(l.rollAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new PB(l);this.helperRoot.add(c)}return l}_importAimConstraint(e,t,r){const{source:i,aimAxis:s,weight:o}=r,a=t[i],l=new Qde(e,a);if(s!=null&&(l.aimAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new PB(l);this.helperRoot.add(c)}return l}_importRotationConstraint(e,t,r){const{source:i,weight:s}=r,o=t[i],a=new Wde(e,o);if(s!=null&&(a.weight=s),this.helperRoot){const l=new PB(a);this.helperRoot.add(l)}return a}};EG.EXTENSION_NAME="VRMC_node_constraint";var Jde=EG,vy=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),l2=class{},LB=new $,XA=new $,BG=class extends l2{get type(){return"capsule"}constructor(n){var e,t,r,i;super(),this.offset=(e=n==null?void 0:n.offset)!=null?e:new $(0,0,0),this.tail=(t=n==null?void 0:n.tail)!=null?t:new $(0,0,0),this.radius=(r=n==null?void 0:n.radius)!=null?r:0,this.inside=(i=n==null?void 0:n.inside)!=null?i:!1}calculateCollision(n,e,t,r){LB.copy(this.offset).applyMatrix4(n),XA.copy(this.tail).applyMatrix4(n),XA.sub(LB);const i=XA.lengthSq();r.copy(e).sub(LB);const s=XA.dot(r);s<=0||(i<=s||XA.multiplyScalar(s/i),r.sub(XA));const o=this.inside?this.radius-t-r.length():r.length()-t-this.radius;return r.normalize(),this.inside&&r.negate(),o}},DB=new $,lO=new dt,SG=class extends l2{get type(){return"plane"}constructor(n){var e,t;super(),this.offset=(e=n==null?void 0:n.offset)!=null?e:new $(0,0,0),this.normal=(t=n==null?void 0:n.normal)!=null?t:new $(0,0,1)}calculateCollision(n,e,t,r){r.copy(this.offset).applyMatrix4(n),r.negate().add(e),lO.getNormalMatrix(n),DB.copy(this.normal).applyNormalMatrix(lO).normalize();const i=r.dot(DB)-t;return r.copy(DB),i}},MG=class extends l2{get type(){return"sphere"}constructor(n){var e,t,r;super(),this.offset=(e=n==null?void 0:n.offset)!=null?e:new $(0,0,0),this.radius=(t=n==null?void 0:n.radius)!=null?t:0,this.inside=(r=n==null?void 0:n.inside)!=null?r:!1}calculateCollision(n,e,t,r){r.copy(this.offset).applyMatrix4(n),r.negate().add(e);const i=this.inside?this.radius-t-r.length():r.length()-t-this.radius;return r.normalize(),this.inside&&r.negate(),i}},ya=new $,qde=class extends Jt{constructor(n){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new $,this._currentTail=new $,this._shape=n,this._attrPos=new ct(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new ct(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,n=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),n=!0);const t=ya.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(t)>1e-10&&(this._currentTail.copy(t),n=!0),n&&this._buildPosition()}_buildPosition(){ya.copy(this._currentTail).sub(this._currentOffset);const n=ya.length()/this._currentRadius;for(let r=0;r<=16;r++){const i=r/16*Math.PI;this._attrPos.setXYZ(r,-Math.sin(i),-Math.cos(i),0),this._attrPos.setXYZ(17+r,n+Math.sin(i),Math.cos(i),0),this._attrPos.setXYZ(34+r,-Math.sin(i),0,-Math.cos(i)),this._attrPos.setXYZ(51+r,n+Math.sin(i),0,Math.cos(i))}for(let r=0;r<32;r++){const i=r/16*Math.PI;this._attrPos.setXYZ(68+r,0,Math.sin(i),Math.cos(i)),this._attrPos.setXYZ(100+r,n,Math.sin(i),Math.cos(i))}const e=Math.atan2(ya.y,Math.sqrt(ya.x*ya.x+ya.z*ya.z)),t=-Math.atan2(ya.z,ya.x);this.rotateZ(e),this.rotateY(t),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<34;n++){const e=(n+1)%34;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(68+n*2,34+n,34+e)}for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(136+n*2,68+n,68+e),this._attrIndex.setXY(200+n*2,100+n,100+e)}this._attrIndex.needsUpdate=!0}},epe=class extends Jt{constructor(n){super(),this.worldScale=1,this._currentOffset=new $,this._currentNormal=new $,this._shape=n,this._attrPos=new ct(new Float32Array(6*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new ct(new Uint16Array(10),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),n=!0),this._currentNormal.equals(this._shape.normal)||(this._currentNormal.copy(this._shape.normal),n=!0),n&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,-.5,-.5,0),this._attrPos.setXYZ(1,.5,-.5,0),this._attrPos.setXYZ(2,.5,.5,0),this._attrPos.setXYZ(3,-.5,.5,0),this._attrPos.setXYZ(4,0,0,0),this._attrPos.setXYZ(5,0,0,.25),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this.lookAt(this._currentNormal),this._attrPos.needsUpdate=!0}_buildIndex(){this._attrIndex.setXY(0,0,1),this._attrIndex.setXY(2,1,2),this._attrIndex.setXY(4,2,3),this._attrIndex.setXY(6,3,0),this._attrIndex.setXY(8,4,5),this._attrIndex.needsUpdate=!0}},tpe=class extends Jt{constructor(n){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new $,this._shape=n,this._attrPos=new ct(new Float32Array(32*3*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new ct(new Uint16Array(64*3),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,n=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),n=!0),n&&this._buildPosition()}_buildPosition(){for(let n=0;n<32;n++){const e=n/16*Math.PI;this._attrPos.setXYZ(n,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+n,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+n,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(64+n*2,32+n,32+e),this._attrIndex.setXY(128+n*2,64+n,64+e)}this._attrIndex.needsUpdate=!0}},npe=new $,NB=class extends ri{constructor(n){if(super(),this.matrixAutoUpdate=!1,this.collider=n,this.collider.shape instanceof MG)this._geometry=new tpe(this.collider.shape);else if(this.collider.shape instanceof BG)this._geometry=new qde(this.collider.shape);else if(this.collider.shape instanceof SG)this._geometry=new epe(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const e=new Ac({color:16711935,depthTest:!1,depthWrite:!1});this._line=new y0(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(n){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=npe.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(n)}},rpe=class extends Jt{constructor(n){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new $,this._springBone=n,this._attrPos=new ct(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new ct(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;const e=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,n=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),n=!0),n&&this._buildPosition()}_buildPosition(){for(let n=0;n<32;n++){const e=n/16*Math.PI;this._attrPos.setXYZ(n,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+n,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+n,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(64+n*2,32+n,32+e),this._attrIndex.setXY(128+n*2,64+n,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},ipe=new $,spe=class extends ri{constructor(n){super(),this.matrixAutoUpdate=!1,this.springBone=n,this._geometry=new rpe(this.springBone);const e=new Ac({color:16776960,depthTest:!1,depthWrite:!1});this._line=new y0(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(n){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=ipe.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(n)}},Pw=class extends Lt{constructor(n){super(),this.shape=n}},ope=new He;function CG(n){return n.invert?n.invert():n.getInverse(ope.copy(n)),n}var ape=class{constructor(n){this._inverseCache=new He,this._shouldUpdateInverse=!0,this.matrix=n;const e={set:(t,r,i)=>(this._shouldUpdateInverse=!0,t[r]=i,!0)};this._originalElements=n.elements,n.elements=new Proxy(n.elements,e)}get inverse(){return this._shouldUpdateInverse&&(CG(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},lpe=new He,wl=new $,Wp=new $,cpe=new $,Ff=new $,cO=new $,Kp=new $,AO=new nt,Pf=new He,Ape=new He,upe=class{constructor(n,e,t={},r=[]){this._currentTail=new $,this._prevTail=new $,this._boneAxis=new $,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new He,this._initialLocalRotation=new nt,this._initialLocalChildPosition=new $;var i,s,o,a,l,c;this.bone=n,this.bone.matrixAutoUpdate=!1,this.child=e,this.settings={hitRadius:(i=t.hitRadius)!=null?i:0,stiffness:(s=t.stiffness)!=null?s:1,gravityPower:(o=t.gravityPower)!=null?o:0,gravityDir:(l=(a=t.gravityDir)==null?void 0:a.clone())!=null?l:new $(0,-1,0),dragForce:(c=t.dragForce)!=null?c:.4},this.colliderGroups=r}get center(){return this._center}set center(n){var e;(e=this._center)!=null&&e.userData.inverseCacheProxy&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=n,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new ape(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:lpe}setInitState(){this._initialLocalMatrix.copy(this.bone.matrix),this._initialLocalRotation.copy(this.bone.quaternion),this.child?this._initialLocalChildPosition.copy(this.child.position):this._initialLocalChildPosition.copy(this.bone.position).normalize().multiplyScalar(.07);const n=this._getMatrixWorldToCenter(Pf);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(n),this._prevTail.copy(this._currentTail),this._boneAxis.copy(this._initialLocalChildPosition).normalize()}reset(){this.bone.quaternion.copy(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix);const n=this._getMatrixWorldToCenter(Pf);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(n),this._prevTail.copy(this._currentTail)}update(n){if(n<=0)return;this._calcWorldSpaceBoneLength(),Ff.setFromMatrixPosition(this.bone.matrixWorld);let e=this._getMatrixWorldToCenter(Pf);cO.copy(Ff).applyMatrix4(e);const t=AO.setFromRotationMatrix(e),r=Ape.copy(e).multiply(this._parentMatrixWorld),i=Wp.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(r).sub(cO).normalize(),s=cpe.copy(this.settings.gravityDir).applyQuaternion(t).normalize(),o=this._getMatrixCenterToWorld(Pf);Kp.copy(this._currentTail).add(wl.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.settings.dragForce)).add(wl.copy(i).multiplyScalar(this.settings.stiffness*n)).add(wl.copy(s).multiplyScalar(this.settings.gravityPower*n)).applyMatrix4(o),Kp.sub(Ff).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Ff),this._collision(Kp),e=this._getMatrixWorldToCenter(Pf),this._prevTail.copy(this._currentTail),this._currentTail.copy(wl.copy(Kp).applyMatrix4(e));const a=CG(Pf.copy(this._parentMatrixWorld).multiply(this._initialLocalMatrix)),l=AO.setFromUnitVectors(this._boneAxis,wl.copy(Kp).applyMatrix4(a).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(l),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix)}_collision(n){this.colliderGroups.forEach(e=>{e.colliders.forEach(t=>{const r=t.shape.calculateCollision(t.matrixWorld,n,this.settings.hitRadius,wl);r<0&&(n.add(wl.multiplyScalar(-r)),n.sub(Ff).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Ff))})})}_calcWorldSpaceBoneLength(){wl.setFromMatrixPosition(this.bone.matrixWorld),this.child?Wp.setFromMatrixPosition(this.child.matrixWorld):(Wp.copy(this._initialLocalChildPosition),Wp.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=wl.sub(Wp).length()}_getMatrixCenterToWorld(n){return this._center?n.copy(this._center.matrixWorld):n.identity(),n}_getMatrixWorldToCenter(n){return this._center?n.copy(this._center.userData.inverseCacheProxy.inverse):n.identity(),n}};function fpe(n,e){const t=[];let r=n;for(;r!==null;)t.unshift(r),r=r.parent;t.forEach(i=>{e(i)})}function TG(n,e){n.children.forEach(t=>{e(t)||TG(t,e)})}var uO=class{constructor(){this._joints=new Set,this._hasWarnedCircularDependency=!1,this._objectSpringBonesMap=new Map}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){const n=new Set;return this._joints.forEach(e=>{e.colliderGroups.forEach(t=>{n.add(t)})}),Array.from(n)}get colliders(){const n=new Set;return this.colliderGroups.forEach(e=>{e.colliders.forEach(t=>{n.add(t)})}),Array.from(n)}addJoint(n){this._joints.add(n);let e=this._objectSpringBonesMap.get(n.bone);e==null&&(e=new Set,this._objectSpringBonesMap.set(n.bone,e)),e.add(n)}addSpringBone(n){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(n)}deleteJoint(n){this._joints.delete(n),this._objectSpringBonesMap.get(n.bone).delete(n)}deleteSpringBone(n){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(n)}setInitState(){const n=new Set,e=new Set,t=new Set;for(const r of this._joints)this._processSpringBone(r,n,e,t,i=>i.setInitState())}reset(){const n=new Set,e=new Set,t=new Set;for(const r of this._joints)this._processSpringBone(r,n,e,t,i=>i.reset())}update(n){const e=new Set,t=new Set,r=new Set;for(const i of this._joints)this._processSpringBone(i,e,t,r,s=>s.update(n)),TG(i.bone,s=>{var o,a;return((a=(o=this._objectSpringBonesMap.get(s))==null?void 0:o.size)!=null?a:0)>0?!0:(s.updateWorldMatrix(!1,!1),!1)})}_processSpringBone(n,e,t,r,i){if(t.has(n))return;if(e.has(n)){this._hasWarnedCircularDependency||(console.warn("VRMSpringBoneManager: Circular dependency detected while updating springbones"),this._hasWarnedCircularDependency=!0);return}e.add(n);const s=this._getDependencies(n);for(const o of s)fpe(o,a=>{const l=this._objectSpringBonesMap.get(a);if(l)for(const c of l)this._processSpringBone(c,e,t,r,i);else r.has(a)||(a.updateWorldMatrix(!1,!1),r.add(a))});n.bone.updateMatrix(),n.bone.updateWorldMatrix(!1,!1),i(n),r.add(n.bone),t.add(n)}_getDependencies(n){const e=new Set,t=n.bone.parent;return t&&e.add(t),n.colliderGroups.forEach(r=>{r.colliders.forEach(i=>{e.add(i)})}),e}},fO="VRMC_springBone_extended_collider",hpe=new Set(["1.0","1.0-beta"]),dpe=new Set(["1.0"]),IG=class Yf{get name(){return Yf.EXTENSION_NAME}constructor(e,t){var r;this.parser=e,this.jointHelperRoot=t==null?void 0:t.jointHelperRoot,this.colliderHelperRoot=t==null?void 0:t.colliderHelperRoot,this.useExtendedColliders=(r=t==null?void 0:t.useExtendedColliders)!=null?r:!0}afterRoot(e){return vy(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return vy(this,null,function*(){const t=yield this._v1Import(e);if(t!=null)return t;const r=yield this._v0Import(e);return r??null})}_v1Import(e){return vy(this,null,function*(){var t,r,i,s,o;const a=e.parser.json;if(!(((t=a.extensionsUsed)==null?void 0:t.indexOf(Yf.EXTENSION_NAME))!==-1))return null;const c=new uO,A=yield e.parser.getDependencies("node"),u=(r=a.extensions)==null?void 0:r[Yf.EXTENSION_NAME];if(!u)return null;const f=u.specVersion;if(!hpe.has(f))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Yf.EXTENSION_NAME} specVersion "${f}"`),null;const h=(i=u.colliders)==null?void 0:i.map((m,g)=>{var p,v,w,_,x,b,B,M,I,S,L,D,T,y,E;const R=A[m.node],F=m.shape,O=(p=m.extensions)==null?void 0:p[fO];if(this.useExtendedColliders&&O!=null){const z=O.specVersion;if(!dpe.has(z))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${fO} specVersion "${z}". Fallbacking to the ${Yf.EXTENSION_NAME} definition`);else{const j=O.shape;if(j.sphere)return this._importSphereCollider(R,{offset:new $().fromArray((v=j.sphere.offset)!=null?v:[0,0,0]),radius:(w=j.sphere.radius)!=null?w:0,inside:(_=j.sphere.inside)!=null?_:!1});if(j.capsule)return this._importCapsuleCollider(R,{offset:new $().fromArray((x=j.capsule.offset)!=null?x:[0,0,0]),radius:(b=j.capsule.radius)!=null?b:0,tail:new $().fromArray((B=j.capsule.tail)!=null?B:[0,0,0]),inside:(M=j.capsule.inside)!=null?M:!1});if(j.plane)return this._importPlaneCollider(R,{offset:new $().fromArray((I=j.plane.offset)!=null?I:[0,0,0]),normal:new $().fromArray((S=j.plane.normal)!=null?S:[0,0,1])})}}if(F.sphere)return this._importSphereCollider(R,{offset:new $().fromArray((L=F.sphere.offset)!=null?L:[0,0,0]),radius:(D=F.sphere.radius)!=null?D:0,inside:!1});if(F.capsule)return this._importCapsuleCollider(R,{offset:new $().fromArray((T=F.capsule.offset)!=null?T:[0,0,0]),radius:(y=F.capsule.radius)!=null?y:0,tail:new $().fromArray((E=F.capsule.tail)!=null?E:[0,0,0]),inside:!1});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${g} has no valid shape`)}),d=(s=u.colliderGroups)==null?void 0:s.map((m,g)=>{var p;return{colliders:((p=m.colliders)!=null?p:[]).map(w=>{const _=h==null?void 0:h[w];if(_==null)throw new Error(`VRMSpringBoneLoaderPlugin: The colliderGroup #${g} attempted to use a collider #${w} but not found`);return _}),name:m.name}});return(o=u.springs)==null||o.forEach((m,g)=>{var p;const v=m.joints,w=(p=m.colliderGroups)==null?void 0:p.map(b=>{const B=d==null?void 0:d[b];if(B==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${g} attempted to use a colliderGroup ${b} but not found`);return B}),_=m.center!=null?A[m.center]:void 0;let x;v.forEach(b=>{if(x){const B=x.node,M=A[B],I=b.node,S=A[I],L={hitRadius:x.hitRadius,dragForce:x.dragForce,gravityPower:x.gravityPower,stiffness:x.stiffness,gravityDir:x.gravityDir!=null?new $().fromArray(x.gravityDir):void 0},D=this._importJoint(M,S,L,w);_&&(D.center=_),c.addJoint(D)}x=b})}),c.setInitState(),c})}_v0Import(e){return vy(this,null,function*(){var t,r,i;const s=e.parser.json;if(!(((t=s.extensionsUsed)==null?void 0:t.indexOf("VRM"))!==-1))return null;const a=(r=s.extensions)==null?void 0:r.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const c=l==null?void 0:l.boneGroups;if(!c)return null;const A=new uO,u=yield e.parser.getDependencies("node"),f=(i=l.colliderGroups)==null?void 0:i.map(h=>{var d;const m=u[h.node];return{colliders:((d=h.colliders)!=null?d:[]).map((p,v)=>{var w,_,x;const b=new $(0,0,0);return p.offset&&b.set((w=p.offset.x)!=null?w:0,(_=p.offset.y)!=null?_:0,p.offset.z?-p.offset.z:0),this._importSphereCollider(m,{offset:b,radius:(x=p.radius)!=null?x:0,inside:!1})})}});return c==null||c.forEach((h,d)=>{const m=h.bones;m&&m.forEach(g=>{var p,v,w,_;const x=u[g],b=new $;h.gravityDir?b.set((p=h.gravityDir.x)!=null?p:0,(v=h.gravityDir.y)!=null?v:0,(w=h.gravityDir.z)!=null?w:0):b.set(0,-1,0);const B=h.center!=null?u[h.center]:void 0,M={hitRadius:h.hitRadius,dragForce:h.dragForce,gravityPower:h.gravityPower,stiffness:h.stiffiness,gravityDir:b},I=(_=h.colliderGroups)==null?void 0:_.map(S=>{const L=f==null?void 0:f[S];if(L==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${d} attempted to use a colliderGroup ${S} but not found`);return L});x.traverse(S=>{var L;const D=(L=S.children[0])!=null?L:null,T=this._importJoint(S,D,M,I);B&&(T.center=B),A.addJoint(T)})})}),e.scene.updateMatrixWorld(),A.setInitState(),A})}_importJoint(e,t,r,i){const s=new upe(e,t,r,i);if(this.jointHelperRoot){const o=new spe(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,t){const r=new MG(t),i=new Pw(r);if(e.add(i),this.colliderHelperRoot){const s=new NB(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importCapsuleCollider(e,t){const r=new BG(t),i=new Pw(r);if(e.add(i),this.colliderHelperRoot){const s=new NB(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importPlaneCollider(e,t){const r=new SG(t),i=new Pw(r);if(e.add(i),this.colliderHelperRoot){const s=new NB(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}};IG.EXTENSION_NAME="VRMC_springBone";var ppe=IG,mpe=class{get name(){return"VRMLoaderPlugin"}constructor(n,e){var t,r,i,s,o,a,l,c,A,u;this.parser=n;const f=e==null?void 0:e.helperRoot,h=e==null?void 0:e.autoUpdateHumanBones;this.expressionPlugin=(t=e==null?void 0:e.expressionPlugin)!=null?t:new Lhe(n),this.firstPersonPlugin=(r=e==null?void 0:e.firstPersonPlugin)!=null?r:new Nhe(n),this.humanoidPlugin=(i=e==null?void 0:e.humanoidPlugin)!=null?i:new Vhe(n,{helperRoot:f,autoUpdateHumanBones:h}),this.lookAtPlugin=(s=e==null?void 0:e.lookAtPlugin)!=null?s:new sde(n,{helperRoot:f}),this.metaPlugin=(o=e==null?void 0:e.metaPlugin)!=null?o:new lde(n),this.mtoonMaterialPlugin=(a=e==null?void 0:e.mtoonMaterialPlugin)!=null?a:new xde(n),this.materialsHDREmissiveMultiplierPlugin=(l=e==null?void 0:e.materialsHDREmissiveMultiplierPlugin)!=null?l:new Ede(n),this.materialsV0CompatPlugin=(c=e==null?void 0:e.materialsV0CompatPlugin)!=null?c:new Rde(n),this.springBonePlugin=(A=e==null?void 0:e.springBonePlugin)!=null?A:new ppe(n,{colliderHelperRoot:f,jointHelperRoot:f}),this.nodeConstraintPlugin=(u=e==null?void 0:e.nodeConstraintPlugin)!=null?u:new Jde(n,{helperRoot:f})}beforeRoot(){return py(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(n){return py(this,null,function*(){return yield this.mtoonMaterialPlugin.loadMesh(n)})}getMaterialType(n){const e=this.mtoonMaterialPlugin.getMaterialType(n);return e??null}extendMaterialParams(n,e){return py(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(n,e),yield this.mtoonMaterialPlugin.extendMaterialParams(n,e)})}afterRoot(n){return py(this,null,function*(){yield this.metaPlugin.afterRoot(n),yield this.humanoidPlugin.afterRoot(n),yield this.expressionPlugin.afterRoot(n),yield this.lookAtPlugin.afterRoot(n),yield this.firstPersonPlugin.afterRoot(n),yield this.springBonePlugin.afterRoot(n),yield this.nodeConstraintPlugin.afterRoot(n),yield this.mtoonMaterialPlugin.afterRoot(n);const e=n.userData.vrmMeta,t=n.userData.vrmHumanoid;if(e&&t){const r=new Ade({scene:n.scene,expressionManager:n.userData.vrmExpressionManager,firstPerson:n.userData.vrmFirstPerson,humanoid:t,lookAt:n.userData.vrmLookAt,meta:e,materials:n.userData.vrmMToonMaterials,springBoneManager:n.userData.vrmSpringBoneManager,nodeConstraintManager:n.userData.vrmNodeConstraintManager});n.userData.vrm=r}})}};function hO(n){if(Object.values(n).forEach(e=>{e!=null&&e.isTexture&&e.dispose()}),n.isShaderMaterial){const e=n.uniforms;e&&Object.values(e).forEach(t=>{const r=t.value;r!=null&&r.isTexture&&r.dispose()})}n.dispose()}function gpe(n){const e=n.geometry;e&&e.dispose();const t=n.skeleton;t&&t.dispose();const r=n.material;r&&(Array.isArray(r)?r.forEach(i=>hO(i)):r&&hO(r))}function vpe(n){n.traverse(gpe)}function ype(n,e){var t;const r=(t=e==null?void 0:e.experimentalSameBoneCounts)!=null?t:!1,i=[];n.traverse(a=>{a.type==="SkinnedMesh"&&i.push(a)});const s=new Map;let o=0;for(const a of i){const c=a.geometry.getAttribute("skinIndex"),A=[],u=[],f={},h=c.array;for(let d=0;d{var r,i,s,o;if(!t.isMesh)return;const a=t,l=a.geometry,c=l.index;if(c==null)return;const A=e.get(l);if(A!=null){a.geometry=A;return}const u=new Jt;u.name=l.name,u.morphTargetsRelative=l.morphTargetsRelative,l.groups.forEach(m=>{u.addGroup(m.start,m.count,m.materialIndex)}),u.boundingBox=(i=(r=l.boundingBox)==null?void 0:r.clone())!=null?i:null,u.boundingSphere=(o=(s=l.boundingSphere)==null?void 0:s.clone())!=null?o:null,u.setDrawRange(l.drawRange.start,l.drawRange.count),u.userData=l.userData,e.set(l,u);const f=[],h=[];{const m=c.array,g=new m.constructor(m.length);let p=0;for(let v=0;v{const g=l.attributes[m];if(g.isInterleavedBufferAttribute)throw new Error("removeUnnecessaryVertices: InterleavedBufferAttribute is not supported");const p=g.array,{itemSize:v,normalized:w}=g,_=new p.constructor(h.length*v);h.forEach((x,b)=>{for(let B=0;B{u.morphAttributes[m]=[];const g=l.morphAttributes[m];for(let p=0;p{for(let I=0;I<_;I++)b[M*_+I]=w[B*_+I]}),d=d&&b.every(B=>B===0),u.morphAttributes[m][p]=new ct(b,_,x)}}),d&&(u.morphAttributes={}),a.geometry=u}),Array.from(e.keys()).forEach(t=>{t.dispose()})}function _pe(n){var e;((e=n.meta)==null?void 0:e.metaVersion)==="0"&&(n.scene.rotation.y=Math.PI)}var E0=class{constructor(){}};E0.deepDispose=vpe;E0.removeUnnecessaryJoints=ype;E0.removeUnnecessaryVertices=wpe;E0.rotateVRM0=_pe;/*! +`;t.vertexShader=i+t.vertexShader,t.fragmentShader=i+t.fragmentShader,r<154&&(t.fragmentShader=t.fragmentShader.replace("#include ","#include "))}}get color(){return this.uniforms.litFactor.value}set color(n){this.uniforms.litFactor.value=n}get map(){return this.uniforms.map.value}set map(n){this.uniforms.map.value=n}get normalMap(){return this.uniforms.normalMap.value}set normalMap(n){this.uniforms.normalMap.value=n}get normalScale(){return this.uniforms.normalScale.value}set normalScale(n){this.uniforms.normalScale.value=n}get emissive(){return this.uniforms.emissive.value}set emissive(n){this.uniforms.emissive.value=n}get emissiveIntensity(){return this.uniforms.emissiveIntensity.value}set emissiveIntensity(n){this.uniforms.emissiveIntensity.value=n}get emissiveMap(){return this.uniforms.emissiveMap.value}set emissiveMap(n){this.uniforms.emissiveMap.value=n}get shadeColorFactor(){return this.uniforms.shadeColorFactor.value}set shadeColorFactor(n){this.uniforms.shadeColorFactor.value=n}get shadeMultiplyTexture(){return this.uniforms.shadeMultiplyTexture.value}set shadeMultiplyTexture(n){this.uniforms.shadeMultiplyTexture.value=n}get shadingShiftFactor(){return this.uniforms.shadingShiftFactor.value}set shadingShiftFactor(n){this.uniforms.shadingShiftFactor.value=n}get shadingShiftTexture(){return this.uniforms.shadingShiftTexture.value}set shadingShiftTexture(n){this.uniforms.shadingShiftTexture.value=n}get shadingShiftTextureScale(){return this.uniforms.shadingShiftTextureScale.value}set shadingShiftTextureScale(n){this.uniforms.shadingShiftTextureScale.value=n}get shadingToonyFactor(){return this.uniforms.shadingToonyFactor.value}set shadingToonyFactor(n){this.uniforms.shadingToonyFactor.value=n}get giEqualizationFactor(){return this.uniforms.giEqualizationFactor.value}set giEqualizationFactor(n){this.uniforms.giEqualizationFactor.value=n}get matcapFactor(){return this.uniforms.matcapFactor.value}set matcapFactor(n){this.uniforms.matcapFactor.value=n}get matcapTexture(){return this.uniforms.matcapTexture.value}set matcapTexture(n){this.uniforms.matcapTexture.value=n}get parametricRimColorFactor(){return this.uniforms.parametricRimColorFactor.value}set parametricRimColorFactor(n){this.uniforms.parametricRimColorFactor.value=n}get rimMultiplyTexture(){return this.uniforms.rimMultiplyTexture.value}set rimMultiplyTexture(n){this.uniforms.rimMultiplyTexture.value=n}get rimLightingMixFactor(){return this.uniforms.rimLightingMixFactor.value}set rimLightingMixFactor(n){this.uniforms.rimLightingMixFactor.value=n}get parametricRimFresnelPowerFactor(){return this.uniforms.parametricRimFresnelPowerFactor.value}set parametricRimFresnelPowerFactor(n){this.uniforms.parametricRimFresnelPowerFactor.value=n}get parametricRimLiftFactor(){return this.uniforms.parametricRimLiftFactor.value}set parametricRimLiftFactor(n){this.uniforms.parametricRimLiftFactor.value=n}get outlineWidthMultiplyTexture(){return this.uniforms.outlineWidthMultiplyTexture.value}set outlineWidthMultiplyTexture(n){this.uniforms.outlineWidthMultiplyTexture.value=n}get outlineWidthFactor(){return this.uniforms.outlineWidthFactor.value}set outlineWidthFactor(n){this.uniforms.outlineWidthFactor.value=n}get outlineColorFactor(){return this.uniforms.outlineColorFactor.value}set outlineColorFactor(n){this.uniforms.outlineColorFactor.value=n}get outlineLightingMixFactor(){return this.uniforms.outlineLightingMixFactor.value}set outlineLightingMixFactor(n){this.uniforms.outlineLightingMixFactor.value=n}get uvAnimationMaskTexture(){return this.uniforms.uvAnimationMaskTexture.value}set uvAnimationMaskTexture(n){this.uniforms.uvAnimationMaskTexture.value=n}get uvAnimationScrollXOffset(){return this.uniforms.uvAnimationScrollXOffset.value}set uvAnimationScrollXOffset(n){this.uniforms.uvAnimationScrollXOffset.value=n}get uvAnimationScrollYOffset(){return this.uniforms.uvAnimationScrollYOffset.value}set uvAnimationScrollYOffset(n){this.uniforms.uvAnimationScrollYOffset.value=n}get uvAnimationRotationPhase(){return this.uniforms.uvAnimationRotationPhase.value}set uvAnimationRotationPhase(n){this.uniforms.uvAnimationRotationPhase.value=n}get ignoreVertexColor(){return this._ignoreVertexColor}set ignoreVertexColor(n){this._ignoreVertexColor=n,this.needsUpdate=!0}get v0CompatShade(){return this._v0CompatShade}set v0CompatShade(n){this._v0CompatShade=n,this.needsUpdate=!0}get debugMode(){return this._debugMode}set debugMode(n){this._debugMode=n,this.needsUpdate=!0}get outlineWidthMode(){return this._outlineWidthMode}set outlineWidthMode(n){this._outlineWidthMode=n,this.needsUpdate=!0}get isOutline(){return this._isOutline}set isOutline(n){this._isOutline=n,this.needsUpdate=!0}get isMToonMaterial(){return!0}update(n){this._uploadUniformsWorkaround(),this._updateUVAnimation(n)}copy(n){return super.copy(n),this.map=n.map,this.normalMap=n.normalMap,this.emissiveMap=n.emissiveMap,this.shadeMultiplyTexture=n.shadeMultiplyTexture,this.shadingShiftTexture=n.shadingShiftTexture,this.matcapTexture=n.matcapTexture,this.rimMultiplyTexture=n.rimMultiplyTexture,this.outlineWidthMultiplyTexture=n.outlineWidthMultiplyTexture,this.uvAnimationMaskTexture=n.uvAnimationMaskTexture,this.normalMapType=n.normalMapType,this.uvAnimationScrollXSpeedFactor=n.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=n.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=n.uvAnimationRotationSpeedFactor,this.ignoreVertexColor=n.ignoreVertexColor,this.v0CompatShade=n.v0CompatShade,this.debugMode=n.debugMode,this.outlineWidthMode=n.outlineWidthMode,this.isOutline=n.isOutline,this.needsUpdate=!0,this}_updateUVAnimation(n){this.uniforms.uvAnimationScrollXOffset.value+=n*this.uvAnimationScrollXSpeedFactor,this.uniforms.uvAnimationScrollYOffset.value+=n*this.uvAnimationScrollYSpeedFactor,this.uniforms.uvAnimationRotationPhase.value+=n*this.uvAnimationRotationSpeedFactor,this.uniforms.alphaTest.value=this.alphaTest,this.uniformsNeedUpdate=!0}_uploadUniformsWorkaround(){this.uniforms.opacity.value=this.opacity,this._updateTextureMatrix(this.uniforms.map,this.uniforms.mapUvTransform),this._updateTextureMatrix(this.uniforms.normalMap,this.uniforms.normalMapUvTransform),this._updateTextureMatrix(this.uniforms.emissiveMap,this.uniforms.emissiveMapUvTransform),this._updateTextureMatrix(this.uniforms.shadeMultiplyTexture,this.uniforms.shadeMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.shadingShiftTexture,this.uniforms.shadingShiftTextureUvTransform),this._updateTextureMatrix(this.uniforms.matcapTexture,this.uniforms.matcapTextureUvTransform),this._updateTextureMatrix(this.uniforms.rimMultiplyTexture,this.uniforms.rimMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.outlineWidthMultiplyTexture,this.uniforms.outlineWidthMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.uvAnimationMaskTexture,this.uniforms.uvAnimationMaskTextureUvTransform),this.uniformsNeedUpdate=!0}_generateDefines(){const n=parseInt(nc,10),e=this.outlineWidthMultiplyTexture!==null,t=this.map!==null||this.normalMap!==null||this.emissiveMap!==null||this.shadeMultiplyTexture!==null||this.shadingShiftTexture!==null||this.rimMultiplyTexture!==null||this.uvAnimationMaskTexture!==null;return{THREE_VRM_THREE_REVISION:n,OUTLINE:this._isOutline,MTOON_USE_UV:e||t,MTOON_UVS_VERTEX_ONLY:e&&!t,V0_COMPAT_SHADE:this._v0CompatShade,USE_SHADEMULTIPLYTEXTURE:this.shadeMultiplyTexture!==null,USE_SHADINGSHIFTTEXTURE:this.shadingShiftTexture!==null,USE_MATCAPTEXTURE:this.matcapTexture!==null,USE_RIMMULTIPLYTEXTURE:this.rimMultiplyTexture!==null,USE_OUTLINEWIDTHMULTIPLYTEXTURE:this._isOutline&&this.outlineWidthMultiplyTexture!==null,USE_UVANIMATIONMASKTEXTURE:this.uvAnimationMaskTexture!==null,IGNORE_VERTEX_COLOR:this._ignoreVertexColor===!0,DEBUG_NORMAL:this._debugMode==="normal",DEBUG_LITSHADERATE:this._debugMode==="litShadeRate",DEBUG_UV:this._debugMode==="uv",OUTLINE_WIDTH_SCREEN:this._isOutline&&this._outlineWidthMode===rO.ScreenCoordinates}}_updateTextureMatrix(n,e){n.value&&(n.value.matrixAutoUpdate&&n.value.updateMatrix(),e.value.copy(n.value.matrix))}},yde=new Set(["1.0","1.0-beta"]),bG=class Pw{get name(){return Pw.EXTENSION_NAME}constructor(e,t={}){var r,i,s,o;this.parser=e,this.materialType=(r=t.materialType)!=null?r:xG,this.renderOrderOffset=(i=t.renderOrderOffset)!=null?i:0,this.v0CompatShade=(s=t.v0CompatShade)!=null?s:!1,this.debugMode=(o=t.debugMode)!=null?o:"none",this._mToonMaterialSet=new Set}beforeRoot(){return pu(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return pu(this,null,function*(){e.userData.vrmMToonMaterials=Array.from(this._mToonMaterialSet)})}getMaterialType(e){return this._getMToonExtension(e)?this.materialType:null}extendMaterialParams(e,t){const r=this._getMToonExtension(e);return r?this._extendMaterialParams(r,t):null}loadMesh(e){return pu(this,null,function*(){var t;const r=this.parser,s=(t=r.json.meshes)==null?void 0:t[e];if(s==null)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${e}] of glTF but the mesh doesn't exist`);const o=s.primitives,a=yield r.loadMesh(e);if(o.length===1){const l=a,c=o[0].material;c!=null&&this._setupPrimitive(l,c)}else{const l=a;for(let c=0;c{var o;this._getMToonExtension(s)&&((o=i.extensions)!=null&&o.KHR_materials_unlit)&&delete i.extensions.KHR_materials_unlit})}_getMToonExtension(e){var t,r;const o=(t=this.parser.json.materials)==null?void 0:t[e];if(o==null){console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[Pw.EXTENSION_NAME];if(a==null)return;const l=a.specVersion;if(!yde.has(l)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${Pw.EXTENSION_NAME} specVersion "${l}"`);return}return a}_extendMaterialParams(e,t){return pu(this,null,function*(){var r;delete t.metalness,delete t.roughness;const i=new dde(this.parser,t);i.assignPrimitive("transparentWithZWrite",e.transparentWithZWrite),i.assignColor("shadeColorFactor",e.shadeColorFactor),i.assignTexture("shadeMultiplyTexture",e.shadeMultiplyTexture,!0),i.assignPrimitive("shadingShiftFactor",e.shadingShiftFactor),i.assignTexture("shadingShiftTexture",e.shadingShiftTexture,!0),i.assignPrimitive("shadingShiftTextureScale",(r=e.shadingShiftTexture)==null?void 0:r.scale),i.assignPrimitive("shadingToonyFactor",e.shadingToonyFactor),i.assignPrimitive("giEqualizationFactor",e.giEqualizationFactor),i.assignColor("matcapFactor",e.matcapFactor),i.assignTexture("matcapTexture",e.matcapTexture,!0),i.assignColor("parametricRimColorFactor",e.parametricRimColorFactor),i.assignTexture("rimMultiplyTexture",e.rimMultiplyTexture,!0),i.assignPrimitive("rimLightingMixFactor",e.rimLightingMixFactor),i.assignPrimitive("parametricRimFresnelPowerFactor",e.parametricRimFresnelPowerFactor),i.assignPrimitive("parametricRimLiftFactor",e.parametricRimLiftFactor),i.assignPrimitive("outlineWidthMode",e.outlineWidthMode),i.assignPrimitive("outlineWidthFactor",e.outlineWidthFactor),i.assignTexture("outlineWidthMultiplyTexture",e.outlineWidthMultiplyTexture,!1),i.assignColor("outlineColorFactor",e.outlineColorFactor),i.assignPrimitive("outlineLightingMixFactor",e.outlineLightingMixFactor),i.assignTexture("uvAnimationMaskTexture",e.uvAnimationMaskTexture,!1),i.assignPrimitive("uvAnimationScrollXSpeedFactor",e.uvAnimationScrollXSpeedFactor),i.assignPrimitive("uvAnimationScrollYSpeedFactor",e.uvAnimationScrollYSpeedFactor),i.assignPrimitive("uvAnimationRotationSpeedFactor",e.uvAnimationRotationSpeedFactor),i.assignPrimitive("v0CompatShade",this.v0CompatShade),i.assignPrimitive("debugMode",this.debugMode),yield i.pending})}_setupPrimitive(e,t){const r=this._getMToonExtension(t);if(r){const i=this._parseRenderOrder(r);e.renderOrder=i+this.renderOrderOffset,this._generateOutline(e),this._addToMaterialSet(e);return}}_shouldGenerateOutline(e){return typeof e.outlineWidthMode=="string"&&e.outlineWidthMode!=="none"&&typeof e.outlineWidthFactor=="number"&&e.outlineWidthFactor>0}_generateOutline(e){const t=e.material;if(!(t instanceof as)||!this._shouldGenerateOutline(t))return;e.material=[t];const r=t.clone();r.name+=" (Outline)",r.isOutline=!0,r.side=oi,e.material.push(r);const i=e.geometry,s=i.index?i.index.count:i.attributes.position.count/3;i.addGroup(0,s,0),i.addGroup(0,s,1)}_addToMaterialSet(e){const t=e.material,r=new Set;Array.isArray(t)?t.forEach(i=>r.add(i)):r.add(t);for(const i of r)this._mToonMaterialSet.add(i)}_parseRenderOrder(e){var t;return(e.transparentWithZWrite?0:19)+((t=e.renderQueueOffsetNumber)!=null?t:0)}};bG.EXTENSION_NAME="VRMC_materials_mtoon";var wde=bG,_de=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),EG=class aT{get name(){return aT.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,t){return _de(this,null,function*(){const r=this._getHDREmissiveMultiplierExtension(e);if(r==null)return;console.warn("VRMMaterialsHDREmissiveMultiplierLoaderPlugin: `VRMC_materials_hdr_emissiveMultiplier` is archived. Use `KHR_materials_emissive_strength` instead.");const i=r.emissiveMultiplier;t.emissiveIntensity=i})}_getHDREmissiveMultiplierExtension(e){var t,r;const o=(t=this.parser.json.materials)==null?void 0:t[e];if(o==null){console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[aT.EXTENSION_NAME];if(a!=null)return a}};EG.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var xde=EG,bde=Object.defineProperty,Ede=Object.defineProperties,Bde=Object.getOwnPropertyDescriptors,iO=Object.getOwnPropertySymbols,Mde=Object.prototype.hasOwnProperty,Sde=Object.prototype.propertyIsEnumerable,sO=(n,e,t)=>e in n?bde(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,wa=(n,e)=>{for(var t in e||(e={}))Mde.call(e,t)&&sO(n,t,e[t]);if(iO)for(var t of iO(e))Sde.call(e,t)&&sO(n,t,e[t]);return n},oO=(n,e)=>Ede(n,Bde(e)),Cde=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())});function Pf(n){return Math.pow(n,2.2)}var Tde=class{get name(){return"VRMMaterialsV0CompatPlugin"}constructor(n){var e;this.parser=n,this._renderQueueMapTransparent=new Map,this._renderQueueMapTransparentZWrite=new Map;const t=this.parser.json;t.extensionsUsed=(e=t.extensionsUsed)!=null?e:[],t.extensionsUsed.indexOf("KHR_texture_transform")===-1&&t.extensionsUsed.push("KHR_texture_transform")}beforeRoot(){return Cde(this,null,function*(){var n;const e=this.parser.json,t=(n=e.extensions)==null?void 0:n.VRM,r=t==null?void 0:t.materialProperties;r&&(this._populateRenderQueueMap(r),r.forEach((i,s)=>{var o,a;const l=(o=e.materials)==null?void 0:o[s];if(l==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${s}] of glTF but the material doesn't exist`);return}if(i.shader==="VRM/MToon"){const c=this._parseV0MToonProperties(i,l);e.materials[s]=c}else if((a=i.shader)!=null&&a.startsWith("VRM/Unlit")){const c=this._parseV0UnlitProperties(i,l);e.materials[s]=c}else i.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${i.shader}`)}))})}_parseV0MToonProperties(n,e){var t,r,i,s,o,a,l,c,A,u,f,h,d,m,g,p,v,w,_,x,b,B,S,I,M,L,D,T,y,E,R,F,O,z,j,Q,C,W,ee,P,re,ue,le,me,ie,ge,_e,se,H,fe,Ae,J,q,he,X;const G=(r=(t=n.keywordMap)==null?void 0:t._ALPHABLEND_ON)!=null?r:!1,Y=((i=n.floatProperties)==null?void 0:i._ZWrite)===1&&G,de=this._v0ParseRenderQueue(n),ae=(o=(s=n.keywordMap)==null?void 0:s._ALPHATEST_ON)!=null?o:!1,Ee=G?"BLEND":ae?"MASK":"OPAQUE",V=ae?(l=(a=n.floatProperties)==null?void 0:a._Cutoff)!=null?l:.5:void 0,N=((A=(c=n.floatProperties)==null?void 0:c._CullMode)!=null?A:2)===0,K=this._portTextureTransform(n),oe=((f=(u=n.vectorProperties)==null?void 0:u._Color)!=null?f:[1,1,1,1]).map((ke,Xe)=>Xe===3?ke:Pf(ke)),pe=(h=n.textureProperties)==null?void 0:h._MainTex,ve=pe!=null?{index:pe,extensions:wa({},K)}:void 0,Ce=(m=(d=n.floatProperties)==null?void 0:d._BumpScale)!=null?m:1,Le=(g=n.textureProperties)==null?void 0:g._BumpMap,Re=Le!=null?{index:Le,scale:Ce,extensions:wa({},K)}:void 0,$e=((v=(p=n.vectorProperties)==null?void 0:p._EmissionColor)!=null?v:[0,0,0,1]).map(Pf),ce=(w=n.textureProperties)==null?void 0:w._EmissionMap,Pe=ce!=null?{index:ce,extensions:wa({},K)}:void 0,Se=((x=(_=n.vectorProperties)==null?void 0:_._ShadeColor)!=null?x:[.97,.81,.86,1]).map(Pf),Te=(b=n.textureProperties)==null?void 0:b._ShadeTexture,Fe=Te!=null?{index:Te,extensions:wa({},K)}:void 0;let De=(S=(B=n.floatProperties)==null?void 0:B._ShadeShift)!=null?S:0,Ze=(M=(I=n.floatProperties)==null?void 0:I._ShadeToony)!=null?M:.9;Ze=Bt.lerp(Ze,1,.5+.5*De),De=-De-(1-Ze);const At=(D=(L=n.floatProperties)==null?void 0:L._IndirectLightIntensity)!=null?D:.1,Pn=At?1-At:void 0,rt=(T=n.textureProperties)==null?void 0:T._SphereAdd,xt=rt!=null?[1,1,1]:void 0,Tr=rt!=null?{index:rt}:void 0,tn=(E=(y=n.floatProperties)==null?void 0:y._RimLightingMix)!=null?E:0,qt=(R=n.textureProperties)==null?void 0:R._RimTexture,Jr=qt!=null?{index:qt,extensions:wa({},K)}:void 0,en=((O=(F=n.vectorProperties)==null?void 0:F._RimColor)!=null?O:[0,0,0,1]).map(Pf),nn=(j=(z=n.floatProperties)==null?void 0:z._RimFresnelPower)!=null?j:1,Ks=(C=(Q=n.floatProperties)==null?void 0:Q._RimLift)!=null?C:0,Xt=["none","worldCoordinates","screenCoordinates"][(ee=(W=n.floatProperties)==null?void 0:W._OutlineWidthMode)!=null?ee:0];let Yt=(re=(P=n.floatProperties)==null?void 0:P._OutlineWidth)!=null?re:0;Yt=.01*Yt;const Ii=(ue=n.textureProperties)==null?void 0:ue._OutlineWidthTexture,rn=Ii!=null?{index:Ii,extensions:wa({},K)}:void 0,sn=((me=(le=n.vectorProperties)==null?void 0:le._OutlineColor)!=null?me:[0,0,0]).map(Pf),un=((ge=(ie=n.floatProperties)==null?void 0:ie._OutlineColorMode)!=null?ge:0)===1?(se=(_e=n.floatProperties)==null?void 0:_e._OutlineLightingMix)!=null?se:1:0,on=(H=n.textureProperties)==null?void 0:H._UvAnimMaskTexture,te=on!=null?{index:on,extensions:wa({},K)}:void 0,ye=(Ae=(fe=n.floatProperties)==null?void 0:fe._UvAnimScrollX)!=null?Ae:0;let Be=(q=(J=n.floatProperties)==null?void 0:J._UvAnimScrollY)!=null?q:0;Be!=null&&(Be=-Be);const Me=(X=(he=n.floatProperties)==null?void 0:he._UvAnimRotation)!=null?X:0,we={specVersion:"1.0",transparentWithZWrite:Y,renderQueueOffsetNumber:de,shadeColorFactor:Se,shadeMultiplyTexture:Fe,shadingShiftFactor:De,shadingToonyFactor:Ze,giEqualizationFactor:Pn,matcapFactor:xt,matcapTexture:Tr,rimLightingMixFactor:tn,rimMultiplyTexture:Jr,parametricRimColorFactor:en,parametricRimFresnelPowerFactor:nn,parametricRimLiftFactor:Ks,outlineWidthMode:Xt,outlineWidthFactor:Yt,outlineWidthMultiplyTexture:rn,outlineColorFactor:sn,outlineLightingMixFactor:un,uvAnimationMaskTexture:te,uvAnimationScrollXSpeedFactor:ye,uvAnimationScrollYSpeedFactor:Be,uvAnimationRotationSpeedFactor:Me};return oO(wa({},e),{pbrMetallicRoughness:{baseColorFactor:oe,baseColorTexture:ve},normalTexture:Re,emissiveTexture:Pe,emissiveFactor:$e,alphaMode:Ee,alphaCutoff:V,doubleSided:N,extensions:{VRMC_materials_mtoon:we}})}_parseV0UnlitProperties(n,e){var t,r,i,s,o;const a=n.shader==="VRM/UnlitTransparentZWrite",l=n.shader==="VRM/UnlitTransparent"||a,c=this._v0ParseRenderQueue(n),A=n.shader==="VRM/UnlitCutout",u=l?"BLEND":A?"MASK":"OPAQUE",f=A?(r=(t=n.floatProperties)==null?void 0:t._Cutoff)!=null?r:.5:void 0,h=this._portTextureTransform(n),d=((s=(i=n.vectorProperties)==null?void 0:i._Color)!=null?s:[1,1,1,1]).map(Pf),m=(o=n.textureProperties)==null?void 0:o._MainTex,g=m!=null?{index:m,extensions:wa({},h)}:void 0,p={specVersion:"1.0",transparentWithZWrite:a,renderQueueOffsetNumber:c,shadeColorFactor:d,shadeMultiplyTexture:g};return oO(wa({},e),{pbrMetallicRoughness:{baseColorFactor:d,baseColorTexture:g},alphaMode:u,alphaCutoff:f,extensions:{VRMC_materials_mtoon:p}})}_portTextureTransform(n){var e,t,r,i,s;const o=(e=n.vectorProperties)==null?void 0:e._MainTex;if(o==null)return{};const a=[(t=o==null?void 0:o[0])!=null?t:0,(r=o==null?void 0:o[1])!=null?r:0],l=[(i=o==null?void 0:o[2])!=null?i:1,(s=o==null?void 0:o[3])!=null?s:1];return a[1]=1-l[1]-a[1],{KHR_texture_transform:{offset:a,scale:l}}}_v0ParseRenderQueue(n){var e,t;const r=n.shader==="VRM/UnlitTransparentZWrite",i=((e=n.keywordMap)==null?void 0:e._ALPHABLEND_ON)!=null||n.shader==="VRM/UnlitTransparent"||r,s=((t=n.floatProperties)==null?void 0:t._ZWrite)===1||r;let o=0;if(i){const a=n.renderQueue;a!=null&&(s?o=this._renderQueueMapTransparentZWrite.get(a):o=this._renderQueueMapTransparent.get(a))}return o}_populateRenderQueueMap(n){const e=new Set,t=new Set;n.forEach(r=>{var i,s;const o=r.shader==="VRM/UnlitTransparentZWrite",a=((i=r.keywordMap)==null?void 0:i._ALPHABLEND_ON)!=null||r.shader==="VRM/UnlitTransparent"||o,l=((s=r.floatProperties)==null?void 0:s._ZWrite)===1||o;if(a){const c=r.renderQueue;c!=null&&(l?t.add(c):e.add(c))}}),e.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${e.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),t.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${t.size} render queues for TransparentZWrite materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),Array.from(e).sort().forEach((r,i)=>{const s=Math.min(Math.max(i-e.size+1,-9),0);this._renderQueueMapTransparent.set(r,s)}),Array.from(t).sort().forEach((r,i)=>{const s=Math.min(Math.max(i,0),9);this._renderQueueMapTransparentZWrite.set(r,s)})}},aO=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),Cc=new $,DB=class extends ri{constructor(n){super(),this._attrPosition=new ct(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(Lq);const e=new Jt;e.setAttribute("position",this._attrPosition);const t=new Ac({color:16711935,depthTest:!1,depthWrite:!1});this._line=new Yd(e,t),this.add(this._line),this.constraint=n}updateMatrixWorld(n){Cc.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,Cc.x,Cc.y,Cc.z),this.constraint.source&&Cc.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,Cc.x,Cc.y,Cc.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(n)}};function lO(n,e){return e.set(n.elements[12],n.elements[13],n.elements[14])}var Ide=new $,Rde=new $;function Ude(n,e){return n.decompose(Ide,e,Rde),e}function J_(n){return n.invert?n.invert():n.inverse(),n}var l2=class{constructor(n,e){this.destination=n,this.source=e,this.weight=1}},Fde=new $,Pde=new $,Lde=new $,Dde=new nt,Nde=new nt,Ode=new nt,kde=class extends l2{get aimAxis(){return this._aimAxis}set aimAxis(n){this._aimAxis=n,this._v3AimAxis.set(n==="PositiveX"?1:n==="NegativeX"?-1:0,n==="PositiveY"?1:n==="NegativeY"?-1:0,n==="PositiveZ"?1:n==="NegativeZ"?-1:0)}get dependencies(){const n=new Set([this.source]);return this.destination.parent&&n.add(this.destination.parent),n}constructor(n,e){super(n,e),this._aimAxis="PositiveX",this._v3AimAxis=new $(1,0,0),this._dstRestQuat=new nt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);const n=Dde.identity(),e=Nde.identity();this.destination.parent&&(Ude(this.destination.parent.matrixWorld,n),J_(e.copy(n)));const t=Fde.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(n),r=lO(this.source.matrixWorld,Pde).sub(lO(this.destination.matrixWorld,Lde)).normalize(),i=Ode.setFromUnitVectors(t,r).premultiply(e).multiply(n).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}};function Qde(n,e){const t=[n];let r=n.parent;for(;r!==null;)t.unshift(r),r=r.parent;t.forEach(i=>{e(i)})}var Hde=class{constructor(){this._constraints=new Set,this._objectConstraintsMap=new Map}get constraints(){return this._constraints}addConstraint(n){this._constraints.add(n);let e=this._objectConstraintsMap.get(n.destination);e==null&&(e=new Set,this._objectConstraintsMap.set(n.destination,e)),e.add(n)}deleteConstraint(n){this._constraints.delete(n),this._objectConstraintsMap.get(n.destination).delete(n)}setInitState(){const n=new Set,e=new Set;for(const t of this._constraints)this._processConstraint(t,n,e,r=>r.setInitState())}update(){const n=new Set,e=new Set;for(const t of this._constraints)this._processConstraint(t,n,e,r=>r.update())}_processConstraint(n,e,t,r){if(t.has(n))return;if(e.has(n))throw new Error("VRMNodeConstraintManager: Circular dependency detected while updating constraints");e.add(n);const i=n.dependencies;for(const s of i)Qde(s,o=>{const a=this._objectConstraintsMap.get(o);if(a)for(const l of a)this._processConstraint(l,e,t,r)});r(n),t.add(n)}},zde=new nt,Gde=new nt,Vde=class extends l2{get dependencies(){return new Set([this.source])}constructor(n,e){super(n,e),this._dstRestQuat=new nt,this._invSrcRestQuat=new nt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),J_(this._invSrcRestQuat.copy(this.source.quaternion))}update(){const n=zde.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=Gde.copy(this._dstRestQuat).multiply(n);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},jde=new $,Wde=new nt,Kde=new nt,Xde=class extends l2{get rollAxis(){return this._rollAxis}set rollAxis(n){this._rollAxis=n,this._v3RollAxis.set(n==="X"?1:0,n==="Y"?1:0,n==="Z"?1:0)}get dependencies(){return new Set([this.source])}constructor(n,e){super(n,e),this._rollAxis="X",this._v3RollAxis=new $(1,0,0),this._dstRestQuat=new nt,this._invDstRestQuat=new nt,this._invSrcRestQuatMulDstRestQuat=new nt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),J_(this._invDstRestQuat.copy(this._dstRestQuat)),J_(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){const n=Wde.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=jde.copy(this._v3RollAxis).applyQuaternion(n),r=Kde.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(n);this.destination.quaternion.copy(this._dstRestQuat).slerp(r,this.weight)}},Yde=new Set(["1.0","1.0-beta"]),BG=class Rm{get name(){return Rm.EXTENSION_NAME}constructor(e,t){this.parser=e,this.helperRoot=t==null?void 0:t.helperRoot}afterRoot(e){return aO(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return aO(this,null,function*(){var t;const r=this.parser.json;if(!(((t=r.extensionsUsed)==null?void 0:t.indexOf(Rm.EXTENSION_NAME))!==-1))return null;const s=new Hde,o=yield this.parser.getDependencies("node");return o.forEach((a,l)=>{var c;const A=r.nodes[l],u=(c=A==null?void 0:A.extensions)==null?void 0:c[Rm.EXTENSION_NAME];if(u==null)return;const f=u.specVersion;if(!Yde.has(f)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${Rm.EXTENSION_NAME} specVersion "${f}"`);return}const h=u.constraint;if(h.roll!=null){const d=this._importRollConstraint(a,o,h.roll);s.addConstraint(d)}else if(h.aim!=null){const d=this._importAimConstraint(a,o,h.aim);s.addConstraint(d)}else if(h.rotation!=null){const d=this._importRotationConstraint(a,o,h.rotation);s.addConstraint(d)}}),e.scene.updateMatrixWorld(),s.setInitState(),s})}_importRollConstraint(e,t,r){const{source:i,rollAxis:s,weight:o}=r,a=t[i],l=new Xde(e,a);if(s!=null&&(l.rollAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new DB(l);this.helperRoot.add(c)}return l}_importAimConstraint(e,t,r){const{source:i,aimAxis:s,weight:o}=r,a=t[i],l=new kde(e,a);if(s!=null&&(l.aimAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new DB(l);this.helperRoot.add(c)}return l}_importRotationConstraint(e,t,r){const{source:i,weight:s}=r,o=t[i],a=new Vde(e,o);if(s!=null&&(a.weight=s),this.helperRoot){const l=new DB(a);this.helperRoot.add(l)}return a}};BG.EXTENSION_NAME="VRMC_node_constraint";var $de=BG,yy=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),c2=class{},NB=new $,YA=new $,MG=class extends c2{get type(){return"capsule"}constructor(n){var e,t,r,i;super(),this.offset=(e=n==null?void 0:n.offset)!=null?e:new $(0,0,0),this.tail=(t=n==null?void 0:n.tail)!=null?t:new $(0,0,0),this.radius=(r=n==null?void 0:n.radius)!=null?r:0,this.inside=(i=n==null?void 0:n.inside)!=null?i:!1}calculateCollision(n,e,t,r){NB.copy(this.offset).applyMatrix4(n),YA.copy(this.tail).applyMatrix4(n),YA.sub(NB);const i=YA.lengthSq();r.copy(e).sub(NB);const s=YA.dot(r);s<=0||(i<=s||YA.multiplyScalar(s/i),r.sub(YA));const o=this.inside?this.radius-t-r.length():r.length()-t-this.radius;return r.normalize(),this.inside&&r.negate(),o}},OB=new $,cO=new dt,SG=class extends c2{get type(){return"plane"}constructor(n){var e,t;super(),this.offset=(e=n==null?void 0:n.offset)!=null?e:new $(0,0,0),this.normal=(t=n==null?void 0:n.normal)!=null?t:new $(0,0,1)}calculateCollision(n,e,t,r){r.copy(this.offset).applyMatrix4(n),r.negate().add(e),cO.getNormalMatrix(n),OB.copy(this.normal).applyNormalMatrix(cO).normalize();const i=r.dot(OB)-t;return r.copy(OB),i}},CG=class extends c2{get type(){return"sphere"}constructor(n){var e,t,r;super(),this.offset=(e=n==null?void 0:n.offset)!=null?e:new $(0,0,0),this.radius=(t=n==null?void 0:n.radius)!=null?t:0,this.inside=(r=n==null?void 0:n.inside)!=null?r:!1}calculateCollision(n,e,t,r){r.copy(this.offset).applyMatrix4(n),r.negate().add(e);const i=this.inside?this.radius-t-r.length():r.length()-t-this.radius;return r.normalize(),this.inside&&r.negate(),i}},_a=new $,Zde=class extends Jt{constructor(n){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new $,this._currentTail=new $,this._shape=n,this._attrPos=new ct(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new ct(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,n=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),n=!0);const t=_a.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(t)>1e-10&&(this._currentTail.copy(t),n=!0),n&&this._buildPosition()}_buildPosition(){_a.copy(this._currentTail).sub(this._currentOffset);const n=_a.length()/this._currentRadius;for(let r=0;r<=16;r++){const i=r/16*Math.PI;this._attrPos.setXYZ(r,-Math.sin(i),-Math.cos(i),0),this._attrPos.setXYZ(17+r,n+Math.sin(i),Math.cos(i),0),this._attrPos.setXYZ(34+r,-Math.sin(i),0,-Math.cos(i)),this._attrPos.setXYZ(51+r,n+Math.sin(i),0,Math.cos(i))}for(let r=0;r<32;r++){const i=r/16*Math.PI;this._attrPos.setXYZ(68+r,0,Math.sin(i),Math.cos(i)),this._attrPos.setXYZ(100+r,n,Math.sin(i),Math.cos(i))}const e=Math.atan2(_a.y,Math.sqrt(_a.x*_a.x+_a.z*_a.z)),t=-Math.atan2(_a.z,_a.x);this.rotateZ(e),this.rotateY(t),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<34;n++){const e=(n+1)%34;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(68+n*2,34+n,34+e)}for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(136+n*2,68+n,68+e),this._attrIndex.setXY(200+n*2,100+n,100+e)}this._attrIndex.needsUpdate=!0}},Jde=class extends Jt{constructor(n){super(),this.worldScale=1,this._currentOffset=new $,this._currentNormal=new $,this._shape=n,this._attrPos=new ct(new Float32Array(6*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new ct(new Uint16Array(10),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),n=!0),this._currentNormal.equals(this._shape.normal)||(this._currentNormal.copy(this._shape.normal),n=!0),n&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,-.5,-.5,0),this._attrPos.setXYZ(1,.5,-.5,0),this._attrPos.setXYZ(2,.5,.5,0),this._attrPos.setXYZ(3,-.5,.5,0),this._attrPos.setXYZ(4,0,0,0),this._attrPos.setXYZ(5,0,0,.25),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this.lookAt(this._currentNormal),this._attrPos.needsUpdate=!0}_buildIndex(){this._attrIndex.setXY(0,0,1),this._attrIndex.setXY(2,1,2),this._attrIndex.setXY(4,2,3),this._attrIndex.setXY(6,3,0),this._attrIndex.setXY(8,4,5),this._attrIndex.needsUpdate=!0}},qde=class extends Jt{constructor(n){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new $,this._shape=n,this._attrPos=new ct(new Float32Array(32*3*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new ct(new Uint16Array(64*3),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,n=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),n=!0),n&&this._buildPosition()}_buildPosition(){for(let n=0;n<32;n++){const e=n/16*Math.PI;this._attrPos.setXYZ(n,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+n,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+n,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(64+n*2,32+n,32+e),this._attrIndex.setXY(128+n*2,64+n,64+e)}this._attrIndex.needsUpdate=!0}},epe=new $,kB=class extends ri{constructor(n){if(super(),this.matrixAutoUpdate=!1,this.collider=n,this.collider.shape instanceof CG)this._geometry=new qde(this.collider.shape);else if(this.collider.shape instanceof MG)this._geometry=new Zde(this.collider.shape);else if(this.collider.shape instanceof SG)this._geometry=new Jde(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const e=new Ac({color:16711935,depthTest:!1,depthWrite:!1});this._line=new w0(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(n){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=epe.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(n)}},tpe=class extends Jt{constructor(n){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new $,this._springBone=n,this._attrPos=new ct(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new ct(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;const e=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,n=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),n=!0),n&&this._buildPosition()}_buildPosition(){for(let n=0;n<32;n++){const e=n/16*Math.PI;this._attrPos.setXYZ(n,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+n,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+n,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(64+n*2,32+n,32+e),this._attrIndex.setXY(128+n*2,64+n,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},npe=new $,rpe=class extends ri{constructor(n){super(),this.matrixAutoUpdate=!1,this.springBone=n,this._geometry=new tpe(this.springBone);const e=new Ac({color:16776960,depthTest:!1,depthWrite:!1});this._line=new w0(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(n){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=npe.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(n)}},Lw=class extends Lt{constructor(n){super(),this.shape=n}},ipe=new He;function TG(n){return n.invert?n.invert():n.getInverse(ipe.copy(n)),n}var spe=class{constructor(n){this._inverseCache=new He,this._shouldUpdateInverse=!0,this.matrix=n;const e={set:(t,r,i)=>(this._shouldUpdateInverse=!0,t[r]=i,!0)};this._originalElements=n.elements,n.elements=new Proxy(n.elements,e)}get inverse(){return this._shouldUpdateInverse&&(TG(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},ope=new He,wl=new $,Kp=new $,ape=new $,Lf=new $,AO=new $,Xp=new $,uO=new nt,Df=new He,lpe=new He,cpe=class{constructor(n,e,t={},r=[]){this._currentTail=new $,this._prevTail=new $,this._boneAxis=new $,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new He,this._initialLocalRotation=new nt,this._initialLocalChildPosition=new $;var i,s,o,a,l,c;this.bone=n,this.bone.matrixAutoUpdate=!1,this.child=e,this.settings={hitRadius:(i=t.hitRadius)!=null?i:0,stiffness:(s=t.stiffness)!=null?s:1,gravityPower:(o=t.gravityPower)!=null?o:0,gravityDir:(l=(a=t.gravityDir)==null?void 0:a.clone())!=null?l:new $(0,-1,0),dragForce:(c=t.dragForce)!=null?c:.4},this.colliderGroups=r}get center(){return this._center}set center(n){var e;(e=this._center)!=null&&e.userData.inverseCacheProxy&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=n,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new spe(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:ope}setInitState(){this._initialLocalMatrix.copy(this.bone.matrix),this._initialLocalRotation.copy(this.bone.quaternion),this.child?this._initialLocalChildPosition.copy(this.child.position):this._initialLocalChildPosition.copy(this.bone.position).normalize().multiplyScalar(.07);const n=this._getMatrixWorldToCenter(Df);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(n),this._prevTail.copy(this._currentTail),this._boneAxis.copy(this._initialLocalChildPosition).normalize()}reset(){this.bone.quaternion.copy(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix);const n=this._getMatrixWorldToCenter(Df);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(n),this._prevTail.copy(this._currentTail)}update(n){if(n<=0)return;this._calcWorldSpaceBoneLength(),Lf.setFromMatrixPosition(this.bone.matrixWorld);let e=this._getMatrixWorldToCenter(Df);AO.copy(Lf).applyMatrix4(e);const t=uO.setFromRotationMatrix(e),r=lpe.copy(e).multiply(this._parentMatrixWorld),i=Kp.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(r).sub(AO).normalize(),s=ape.copy(this.settings.gravityDir).applyQuaternion(t).normalize(),o=this._getMatrixCenterToWorld(Df);Xp.copy(this._currentTail).add(wl.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.settings.dragForce)).add(wl.copy(i).multiplyScalar(this.settings.stiffness*n)).add(wl.copy(s).multiplyScalar(this.settings.gravityPower*n)).applyMatrix4(o),Xp.sub(Lf).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Lf),this._collision(Xp),e=this._getMatrixWorldToCenter(Df),this._prevTail.copy(this._currentTail),this._currentTail.copy(wl.copy(Xp).applyMatrix4(e));const a=TG(Df.copy(this._parentMatrixWorld).multiply(this._initialLocalMatrix)),l=uO.setFromUnitVectors(this._boneAxis,wl.copy(Xp).applyMatrix4(a).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(l),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix)}_collision(n){this.colliderGroups.forEach(e=>{e.colliders.forEach(t=>{const r=t.shape.calculateCollision(t.matrixWorld,n,this.settings.hitRadius,wl);r<0&&(n.add(wl.multiplyScalar(-r)),n.sub(Lf).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Lf))})})}_calcWorldSpaceBoneLength(){wl.setFromMatrixPosition(this.bone.matrixWorld),this.child?Kp.setFromMatrixPosition(this.child.matrixWorld):(Kp.copy(this._initialLocalChildPosition),Kp.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=wl.sub(Kp).length()}_getMatrixCenterToWorld(n){return this._center?n.copy(this._center.matrixWorld):n.identity(),n}_getMatrixWorldToCenter(n){return this._center?n.copy(this._center.userData.inverseCacheProxy.inverse):n.identity(),n}};function Ape(n,e){const t=[];let r=n;for(;r!==null;)t.unshift(r),r=r.parent;t.forEach(i=>{e(i)})}function IG(n,e){n.children.forEach(t=>{e(t)||IG(t,e)})}var fO=class{constructor(){this._joints=new Set,this._hasWarnedCircularDependency=!1,this._objectSpringBonesMap=new Map}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){const n=new Set;return this._joints.forEach(e=>{e.colliderGroups.forEach(t=>{n.add(t)})}),Array.from(n)}get colliders(){const n=new Set;return this.colliderGroups.forEach(e=>{e.colliders.forEach(t=>{n.add(t)})}),Array.from(n)}addJoint(n){this._joints.add(n);let e=this._objectSpringBonesMap.get(n.bone);e==null&&(e=new Set,this._objectSpringBonesMap.set(n.bone,e)),e.add(n)}addSpringBone(n){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(n)}deleteJoint(n){this._joints.delete(n),this._objectSpringBonesMap.get(n.bone).delete(n)}deleteSpringBone(n){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(n)}setInitState(){const n=new Set,e=new Set,t=new Set;for(const r of this._joints)this._processSpringBone(r,n,e,t,i=>i.setInitState())}reset(){const n=new Set,e=new Set,t=new Set;for(const r of this._joints)this._processSpringBone(r,n,e,t,i=>i.reset())}update(n){const e=new Set,t=new Set,r=new Set;for(const i of this._joints)this._processSpringBone(i,e,t,r,s=>s.update(n)),IG(i.bone,s=>{var o,a;return((a=(o=this._objectSpringBonesMap.get(s))==null?void 0:o.size)!=null?a:0)>0?!0:(s.updateWorldMatrix(!1,!1),!1)})}_processSpringBone(n,e,t,r,i){if(t.has(n))return;if(e.has(n)){this._hasWarnedCircularDependency||(console.warn("VRMSpringBoneManager: Circular dependency detected while updating springbones"),this._hasWarnedCircularDependency=!0);return}e.add(n);const s=this._getDependencies(n);for(const o of s)Ape(o,a=>{const l=this._objectSpringBonesMap.get(a);if(l)for(const c of l)this._processSpringBone(c,e,t,r,i);else r.has(a)||(a.updateWorldMatrix(!1,!1),r.add(a))});n.bone.updateMatrix(),n.bone.updateWorldMatrix(!1,!1),i(n),r.add(n.bone),t.add(n)}_getDependencies(n){const e=new Set,t=n.bone.parent;return t&&e.add(t),n.colliderGroups.forEach(r=>{r.colliders.forEach(i=>{e.add(i)})}),e}},hO="VRMC_springBone_extended_collider",upe=new Set(["1.0","1.0-beta"]),fpe=new Set(["1.0"]),RG=class Zf{get name(){return Zf.EXTENSION_NAME}constructor(e,t){var r;this.parser=e,this.jointHelperRoot=t==null?void 0:t.jointHelperRoot,this.colliderHelperRoot=t==null?void 0:t.colliderHelperRoot,this.useExtendedColliders=(r=t==null?void 0:t.useExtendedColliders)!=null?r:!0}afterRoot(e){return yy(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return yy(this,null,function*(){const t=yield this._v1Import(e);if(t!=null)return t;const r=yield this._v0Import(e);return r??null})}_v1Import(e){return yy(this,null,function*(){var t,r,i,s,o;const a=e.parser.json;if(!(((t=a.extensionsUsed)==null?void 0:t.indexOf(Zf.EXTENSION_NAME))!==-1))return null;const c=new fO,A=yield e.parser.getDependencies("node"),u=(r=a.extensions)==null?void 0:r[Zf.EXTENSION_NAME];if(!u)return null;const f=u.specVersion;if(!upe.has(f))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Zf.EXTENSION_NAME} specVersion "${f}"`),null;const h=(i=u.colliders)==null?void 0:i.map((m,g)=>{var p,v,w,_,x,b,B,S,I,M,L,D,T,y,E;const R=A[m.node],F=m.shape,O=(p=m.extensions)==null?void 0:p[hO];if(this.useExtendedColliders&&O!=null){const z=O.specVersion;if(!fpe.has(z))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${hO} specVersion "${z}". Fallbacking to the ${Zf.EXTENSION_NAME} definition`);else{const j=O.shape;if(j.sphere)return this._importSphereCollider(R,{offset:new $().fromArray((v=j.sphere.offset)!=null?v:[0,0,0]),radius:(w=j.sphere.radius)!=null?w:0,inside:(_=j.sphere.inside)!=null?_:!1});if(j.capsule)return this._importCapsuleCollider(R,{offset:new $().fromArray((x=j.capsule.offset)!=null?x:[0,0,0]),radius:(b=j.capsule.radius)!=null?b:0,tail:new $().fromArray((B=j.capsule.tail)!=null?B:[0,0,0]),inside:(S=j.capsule.inside)!=null?S:!1});if(j.plane)return this._importPlaneCollider(R,{offset:new $().fromArray((I=j.plane.offset)!=null?I:[0,0,0]),normal:new $().fromArray((M=j.plane.normal)!=null?M:[0,0,1])})}}if(F.sphere)return this._importSphereCollider(R,{offset:new $().fromArray((L=F.sphere.offset)!=null?L:[0,0,0]),radius:(D=F.sphere.radius)!=null?D:0,inside:!1});if(F.capsule)return this._importCapsuleCollider(R,{offset:new $().fromArray((T=F.capsule.offset)!=null?T:[0,0,0]),radius:(y=F.capsule.radius)!=null?y:0,tail:new $().fromArray((E=F.capsule.tail)!=null?E:[0,0,0]),inside:!1});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${g} has no valid shape`)}),d=(s=u.colliderGroups)==null?void 0:s.map((m,g)=>{var p;return{colliders:((p=m.colliders)!=null?p:[]).map(w=>{const _=h==null?void 0:h[w];if(_==null)throw new Error(`VRMSpringBoneLoaderPlugin: The colliderGroup #${g} attempted to use a collider #${w} but not found`);return _}),name:m.name}});return(o=u.springs)==null||o.forEach((m,g)=>{var p;const v=m.joints,w=(p=m.colliderGroups)==null?void 0:p.map(b=>{const B=d==null?void 0:d[b];if(B==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${g} attempted to use a colliderGroup ${b} but not found`);return B}),_=m.center!=null?A[m.center]:void 0;let x;v.forEach(b=>{if(x){const B=x.node,S=A[B],I=b.node,M=A[I],L={hitRadius:x.hitRadius,dragForce:x.dragForce,gravityPower:x.gravityPower,stiffness:x.stiffness,gravityDir:x.gravityDir!=null?new $().fromArray(x.gravityDir):void 0},D=this._importJoint(S,M,L,w);_&&(D.center=_),c.addJoint(D)}x=b})}),c.setInitState(),c})}_v0Import(e){return yy(this,null,function*(){var t,r,i;const s=e.parser.json;if(!(((t=s.extensionsUsed)==null?void 0:t.indexOf("VRM"))!==-1))return null;const a=(r=s.extensions)==null?void 0:r.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const c=l==null?void 0:l.boneGroups;if(!c)return null;const A=new fO,u=yield e.parser.getDependencies("node"),f=(i=l.colliderGroups)==null?void 0:i.map(h=>{var d;const m=u[h.node];return{colliders:((d=h.colliders)!=null?d:[]).map((p,v)=>{var w,_,x;const b=new $(0,0,0);return p.offset&&b.set((w=p.offset.x)!=null?w:0,(_=p.offset.y)!=null?_:0,p.offset.z?-p.offset.z:0),this._importSphereCollider(m,{offset:b,radius:(x=p.radius)!=null?x:0,inside:!1})})}});return c==null||c.forEach((h,d)=>{const m=h.bones;m&&m.forEach(g=>{var p,v,w,_;const x=u[g],b=new $;h.gravityDir?b.set((p=h.gravityDir.x)!=null?p:0,(v=h.gravityDir.y)!=null?v:0,(w=h.gravityDir.z)!=null?w:0):b.set(0,-1,0);const B=h.center!=null?u[h.center]:void 0,S={hitRadius:h.hitRadius,dragForce:h.dragForce,gravityPower:h.gravityPower,stiffness:h.stiffiness,gravityDir:b},I=(_=h.colliderGroups)==null?void 0:_.map(M=>{const L=f==null?void 0:f[M];if(L==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${d} attempted to use a colliderGroup ${M} but not found`);return L});x.traverse(M=>{var L;const D=(L=M.children[0])!=null?L:null,T=this._importJoint(M,D,S,I);B&&(T.center=B),A.addJoint(T)})})}),e.scene.updateMatrixWorld(),A.setInitState(),A})}_importJoint(e,t,r,i){const s=new cpe(e,t,r,i);if(this.jointHelperRoot){const o=new rpe(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,t){const r=new CG(t),i=new Lw(r);if(e.add(i),this.colliderHelperRoot){const s=new kB(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importCapsuleCollider(e,t){const r=new MG(t),i=new Lw(r);if(e.add(i),this.colliderHelperRoot){const s=new kB(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importPlaneCollider(e,t){const r=new SG(t),i=new Lw(r);if(e.add(i),this.colliderHelperRoot){const s=new kB(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}};RG.EXTENSION_NAME="VRMC_springBone";var hpe=RG,dpe=class{get name(){return"VRMLoaderPlugin"}constructor(n,e){var t,r,i,s,o,a,l,c,A,u;this.parser=n;const f=e==null?void 0:e.helperRoot,h=e==null?void 0:e.autoUpdateHumanBones;this.expressionPlugin=(t=e==null?void 0:e.expressionPlugin)!=null?t:new Fhe(n),this.firstPersonPlugin=(r=e==null?void 0:e.firstPersonPlugin)!=null?r:new Lhe(n),this.humanoidPlugin=(i=e==null?void 0:e.humanoidPlugin)!=null?i:new zhe(n,{helperRoot:f,autoUpdateHumanBones:h}),this.lookAtPlugin=(s=e==null?void 0:e.lookAtPlugin)!=null?s:new rde(n,{helperRoot:f}),this.metaPlugin=(o=e==null?void 0:e.metaPlugin)!=null?o:new ode(n),this.mtoonMaterialPlugin=(a=e==null?void 0:e.mtoonMaterialPlugin)!=null?a:new wde(n),this.materialsHDREmissiveMultiplierPlugin=(l=e==null?void 0:e.materialsHDREmissiveMultiplierPlugin)!=null?l:new xde(n),this.materialsV0CompatPlugin=(c=e==null?void 0:e.materialsV0CompatPlugin)!=null?c:new Tde(n),this.springBonePlugin=(A=e==null?void 0:e.springBonePlugin)!=null?A:new hpe(n,{colliderHelperRoot:f,jointHelperRoot:f}),this.nodeConstraintPlugin=(u=e==null?void 0:e.nodeConstraintPlugin)!=null?u:new $de(n,{helperRoot:f})}beforeRoot(){return my(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(n){return my(this,null,function*(){return yield this.mtoonMaterialPlugin.loadMesh(n)})}getMaterialType(n){const e=this.mtoonMaterialPlugin.getMaterialType(n);return e??null}extendMaterialParams(n,e){return my(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(n,e),yield this.mtoonMaterialPlugin.extendMaterialParams(n,e)})}afterRoot(n){return my(this,null,function*(){yield this.metaPlugin.afterRoot(n),yield this.humanoidPlugin.afterRoot(n),yield this.expressionPlugin.afterRoot(n),yield this.lookAtPlugin.afterRoot(n),yield this.firstPersonPlugin.afterRoot(n),yield this.springBonePlugin.afterRoot(n),yield this.nodeConstraintPlugin.afterRoot(n),yield this.mtoonMaterialPlugin.afterRoot(n);const e=n.userData.vrmMeta,t=n.userData.vrmHumanoid;if(e&&t){const r=new lde({scene:n.scene,expressionManager:n.userData.vrmExpressionManager,firstPerson:n.userData.vrmFirstPerson,humanoid:t,lookAt:n.userData.vrmLookAt,meta:e,materials:n.userData.vrmMToonMaterials,springBoneManager:n.userData.vrmSpringBoneManager,nodeConstraintManager:n.userData.vrmNodeConstraintManager});n.userData.vrm=r}})}};function dO(n){if(Object.values(n).forEach(e=>{e!=null&&e.isTexture&&e.dispose()}),n.isShaderMaterial){const e=n.uniforms;e&&Object.values(e).forEach(t=>{const r=t.value;r!=null&&r.isTexture&&r.dispose()})}n.dispose()}function ppe(n){const e=n.geometry;e&&e.dispose();const t=n.skeleton;t&&t.dispose();const r=n.material;r&&(Array.isArray(r)?r.forEach(i=>dO(i)):r&&dO(r))}function mpe(n){n.traverse(ppe)}function gpe(n,e){var t;const r=(t=e==null?void 0:e.experimentalSameBoneCounts)!=null?t:!1,i=[];n.traverse(a=>{a.type==="SkinnedMesh"&&i.push(a)});const s=new Map;let o=0;for(const a of i){const c=a.geometry.getAttribute("skinIndex"),A=[],u=[],f={},h=c.array;for(let d=0;d{var r,i,s,o;if(!t.isMesh)return;const a=t,l=a.geometry,c=l.index;if(c==null)return;const A=e.get(l);if(A!=null){a.geometry=A;return}const u=new Jt;u.name=l.name,u.morphTargetsRelative=l.morphTargetsRelative,l.groups.forEach(m=>{u.addGroup(m.start,m.count,m.materialIndex)}),u.boundingBox=(i=(r=l.boundingBox)==null?void 0:r.clone())!=null?i:null,u.boundingSphere=(o=(s=l.boundingSphere)==null?void 0:s.clone())!=null?o:null,u.setDrawRange(l.drawRange.start,l.drawRange.count),u.userData=l.userData,e.set(l,u);const f=[],h=[];{const m=c.array,g=new m.constructor(m.length);let p=0;for(let v=0;v{const g=l.attributes[m];if(g.isInterleavedBufferAttribute)throw new Error("removeUnnecessaryVertices: InterleavedBufferAttribute is not supported");const p=g.array,{itemSize:v,normalized:w}=g,_=new p.constructor(h.length*v);h.forEach((x,b)=>{for(let B=0;B{u.morphAttributes[m]=[];const g=l.morphAttributes[m];for(let p=0;p{for(let I=0;I<_;I++)b[S*_+I]=w[B*_+I]}),d=d&&b.every(B=>B===0),u.morphAttributes[m][p]=new ct(b,_,x)}}),d&&(u.morphAttributes={}),a.geometry=u}),Array.from(e.keys()).forEach(t=>{t.dispose()})}function ype(n){var e;((e=n.meta)==null?void 0:e.metaVersion)==="0"&&(n.scene.rotation.y=Math.PI)}var B0=class{constructor(){}};B0.deepDispose=mpe;B0.removeUnnecessaryJoints=gpe;B0.removeUnnecessaryVertices=vpe;B0.rotateVRM0=ype;/*! * @pixiv/three-vrm-core v3.1.4 * The implementation of core features of VRM, for @pixiv/three-vrm * @@ -4913,7 +4913,7 @@ void main() { * Copyright (c) 2019-2024 pixiv Inc. * @pixiv/three-vrm-springbone is distributed under MIT License * https://github.com/pixiv/three-vrm/blob/release/LICENSE - */var yr;(function(n){n[n.ARRAY_BUFFER=34962]="ARRAY_BUFFER",n[n.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.LINEAR=9729]="LINEAR",n[n.REPEAT=10497]="REPEAT"})(yr||(yr={}));const J_="blend_",dO="vrmColliderSphere";class xpe{parse(e,t,r,i){const s=e.humanoid,o=e.meta,a=e.materials,l={},c={},A={},u=e.lookAt,f={generator:"UniGLTF-2.0.0",version:"2.0"};if(t)if(s)if(o)if(a){if(!u)throw new Error("lookAt is undefined or null")}else throw new Error("materials is undefined or null");else throw new Error("meta is undefined or null");else throw new Error("humanoid is undefined or null");else throw new Error("avatar is undefined or null");const h=a.filter((ie,ge,_e)=>_e.findIndex(se=>se.name===ie.name.replace(" (Outline)",""))===ge).map(ie=>ie),d=h.map(ie=>ie.name),m=r?{name:"icon",imageBitmap:r.image}:null,g=h.filter(ie=>ie.map).map(ie=>{if(!ie.map)throw new Error(ie.name+" map is null");return{name:ie.name,imageBitmap:ie.map.image}}),p=h.filter(ie=>ie.userData.shadeTexture).map(ie=>{if(!ie.userData.shadeTexture)throw new Error(ie.userData.shadeTexture+" map is null");return{name:ie.name+"_shade",imageBitmap:ie.userData.shadeTexture.image}}),v=g.concat(p),w=Mpe(v,m),_=Cpe(w),x=Tpe(w),b=Spe(h,v),B=t.children.filter(ie=>ie.children.length>0&&ie.children[0].type===Li.Bone)[0],M=RG(B).filter(ie=>ie.name!==dO),I=M.map(ie=>ie.name),S=M.map(ie=>({children:ie.children.filter(ge=>ge.name!==dO).map(ge=>I.indexOf(ge.name)),name:ie.name,rotation:[ie.quaternion.x,ie.quaternion.y,ie.quaternion.z,ie.quaternion.w],scale:[ie.scale.x,ie.scale.y,ie.scale.z],translation:[ie.position.x,ie.position.y,ie.position.z]})),L=[],D=t.children.filter(ie=>ie.type===Li.Group||ie.type===Li.SkinnedMesh),T=[];D.forEach(ie=>{const ge=ie.type===Li.Group?ie.children[0]:ie,_e=ge.geometry.attributes;T.push(new _l(_e.position,yr.FLOAT,cn.POSITION,Vo.VEC3,ge.name,void 0)),T.push(new _l(_e.normal,yr.FLOAT,cn.NORMAL,Vo.VEC3,ge.name,void 0)),T.push(new _l(_e.uv,yr.FLOAT,cn.UV,Vo.VEC2,ge.name,void 0)),T.push(new _l(_e.skinWeight,yr.FLOAT,cn.SKIN_WEIGHT,Vo.VEC4,ge.name,void 0)),T.push(new _l(_e.skinIndex,yr.UNSIGNED_SHORT,cn.SKIN_INDEX,Vo.VEC4,ge.name,void 0)),(ie.type===Li.Group?ie.children.map(Q=>Q):[ie]).forEach(Q=>{if(!Q.geometry.index)throw new Error(Q.name+" geometry.index is null");T.push(new _l(Q.geometry.index,yr.UNSIGNED_INT,cn.INDEX,Vo.SCALAR,ge.name,Q.name))}),ge.morphTargetDictionary||(ge.morphTargetDictionary={},ge.morphTargetInfluences=[],ge.geometry.morphAttributes={},ge.updateMorphTargets()),ge.geometry.userData.targetNames=[];for(const Q in e.expressionManager.expressionMap){const fe=e.expressionManager.expressionMap[Q],Ae=fe._binds.map(q=>({node:M.length,index:q.index,weight:q.weight}));let Z=!1;for(const q in ni)if(Q.toLowerCase()===ni[q].toLowerCase()){l[ni[q]]={morphTargetBinds:Ae,isBinary:fe.isBinary,overrideBlink:fe.overrideBlink,overrideLookAt:fe.overrideLookAt,overrideMouth:fe.overrideMouth},Z=!0;break}!Z&&Q.toLowerCase()==="surprise"&&(l.surprised={morphTargetBinds:Ae,isBinary:fe.isBinary,overrideBlink:fe.overrideBlink,overrideLookAt:fe.overrideLookAt,overrideMouth:fe.overrideMouth},Z=!0),Z===!1&&(c[Q]={morphTargetBinds:Ae,isBinary:fe.isBinary,overrideBlink:fe.overrideBlink,overrideLookAt:fe.overrideLookAt,overrideMouth:fe.overrideMouth})}for(const Q in ge.morphTargetDictionary){ge.geometry.userData.targetNames.push(Q);const fe=ge.morphTargetDictionary[Q],Ae=ge.geometry.morphAttributes;T.push(new _l(Ae.position[fe],yr.FLOAT,cn.BLEND_POSITION,Vo.VEC3,ge.name,J_+Q)),T.push(new _l(Ae.normal[fe],yr.FLOAT,cn.BLEND_NORMAL,Vo.VEC3,ge.name,J_+Q))}}),Object.keys(l).length>0&&(A.preset=l),Object.keys(c).length>0&&(A.custom=c),D.forEach(ie=>{const ge=ie.type===Li.Group?ie.children[0]:ie,_e=new Float32Array(ge.skeleton.boneInverses.map(se=>se.elements).flat());T.push(new _l(new ct(_e,16),yr.FLOAT,cn.BIND_MATRIX,Vo.MAT4,ge.name,ge.name))}),L.push(...T.map(ie=>({bufferView:-1,byteOffset:0,componentType:ie.valueType,count:ie.attribute.count,max:ie.max,min:ie.min,normalized:!1,type:ie.accessorsType})));const y=Epe(D,T,d);D.forEach((ie,ge)=>{S.push({mesh:ge,name:ie.name,rotation:[ie.quaternion.x,ie.quaternion.y,ie.quaternion.z,ie.quaternion.w],scale:[ie.scale.x,ie.scale.y,ie.scale.z],skin:ge,translation:[ie.position.x,ie.position.y,ie.position.z]})});const E=Bpe(D,T,I),R={offsetFromHeadBone:[0,0,0],rangeMapHorizontalInner:{inputMaxValue:u.applier.rangeMapHorizontalInner.inputMaxValue,outputScale:u.applier.rangeMapHorizontalInner.outputScale},rangeMapHorizontalOuter:{inputMaxValue:u.applier.rangeMapHorizontalOuter.inputMaxValue,outputScale:u.applier.rangeMapHorizontalOuter.outputScale},rangeMapVerticalDown:{inputMaxValue:u.applier.rangeMapVerticalDown.inputMaxValue,outputScale:u.applier.rangeMapVerticalDown.outputScale},rangeMapVerticalUp:{inputMaxValue:u.applier.rangeMapVerticalUp.inputMaxValue,outputScale:u.applier.rangeMapVerticalUp.outputScale},type:"bone"},F={humanBones:{}};for(const ie in s.humanBones)F.humanBones[ie]={node:I.indexOf(s.humanBones[ie].node.name)};const O=o,z=[];z.push(...v.map(ie=>({buffer:pO(ie.imageBitmap),type:cn.IMAGE}))),z.push(...T.map(ie=>({buffer:ie.buffer,type:ie.type}))),m&&z.push({buffer:pO(m.imageBitmap),type:cn.IMAGE});let j=0,H=0,C=0;const W=z.map((ie,ge)=>{const _e={buffer:0,byteLength:ie.buffer.byteLength,byteOffset:j,target:ie.type===cn.IMAGE||ie.type===cn.BIND_MATRIX?void 0:ie.type===cn.INDEX?yr.ELEMENT_ARRAY_BUFFER:yr.ARRAY_BUFFER};return j+=ie.buffer.byteLength,ie.type===cn.IMAGE?w[H++].bufferView=ge:L[C++].bufferView=ge,_e}),ee=Ipe(t,S),P={accessors:L,asset:f,buffers:[{byteLength:j}],bufferViews:W,extensions:{VRMC_vrm:{expressions:A,humanoid:F,lookAt:R,meta:O,specVersion:"1.0"}},extensionsUsed:["KHR_materials_unlit","KHR_texture_transform","VRMC_materials_mtoon","VRMC_vrm"],images:w,materials:b,meshes:y,nodes:S,samplers:_,avatar:0,scenes:ee,skins:E,textures:x},re=new mO(aT(JSON.stringify(P,void 0,2)),"JSON"),ue=new mO(Rm(z.map(ie=>ie.buffer)),"BIN\0"),le=Rm([re.buffer,ue.buffer]),me=Rm([aT("glTF"),oT(2,4),oT(le.byteLength+12,4)]);i(Rm([me,le]))}}function RG(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>RG(e)).flat())}function pO(n){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0);const t=e.toDataURL("image/png"),r=atob(t.split(",")[1]),i=new ArrayBuffer(r.length),s=new DataView(i);for(let o=0;o4?c=r[a*n.itemSize+l]:l===0?c=n.getX(a):l===1?c=n.getY(a):l===2?c=n.getZ(a):c=n.getW(a),e===yr.UNSIGNED_SHORT?o.setUint16(i,c,!0):e===yr.UNSIGNED_INT?o.setUint32(i,c,!0):o.setFloat32(i,c,!0),i+=t}return s}let mO=class{constructor(e,t){this.data=e,this.type=t;const r=this.data;this.buffer=Rm([oT(r.byteLength,4),aT(this.type),r])}paddingBinary(e,t){const r=Math.ceil(e.byteLength/4)*4;if(e.byteLength===r)return e;const i=new Uint8Array(r);i.set(new Uint8Array(e),0);for(let s=e.byteLength;sl%3===0)),Math.max.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===1)),Math.max.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===2))]:void 0,this.min=r===cn.POSITION||r===cn.BLEND_POSITION?[Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===0)),Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===1)),Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===2))]:void 0}};var Hh;(function(n){n.MeshBasicMaterial="MeshBasicMaterial",n.MeshStandardMaterial="MeshStandardMaterial",n.MToonMaterial="MToonMaterial"})(Hh||(Hh={}));var Vo;(function(n){n.SCALAR="SCALAR",n.VEC2="VEC2",n.VEC3="VEC3",n.VEC4="VEC4",n.MAT4="MAT4"})(Vo||(Vo={}));var cn;(function(n){n.POSITION="POSITION",n.NORMAL="NORMAL",n.UV="UV",n.INDEX="INDEX",n.SKIN_WEIGHT="SKIN_WEIGHT",n.SKIN_INDEX="SKIN_INDEX",n.BLEND_POSITION="BLEND_POSITION",n.BLEND_NORMAL="BLEND_NORMAL",n.BIND_MATRIX="BIND_MATRIX",n.IMAGE="IMAGE"})(cn||(cn={}));var Li;(function(n){n.Group="Group",n.SkinnedMesh="SkinnedMesh",n.Object3D="Object3D",n.Bone="Bone"})(Li||(Li={}));const Epe=(n,e,t)=>n.map(r=>{const i=r.type===Li.Group?r.children[0]:r,s=r.type===Li.Group?r.children.map(o=>o):[r];return{name:r.name,primitives:s.map(o=>{const a=e.map(c=>c.meshName===i.name?c.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(cn.SKIN_INDEX),NORMAL:a.indexOf(cn.NORMAL),POSITION:a.indexOf(cn.POSITION),TEXCOORD_0:a.indexOf(cn.UV),WEIGHTS_0:a.indexOf(cn.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(c=>c.type===cn.INDEX&&c.meshName===i.name?c.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(c=>({NORMAL:e.map(A=>A.type===cn.BLEND_NORMAL&&A.meshName===i.name?A.name:null).indexOf(J_+c),POSITION:e.map(A=>A.type===cn.BLEND_POSITION&&A.meshName===i.name?A.name:null).indexOf(J_+c)})):void 0}})}}),Bpe=(n,e,t)=>n.map(r=>{const i=r.type===Li.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===cn.BIND_MATRIX?s.meshName:null).indexOf(i.name),joints:i.skeleton.bones.map(s=>t.indexOf(s.name)),skeleton:t.indexOf(i.skeleton.bones[0].name)}}),Spe=(n,e)=>n.map(t=>{let r,i=null;if(t=t.userData.vrmMaterial?t.userData.vrmMaterial:t,t.type==="ShaderMaterial")i=t.userData.gltfExtensions.VRMC_materials_mtoon,i.shadeMultiplyTexture={index:e.map(A=>A.name).indexOf(t.uniforms.shadeMultiplyTexture.name)},r=t.color?[1,1,1,1]:void 0;else{const c=t;r=c.color?[c.color.r,c.color.g,c.color.b,1]:void 0}let s=-1;t.map?s=e.map(c=>c.name).indexOf(t.name):t.uniforms&&t.uniforms.map&&(s=e.map(c=>c.name).indexOf(t.uniforms.map.name));const o=s>=0?{extensions:{KHR_texture_transform:{offset:[0,0],scale:[1,1]}},index:s,texCoord:0}:void 0,a=(()=>{switch(t.type){case Hh.MeshStandardMaterial:return t.metalness;case Hh.MeshBasicMaterial:return 0;default:return 0}})(),l=(()=>{switch(t.type){case Hh.MeshStandardMaterial:return t.roughness;case Hh.MeshBasicMaterial:return .9;default:return .9}})();return{alphaCutoff:t.alphaTest>0?t.alphaTest:void 0,alphaMode:t.transparent?"BLEND":t.alphaTest>0?"MASK":"OPAQUE",doubleSided:t.side===2,extensions:t.type==="ShaderMaterial"?{KHR_materials_unlit:{},VRMC_materials_mtoon:i}:void 0,name:t.name,pbrMetallicRoughness:{baseColorFactor:r,baseColorTexture:o,metallicFactor:a,roughnessFactor:l}}}),Mpe=(n,e)=>(e?n.concat(e):n).filter(t=>t&&t.imageBitmap).map(t=>({bufferView:-1,mimeType:"image/png",name:t.name})),Cpe=n=>n.map(()=>({magFilter:yr.LINEAR,minFilter:yr.LINEAR,wrapS:yr.REPEAT,wrapT:yr.REPEAT})),Tpe=n=>n.map((e,t)=>({sampler:0,source:t})),Ipe=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===Li.Object3D||r.type===Li.SkinnedMesh||r.type===Li.Group||r.type===Li.Bone).map(r=>t.indexOf(r.name))}]},UG=0,Rpe=1,FG=2,gO=2,OB=1.25,vO=1,sg=6*4+4+4,I1=65535,Upe=Math.pow(2,-24),kB=Symbol("SKIP_GENERATION");function Fpe(n){return n.index?n.index.count:n.attributes.position.count}function Jd(n){return Fpe(n)/3}function Ppe(n,e=ArrayBuffer){return n>65535?new Uint32Array(new e(4*n)):new Uint16Array(new e(2*n))}function Lpe(n,e){if(!n.index){const t=n.attributes.position.count,r=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=Ppe(t,r);n.setIndex(new ct(i,1));for(let s=0;sl-c);for(let l=0;lo.offset-a.offset),i=r[r.length-1];i.count=Math.min(t-i.offset,i.count);let s=0;return r.forEach(({count:o})=>s+=o),t!==s}function HB(n,e,t,r,i){let s=1/0,o=1/0,a=1/0,l=-1/0,c=-1/0,A=-1/0,u=1/0,f=1/0,h=1/0,d=-1/0,m=-1/0,g=-1/0;for(let p=e*6,v=(e+t)*6;pl&&(l=b),wd&&(d=w);const B=n[p+2],M=n[p+3],I=B-M,S=B+M;Ic&&(c=S),Bm&&(m=B);const L=n[p+4],D=n[p+5],T=L-D,y=L+D;TA&&(A=y),Lg&&(g=L)}r[0]=s,r[1]=o,r[2]=a,r[3]=l,r[4]=c,r[5]=A,i[0]=u,i[1]=f,i[2]=h,i[3]=d,i[4]=m,i[5]=g}function Npe(n,e=null,t=null,r=null){const i=n.attributes.position,s=n.index?n.index.array:null,o=Jd(n),a=i.normalized;let l;e===null?(l=new Float32Array(o*6),t=0,r=o):(l=e,t=t||0,r=r||o);const c=i.array,A=i.offset||0;let u=3;i.isInterleavedBufferAttribute&&(u=i.data.stride);const f=["getX","getY","getZ"];for(let h=t;hM&&(M=x),b>M&&(M=b);const I=(M-B)/2,S=w*2;l[m+S+0]=B+I,l[m+S+1]=I+(Math.abs(B)+I)*Upe}}return l}function er(n,e,t){return t.min.x=e[n],t.min.y=e[n+1],t.min.z=e[n+2],t.max.x=e[n+3],t.max.y=e[n+4],t.max.z=e[n+5],t}function yO(n){let e=-1,t=-1/0;for(let r=0;r<3;r++){const i=n[r+3]-n[r];i>t&&(t=i,e=r)}return e}function wO(n,e){e.set(n)}function _O(n,e,t){let r,i;for(let s=0;s<3;s++){const o=s+3;r=n[s],i=e[s],t[s]=ri?r:i}}function yy(n,e,t){for(let r=0;r<3;r++){const i=e[n+2*r],s=e[n+2*r+1],o=i-s,a=i+s;ot[r+3]&&(t[r+3]=a)}}function Xp(n){const e=n[3]-n[0],t=n[4]-n[1],r=n[5]-n[2];return 2*(e*t+t*r+r*e)}const Sl=32,Ope=(n,e)=>n.candidate-e.candidate,Tc=new Array(Sl).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),wy=new Float32Array(6);function kpe(n,e,t,r,i,s){let o=-1,a=0;if(s===UG)o=yO(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(s===Rpe)o=yO(n),o!==-1&&(a=Hpe(t,r,i,o));else if(s===FG){const l=Xp(n);let c=OB*i;const A=r*6,u=(r+i)*6;for(let f=0;f<3;f++){const h=e[f],g=(e[f+3]-h)/Sl;if(i=B.candidate?yy(_,t,B.rightCacheBounds):(yy(_,t,B.leftCacheBounds),B.count++)}}for(let _=0;_=Sl&&(b=Sl-1);const B=Tc[b];B.count++,yy(w,t,B.bounds)}const p=Tc[Sl-1];wO(p.bounds,p.rightCacheBounds);for(let w=Sl-2;w>=0;w--){const _=Tc[w],x=Tc[w+1];_O(_.bounds,x.rightCacheBounds,_.rightCacheBounds)}let v=0;for(let w=0;w=l;)a--;if(o=l;)a--;if(oGpe)throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return Um[t+6]=c/4,c=cT(c,a),Um[t+7]=l,c}}function jpe(n,e){const t=(n.index?n.index.count:n.attributes.position.count)/3,r=t>2**16,i=r?4:2,s=e?new SharedArrayBuffer(t*i):new ArrayBuffer(t*i),o=r?new Uint32Array(s):new Uint16Array(s);for(let a=0,l=o.length;a=s&&(p=!0,o&&(console.warn(`MeshBVH: Max depth of ${s} reached when generating BVH. Consider increasing maxDepth.`),console.warn(f))),B<=a||I>=s)return w(b+B),x.offset=b,x.count=B,x;const S=kpe(x.boundingData,M,e,b,B,l);if(S.axis===-1)return w(b+B),x.offset=b,x.count=B,x;const L=d(u,h,e,b,B,S);if(L===b||L===b+B)w(b+B),x.offset=b,x.count=B;else{x.splitAxis=S.axis;const D=new QB,T=b,y=L-b;x.left=D,HB(e,T,y,D.boundingData,g),_(D,T,y,g,I+1);const E=new QB,R=L,F=B-y;x.right=E,HB(e,R,F,E.boundingData,g),_(E,R,F,g,I+1)}return x}}function Kpe(n,e){const t=n.geometry;e.indirect&&(n._indirectBuffer=jpe(t,e.useSharedArrayBuffer),Dpe(t,e.range)&&!e.verbose&&console.warn('MeshBVH: Provided geometry contains groups or a range that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),n._indirectBuffer||Lpe(t,e);const r=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=Npe(t),s=e.indirect?PG(t,e.range):LG(t,e.range);n._roots=s.map(o=>{const a=Wpe(n,i,o.offset,o.count,e),l=lT(a),c=new r(sg*l);return Vpe(0,a,c),c})}class sc{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let r=1/0,i=-1/0;for(let s=0,o=e.length;si?l:i}this.min=r,this.max=i}setFromPoints(e,t){let r=1/0,i=-1/0;for(let s=0,o=t.length;si?l:i}this.min=r,this.max=i}isSeparated(e){return this.min>e.max||e.min>this.max}}sc.prototype.setFromBox=function(){const n=new $;return function(t,r){const i=r.min,s=r.max;let o=1/0,a=-1/0;for(let l=0;l<=1;l++)for(let c=0;c<=1;c++)for(let A=0;A<=1;A++){n.x=i.x*l+s.x*(1-l),n.y=i.y*c+s.y*(1-c),n.z=i.z*A+s.z*(1-A);const u=t.dot(n);o=Math.min(u,o),a=Math.max(u,a)}this.min=o,this.max=a}}();const Xpe=function(){const n=new $,e=new $,t=new $;return function(i,s,o){const a=i.start,l=n,c=s.start,A=e;t.subVectors(a,c),n.subVectors(i.end,i.start),e.subVectors(s.end,s.start);const u=t.dot(A),f=A.dot(l),h=A.dot(A),d=t.dot(l),g=l.dot(l)*h-f*f;let p,v;g!==0?p=(u*f-d*h)/g:p=0,v=(u+p*f)/h,o.x=p,o.y=v}}(),c2=function(){const n=new je,e=new $,t=new $;return function(i,s,o,a){Xpe(i,s,n);let l=n.x,c=n.y;if(l>=0&&l<=1&&c>=0&&c<=1){i.at(l,o),s.at(c,a);return}else if(l>=0&&l<=1){c<0?s.at(0,a):s.at(1,a),i.closestPointToPoint(a,!0,o);return}else if(c>=0&&c<=1){l<0?i.at(0,o):i.at(1,o),s.closestPointToPoint(o,!0,a);return}else{let A;l<0?A=i.start:A=i.end;let u;c<0?u=s.start:u=s.end;const f=e,h=t;if(i.closestPointToPoint(u,!0,e),s.closestPointToPoint(A,!0,t),f.distanceToSquared(u)<=h.distanceToSquared(A)){o.copy(f),a.copy(u);return}else{o.copy(A),a.copy(h);return}}}}(),Ype=function(){const n=new $,e=new $,t=new Ta,r=new Wl;return function(s,o){const{radius:a,center:l}=s,{a:c,b:A,c:u}=o;if(r.start=c,r.end=A,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a||(r.start=c,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a)||(r.start=A,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a))return!0;const m=o.getPlane(t);if(Math.abs(m.distanceToPoint(l))<=a){const p=m.projectPoint(l,e);if(o.containsPoint(p))return!0}return!1}}(),$pe=1e-15;function zB(n){return Math.abs(n)<$pe}class la extends Wr{constructor(...e){super(...e),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new $),this.satBounds=new Array(4).fill().map(()=>new sc),this.points=[this.a,this.b,this.c],this.sphere=new Si,this.plane=new Ta,this.needsUpdate=!0}intersectsSphere(e){return Ype(e,this)}update(){const e=this.a,t=this.b,r=this.c,i=this.points,s=this.satAxes,o=this.satBounds,a=s[0],l=o[0];this.getNormal(a),l.setFromPoints(a,i);const c=s[1],A=o[1];c.subVectors(e,t),A.setFromPoints(c,i);const u=s[2],f=o[2];u.subVectors(t,r),f.setFromPoints(u,i);const h=s[3],d=o[3];h.subVectors(r,e),d.setFromPoints(h,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}}la.prototype.closestPointToSegment=function(){const n=new $,e=new $,t=new Wl;return function(i,s=null,o=null){const{start:a,end:l}=i,c=this.points;let A,u=1/0;for(let f=0;f<3;f++){const h=(f+1)%3;t.start.copy(c[f]),t.end.copy(c[h]),c2(t,i,n,e),A=n.distanceToSquared(e),A=2){(_===1?p.start:p.end).copy(h),w=2;break}if(w++,w===2&&_===-1)break}}return w}return function(g,p=null,v=!1){this.needsUpdate&&this.update(),g.isExtendedTriangle?g.needsUpdate&&g.update():(n.copy(g),n.update(),g=n);const w=this.plane,_=g.plane;if(Math.abs(w.normal.dot(_.normal))>1-1e-10){const x=this.satBounds,b=this.satAxes;t[0]=g.a,t[1]=g.b,t[2]=g.c;for(let I=0;I<4;I++){const S=x[I],L=b[I];if(r.setFromPoints(L,t),S.isSeparated(r))return!1}const B=g.satBounds,M=g.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let I=0;I<4;I++){const S=B[I],L=M[I];if(r.setFromPoints(L,e),S.isSeparated(r))return!1}for(let I=0;I<4;I++){const S=b[I];for(let L=0;L<4;L++){const D=M[L];if(s.crossVectors(S,D),r.setFromPoints(s,e),i.setFromPoints(s,t),r.isSeparated(i))return!1}}return p&&(v||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),p.start.set(0,0,0),p.end.set(0,0,0)),!0}else{const x=d(this,_,u);if(x===1&&g.containsPoint(u.end))return p&&(p.start.copy(u.end),p.end.copy(u.end)),!0;if(x!==2)return!1;const b=d(g,w,f);if(b===1&&this.containsPoint(f.end))return p&&(p.start.copy(f.end),p.end.copy(f.end)),!0;if(b!==2)return!1;if(u.delta(a),f.delta(l),a.dot(l)<0){let T=f.start;f.start=f.end,f.end=T}const B=u.start.dot(a),M=u.end.dot(a),I=f.start.dot(a),S=f.end.dot(a),L=M0?p.start.copy(u.start):p.start.copy(f.start),c.subVectors(u.end,f.end),c.dot(a)<0?p.end.copy(u.end):p.end.copy(f.end)),!0)}}}();la.prototype.distanceToPoint=function(){const n=new $;return function(t){return this.closestPointToPoint(t,n),t.distanceTo(n)}}();la.prototype.distanceToTriangle=function(){const n=new $,e=new $,t=["a","b","c"],r=new Wl,i=new Wl;return function(o,a=null,l=null){const c=a||l?r:null;if(this.intersectsTriangle(o,c))return(a||l)&&(a&&c.getCenter(a),l&&c.getCenter(l)),0;let A=1/0;for(let u=0;u<3;u++){let f;const h=t[u],d=o[h];this.closestPointToPoint(d,n),f=d.distanceToSquared(n),fnew $),this.satAxes=new Array(3).fill().map(()=>new $),this.satBounds=new Array(3).fill().map(()=>new sc),this.alignedSatBounds=new Array(3).fill().map(()=>new sc),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),r&&this.matrix.copy(r)}set(e,t,r){this.min.copy(e),this.max.copy(t),this.matrix.copy(r),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}zi.prototype.update=function(){return function(){const e=this.matrix,t=this.min,r=this.max,i=this.points;for(let c=0;c<=1;c++)for(let A=0;A<=1;A++)for(let u=0;u<=1;u++){const f=1*c|2*A|4*u,h=i[f];h.x=c?r.x:t.x,h.y=A?r.y:t.y,h.z=u?r.z:t.z,h.applyMatrix4(e)}const s=this.satBounds,o=this.satAxes,a=i[0];for(let c=0;c<3;c++){const A=o[c],u=s[c],f=1<new Wl),t=new Array(12).fill().map(()=>new Wl),r=new $,i=new $;return function(o,a=0,l=null,c=null){if(this.needsUpdate&&this.update(),this.intersectsBox(o))return(l||c)&&(o.getCenter(i),this.closestPointToPoint(i,r),o.closestPointToPoint(r,i),l&&l.copy(r),c&&c.copy(i)),0;const A=a*a,u=o.min,f=o.max,h=this.points;let d=1/0;for(let g=0;g<8;g++){const p=h[g];i.copy(p).clamp(u,f);const v=p.distanceToSquared(i);if(vnew la)}}const vo=new Zpe;class Jpe{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const e=[];let t=null;this.setBuffer=r=>{t&&e.push(t),t=r,this.float32Array=new Float32Array(r),this.uint16Array=new Uint16Array(r),this.uint32Array=new Uint32Array(r)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,e.length!==0&&this.setBuffer(e.pop())}}}const Fn=new Jpe;let qc,Qh;const Lf=[],_y=new A2(()=>new Qn);function qpe(n,e,t,r,i,s){qc=_y.getPrimitive(),Qh=_y.getPrimitive(),Lf.push(qc,Qh),Fn.setBuffer(n._roots[e]);const o=AT(0,n.geometry,t,r,i,s);Fn.clearBuffer(),_y.releasePrimitive(qc),_y.releasePrimitive(Qh),Lf.pop(),Lf.pop();const a=Lf.length;return a>0&&(Qh=Lf[a-1],qc=Lf[a-2]),o}function AT(n,e,t,r,i=null,s=0,o=0){const{float32Array:a,uint16Array:l,uint32Array:c}=Fn;let A=n*2;if(Zi(A,l)){const f=Fs(n,c),h=po(A,l);return er(n,a,qc),r(f,h,!1,o,s+n,qc)}else{let S=function(D){const{uint16Array:T,uint32Array:y}=Fn;let E=D*2;for(;!Zi(E,T);)D=mo(D),E=D*2;return Fs(D,y)},L=function(D){const{uint16Array:T,uint32Array:y}=Fn;let E=D*2;for(;!Zi(E,T);)D=go(D,y),E=D*2;return Fs(D,y)+po(E,T)};const f=mo(n),h=go(n,c);let d=f,m=h,g,p,v,w;if(i&&(v=qc,w=Qh,er(d,a,v),er(m,a,w),g=i(v),p=i(w),p(Yp.copy(e).clamp(A.min,A.max),Yp.distanceToSquared(e)),intersectsBounds:(A,u,f)=>f{A.closestPointToPoint(e,Yp);const f=e.distanceToSquared(Yp);return f=169,YA=new $,$A=new $,ZA=new $,xy=new je,by=new je,Ey=new je,xO=new $,bO=new $,EO=new $,$p=new $;function nme(n,e,t,r,i,s,o,a){let l;if(s===oi?l=n.intersectTriangle(r,t,e,!0,i):l=n.intersectTriangle(e,t,r,s!==_i,i),l===null)return null;const c=n.origin.distanceTo(i);return ca?null:{distance:c,point:i.clone()}}function rme(n,e,t,r,i,s,o,a,l,c,A){YA.fromBufferAttribute(e,s),$A.fromBufferAttribute(e,o),ZA.fromBufferAttribute(e,a);const u=nme(n,YA,$A,ZA,$p,l,c,A);if(u){const f=new $;Wr.getBarycoord($p,YA,$A,ZA,f),r&&(xy.fromBufferAttribute(r,s),by.fromBufferAttribute(r,o),Ey.fromBufferAttribute(r,a),u.uv=Wr.getInterpolation($p,YA,$A,ZA,xy,by,Ey,new je)),i&&(xy.fromBufferAttribute(i,s),by.fromBufferAttribute(i,o),Ey.fromBufferAttribute(i,a),u.uv1=Wr.getInterpolation($p,YA,$A,ZA,xy,by,Ey,new je)),t&&(xO.fromBufferAttribute(t,s),bO.fromBufferAttribute(t,o),EO.fromBufferAttribute(t,a),u.normal=Wr.getInterpolation($p,YA,$A,ZA,xO,bO,EO,new $),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const h={a:s,b:o,c:a,normal:new $,materialIndex:0};Wr.getNormal(YA,$A,ZA,h.normal),u.face=h,u.faceIndex=s,tme&&(u.barycoord=f)}return u}function R1(n,e,t,r,i,s,o){const a=r*3;let l=a+0,c=a+1,A=a+2;const u=n.index;n.index&&(l=u.getX(l),c=u.getX(c),A=u.getX(A));const{position:f,normal:h,uv:d,uv1:m}=n.attributes,g=rme(t,f,h,d,m,l,c,A,e,s,o);return g?(g.faceIndex=r,i&&i.push(g),g):null}function Sr(n,e,t,r){const i=n.a,s=n.b,o=n.c;let a=e,l=e+1,c=e+2;t&&(a=t.getX(a),l=t.getX(l),c=t.getX(c)),i.x=r.getX(a),i.y=r.getY(a),i.z=r.getZ(a),s.x=r.getX(l),s.y=r.getY(l),s.z=r.getZ(l),o.x=r.getX(c),o.y=r.getY(c),o.z=r.getZ(c)}function ime(n,e,t,r,i,s,o,a){const{geometry:l,_indirectBuffer:c}=n;for(let A=r,u=r+i;Ab&&(b=D),T<_&&(_=T),T>B&&(B=T),yM&&(M=y)}return l[f+0]!==w||l[f+1]!==_||l[f+2]!==x||l[f+3]!==b||l[f+4]!==B||l[f+5]!==M?(l[f+0]=w,l[f+1]=_,l[f+2]=x,l[f+3]=b,l[f+4]=B,l[f+5]=M,!0):!1}else{const p=f+8,v=o[f+6],w=p+h,_=v+h;let x=d,b=!1,B=!1;e?x||(b=e.has(w),B=e.has(_),x=!b&&!B):(b=!0,B=!0);const M=x||b,I=x||B;let S=!1;M&&(S=u(p,h,x));let L=!1;I&&(L=u(v,h,x));const D=S||L;if(D)for(let T=0;T<3;T++){const y=p+T,E=v+T,R=l[y],F=l[y+3],O=l[E],z=l[E+3];l[f+T]=Rz?F:z}return D}}}function _A(n,e,t,r,i){let s,o,a,l,c,A;const u=1/t.direction.x,f=1/t.direction.y,h=1/t.direction.z,d=t.origin.x,m=t.origin.y,g=t.origin.z;let p=e[n],v=e[n+3],w=e[n+1],_=e[n+3+1],x=e[n+2],b=e[n+3+2];return u>=0?(s=(p-d)*u,o=(v-d)*u):(s=(v-d)*u,o=(p-d)*u),f>=0?(a=(w-m)*f,l=(_-m)*f):(a=(_-m)*f,l=(w-m)*f),s>l||a>o||((a>s||isNaN(s))&&(s=a),(l=0?(c=(x-g)*h,A=(b-g)*h):(c=(b-g)*h,A=(x-g)*h),s>A||c>o)?!1:((c>s||s!==s)&&(s=c),(A=r)}function lme(n,e,t,r,i,s,o,a){const{geometry:l,_indirectBuffer:c}=n;for(let A=r,u=r+i;A=0;let m,g;d?(m=mo(n),g=go(n,l)):(m=go(n,l),g=mo(n));const v=_A(m,o,r,i,s)?fT(m,e,t,r,i,s):null;if(v){const x=v.point[f];if(d?x<=o[g+u]:x>=o[g+u+3])return v}const _=_A(g,o,r,i,s)?fT(g,e,t,r,i,s):null;return v&&_?v.distance<=_.distance?v:_:v||_||null}}const By=new Qn,Df=new la,Nf=new la,Zp=new He,BO=new zi,Sy=new zi;function dme(n,e,t,r){Fn.setBuffer(n._roots[e]);const i=hT(0,n,t,r);return Fn.clearBuffer(),i}function hT(n,e,t,r,i=null){const{float32Array:s,uint16Array:o,uint32Array:a}=Fn;let l=n*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),BO.set(t.boundingBox.min,t.boundingBox.max,r),i=BO),Zi(l,o)){const A=e.geometry,u=A.index,f=A.attributes.position,h=t.index,d=t.attributes.position,m=Fs(n,a),g=po(l,o);if(Zp.copy(r).invert(),t.boundsTree)return er(n,s,Sy),Sy.matrix.copy(Zp),Sy.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:v=>Sy.intersectsBox(v),intersectsTriangle:v=>{v.a.applyMatrix4(r),v.b.applyMatrix4(r),v.c.applyMatrix4(r),v.needsUpdate=!0;for(let w=m*3,_=(g+m)*3;w<_;w+=3)if(Sr(Nf,w,u,f),Nf.needsUpdate=!0,v.intersectsTriangle(Nf))return!0;return!1}});for(let p=m*3,v=(g+m)*3;pVB.distanceToBox(x),intersectsBounds:(x,b,B)=>B{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:M=>Jp.distanceToBox(M),intersectsBounds:(M,I,S)=>S{for(let S=M,L=M+I;Sb&&(b=y),E<_&&(_=E),E>B&&(B=E),RM&&(M=R)}}return l[f+0]!==w||l[f+1]!==_||l[f+2]!==x||l[f+3]!==b||l[f+4]!==B||l[f+5]!==M?(l[f+0]=w,l[f+1]=_,l[f+2]=x,l[f+3]=b,l[f+4]=B,l[f+5]=M,!0):!1}else{const p=f+8,v=o[f+6],w=p+h,_=v+h;let x=d,b=!1,B=!1;e?x||(b=e.has(w),B=e.has(_),x=!b&&!B):(b=!0,B=!0);const M=x||b,I=x||B;let S=!1;M&&(S=u(p,h,x));let L=!1;I&&(L=u(v,h,x));const D=S||L;if(D)for(let T=0;T<3;T++){const y=p+T,E=v+T,R=l[y],F=l[y+3],O=l[E],z=l[E+3];l[f+T]=Rz?F:z}return D}}}function _me(n,e,t,r,i,s,o){Fn.setBuffer(n._roots[e]),dT(0,n,t,r,i,s,o),Fn.clearBuffer()}function dT(n,e,t,r,i,s,o){const{float32Array:a,uint16Array:l,uint32Array:c}=Fn,A=n*2;if(Zi(A,l)){const f=Fs(n,c),h=po(A,l);lme(e,t,r,f,h,i,s,o)}else{const f=mo(n);_A(f,a,r,s,o)&&dT(f,e,t,r,i,s,o);const h=go(n,c);_A(h,a,r,s,o)&&dT(h,e,t,r,i,s,o)}}const xme=["x","y","z"];function bme(n,e,t,r,i,s){Fn.setBuffer(n._roots[e]);const o=pT(0,n,t,r,i,s);return Fn.clearBuffer(),o}function pT(n,e,t,r,i,s){const{float32Array:o,uint16Array:a,uint32Array:l}=Fn;let c=n*2;if(Zi(c,a)){const u=Fs(n,l),f=po(c,a);return cme(e,t,r,u,f,i,s)}else{const u=DG(n,l),f=xme[u],d=r.direction[f]>=0;let m,g;d?(m=mo(n),g=go(n,l)):(m=go(n,l),g=mo(n));const v=_A(m,o,r,i,s)?pT(m,e,t,r,i,s):null;if(v){const x=v.point[f];if(d?x<=o[g+u]:x>=o[g+u+3])return v}const _=_A(g,o,r,i,s)?pT(g,e,t,r,i,s):null;return v&&_?v.distance<=_.distance?v:_:v||_||null}}const Cy=new Qn,Of=new la,kf=new la,qp=new He,SO=new zi,Ty=new zi;function Eme(n,e,t,r){Fn.setBuffer(n._roots[e]);const i=mT(0,n,t,r);return Fn.clearBuffer(),i}function mT(n,e,t,r,i=null){const{float32Array:s,uint16Array:o,uint32Array:a}=Fn;let l=n*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),SO.set(t.boundingBox.min,t.boundingBox.max,r),i=SO),Zi(l,o)){const A=e.geometry,u=A.index,f=A.attributes.position,h=t.index,d=t.attributes.position,m=Fs(n,a),g=po(l,o);if(qp.copy(r).invert(),t.boundsTree)return er(n,s,Ty),Ty.matrix.copy(qp),Ty.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:v=>Ty.intersectsBox(v),intersectsTriangle:v=>{v.a.applyMatrix4(r),v.b.applyMatrix4(r),v.c.applyMatrix4(r),v.needsUpdate=!0;for(let w=m,_=g+m;w<_;w++)if(Sr(kf,3*e.resolveTriangleIndex(w),u,f),kf.needsUpdate=!0,v.intersectsTriangle(kf))return!0;return!1}});for(let p=m,v=g+m;pjB.distanceToBox(x),intersectsBounds:(x,b,B)=>B{if(e.boundsTree){const B=e.boundsTree;return B.shapecast({boundsTraverseOrder:M=>em.distanceToBox(M),intersectsBounds:(M,I,S)=>S{for(let S=M,L=M+I;Snew Qn),Hf=new Qn,Qf=new Qn,WB=new Qn,KB=new Qn;let XB=!1;function Rme(n,e,t,r){if(XB)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");XB=!0;const i=n._roots,s=e._roots;let o,a=0,l=0;const c=new He().copy(t).invert();for(let A=0,u=i.length;Al.slice()),index:o?o.array.slice():null,indirectBuffer:s?s.slice():null}:a={roots:i,index:o?o.array:null,indirectBuffer:s},a}static deserialize(e,t,r={}){r={setIndex:!0,indirect:!!e.indirectBuffer,...r};const{index:i,roots:s,indirectBuffer:o}=e,a=new u2(t,{...r,[kB]:!0});if(a._roots=s,a._indirectBuffer=o||null,r.setIndex){const l=t.getIndex();if(l===null){const c=new ct(e.index,1,!1);t.setIndex(c)}else l.array!==i&&(l.array.set(i),l.needsUpdate=!0)}return a}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({...Ume,[kB]:!1},t),t.useSharedArrayBuffer&&!Ime())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[kB]||(Kpe(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new Qn))),this.resolveTriangleIndex=t.indirect?r=>this._indirectBuffer[r]:r=>r}refit(e=null){return(this.indirect?wme:ame)(this,e)}traverse(e,t=0){const r=this._roots[t],i=new Uint32Array(r),s=new Uint16Array(r);o(0);function o(a,l=0){const c=a*2,A=s[c+15]===I1;if(A){const u=i[a+6],f=s[c+14];e(l,A,new Float32Array(r,a*4,6),u,f)}else{const u=a+sg/4,f=i[a+6],h=i[a+7];e(l,A,new Float32Array(r,a*4,6),h)||(o(u,l+1),o(f,l+1))}}}raycast(e,t=Qs,r=0,i=1/0){const s=this._roots,o=this.geometry,a=[],l=t.isMaterial,c=Array.isArray(t),A=o.groups,u=l?t.side:t,f=this.indirect?_me:ume;for(let h=0,d=s.length;hu(f,h,d,m,g)?!0:r(f,h,this,a,d,m,t)}else o||(a?o=(u,f,h,d)=>r(u,f,this,a,h,d,t):o=(u,f,h)=>h);let l=!1,c=0;const A=this._roots;for(let u=0,f=A.length;u{const m=this.resolveTriangleIndex(d);Sr(o,m*3,a,l)}:d=>{Sr(o,d*3,a,l)},A=vo.getPrimitive(),u=e.geometry.index,f=e.geometry.attributes.position,h=e.indirect?d=>{const m=e.resolveTriangleIndex(d);Sr(A,m*3,u,f)}:d=>{Sr(A,d*3,u,f)};if(s){const d=(m,g,p,v,w,_,x,b)=>{for(let B=p,M=p+v;BRy.intersectsBox(r),intersectsTriangle:r=>Ry.intersectsTriangle(r)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,r={},i={},s=0,o=1/0){return(this.indirect?Tme:yme)(this,e,t,r,i,s,o)}closestPointToPoint(e,t={},r=0,i=1/0){return eme(this,e,t,r,i)}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(r=>{er(0,new Float32Array(r),MO),e.union(MO)}),e}}function CO(n,e,t){return n===null?null:(n.point.applyMatrix4(e.matrixWorld),n.distance=n.point.distanceTo(t.ray.origin),n.object=e,n)}const Uy=new Xu,TO=new $,IO=new He,Fme=dn.prototype.raycast,Pme=Sse.prototype.raycast,RO=new $,qr=new dn,Fy=[];function Lme(n,e){this.isBatchedMesh?Dme.call(this,n,e):Nme.call(this,n,e)}function Dme(n,e){if(this.boundsTrees){const t=this.boundsTrees,r=this._drawInfo,i=this._drawRanges,s=this.matrixWorld;qr.material=this.material,qr.geometry=this.geometry;const o=qr.geometry.boundsTree,a=qr.geometry.drawRange;qr.geometry.boundingSphere===null&&(qr.geometry.boundingSphere=new Si);for(let l=0,c=r.length;l{const e=n.attributes.position,t=n.index,r=new Wr,i=new $,s=new $,o=new $,a=[];for(let l=0;l{const e=n.geometry.clone();let t=[];if(Array.isArray(n.material))for(let i=0;i{n.isMesh&&(n.geometry.userData.faceNormals=null,n.geometry.dispose(),n.geometry.disposeBoundsTree(),n.parent&&n.parent.remove(n),n.userData.cancelMesh&&Dw(n.userData.cancelMesh))},kG=n=>{var e,t;n.userData.cullingClone&&(Dw(n.userData.cullingClone),n.userData.cullingClone=null,Dw(n.userData.cullingCloneP),n.userData.cullingCloneP=null,Dw(n.userData.cullingCloneN),n.userData.cullingCloneN=null,((e=n.userData)==null?void 0:e.clippedIndexGeometry)!=null&&(n.userData.clippedIndexGeometry=null),((t=n.userData)==null?void 0:t.origIndexBuffer)!=null&&(n.userData.origIndexBuffer=null))},Wme=async n=>{if(n==null){console.warn("Null parameter for meshes was provided. Skipping mesh culling.");return}if(!Array.isArray(n)){console.warn("No valid mesh array was provided. Skipping mesh culling.");return}if(n.length==0){console.warn("No mesh array with elements was provided. Skipping mesh culling.");return}const e=[];Fm=n[0].parent,Fm.lines!=null&&(Fm.lines.forEach(i=>{i.visible=!1}),Fm.lines.length=0),n.forEach(i=>{if(i.userData.cullLayer!=null){i.userData.origIndexBuffer==null&&(i.userData.origIndexBuffer=i.geometry.index.clone()),e[i.userData.cullLayer]==null&&(e[i.userData.cullLayer]={origMeshes:[],cloneMeshes:[],posMeshes:[],negMeshes:[],scaleMeshes:[],positionMeshes:[]}),i.userData.cullingClone==null&&(i.userData.cullingClone=jme(i),i.userData.cullingCloneP=i.userData.cullingClone.clone(),i.userData.cullingCloneN=i.userData.cullingClone.clone());const s=i.userData.cullingClone,o=i.userData.cullingCloneP,a=i.userData.cullingCloneN;o.material=zme,a.userData.cancelMesh=o,a.material=Gme,o.userData.maxCullDistance=a.userData.maxCullDistance=i.userData.maxCullDistance,e[i.userData.cullLayer].origMeshes.push(i),e[i.userData.cullLayer].cloneMeshes.push(s),e[i.userData.cullLayer].posMeshes.push(o),e[i.userData.cullLayer].negMeshes.push(a),i.geometry.setIndex(i.userData.origIndexBuffer)}});for(let i=e.length-1;i>=0;i--)e[i]==null&&e.splice(i,1);let t=[];const r=[];for(let i=e.length-1;i>=0;i--){if(t.length!=0||e.length>=1)for(let s=0;s{i.geom.setIndex(i.index)})},Kme=n=>{let e=Hme,t=Qme;return n&&(isNaN(n)?Array.isArray(n)&&(isNaN(n[0])||(e=n[0]),isNaN(n[1])||(t=n[1])):e=n),[e,t]},Xme=(n,e,t,r,i,s,o=!1)=>{const a=[],l=Kme(s);let c=l[0],A=l[1];Py.far=c+A;for(let f=0;f=0;v--)c-p[v].distance>=p[v].object.userData.maxCullDistance&&p.splice(v,1);if(p.length===0){for(let v=0;v<3;v++)a.push(n[h+v]);break}else{const v=p.map(w=>w.object);for(let w=0;ww).length===0){for(let w=0;w<3;w++)a.push(n[h+w]);break}if(m===0)d=p.map(w=>w.object);else if(d=p.map(w=>{if(d.indexOf(w.object)!==-1)return w.object}),d=d.filter(w=>w),m===2&&d.filter(w=>w).length===0)for(let w=0;w<3;w++)a.push(n[h+w]);o&&Yme(YB,tm.clone().multiplyScalar(-1),Py.far,16711680,Fm)}}}const u=new Uint32Array(a);return new ct(u,1,!1)};function Yme(n,e,t,r,i){i.lines==null&&(i.lines=[]);let s=new $;s.addVectors(n,e.clone().multiplyScalar(t));const o=[];o.push(n),o.push(s);const a=new Jt().setFromPoints(o),l=[];l.push(new ke(0)),l.push(new ke(16777215));let c=new Ac({color:r});var A=new Yd(a,c);A.renderOrder=100,i.add(A),i.lines.push(A)}function $me(n,e=10){if(n<=0)return[];const t=n,r=[{w:e,h:e,x:0,y:0}];function i(o,a,l,c){if(a<=0)return;const A=o.w/2,u=[{w:A,h:A,x:l,y:c},{w:A,h:A,x:l+A,y:c},{w:A,h:A,x:l,y:c+A},{w:A,h:A,x:l+A,y:c+A}];r.push(...u);const f=r.find(p=>p.x===l&&p.y===c&&p.w===o.w&&p.h===o.h);if(r.splice(r.indexOf(f),1),n<=r.length)return;const h=Math.max(...r.map(p=>p.w)),d=r.find(p=>p.w===h),m=d.x,g=d.y;i({w:d.w,h:d.h},a-1,m,g)}if(n==1)return{squares:r,fill:1};for(i({w:e,h:e},t,0,0),r.sort((o,a)=>a.w-o.w);r.length>n;)r.pop();const s=r.reduce((o,a)=>o+a.w*a.h,0)/(e*e);return{squares:r,fill:s}}class U1{constructor(e,t){We(this,"width");We(this,"height");We(this,"cameraRTT",null);We(this,"sceneRTT",null);We(this,"materials",[]);We(this,"quads",[]);We(this,"renderer",null);We(this,"rtTexture",null);this.width=e,this.height=t}_addPlane(e,t=0){if(!this.sceneRTT)return;const r=new qi({side:_i,transparent:!0,opacity:1,color:new ke(1,1,1)});this.materials.push(r);const i=new cc(1,1),s=new dn(i,r);s.position.z=t*1e-4,s.scale.set(this.width,this.height,1),this.quads.push(s),this.sceneRTT.add(s)}render(e,t,r,i,s=!0){var c;const o=ut(e);if(o.length===0&&(e=ut(U1.createSolidColorTexture(r,this.width,this.height))),this.renderer==null){this.sceneRTT=new zg,this.cameraRTT=new g0(-this.width/2,this.width/2,this.height/2,-this.height/2,-1e4,1e4),this.cameraRTT.position.z=100,this.sceneRTT.add(this.cameraRTT);for(let A=0;A{A==null||A.scale.set(this.width,this.height,1)}),this.renderer.setSize(this.width,this.height);if(o.length>this.materials.length){const A=o.length-this.materials.length;for(let u=0;uo.length)for(let A=o.length;A{var i;(i=r.map)==null||i.dispose(),r.map=null})}destroy(){var e,t;this.cameraRTT=null,(e=this.sceneRTT)==null||e.clear(),this.sceneRTT=null,this.materials.forEach(r=>{var i;(i=r.map)==null||i.dispose(),r.map=null}),this.quads.forEach(r=>{var i;(i=this.sceneRTT)==null||i.remove(r),r=null}),this.materials.length=0,this.quads.length=0,(t=this.renderer)==null||t.dispose(),this.renderer=null,this.rtTexture=null}static createSolidColorTexture(e,t,r){const i=t*r,s=new Uint8Array(4*i),o=Math.floor(e.r*255),a=Math.floor(e.g*255),l=Math.floor(e.b*255);for(let A=0;Atypeof window>"u"?await qme({meshes:e,atlasSize:r,mtoon:i,transparentMaterial:s,transparentTexture:o}):await ege({backColor:n,meshes:e,atlasSize:r,mtoon:i,includeNonTexturedMeshesInAtlas:t,transparentMaterial:s,transparentTexture:o,twoSidedMaterial:a}),qme=async({meshes:n,atlasSize:e,mtoon:t,transparentMaterial:r,transparentTexture:i})=>{const s=e,o=["diffuse"],a=[];n.forEach(b=>{const B=b.material;let M=a.find(I=>I.material===B);if(!M)a.push({material:B,mesh:b});else{const{dest:I}=F1({meshes:[M.mesh,b]});M.mesh.geometry=I}});const l=Object.fromEntries(o.map(b=>[b,h2({width:s,height:s,transparent:i})])),c=Math.floor(Math.sqrt(n.length)+1),A=s/c,u=new Map(a.map((b,B)=>{const M=new je(B%c,Math.floor(B/c)).multiplyScalar(1/c),I=new je(M.x+1/c,M.y+1/c);return[b.mesh,{min:M,max:I}]})),f=[],h=[];a.forEach(b=>{const{min:B,max:M}=u.get(b.mesh);h.push(M),f.push(B)});const d=new je(Math.max(...h.map(b=>b.x)),Math.max(...h.map(b=>b.y))),m=new je(Math.min(...f.map(b=>b.x)),Math.min(...f.map(b=>b.y))),g=1/(d.x-m.x),p=1/(d.y-m.y),v=A*g,w=A*p,_=new Map(a.map(b=>{let{min:B,max:M}=u.get(b.mesh);return B.x=B.x*g,B.y=B.y*p,M.x=M.x*g,M.y=M.y*p,[b.mesh,{min:B,max:M}]}));a.forEach(b=>{const{material:B,mesh:M}=b,{min:I,max:S}=_.get(M);o.forEach(y=>{const E=l[y];E.globalCompositeOperation="source-over";let R=ex(B,gT[y].find(F=>ex(B,F)));if(R!==""&&R!==void 0)try{const F=new Uint8ClampedArray(R.data),O=new ImageData(F,v,w),z=document.createElement("canvas");z.width=v,z.height=w;const j=z.getContext("2d");j.putImageData(O,0,0),j.save(),E.drawImage(z,I.x*s,I.y*s,v,w)}catch(F){console.error("error",F)}else E.fillStyle=y==="diffuse"?`#${B.color.clone().getHexString()}`:y==="normal"?"#bcbcff":y==="orm"?`#${new ke(B.aoMapIntensity,B.roughness,B.metalness).getHexString()}`:"#7F7F7F",E.fillRect(I.x*s,I.y*s,v,w)});const L=M.geometry,D=L.attributes.uv;if(D)for(let y=0;y{const B=new Un(l[b].canvas);return B.flipY=!1,[b,B]})));return{bakeObjects:a,textures:x,uvs:_}},ege=async({backColor:n,includeNonTexturedMeshesInAtlas:e=!1,meshes:t,atlasSize:r,mtoon:i,transparentMaterial:s,transparentTexture:o,twoSidedMaterial:a})=>{const l=r,c=i?["diffuse"]:["diffuse","orm","normal"],A=[];let u=null;t.forEach(F=>{F=F.clone();const O=F.material.length==null?F.material:F.material[0];i&&u==null&&O.type=="ShaderMaterial"&&(u=O.clone());let z=A.find(j=>{j.material});if(!z)A.push({material:O,mesh:F});else{const{dest:j}=F1({meshes:[z.mesh,F]});z.mesh.geometry=j}});const f=Object.fromEntries(c.map(F=>[F,h2({width:l,height:l,transparent:o&&F=="diffuse"})])),h=new Set,d=new Map,m=A.map(F=>{const O=F.mesh.geometry;if(e==!1){if(!F.mesh.visible)return h.add(F.mesh),[F.mesh,0];let z=!0;for(const j of c)for(const H of gT[j])if(ex(F.material,H)&&z){z=!1;break}if(z){const j=F.material;if(j instanceof mr)return[F.mesh,2];if(d.size==0)return d.set(j,[F.mesh]),[F.mesh,1];for(let[H,C]of Array.from(d.entries()))if((()=>H.color.r.toFixed(5)==j.color.r.toFixed(5)&&H.color.g.toFixed(5)==j.color.g.toFixed(5)&&H.color.b.toFixed(5)==j.color.b.toFixed(5)&&H.emissive.equals(j.emissive)&&H.aoMapIntensity==j.aoMapIntensity&&H.metalness==j.metalness&&H.normalScale.equals(j.normalScale)&&H.roughness==j.roughness&&H.transparent==j.transparent&&H.vertexColors==j.vertexColors)())return C.push(F.mesh),[F.mesh,0];return d.set(j,[F.mesh]),[F.mesh,1]}}return[F.mesh,O.index?O.index.count/3:O.attributes.position.count/3]}).sort((F,O)=>O[1]-F[1]),g=m.filter(([,F])=>F!=0),{squares:p,fill:v}=$me(g.length,l);console.log("squaresplit",v);const w=p.map(F=>({x:F.x,y:F.y,width:F.w,height:F.h})),_=new Map(w.map((F,O)=>[m[O][0],F]));d.forEach(F=>{if(F.length>1){const O=_.get(F[0]);F.forEach(z=>{_.set(z,O)})}});const x=new Map(Array.from(_.entries()).map(([F,O])=>{const z=new je(O.x,O.y),j=new je(O.x+O.width,O.y+O.height);return[F,{min:z,max:j}]})),b=[];Array.from(_.keys()).forEach(F=>{if(h.has(F))return;const{min:O,max:z}=x.get(F);b.push(O)});const B=new je(Math.min(...b.map(F=>F.x)),Math.min(...b.map(F=>F.y))),M=1/(l-B.x),I=1/(l-B.y),S=new Map(Array.from(_.keys()).map(F=>{if(h.has(F))return;let{min:O,max:z}=x.get(F);return O.x=O.x*M,O.y=O.y*I,z.x=z.x*M,z.y=z.y*I,[F,{min:O,max:z}]}).filter(F=>F));let L=!1;const D=new U1(l,l);Array.from(_.keys()).forEach(F=>{const O=A.find(re=>re.mesh===F),{material:z}=O;let j,H;const C=S.get(F);if(C?(j=C.min,H=C.max):(j=new je(0,0),H=new je(0,0)),!h.has(O.mesh)){const re=_.get(F).width,ue=_.get(F).height;c.forEach(le=>{var Q;const me=f[le];me.globalCompositeOperation="source-over";let ie,ge=new ke(1,1,1);switch(le){case"diffuse":ie=z.color||n,(Q=z.uniforms)!=null&&Q.litFactor?ge=z.uniforms.litFactor.value:ge=z.color;break;case"normal":ie=new ke(12369151);break;case"orm":ie=new ke(0,z.roughness,z.metalness);break;default:ie=new ke(1,1,1);break}let _e=Zme(z,gT[le].find(fe=>ex(z,fe)));L==!1&&le=="normal"&&_e!=null&&(L=!0);const se=D.render(_e,ge,ie,le=="diffuse"&&o,le!="normal");createImageBitmap(se).then(fe=>me.drawImage(fe,j.x*l,j.y*l,re,ue))})}const W=F.geometry.clone();F.geometry=W;const ee=W.attributes.uv.clone();if(W.attributes.uv=ee,ee)for(let re=0;re{const O=new Un(f[F].canvas);return O.flipY=!1,[F,O]}))),y=a?_i:Qs;let E;const R=s?"transparent":"opaque";return i?(E=new Nd({map:T.diffuse,transparent:s,side:y}),u==null&&(u=new _G),u.side=y,u.uniforms.map=T.diffuse,u.uniforms.shadeMultiplyTexture=T.diffuse,u.transparent=s,o&&!s&&(E.alphaTest=.5,u.alphaTest=.5),E.userData.vrmMaterial=u,E.userData.shadeTexture=T.uniformColor,E.name="mToon_"+R,E.map.name=E.name):(E=new Nd({map:T.diffuse,roughnessMap:T.orm,metalnessMap:T.orm,normalMap:L?T.normal:null,transparent:s,side:y}),o&&!s&&(E.alphaTest=.5),E.name="standard_"+R,E.roughnessMap!=null&&(E.roughnessMap.name=E.name+"_orm"),E.normalMap!=null&&(E.normalMap.name=E.name+"_normal")),{bakeObjects:A,material:E}};function HG(n){const e=new Map;for(const r of n.skeleton.bones){const i=r.clone(!1);e.set(r,i)}n.skeleton.bones[0].traverse(r=>{if(r.type!=="Bone")return;const i=e.get(r);for(const s of r.children){const o=e.get(s);o&&i.add(o)}});const t=new UA(n.skeleton.bones.map(r=>e.get(r)));return t.boneInverses=n.skeleton.boneInverses,t.pose(),t}function QG(n,e){const t=new Map;new $(-1,1,-1),new He,new $;let r=0;n.forEach(l=>{if(l.skeleton){var c=HG(l);const A=c.bones;c.bones.forEach((u,f)=>{var h;if(A.indexOf(u)!==-1){const d=t.get(u.name);if(d==null){const m={index:r,boneInverses:c.boneInverses[f],bone:u.clone(!1),parentName:((h=u.parent)==null?void 0:h.type)=="Bone"?u.parent.name:null};r++,t.set(u.name,m)}else u.userData.VRMcolliders!=null&&(d.bone.userData.VRMcolliders==null?d.bone.userData.VRMcolliders=u.userData.VRMcolliders:u.userData.VRMcollidersID!=d.bone.userData.VRMcollidersID&&(d.bone.userData.VRMcolliders=[...d.bone.userData.VRMcolliders,...u.userData.VRMcolliders]))}})}});const i=[],s=[];[...t.values()].forEach(l=>{var c;if(i.push(l.bone),s.push(l.boneInverses),l.parentName!=null){const A=(c=t.get(l.parentName))==null?void 0:c.bone;A&&A.add(l.bone)}});const a=new UA(i,s);return a.bones.forEach(l=>{var A;const c=(A=l.userData)==null?void 0:A.vrm0RestPosition;c&&l.position.set(-c.x,c.y,-c.z),l.position.set(l.position.x*e,l.position.y*e,l.position.z*e)}),a}function tge(n,e){if(!e.skeleton)return;const t=new Map;if(e.skeleton){e.skeleton.bones.forEach((o,a)=>{const l=n.bones.filter(A=>A.name===o.name),c=l.length>0?n.bones.indexOf(l[0]):-1;t.set(a,c)});const r=[],i=e.geometry.attributes.skinIndex.array;for(let o=0;oe.indexOf(t)===r)}function nge(n){const t=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array].filter(r=>n.constructor===r);return t.length&&t[0]||null}function tx(n,e){const t=[];for(let s=0;ss.name===r.name);return i?t.bones.indexOf(i):-1}async function sge(n,e,t){const{scale:r,isVrm0:i,mergeAppliedMorphs:s}=t,o=[],a=[],l=Od(n,"SkinnedMesh"),c=VG(e),A=GG(e).map(h=>h.id);l.forEach(h=>{const d=h.clone();o.push(d),Array.isArray(h.material)?a.push(...h.material):a.push(h.material)});const u=QG(o,r),f=new Lt;return f.name="AvatarRoot",o.forEach(h=>{var L,D;const d=new Jt,m={};for(const T in h.geometry.attributes){const y=h.geometry.attributes[T];m[T]=y.clone()}const g={merge:new Set,keep:new Set(c),remove:new Set};if(s){if(!h.morphTargetDictionary||!h.morphTargetInfluences)return;A.forEach(T=>{const y=h.morphTargetDictionary[T];if(y!==void 0&&h.morphTargetInfluences[y]>0)g.merge.add(T);else return g.remove.add(T),null})}if((L=h.userData)!=null&&L.isVRM0)for(let T=0;T[T,T.morphTargetDictionary||{}])),morphTargetInfluences:new Map(l.map(T=>[T,T.morphTargetInfluences||[]])),index:null,animations:{}},{dest:v,destMorphToMerge:w}=F1({meshes:[h],scale:r,morphTargetsProcess:g},i);if(i)for(let T=0;Th.name===e.userData.boneName),s=e.userData.globalPosition,o=e.userData.globalScale||new $(1,1,1),a=e.userData.globalRotationMatrix;t.add(r.bones[0]);const l=[],c=[],A=t.geometry.attributes.position.array,u=new $,f=e.userData.isVRM0?-1:1;for(let h=0;hE.id);for(const E in I){const R=I[E],F=R.meshArray;if(F.length>0){const{bakeObjects:O,material:z}=await Jme({transparentColor:r,atlasSize:R.size,meshes:F,mtoon:R.isMtoon,includeNonTexturedMeshesInAtlas:l,transparentMaterial:R.transparentMaterial,transparentTexture:b,twoSidedMaterial:d}),j=O.map(le=>le.mesh),H=[],C={merge:new Set,keep:new Set(Object.keys(S)),remove:new Set};j.forEach(le=>{if(le.type=="Mesh"&&(le=age(M,le)),H.push(le),u){if(!le.morphTargetDictionary||!le.morphTargetInfluences)return;L.forEach(fe=>{const Ae=le.morphTargetDictionary[fe];if(Ae!==void 0&&le.morphTargetInfluences[Ae]>0)C.merge.add(fe);else return C.remove.add(fe),null})}const me=le.geometry,ie=me.index.array,ge=zG(le.geometry.index.array),_e=[];for(let fe=0;fe{const me=ue.morphTargetDictionary[le];me!==void 0&&(ue.userData.bindMorphs.new[le]={index:me,primitives:[ue.id]})}),B.userData.atlasMaterial.push(z)}}const D=(y=Object.values(e).find(E=>{var R;return(R=E==null?void 0:E.vrm)==null?void 0:R.expressionManager}))==null?void 0:y.vrm.expressionManager;return B.userData.expressionManagerToClone=D,B.add(M.bones[0]),B}function GG(n){var t;return((t=Object.values(n).filter(r=>r)[0])==null?void 0:t.traitInfo.manifestData.getAllBlendShapeTraits())||[]}function VG(n){const e=Object.values(n).map(i=>i==null?void 0:i.vrm).filter(i=>!!i).map(i=>{var s;return(s=i.expressionManager)==null?void 0:s.expressionMap}),t={};let r=[];for(const i of e)if(i)for(const s of Object.values(i)){if(r.includes(s.expressionName))continue;r.push(s.expressionName);const o=s._binds;!o||o.length==0||o.forEach(a=>{function l(A){const f=a.primitives.map(h=>h.morphTargetDictionary).filter(h=>!!h).find(h=>Object.values(h).includes(A));if(f)return Object.entries(f).find(([,h])=>h==A)}const c=l(a.index);c&&(t[c[0]]={index:c[1],primitives:a.primitives.map(A=>A.id)})})}return t}function FO({meshes:n,sourceMorphTargetDictionaries:e,destMorphTargetDictionary:t}){const r=[];return Object.entries(t).map(([i,s])=>{const o=n.find(l=>e.get(l).hasOwnProperty(i)),a=o.morphTargetDictionary[i];r[s]=o.morphTargetInfluences[a]}),r}function cge({sourceAttributes:n}){const e=new Set,t=Array.from(n.values());t.forEach(i=>{Object.keys(i).forEach(s=>e.add(s))});const r={};return Array.from(e.keys()).map(i=>{r[i]=Wz(t.map(s=>s[i]).flat().filter(s=>s!==void 0))}),r}function PO(n){const{sourceMorphTargetDictionaries:e,morphTargetsProcess:t}=n,r=new Set;Array.from(e.values()).forEach(o=>{Object.keys(o).forEach(a=>{if(!t)r.add(a);else{if(t.remove.has(a)||t.merge.has(a))return;t.keep.has(a)&&r.add(a)}})});const s={};return Array.from(r.keys()).map((o,a)=>{s[o]=a}),s}function LO({meshes:n,sourceMorphTargetDictionaries:e,sourceMorphAttributes:t,destMorphTargetDictionary:r,scale:i}){const s=new Set;Array.from(t.values()).forEach(A=>{Object.keys(A).forEach(u=>s.add(u))});const a=Array.from(s),l={};a.forEach(A=>{l[A]=[],Object.entries(r).forEach(([u,f])=>{l[A][f]=[],n.forEach(h=>{let d;const m=e.get(h);if(m.hasOwnProperty(u)&&h.geometry.morphAttributes[A]){const g=m[u];d=h.geometry.morphAttributes[A][g]}else{const g=h.geometry.attributes[A],p=new g.array.constructor(new Array(g.array.length).fill(0));d=new ct(p,g.itemSize,g.normalized)}l[A][f].push(d)})})});const c={};return a.forEach(A=>{c[A]=[];for(let u=0;u{const i=r.geometry.index;for(var s=0;s{var h;if(i+=f.geometry.attributes.uv.count,(h=f.userData)!=null&&h.isVRM0)for(let d=0;d[f,f.geometry.attributes])),morphAttributes:new Map(n.map(f=>[f,f.geometry.morphAttributes])),morphTargetDictionaries:new Map(n.map(f=>[f,f.morphTargetDictionary||{}])),morphTargetInfluences:new Map(n.map(f=>[f,f.morphTargetInfluences||[]]))},o={attributes:null,morphTargetDictionary:null,morphAttributes:null,morphTargetInfluences:null,index:null,animations:{}};o.attributes=cge({sourceAttributes:s.attributes});const a=PO({sourceMorphTargetDictionaries:s.morphTargetDictionaries,morphTargetsProcess:{remove:(t==null?void 0:t.remove)||new Set,keep:(t==null?void 0:t.keep)||new Set,merge:(t==null?void 0:t.merge)||new Set}});o.morphTargetDictionary=a,o.morphAttributes=LO({meshes:n,sourceMorphAttributes:s.morphAttributes,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:a,scale:e}),o.morphTargetInfluences=FO({meshes:n,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:a}),o.index=Age({meshes:n});const l={morphAttributes:{},morphTargetDictionaries:{},morphTargetInfluences:null};let c=new Set((t==null?void 0:t.keep)||[]);t==null||t.merge.forEach(f=>{c.add(f)});const A=PO({sourceMorphTargetDictionaries:s.morphTargetDictionaries,morphTargetsProcess:{remove:new Set,keep:c,merge:new Set}});l.morphAttributes=LO({meshes:n,sourceMorphAttributes:s.morphAttributes,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:A,scale:e});const u=FO({meshes:n,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:A});return l.morphTargetInfluences=u,l.morphTargetDictionaries=A,o.animations={},{source:s,dest:o,destMorphToMerge:l}}function ut(n){return n==null?[]:Array.isArray(n)?n:[n]}function uge(n,e){let t=n.children.slice();t.forEach(r=>n.remove(r)),n.add(e),t.forEach(r=>n.add(r))}async function fge(n,e){const r=await new FA().load(e);r.colorSpace=Ut,r.flipY=!1,n.traverse(i=>{if(i instanceof dn){const s=Array.isArray(i.material)?i.material:[i.material];for(let o=0;o{const e=[];for(const t in n){const r=n[t].vrm;if(r){const i=r.data.cullingLayer;i>=0&&r.data.cullingMeshes.map(s=>{s.userData.cullLayer=i,s.userData.cullDistance=r.data.cullingDistance,s.userData.maxCullDistance=r.data.maxCullingDistance,e.push(s)})}}Wme(e)};function hge(n){const e=[],t=[],r=[],i=[];let s=!1;return n.forEach(o=>{var c;const l=ut(o.material)[0];l.type=="ShaderMaterial"?l.transparent==!0?(i.push(o),s=!0):(r.push(o),((c=l.uniforms.alphaTest)==null?void 0:c.value)!=0&&(s=!0)):l.transparent==!0?(t.push(o),s=!0):(e.push(o),l.alphaTest!=0&&(s=!0))}),{stdMesh:e,stdTranspMesh:t,mToonMesh:r,mToonTranspMesh:i,requiresTransparency:s}}function dge(n){const e=[],t=[],r=[],i=[],s=[],o=[];return n.forEach(a=>{ut(a.material).forEach(c=>{c.type=="ShaderMaterial"?c.transparent==!0?o.push(c):c.uniforms.alphaTest.value!=0?s.push(c):i.push(c):c.transparent==!0?r.push(c):c.alphaTest!=0?t.push(c):e.push(c)})}),{stdMats:e,stdCutoutpMats:t,stdTranspMats:r,mToonMats:i,mToonCutoutMats:s,mToonTranspMats:o}}function DO(n,e){n.data==null?n.data=e:n.data={...n.data,...e}}function pge(n,e){if(n.data!=null)return n.data[e]}function mge(n){const e=pge(n,"cullingMeshes");e&&(e.forEach(t=>{kG(t)}),n.data.cullingMeshes=null)}function Nn(n){switch(n){case 1:return 128;case 2:return 256;case 3:return 512;case 4:return 1024;case 5:return 2048;case 6:return 4096;case 7:return 8192;case 8:return 16384;default:return 4096}}function gge(n){const e=n.scene;mge(n),e.traverse(t=>{t.material&&vT(t.material),t.geometry&&(kG(t),t.geometry.dispose(),t.geometry.disposeBoundsTree())}),e.parent&&e.parent.remove(e),E0.deepDispose(e),n.expressionManager&&n.expressionManager.expressions.forEach(t=>{t._binds&&t._binds.forEach(r=>{r.primitives&&r.primitives.forEach(i=>{i.geometry.dispose(),i.material&&vT(i.material)})})});for(const t in n)n[t]=null}const vT=n=>{var e,t,r,i,s,o;if(n.length)for(let a=0;a{let e,t,r=0;return Array.isArray(n)?(e=n[0]||0,t=n[1]||0,r=n[2]||0):(typeof n=="string"||n instanceof String)&&n.split("-").forEach(s=>{switch(s=s.toLowerCase(),s){case"left":e=-1;break;case"right":e=1;break;case"bottom":case"down":t=-1;break;case"top":case"up":t=1;break;case"back":case"backward":r=-1;break;case"front":case"forward":r=1;break;default:console.warn("unkown cameraPosition name: "+s+" in: "+n+". Please use left, right, bottom, top, back or front");break}}),new $(e,t,r)},jG=()=>{const n=new Date().getTime(),e=Math.random().toString(36).substr(2,9);return n+"-"+e},vge=n=>{var t,r,i,s,o,a,l,c,A,u,f;const e=n.humanoid.humanBones;e.hips.node.parent.name="rootBone",e.upperChest==null&&e.neck.node.parent!=e.chest&&(e.neck.node.parent!=e.chest.node?e.upperChest={node:e.neck.node.parent}:e.upperChest!=null&&(e.upperChest={node:e.neck.node.parent},e.chest={node:e.neck.node.parent.parent})),e.leftShoulder==null&&(e.leftUpperArm.node.parent!=((t=e.chest)==null?void 0:t.node)&&e.leftUpperArm.node.parent!=((r=e.upperChest)==null?void 0:r.node)&&e.leftUpperArm.node.parent!=((i=e.spine)==null?void 0:i.node)&&e.leftUpperArm.node.parent!=((s=e.neck)==null?void 0:s.node)&&e.leftUpperArm.node.parent!=((o=e.head)==null?void 0:o.node),e.leftShoulder={node:e.leftUpperArm.node.parent}),e.rightShoulder==null&&(e.rightUpperArm.node.parent!=((a=e.chest)==null?void 0:a.node)&&e.rightUpperArm.node.parent!=((l=e.upperChest)==null?void 0:l.node)&&e.rightUpperArm.node.parent!=((c=e.spine)==null?void 0:c.node)&&e.rightUpperArm.node.parent!=((A=e.neck)==null?void 0:A.node)&&e.rightUpperArm.node.parent!=((u=e.head)==null?void 0:u.node),e.rightShoulder={node:e.rightUpperArm.node.parent});for(let h in Zg)h=h.charAt(0).toLowerCase()+h.slice(1),(f=e[h])!=null&&f.node&&(e[h].node.name=h)};function WG({candidates:n,predicate:e}){if(!n.length)return null;const t=n.shift();return e(t)?t:(n=n.concat(t.children),WG({candidates:n,predicate:e}))}function KG(n,e){return WG({candidates:[n],predicate:t=>t.name===e})}function XG({candidates:n,predicate:e,results:t=[]}){if(!n.length)return t;const r=n.shift();return e(r)&&t.push(r),n=n.concat(r.children),XG({candidates:n,predicate:e,results:t})}function Od(n,e){return XG({candidates:[n],predicate:t=>ut(e).includes(t.type)})}function yge(n,e){if(!n.morphTargetDictionary)return!1;for(const t of Object.keys(n.morphTargetDictionary))if(e[t])return!0;return!1}function h2({width:n,height:e,transparent:t}){const r=document.createElement("canvas");r.width=n,r.height=e;const i=r.getContext("2d");return i.fillStyle="white",t&&(i.globalAlpha=0),i.fillRect(0,0,r.width,r.height),i.globalAlpha=1,i}const wge={mixamorigHips:"hips",mixamorigSpine:"spine",mixamorigSpine1:"chest",mixamorigSpine2:"upperChest",mixamorigNeck:"neck",mixamorigHead:"head",mixamorigLeftShoulder:"leftShoulder",mixamorigLeftArm:"leftUpperArm",mixamorigLeftForeArm:"leftLowerArm",mixamorigLeftHand:"leftHand",mixamorigLeftHandThumb1:"leftThumbMetacarpal",mixamorigLeftHandThumb2:"leftThumbProximal",mixamorigLeftHandThumb3:"leftThumbDistal",mixamorigLeftHandIndex1:"leftIndexProximal",mixamorigLeftHandIndex2:"leftIndexIntermediate",mixamorigLeftHandIndex3:"leftIndexDistal",mixamorigLeftHandMiddle1:"leftMiddleProximal",mixamorigLeftHandMiddle2:"leftMiddleIntermediate",mixamorigLeftHandMiddle3:"leftMiddleDistal",mixamorigLeftHandRing1:"leftRingProximal",mixamorigLeftHandRing2:"leftRingIntermediate",mixamorigLeftHandRing3:"leftRingDistal",mixamorigLeftHandPinky1:"leftLittleProximal",mixamorigLeftHandPinky2:"leftLittleIntermediate",mixamorigLeftHandPinky3:"leftLittleDistal",mixamorigRightShoulder:"rightShoulder",mixamorigRightArm:"rightUpperArm",mixamorigRightForeArm:"rightLowerArm",mixamorigRightHand:"rightHand",mixamorigRightHandPinky1:"rightLittleProximal",mixamorigRightHandPinky2:"rightLittleIntermediate",mixamorigRightHandPinky3:"rightLittleDistal",mixamorigRightHandRing1:"rightRingProximal",mixamorigRightHandRing2:"rightRingIntermediate",mixamorigRightHandRing3:"rightRingDistal",mixamorigRightHandMiddle1:"rightMiddleProximal",mixamorigRightHandMiddle2:"rightMiddleIntermediate",mixamorigRightHandMiddle3:"rightMiddleDistal",mixamorigRightHandIndex1:"rightIndexProximal",mixamorigRightHandIndex2:"rightIndexIntermediate",mixamorigRightHandIndex3:"rightIndexDistal",mixamorigRightHandThumb1:"rightThumbMetacarpal",mixamorigRightHandThumb2:"rightThumbProximal",mixamorigRightHandThumb3:"rightThumbDistal",mixamorigLeftUpLeg:"leftUpperLeg",mixamorigLeftLeg:"leftLowerLeg",mixamorigLeftFoot:"leftFoot",mixamorigLeftToeBase:"leftToes",mixamorigRightUpLeg:"rightUpperLeg",mixamorigRightLeg:"rightLowerLeg",mixamorigRightFoot:"rightFoot",mixamorigRightToeBase:"rightToes"};function YG(n,e,t){var m;const r=Nu.findByName(n,"mixamo.com");if(r==null)return null;const i=[],s=new nt,o=new nt,a=new nt,l=new $,c=e.getObjectByName("mixamorigHips").position.y,A=(m=t.humanoid)==null?void 0:m.getNormalizedBoneNode("hips").getWorldPosition(l).y,u=t.scene.getWorldPosition(l).y,h=Math.abs(A-u)/c;return r.tracks.forEach(g=>{const p=g.clone(),v=p.name.split("."),w=v[0],x=wge[w],b=e.getObjectByName(w);if(x!=null){const B=v[1];if(b.getWorldQuaternion(s).invert(),b.parent.getWorldQuaternion(o),p instanceof tl){for(let M=0;M{p.values[L+M]=S})}i.push(new tl(`${x}.${B}`,p.times,p.values.map((M,I)=>{var S;return((S=t.meta)==null?void 0:S.metaVersion)==="0"&&I%2===0?-M:M})))}else if(p instanceof ic){const M=p.values.map((I,S)=>{var L;return(((L=t.meta)==null?void 0:L.metaVersion)==="0"&&S%3!==1?-I:I)*h});i.push(new ic(`${x}.${B}`,p.times,M))}}}),new Nu("vrmAnimation",r.duration,i)}const _ge=new Gae,xge=new Kz,ZB=.2,bge=n=>Math.floor(Math.random()*n);class NO{constructor(e,t,r,i,s,o,a){var l,c,A,u;this.mixer=new xoe(t),this.actions=[],this.to=null,this.from=null,this.vrm=r,this.animationManager=e,this.mixamoModel=null,this.fadeOutActions=null,this.newAnimationWeight=1,this.neckBone=(c=(l=r==null?void 0:r.humanoid)==null?void 0:l.humanBones)==null?void 0:c.neck,this.spineBone=(u=(A=r==null?void 0:r.humanoid)==null?void 0:A.humanBones)==null?void 0:u.spine,this.timeScale=1,i&&(this.setAnimations(i,null,null,a),this.to=this.actions[s],o!=-1&&(this.from=this.actions[o],this.from.reset(),this.from.time=e.getFromActionTime(),this.from.play(),this.to.weight=e.getWeightIn(),this.from.weight=e.getWeightOut()),this.actions[s].reset(),this.actions[s].time=e.getToActionTime(),this.actions[s].play())}setTimeScale(e){this.timeScale=e,this.actions.forEach(t=>{t.timeScale=e})}setMouseLookEnabled(e){this.setAnimations(this.animations,this.mixamoModel,e)}setAnimations(e,t=null,r=null,i=!1){if(r=r??this.animationManager.mouseLookEnabled,this.animations=e,t!=null){if(this.vrm!=null){const s=YG(e,t,this.vrm);s&&(e=[s],this.mixamoModel=t)}}else{const s=[];e.forEach(o=>{s.push(o.clone())}),e=s}if(r&&e[0].tracks.map((s,o)=>{(s.name==="neck.quaternion"||s.name==="spine.quaternion")&&e[0].tracks.splice(o,1)}),i){this.actions.forEach(s=>{s.weight=0,s.stop()}),this.actions=[],this.newAnimationWeight=1;for(let s=0;s{r.weight=1-this.newAnimationWeight}),this.newAnimationWeight>=1&&(this.newAnimationWeight=1,this.fadeOutActions.forEach(r=>{r.weight=0,r.stop()}),this.fadeOutActions=null),this.actions.forEach(r=>{r.weight=this.newAnimationWeight})),this.from!=null&&(this.from.weight=t),this.to!=null&&(this.to.weight=e),this.mixer.update(1/30)}reset(){this.mixer.setTime(0),this.to.paused=!0}resume(){this.to.paused=!1}setTime(e){this.mixer.setTime(e)}getTime(){return this.mixer.time}dispose(){this.animationManager.disposeAnimation(this)}}class Ege{constructor(){this.animationPaths=[],this.defaultAnimations=[],this.lastAnimID=null,this.mainControl=null,this.animationControl=null,this.animations=null,this.paused=!1,this.scale=1,this.curLoadAnim=0,this.currentAnimationName="",this.weightIn=NaN,this.weightOut=NaN,this.lastAnimID=-1,this.curAnimID=0,this.animationControls=[],this.started=!1,this.mouseLookEnabled=!1,this.mixamoModel=null,this.mixamoAnimations=null,this.currentClip=null,setInterval(()=>{this.update()},1e3/30)}enableMouseLook(e){this.mouseLookEnabled=e,this.animationControls.forEach(t=>{t.setMouseLookEnabled(e)})}setScale(e){this.scale=e}async loadAnimation(e,t,r=0,i=!0,s="",o=""){const a=s+(s!=""?"/":"")+ut(e)[0];o=o==""?Kl(a):o,this.currentAnimationName=o;const c=await(i?_ge:xge).loadAsync(a);c.scale.set(this.scale,this.scale,this.scale),this._scaleOffsetHips(c.animations);const A=Nu.findByName(c.animations,"mixamo.com");A!=null?(this.mixamoModel=c.clone(),this.mixamoAnimations=c.animations,this.currentClip=A):(this.mixamoModel=null,this.animations=c.animations,this.currentClip=c.animations[0]),this.mainControl==null&&(this.curAnimID=0,this.lastAnimID=-1,this.mainControl=new NO(this,c,null,c.animations,this.curAnimID,this.lastAnimID,t),this.animationControls.push(this.mainControl)),this.animationControls.forEach(u=>{u.setAnimations(c.animations,this.mixamoModel,this.mouseLookEnabled,t)}),this.setTime(r),t?this.pause():this.play()}getCurrentClip(){return this.currentClip}getCurrentClipDuration(){return this.currentClip?this.currentClip.duration:0}getCurrentAnimationName(){return this.currentAnimationName}clearCurrentAnimations(){this.animationPaths=this.defaultAnimations,this.animationControls=[],this.mainControl=null}storeAnimationPaths(e,t,r=!0){const i=ut(e);r?this.animationPaths=[...this.defaultAnimations,...i.map(s=>`${t}/${s}`)]:this.animationPaths=i.map(s=>t!=""?`${t}/${s}`:s)}storeDefaultAnimationPaths(e,t){const r=ut(e);this.defaultAnimations=r.map(i=>t!=""?`${t}/${i}`:i),this.animationPaths=this.defaultAnimations}loadNextAnimation(){this.curLoadAnim==this.animationPaths.length-1?this.curLoadAnim=0:this.curLoadAnim++,this.loadAnimation(this.animationPaths[this.curLoadAnim])}loadPreviousAnimation(){this.curLoadAnim==0?this.curLoadAnim=this.animationPaths.length-1:this.curLoadAnim--,this.loadAnimation(this.animationPaths[this.curLoadAnim])}enableScreenshot(){this.animationControls.forEach(e=>{e.reset()})}disableScreenshot(){this.animationControls.forEach(e=>{e.resume()})}_scaleOffsetHips(e){e.forEach(t=>{for(let r=0;rr.vrm===e);t!==-1&&this.animationControls.splice(t,1)[0].dispose()}getFromActionTime(){return this.mainControl.actions[this.lastAnimID].time}getToActionTime(){return this.mainControl?this.mainControl.actions[this.curAnimID].time:.1}getWeightIn(){return this.weightIn}getWeightOut(){return this.weightOut}disposeAnimation(e){if(e!=null){const t=this.animationControls.indexOf(e);t!=-1&&this.animationControls.splice(t,1)}}dispose(){this.animationControls.forEach(e=>{e.dispose()})}animRandomizer(e){setTimeout(()=>{this.lastAnimID=this.curAnimID,this.curAnimID=bge(this.animations.length),this.curAnimID!=this.lastAnimID&&this.animationControls.forEach(t=>{t.from=t.actions[this.lastAnimID],t.to=t.actions[this.curAnimID],this.weightIn=0,this.weightOut=1,t.to.play(),t.to.reset()}),this.animRandomizer(this.animations[this.curAnimID].duration-ZB)},e*1e3)}pause(){this.paused=!0}play(){this.paused=!1}isPaused(){return this.paused}setTime(e){this.mainControl&&this.animationControls.forEach(t=>{t.setTime(e)})}setFrame(e){this.setTime(e*30)}setSpeed(e){this.mainControl&&this.animationControls.forEach(t=>{t.setTimeScale(e)})}update(e=!1){(this.mainControl&&!this.paused||e)&&(this.animationControls.forEach(t=>{t.update(this.weightIn,this.weightOut)}),this.weightIn<1?this.weightIn+=1/(30*ZB):this.weightIn=1,this.weightOut>0?this.weightOut-=1/(30*ZB):this.weightOut=0)}}const Bge={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` + */var yr;(function(n){n[n.ARRAY_BUFFER=34962]="ARRAY_BUFFER",n[n.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.LINEAR=9729]="LINEAR",n[n.REPEAT=10497]="REPEAT"})(yr||(yr={}));const q_="blend_",pO="vrmColliderSphere";class wpe{parse(e,t,r,i){const s=e.humanoid,o=e.meta,a=e.materials,l={},c={},A={},u=e.lookAt,f={generator:"UniGLTF-2.0.0",version:"2.0"};if(t)if(s)if(o)if(a){if(!u)throw new Error("lookAt is undefined or null")}else throw new Error("materials is undefined or null");else throw new Error("meta is undefined or null");else throw new Error("humanoid is undefined or null");else throw new Error("avatar is undefined or null");const h=a.filter((ie,ge,_e)=>_e.findIndex(se=>se.name===ie.name.replace(" (Outline)",""))===ge).map(ie=>ie),d=h.map(ie=>ie.name),m=r?{name:"icon",imageBitmap:r.image}:null,g=h.filter(ie=>ie.map).map(ie=>{if(!ie.map)throw new Error(ie.name+" map is null");return{name:ie.name,imageBitmap:ie.map.image}}),p=h.filter(ie=>ie.userData.shadeTexture).map(ie=>{if(!ie.userData.shadeTexture)throw new Error(ie.userData.shadeTexture+" map is null");return{name:ie.name+"_shade",imageBitmap:ie.userData.shadeTexture.image}}),v=g.concat(p),w=Bpe(v,m),_=Mpe(w),x=Spe(w),b=Epe(h,v),B=t.children.filter(ie=>ie.children.length>0&&ie.children[0].type===Li.Bone)[0],S=UG(B).filter(ie=>ie.name!==pO),I=S.map(ie=>ie.name),M=S.map(ie=>({children:ie.children.filter(ge=>ge.name!==pO).map(ge=>I.indexOf(ge.name)),name:ie.name,rotation:[ie.quaternion.x,ie.quaternion.y,ie.quaternion.z,ie.quaternion.w],scale:[ie.scale.x,ie.scale.y,ie.scale.z],translation:[ie.position.x,ie.position.y,ie.position.z]})),L=[],D=t.children.filter(ie=>ie.type===Li.Group||ie.type===Li.SkinnedMesh),T=[];D.forEach(ie=>{const ge=ie.type===Li.Group?ie.children[0]:ie,_e=ge.geometry.attributes;T.push(new _l(_e.position,yr.FLOAT,cn.POSITION,Vo.VEC3,ge.name,void 0)),T.push(new _l(_e.normal,yr.FLOAT,cn.NORMAL,Vo.VEC3,ge.name,void 0)),T.push(new _l(_e.uv,yr.FLOAT,cn.UV,Vo.VEC2,ge.name,void 0)),T.push(new _l(_e.skinWeight,yr.FLOAT,cn.SKIN_WEIGHT,Vo.VEC4,ge.name,void 0)),T.push(new _l(_e.skinIndex,yr.UNSIGNED_SHORT,cn.SKIN_INDEX,Vo.VEC4,ge.name,void 0)),(ie.type===Li.Group?ie.children.map(H=>H):[ie]).forEach(H=>{if(!H.geometry.index)throw new Error(H.name+" geometry.index is null");T.push(new _l(H.geometry.index,yr.UNSIGNED_INT,cn.INDEX,Vo.SCALAR,ge.name,H.name))}),ge.morphTargetDictionary||(ge.morphTargetDictionary={},ge.morphTargetInfluences=[],ge.geometry.morphAttributes={},ge.updateMorphTargets()),ge.geometry.userData.targetNames=[];for(const H in e.expressionManager.expressionMap){const fe=e.expressionManager.expressionMap[H],Ae=fe._binds.map(q=>({node:S.length,index:q.index,weight:q.weight}));let J=!1;for(const q in Wr)if(H.toLowerCase()===Wr[q].toLowerCase()){l[Wr[q]]={morphTargetBinds:Ae,isBinary:fe.isBinary,overrideBlink:fe.overrideBlink,overrideLookAt:fe.overrideLookAt,overrideMouth:fe.overrideMouth},J=!0;break}!J&&H.toLowerCase()==="surprise"&&(l.surprised={morphTargetBinds:Ae,isBinary:fe.isBinary,overrideBlink:fe.overrideBlink,overrideLookAt:fe.overrideLookAt,overrideMouth:fe.overrideMouth},J=!0),J===!1&&(c[H]={morphTargetBinds:Ae,isBinary:fe.isBinary,overrideBlink:fe.overrideBlink,overrideLookAt:fe.overrideLookAt,overrideMouth:fe.overrideMouth})}for(const H in ge.morphTargetDictionary){ge.geometry.userData.targetNames.push(H);const fe=ge.morphTargetDictionary[H],Ae=ge.geometry.morphAttributes;T.push(new _l(Ae.position[fe],yr.FLOAT,cn.BLEND_POSITION,Vo.VEC3,ge.name,q_+H)),T.push(new _l(Ae.normal[fe],yr.FLOAT,cn.BLEND_NORMAL,Vo.VEC3,ge.name,q_+H))}}),Object.keys(l).length>0&&(A.preset=l),Object.keys(c).length>0&&(A.custom=c),D.forEach(ie=>{const ge=ie.type===Li.Group?ie.children[0]:ie,_e=new Float32Array(ge.skeleton.boneInverses.map(se=>se.elements).flat());T.push(new _l(new ct(_e,16),yr.FLOAT,cn.BIND_MATRIX,Vo.MAT4,ge.name,ge.name))}),L.push(...T.map(ie=>({bufferView:-1,byteOffset:0,componentType:ie.valueType,count:ie.attribute.count,max:ie.max,min:ie.min,normalized:!1,type:ie.accessorsType})));const y=xpe(D,T,d);D.forEach((ie,ge)=>{M.push({mesh:ge,name:ie.name,rotation:[ie.quaternion.x,ie.quaternion.y,ie.quaternion.z,ie.quaternion.w],scale:[ie.scale.x,ie.scale.y,ie.scale.z],skin:ge,translation:[ie.position.x,ie.position.y,ie.position.z]})});const E=bpe(D,T,I),R={offsetFromHeadBone:[0,0,0],rangeMapHorizontalInner:{inputMaxValue:u.applier.rangeMapHorizontalInner.inputMaxValue,outputScale:u.applier.rangeMapHorizontalInner.outputScale},rangeMapHorizontalOuter:{inputMaxValue:u.applier.rangeMapHorizontalOuter.inputMaxValue,outputScale:u.applier.rangeMapHorizontalOuter.outputScale},rangeMapVerticalDown:{inputMaxValue:u.applier.rangeMapVerticalDown.inputMaxValue,outputScale:u.applier.rangeMapVerticalDown.outputScale},rangeMapVerticalUp:{inputMaxValue:u.applier.rangeMapVerticalUp.inputMaxValue,outputScale:u.applier.rangeMapVerticalUp.outputScale},type:"bone"},F={humanBones:{}};for(const ie in s.humanBones)F.humanBones[ie]={node:I.indexOf(s.humanBones[ie].node.name)};const O=o,z=[];z.push(...v.map(ie=>({buffer:mO(ie.imageBitmap),type:cn.IMAGE}))),z.push(...T.map(ie=>({buffer:ie.buffer,type:ie.type}))),m&&z.push({buffer:mO(m.imageBitmap),type:cn.IMAGE});let j=0,Q=0,C=0;const W=z.map((ie,ge)=>{const _e={buffer:0,byteLength:ie.buffer.byteLength,byteOffset:j,target:ie.type===cn.IMAGE||ie.type===cn.BIND_MATRIX?void 0:ie.type===cn.INDEX?yr.ELEMENT_ARRAY_BUFFER:yr.ARRAY_BUFFER};return j+=ie.buffer.byteLength,ie.type===cn.IMAGE?w[Q++].bufferView=ge:L[C++].bufferView=ge,_e}),ee=Cpe(t,M),P={accessors:L,asset:f,buffers:[{byteLength:j}],bufferViews:W,extensions:{VRMC_vrm:{expressions:A,humanoid:F,lookAt:R,meta:O,specVersion:"1.0"}},extensionsUsed:["KHR_materials_unlit","KHR_texture_transform","VRMC_materials_mtoon","VRMC_vrm"],images:w,materials:b,meshes:y,nodes:M,samplers:_,avatar:0,scenes:ee,skins:E,textures:x},re=new gO(cT(JSON.stringify(P,void 0,2)),"JSON"),ue=new gO(Um(z.map(ie=>ie.buffer)),"BIN\0"),le=Um([re.buffer,ue.buffer]),me=Um([cT("glTF"),lT(2,4),lT(le.byteLength+12,4)]);i(Um([me,le]))}}function UG(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>UG(e)).flat())}function mO(n){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0);const t=e.toDataURL("image/png"),r=atob(t.split(",")[1]),i=new ArrayBuffer(r.length),s=new DataView(i);for(let o=0;o4?c=r[a*n.itemSize+l]:l===0?c=n.getX(a):l===1?c=n.getY(a):l===2?c=n.getZ(a):c=n.getW(a),e===yr.UNSIGNED_SHORT?o.setUint16(i,c,!0):e===yr.UNSIGNED_INT?o.setUint32(i,c,!0):o.setFloat32(i,c,!0),i+=t}return s}let gO=class{constructor(e,t){this.data=e,this.type=t;const r=this.data;this.buffer=Um([lT(r.byteLength,4),cT(this.type),r])}paddingBinary(e,t){const r=Math.ceil(e.byteLength/4)*4;if(e.byteLength===r)return e;const i=new Uint8Array(r);i.set(new Uint8Array(e),0);for(let s=e.byteLength;sl%3===0)),Math.max.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===1)),Math.max.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===2))]:void 0,this.min=r===cn.POSITION||r===cn.BLEND_POSITION?[Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===0)),Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===1)),Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===2))]:void 0}};var zh;(function(n){n.MeshBasicMaterial="MeshBasicMaterial",n.MeshStandardMaterial="MeshStandardMaterial",n.MToonMaterial="MToonMaterial"})(zh||(zh={}));var Vo;(function(n){n.SCALAR="SCALAR",n.VEC2="VEC2",n.VEC3="VEC3",n.VEC4="VEC4",n.MAT4="MAT4"})(Vo||(Vo={}));var cn;(function(n){n.POSITION="POSITION",n.NORMAL="NORMAL",n.UV="UV",n.INDEX="INDEX",n.SKIN_WEIGHT="SKIN_WEIGHT",n.SKIN_INDEX="SKIN_INDEX",n.BLEND_POSITION="BLEND_POSITION",n.BLEND_NORMAL="BLEND_NORMAL",n.BIND_MATRIX="BIND_MATRIX",n.IMAGE="IMAGE"})(cn||(cn={}));var Li;(function(n){n.Group="Group",n.SkinnedMesh="SkinnedMesh",n.Object3D="Object3D",n.Bone="Bone"})(Li||(Li={}));const xpe=(n,e,t)=>n.map(r=>{const i=r.type===Li.Group?r.children[0]:r,s=r.type===Li.Group?r.children.map(o=>o):[r];return{name:r.name,primitives:s.map(o=>{const a=e.map(c=>c.meshName===i.name?c.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(cn.SKIN_INDEX),NORMAL:a.indexOf(cn.NORMAL),POSITION:a.indexOf(cn.POSITION),TEXCOORD_0:a.indexOf(cn.UV),WEIGHTS_0:a.indexOf(cn.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(c=>c.type===cn.INDEX&&c.meshName===i.name?c.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(c=>({NORMAL:e.map(A=>A.type===cn.BLEND_NORMAL&&A.meshName===i.name?A.name:null).indexOf(q_+c),POSITION:e.map(A=>A.type===cn.BLEND_POSITION&&A.meshName===i.name?A.name:null).indexOf(q_+c)})):void 0}})}}),bpe=(n,e,t)=>n.map(r=>{const i=r.type===Li.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===cn.BIND_MATRIX?s.meshName:null).indexOf(i.name),joints:i.skeleton.bones.map(s=>t.indexOf(s.name)),skeleton:t.indexOf(i.skeleton.bones[0].name)}}),Epe=(n,e)=>n.map(t=>{let r,i=null;if(t=t.userData.vrmMaterial?t.userData.vrmMaterial:t,t.type==="ShaderMaterial")i=t.userData.gltfExtensions.VRMC_materials_mtoon,i.shadeMultiplyTexture={index:e.map(A=>A.name).indexOf(t.uniforms.shadeMultiplyTexture.name)},r=t.color?[1,1,1,1]:void 0;else{const c=t;r=c.color?[c.color.r,c.color.g,c.color.b,1]:void 0}let s=-1;t.map?s=e.map(c=>c.name).indexOf(t.name):t.uniforms&&t.uniforms.map&&(s=e.map(c=>c.name).indexOf(t.uniforms.map.name));const o=s>=0?{extensions:{KHR_texture_transform:{offset:[0,0],scale:[1,1]}},index:s,texCoord:0}:void 0,a=(()=>{switch(t.type){case zh.MeshStandardMaterial:return t.metalness;case zh.MeshBasicMaterial:return 0;default:return 0}})(),l=(()=>{switch(t.type){case zh.MeshStandardMaterial:return t.roughness;case zh.MeshBasicMaterial:return .9;default:return .9}})();return{alphaCutoff:t.alphaTest>0?t.alphaTest:void 0,alphaMode:t.transparent?"BLEND":t.alphaTest>0?"MASK":"OPAQUE",doubleSided:t.side===2,extensions:t.type==="ShaderMaterial"?{KHR_materials_unlit:{},VRMC_materials_mtoon:i}:void 0,name:t.name,pbrMetallicRoughness:{baseColorFactor:r,baseColorTexture:o,metallicFactor:a,roughnessFactor:l}}}),Bpe=(n,e)=>(e?n.concat(e):n).filter(t=>t&&t.imageBitmap).map(t=>({bufferView:-1,mimeType:"image/png",name:t.name})),Mpe=n=>n.map(()=>({magFilter:yr.LINEAR,minFilter:yr.LINEAR,wrapS:yr.REPEAT,wrapT:yr.REPEAT})),Spe=n=>n.map((e,t)=>({sampler:0,source:t})),Cpe=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===Li.Object3D||r.type===Li.SkinnedMesh||r.type===Li.Group||r.type===Li.Bone).map(r=>t.indexOf(r.name))}]},FG=0,Tpe=1,PG=2,vO=2,QB=1.25,yO=1,og=6*4+4+4,U1=65535,Ipe=Math.pow(2,-24),HB=Symbol("SKIP_GENERATION");function Rpe(n){return n.index?n.index.count:n.attributes.position.count}function Jd(n){return Rpe(n)/3}function Upe(n,e=ArrayBuffer){return n>65535?new Uint32Array(new e(4*n)):new Uint16Array(new e(2*n))}function Fpe(n,e){if(!n.index){const t=n.attributes.position.count,r=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=Upe(t,r);n.setIndex(new ct(i,1));for(let s=0;sl-c);for(let l=0;lo.offset-a.offset),i=r[r.length-1];i.count=Math.min(t-i.offset,i.count);let s=0;return r.forEach(({count:o})=>s+=o),t!==s}function zB(n,e,t,r,i){let s=1/0,o=1/0,a=1/0,l=-1/0,c=-1/0,A=-1/0,u=1/0,f=1/0,h=1/0,d=-1/0,m=-1/0,g=-1/0;for(let p=e*6,v=(e+t)*6;pl&&(l=b),wd&&(d=w);const B=n[p+2],S=n[p+3],I=B-S,M=B+S;Ic&&(c=M),Bm&&(m=B);const L=n[p+4],D=n[p+5],T=L-D,y=L+D;TA&&(A=y),Lg&&(g=L)}r[0]=s,r[1]=o,r[2]=a,r[3]=l,r[4]=c,r[5]=A,i[0]=u,i[1]=f,i[2]=h,i[3]=d,i[4]=m,i[5]=g}function Lpe(n,e=null,t=null,r=null){const i=n.attributes.position,s=n.index?n.index.array:null,o=Jd(n),a=i.normalized;let l;e===null?(l=new Float32Array(o*6),t=0,r=o):(l=e,t=t||0,r=r||o);const c=i.array,A=i.offset||0;let u=3;i.isInterleavedBufferAttribute&&(u=i.data.stride);const f=["getX","getY","getZ"];for(let h=t;hS&&(S=x),b>S&&(S=b);const I=(S-B)/2,M=w*2;l[m+M+0]=B+I,l[m+M+1]=I+(Math.abs(B)+I)*Ipe}}return l}function tr(n,e,t){return t.min.x=e[n],t.min.y=e[n+1],t.min.z=e[n+2],t.max.x=e[n+3],t.max.y=e[n+4],t.max.z=e[n+5],t}function wO(n){let e=-1,t=-1/0;for(let r=0;r<3;r++){const i=n[r+3]-n[r];i>t&&(t=i,e=r)}return e}function _O(n,e){e.set(n)}function xO(n,e,t){let r,i;for(let s=0;s<3;s++){const o=s+3;r=n[s],i=e[s],t[s]=ri?r:i}}function wy(n,e,t){for(let r=0;r<3;r++){const i=e[n+2*r],s=e[n+2*r+1],o=i-s,a=i+s;ot[r+3]&&(t[r+3]=a)}}function Yp(n){const e=n[3]-n[0],t=n[4]-n[1],r=n[5]-n[2];return 2*(e*t+t*r+r*e)}const Ml=32,Dpe=(n,e)=>n.candidate-e.candidate,Tc=new Array(Ml).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),_y=new Float32Array(6);function Npe(n,e,t,r,i,s){let o=-1,a=0;if(s===FG)o=wO(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(s===Tpe)o=wO(n),o!==-1&&(a=Ope(t,r,i,o));else if(s===PG){const l=Yp(n);let c=QB*i;const A=r*6,u=(r+i)*6;for(let f=0;f<3;f++){const h=e[f],g=(e[f+3]-h)/Ml;if(i=B.candidate?wy(_,t,B.rightCacheBounds):(wy(_,t,B.leftCacheBounds),B.count++)}}for(let _=0;_=Ml&&(b=Ml-1);const B=Tc[b];B.count++,wy(w,t,B.bounds)}const p=Tc[Ml-1];_O(p.bounds,p.rightCacheBounds);for(let w=Ml-2;w>=0;w--){const _=Tc[w],x=Tc[w+1];xO(_.bounds,x.rightCacheBounds,_.rightCacheBounds)}let v=0;for(let w=0;w=l;)a--;if(o=l;)a--;if(oHpe)throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return Fm[t+6]=c/4,c=uT(c,a),Fm[t+7]=l,c}}function Gpe(n,e){const t=(n.index?n.index.count:n.attributes.position.count)/3,r=t>2**16,i=r?4:2,s=e?new SharedArrayBuffer(t*i):new ArrayBuffer(t*i),o=r?new Uint32Array(s):new Uint16Array(s);for(let a=0,l=o.length;a=s&&(p=!0,o&&(console.warn(`MeshBVH: Max depth of ${s} reached when generating BVH. Consider increasing maxDepth.`),console.warn(f))),B<=a||I>=s)return w(b+B),x.offset=b,x.count=B,x;const M=Npe(x.boundingData,S,e,b,B,l);if(M.axis===-1)return w(b+B),x.offset=b,x.count=B,x;const L=d(u,h,e,b,B,M);if(L===b||L===b+B)w(b+B),x.offset=b,x.count=B;else{x.splitAxis=M.axis;const D=new GB,T=b,y=L-b;x.left=D,zB(e,T,y,D.boundingData,g),_(D,T,y,g,I+1);const E=new GB,R=L,F=B-y;x.right=E,zB(e,R,F,E.boundingData,g),_(E,R,F,g,I+1)}return x}}function jpe(n,e){const t=n.geometry;e.indirect&&(n._indirectBuffer=Gpe(t,e.useSharedArrayBuffer),Ppe(t,e.range)&&!e.verbose&&console.warn('MeshBVH: Provided geometry contains groups or a range that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),n._indirectBuffer||Fpe(t,e);const r=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=Lpe(t),s=e.indirect?LG(t,e.range):DG(t,e.range);n._roots=s.map(o=>{const a=Vpe(n,i,o.offset,o.count,e),l=AT(a),c=new r(og*l);return zpe(0,a,c),c})}class sc{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let r=1/0,i=-1/0;for(let s=0,o=e.length;si?l:i}this.min=r,this.max=i}setFromPoints(e,t){let r=1/0,i=-1/0;for(let s=0,o=t.length;si?l:i}this.min=r,this.max=i}isSeparated(e){return this.min>e.max||e.min>this.max}}sc.prototype.setFromBox=function(){const n=new $;return function(t,r){const i=r.min,s=r.max;let o=1/0,a=-1/0;for(let l=0;l<=1;l++)for(let c=0;c<=1;c++)for(let A=0;A<=1;A++){n.x=i.x*l+s.x*(1-l),n.y=i.y*c+s.y*(1-c),n.z=i.z*A+s.z*(1-A);const u=t.dot(n);o=Math.min(u,o),a=Math.max(u,a)}this.min=o,this.max=a}}();const Wpe=function(){const n=new $,e=new $,t=new $;return function(i,s,o){const a=i.start,l=n,c=s.start,A=e;t.subVectors(a,c),n.subVectors(i.end,i.start),e.subVectors(s.end,s.start);const u=t.dot(A),f=A.dot(l),h=A.dot(A),d=t.dot(l),g=l.dot(l)*h-f*f;let p,v;g!==0?p=(u*f-d*h)/g:p=0,v=(u+p*f)/h,o.x=p,o.y=v}}(),A2=function(){const n=new We,e=new $,t=new $;return function(i,s,o,a){Wpe(i,s,n);let l=n.x,c=n.y;if(l>=0&&l<=1&&c>=0&&c<=1){i.at(l,o),s.at(c,a);return}else if(l>=0&&l<=1){c<0?s.at(0,a):s.at(1,a),i.closestPointToPoint(a,!0,o);return}else if(c>=0&&c<=1){l<0?i.at(0,o):i.at(1,o),s.closestPointToPoint(o,!0,a);return}else{let A;l<0?A=i.start:A=i.end;let u;c<0?u=s.start:u=s.end;const f=e,h=t;if(i.closestPointToPoint(u,!0,e),s.closestPointToPoint(A,!0,t),f.distanceToSquared(u)<=h.distanceToSquared(A)){o.copy(f),a.copy(u);return}else{o.copy(A),a.copy(h);return}}}}(),Kpe=function(){const n=new $,e=new $,t=new Ra,r=new Wl;return function(s,o){const{radius:a,center:l}=s,{a:c,b:A,c:u}=o;if(r.start=c,r.end=A,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a||(r.start=c,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a)||(r.start=A,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a))return!0;const m=o.getPlane(t);if(Math.abs(m.distanceToPoint(l))<=a){const p=m.projectPoint(l,e);if(o.containsPoint(p))return!0}return!1}}(),Xpe=1e-15;function VB(n){return Math.abs(n)new $),this.satBounds=new Array(4).fill().map(()=>new sc),this.points=[this.a,this.b,this.c],this.sphere=new Mi,this.plane=new Ra,this.needsUpdate=!0}intersectsSphere(e){return Kpe(e,this)}update(){const e=this.a,t=this.b,r=this.c,i=this.points,s=this.satAxes,o=this.satBounds,a=s[0],l=o[0];this.getNormal(a),l.setFromPoints(a,i);const c=s[1],A=o[1];c.subVectors(e,t),A.setFromPoints(c,i);const u=s[2],f=o[2];u.subVectors(t,r),f.setFromPoints(u,i);const h=s[3],d=o[3];h.subVectors(r,e),d.setFromPoints(h,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}}ca.prototype.closestPointToSegment=function(){const n=new $,e=new $,t=new Wl;return function(i,s=null,o=null){const{start:a,end:l}=i,c=this.points;let A,u=1/0;for(let f=0;f<3;f++){const h=(f+1)%3;t.start.copy(c[f]),t.end.copy(c[h]),A2(t,i,n,e),A=n.distanceToSquared(e),A=2){(_===1?p.start:p.end).copy(h),w=2;break}if(w++,w===2&&_===-1)break}}return w}return function(g,p=null,v=!1){this.needsUpdate&&this.update(),g.isExtendedTriangle?g.needsUpdate&&g.update():(n.copy(g),n.update(),g=n);const w=this.plane,_=g.plane;if(Math.abs(w.normal.dot(_.normal))>1-1e-10){const x=this.satBounds,b=this.satAxes;t[0]=g.a,t[1]=g.b,t[2]=g.c;for(let I=0;I<4;I++){const M=x[I],L=b[I];if(r.setFromPoints(L,t),M.isSeparated(r))return!1}const B=g.satBounds,S=g.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let I=0;I<4;I++){const M=B[I],L=S[I];if(r.setFromPoints(L,e),M.isSeparated(r))return!1}for(let I=0;I<4;I++){const M=b[I];for(let L=0;L<4;L++){const D=S[L];if(s.crossVectors(M,D),r.setFromPoints(s,e),i.setFromPoints(s,t),r.isSeparated(i))return!1}}return p&&(v||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),p.start.set(0,0,0),p.end.set(0,0,0)),!0}else{const x=d(this,_,u);if(x===1&&g.containsPoint(u.end))return p&&(p.start.copy(u.end),p.end.copy(u.end)),!0;if(x!==2)return!1;const b=d(g,w,f);if(b===1&&this.containsPoint(f.end))return p&&(p.start.copy(f.end),p.end.copy(f.end)),!0;if(b!==2)return!1;if(u.delta(a),f.delta(l),a.dot(l)<0){let T=f.start;f.start=f.end,f.end=T}const B=u.start.dot(a),S=u.end.dot(a),I=f.start.dot(a),M=f.end.dot(a),L=S0?p.start.copy(u.start):p.start.copy(f.start),c.subVectors(u.end,f.end),c.dot(a)<0?p.end.copy(u.end):p.end.copy(f.end)),!0)}}}();ca.prototype.distanceToPoint=function(){const n=new $;return function(t){return this.closestPointToPoint(t,n),t.distanceTo(n)}}();ca.prototype.distanceToTriangle=function(){const n=new $,e=new $,t=["a","b","c"],r=new Wl,i=new Wl;return function(o,a=null,l=null){const c=a||l?r:null;if(this.intersectsTriangle(o,c))return(a||l)&&(a&&c.getCenter(a),l&&c.getCenter(l)),0;let A=1/0;for(let u=0;u<3;u++){let f;const h=t[u],d=o[h];this.closestPointToPoint(d,n),f=d.distanceToSquared(n),fnew $),this.satAxes=new Array(3).fill().map(()=>new $),this.satBounds=new Array(3).fill().map(()=>new sc),this.alignedSatBounds=new Array(3).fill().map(()=>new sc),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),r&&this.matrix.copy(r)}set(e,t,r){this.min.copy(e),this.max.copy(t),this.matrix.copy(r),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}zi.prototype.update=function(){return function(){const e=this.matrix,t=this.min,r=this.max,i=this.points;for(let c=0;c<=1;c++)for(let A=0;A<=1;A++)for(let u=0;u<=1;u++){const f=1*c|2*A|4*u,h=i[f];h.x=c?r.x:t.x,h.y=A?r.y:t.y,h.z=u?r.z:t.z,h.applyMatrix4(e)}const s=this.satBounds,o=this.satAxes,a=i[0];for(let c=0;c<3;c++){const A=o[c],u=s[c],f=1<new Wl),t=new Array(12).fill().map(()=>new Wl),r=new $,i=new $;return function(o,a=0,l=null,c=null){if(this.needsUpdate&&this.update(),this.intersectsBox(o))return(l||c)&&(o.getCenter(i),this.closestPointToPoint(i,r),o.closestPointToPoint(r,i),l&&l.copy(r),c&&c.copy(i)),0;const A=a*a,u=o.min,f=o.max,h=this.points;let d=1/0;for(let g=0;g<8;g++){const p=h[g];i.copy(p).clamp(u,f);const v=p.distanceToSquared(i);if(vnew ca)}}const vo=new Ype;class $pe{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const e=[];let t=null;this.setBuffer=r=>{t&&e.push(t),t=r,this.float32Array=new Float32Array(r),this.uint16Array=new Uint16Array(r),this.uint32Array=new Uint32Array(r)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,e.length!==0&&this.setBuffer(e.pop())}}}const Fn=new $pe;let eA,Gh;const Nf=[],xy=new u2(()=>new Hn);function Zpe(n,e,t,r,i,s){eA=xy.getPrimitive(),Gh=xy.getPrimitive(),Nf.push(eA,Gh),Fn.setBuffer(n._roots[e]);const o=fT(0,n.geometry,t,r,i,s);Fn.clearBuffer(),xy.releasePrimitive(eA),xy.releasePrimitive(Gh),Nf.pop(),Nf.pop();const a=Nf.length;return a>0&&(Gh=Nf[a-1],eA=Nf[a-2]),o}function fT(n,e,t,r,i=null,s=0,o=0){const{float32Array:a,uint16Array:l,uint32Array:c}=Fn;let A=n*2;if(Zi(A,l)){const f=Fs(n,c),h=po(A,l);return tr(n,a,eA),r(f,h,!1,o,s+n,eA)}else{let M=function(D){const{uint16Array:T,uint32Array:y}=Fn;let E=D*2;for(;!Zi(E,T);)D=mo(D),E=D*2;return Fs(D,y)},L=function(D){const{uint16Array:T,uint32Array:y}=Fn;let E=D*2;for(;!Zi(E,T);)D=go(D,y),E=D*2;return Fs(D,y)+po(E,T)};const f=mo(n),h=go(n,c);let d=f,m=h,g,p,v,w;if(i&&(v=eA,w=Gh,tr(d,a,v),tr(m,a,w),g=i(v),p=i(w),p($p.copy(e).clamp(A.min,A.max),$p.distanceToSquared(e)),intersectsBounds:(A,u,f)=>f{A.closestPointToPoint(e,$p);const f=e.distanceToSquared($p);return f=169,$A=new $,ZA=new $,JA=new $,by=new We,Ey=new We,By=new We,bO=new $,EO=new $,BO=new $,Zp=new $;function eme(n,e,t,r,i,s,o,a){let l;if(s===oi?l=n.intersectTriangle(r,t,e,!0,i):l=n.intersectTriangle(e,t,r,s!==_i,i),l===null)return null;const c=n.origin.distanceTo(i);return ca?null:{distance:c,point:i.clone()}}function tme(n,e,t,r,i,s,o,a,l,c,A){$A.fromBufferAttribute(e,s),ZA.fromBufferAttribute(e,o),JA.fromBufferAttribute(e,a);const u=eme(n,$A,ZA,JA,Zp,l,c,A);if(u){const f=new $;Kr.getBarycoord(Zp,$A,ZA,JA,f),r&&(by.fromBufferAttribute(r,s),Ey.fromBufferAttribute(r,o),By.fromBufferAttribute(r,a),u.uv=Kr.getInterpolation(Zp,$A,ZA,JA,by,Ey,By,new We)),i&&(by.fromBufferAttribute(i,s),Ey.fromBufferAttribute(i,o),By.fromBufferAttribute(i,a),u.uv1=Kr.getInterpolation(Zp,$A,ZA,JA,by,Ey,By,new We)),t&&(bO.fromBufferAttribute(t,s),EO.fromBufferAttribute(t,o),BO.fromBufferAttribute(t,a),u.normal=Kr.getInterpolation(Zp,$A,ZA,JA,bO,EO,BO,new $),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const h={a:s,b:o,c:a,normal:new $,materialIndex:0};Kr.getNormal($A,ZA,JA,h.normal),u.face=h,u.faceIndex=s,qpe&&(u.barycoord=f)}return u}function F1(n,e,t,r,i,s,o){const a=r*3;let l=a+0,c=a+1,A=a+2;const u=n.index;n.index&&(l=u.getX(l),c=u.getX(c),A=u.getX(A));const{position:f,normal:h,uv:d,uv1:m}=n.attributes,g=tme(t,f,h,d,m,l,c,A,e,s,o);return g?(g.faceIndex=r,i&&i.push(g),g):null}function Mr(n,e,t,r){const i=n.a,s=n.b,o=n.c;let a=e,l=e+1,c=e+2;t&&(a=t.getX(a),l=t.getX(l),c=t.getX(c)),i.x=r.getX(a),i.y=r.getY(a),i.z=r.getZ(a),s.x=r.getX(l),s.y=r.getY(l),s.z=r.getZ(l),o.x=r.getX(c),o.y=r.getY(c),o.z=r.getZ(c)}function nme(n,e,t,r,i,s,o,a){const{geometry:l,_indirectBuffer:c}=n;for(let A=r,u=r+i;Ab&&(b=D),T<_&&(_=T),T>B&&(B=T),yS&&(S=y)}return l[f+0]!==w||l[f+1]!==_||l[f+2]!==x||l[f+3]!==b||l[f+4]!==B||l[f+5]!==S?(l[f+0]=w,l[f+1]=_,l[f+2]=x,l[f+3]=b,l[f+4]=B,l[f+5]=S,!0):!1}else{const p=f+8,v=o[f+6],w=p+h,_=v+h;let x=d,b=!1,B=!1;e?x||(b=e.has(w),B=e.has(_),x=!b&&!B):(b=!0,B=!0);const S=x||b,I=x||B;let M=!1;S&&(M=u(p,h,x));let L=!1;I&&(L=u(v,h,x));const D=M||L;if(D)for(let T=0;T<3;T++){const y=p+T,E=v+T,R=l[y],F=l[y+3],O=l[E],z=l[E+3];l[f+T]=Rz?F:z}return D}}}function xA(n,e,t,r,i){let s,o,a,l,c,A;const u=1/t.direction.x,f=1/t.direction.y,h=1/t.direction.z,d=t.origin.x,m=t.origin.y,g=t.origin.z;let p=e[n],v=e[n+3],w=e[n+1],_=e[n+3+1],x=e[n+2],b=e[n+3+2];return u>=0?(s=(p-d)*u,o=(v-d)*u):(s=(v-d)*u,o=(p-d)*u),f>=0?(a=(w-m)*f,l=(_-m)*f):(a=(_-m)*f,l=(w-m)*f),s>l||a>o||((a>s||isNaN(s))&&(s=a),(l=0?(c=(x-g)*h,A=(b-g)*h):(c=(b-g)*h,A=(x-g)*h),s>A||c>o)?!1:((c>s||s!==s)&&(s=c),(A=r)}function ome(n,e,t,r,i,s,o,a){const{geometry:l,_indirectBuffer:c}=n;for(let A=r,u=r+i;A=0;let m,g;d?(m=mo(n),g=go(n,l)):(m=go(n,l),g=mo(n));const v=xA(m,o,r,i,s)?dT(m,e,t,r,i,s):null;if(v){const x=v.point[f];if(d?x<=o[g+u]:x>=o[g+u+3])return v}const _=xA(g,o,r,i,s)?dT(g,e,t,r,i,s):null;return v&&_?v.distance<=_.distance?v:_:v||_||null}}const My=new Hn,Of=new ca,kf=new ca,Jp=new He,MO=new zi,Sy=new zi;function fme(n,e,t,r){Fn.setBuffer(n._roots[e]);const i=pT(0,n,t,r);return Fn.clearBuffer(),i}function pT(n,e,t,r,i=null){const{float32Array:s,uint16Array:o,uint32Array:a}=Fn;let l=n*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),MO.set(t.boundingBox.min,t.boundingBox.max,r),i=MO),Zi(l,o)){const A=e.geometry,u=A.index,f=A.attributes.position,h=t.index,d=t.attributes.position,m=Fs(n,a),g=po(l,o);if(Jp.copy(r).invert(),t.boundsTree)return tr(n,s,Sy),Sy.matrix.copy(Jp),Sy.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:v=>Sy.intersectsBox(v),intersectsTriangle:v=>{v.a.applyMatrix4(r),v.b.applyMatrix4(r),v.c.applyMatrix4(r),v.needsUpdate=!0;for(let w=m*3,_=(g+m)*3;w<_;w+=3)if(Mr(kf,w,u,f),kf.needsUpdate=!0,v.intersectsTriangle(kf))return!0;return!1}});for(let p=m*3,v=(g+m)*3;pWB.distanceToBox(x),intersectsBounds:(x,b,B)=>B{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:S=>qp.distanceToBox(S),intersectsBounds:(S,I,M)=>M{for(let M=S,L=S+I;Mb&&(b=y),E<_&&(_=E),E>B&&(B=E),RS&&(S=R)}}return l[f+0]!==w||l[f+1]!==_||l[f+2]!==x||l[f+3]!==b||l[f+4]!==B||l[f+5]!==S?(l[f+0]=w,l[f+1]=_,l[f+2]=x,l[f+3]=b,l[f+4]=B,l[f+5]=S,!0):!1}else{const p=f+8,v=o[f+6],w=p+h,_=v+h;let x=d,b=!1,B=!1;e?x||(b=e.has(w),B=e.has(_),x=!b&&!B):(b=!0,B=!0);const S=x||b,I=x||B;let M=!1;S&&(M=u(p,h,x));let L=!1;I&&(L=u(v,h,x));const D=M||L;if(D)for(let T=0;T<3;T++){const y=p+T,E=v+T,R=l[y],F=l[y+3],O=l[E],z=l[E+3];l[f+T]=Rz?F:z}return D}}}function yme(n,e,t,r,i,s,o){Fn.setBuffer(n._roots[e]),mT(0,n,t,r,i,s,o),Fn.clearBuffer()}function mT(n,e,t,r,i,s,o){const{float32Array:a,uint16Array:l,uint32Array:c}=Fn,A=n*2;if(Zi(A,l)){const f=Fs(n,c),h=po(A,l);ome(e,t,r,f,h,i,s,o)}else{const f=mo(n);xA(f,a,r,s,o)&&mT(f,e,t,r,i,s,o);const h=go(n,c);xA(h,a,r,s,o)&&mT(h,e,t,r,i,s,o)}}const wme=["x","y","z"];function _me(n,e,t,r,i,s){Fn.setBuffer(n._roots[e]);const o=gT(0,n,t,r,i,s);return Fn.clearBuffer(),o}function gT(n,e,t,r,i,s){const{float32Array:o,uint16Array:a,uint32Array:l}=Fn;let c=n*2;if(Zi(c,a)){const u=Fs(n,l),f=po(c,a);return ame(e,t,r,u,f,i,s)}else{const u=NG(n,l),f=wme[u],d=r.direction[f]>=0;let m,g;d?(m=mo(n),g=go(n,l)):(m=go(n,l),g=mo(n));const v=xA(m,o,r,i,s)?gT(m,e,t,r,i,s):null;if(v){const x=v.point[f];if(d?x<=o[g+u]:x>=o[g+u+3])return v}const _=xA(g,o,r,i,s)?gT(g,e,t,r,i,s):null;return v&&_?v.distance<=_.distance?v:_:v||_||null}}const Ty=new Hn,Qf=new ca,Hf=new ca,em=new He,SO=new zi,Iy=new zi;function xme(n,e,t,r){Fn.setBuffer(n._roots[e]);const i=vT(0,n,t,r);return Fn.clearBuffer(),i}function vT(n,e,t,r,i=null){const{float32Array:s,uint16Array:o,uint32Array:a}=Fn;let l=n*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),SO.set(t.boundingBox.min,t.boundingBox.max,r),i=SO),Zi(l,o)){const A=e.geometry,u=A.index,f=A.attributes.position,h=t.index,d=t.attributes.position,m=Fs(n,a),g=po(l,o);if(em.copy(r).invert(),t.boundsTree)return tr(n,s,Iy),Iy.matrix.copy(em),Iy.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:v=>Iy.intersectsBox(v),intersectsTriangle:v=>{v.a.applyMatrix4(r),v.b.applyMatrix4(r),v.c.applyMatrix4(r),v.needsUpdate=!0;for(let w=m,_=g+m;w<_;w++)if(Mr(Hf,3*e.resolveTriangleIndex(w),u,f),Hf.needsUpdate=!0,v.intersectsTriangle(Hf))return!0;return!1}});for(let p=m,v=g+m;pKB.distanceToBox(x),intersectsBounds:(x,b,B)=>B{if(e.boundsTree){const B=e.boundsTree;return B.shapecast({boundsTraverseOrder:S=>tm.distanceToBox(S),intersectsBounds:(S,I,M)=>M{for(let M=S,L=S+I;Mnew Hn),zf=new Hn,Gf=new Hn,XB=new Hn,YB=new Hn;let $B=!1;function Tme(n,e,t,r){if($B)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");$B=!0;const i=n._roots,s=e._roots;let o,a=0,l=0;const c=new He().copy(t).invert();for(let A=0,u=i.length;Al.slice()),index:o?o.array.slice():null,indirectBuffer:s?s.slice():null}:a={roots:i,index:o?o.array:null,indirectBuffer:s},a}static deserialize(e,t,r={}){r={setIndex:!0,indirect:!!e.indirectBuffer,...r};const{index:i,roots:s,indirectBuffer:o}=e,a=new f2(t,{...r,[HB]:!0});if(a._roots=s,a._indirectBuffer=o||null,r.setIndex){const l=t.getIndex();if(l===null){const c=new ct(e.index,1,!1);t.setIndex(c)}else l.array!==i&&(l.array.set(i),l.needsUpdate=!0)}return a}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({...Ime,[HB]:!1},t),t.useSharedArrayBuffer&&!Cme())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[HB]||(jpe(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new Hn))),this.resolveTriangleIndex=t.indirect?r=>this._indirectBuffer[r]:r=>r}refit(e=null){return(this.indirect?vme:sme)(this,e)}traverse(e,t=0){const r=this._roots[t],i=new Uint32Array(r),s=new Uint16Array(r);o(0);function o(a,l=0){const c=a*2,A=s[c+15]===U1;if(A){const u=i[a+6],f=s[c+14];e(l,A,new Float32Array(r,a*4,6),u,f)}else{const u=a+og/4,f=i[a+6],h=i[a+7];e(l,A,new Float32Array(r,a*4,6),h)||(o(u,l+1),o(f,l+1))}}}raycast(e,t=Hs,r=0,i=1/0){const s=this._roots,o=this.geometry,a=[],l=t.isMaterial,c=Array.isArray(t),A=o.groups,u=l?t.side:t,f=this.indirect?yme:cme;for(let h=0,d=s.length;hu(f,h,d,m,g)?!0:r(f,h,this,a,d,m,t)}else o||(a?o=(u,f,h,d)=>r(u,f,this,a,h,d,t):o=(u,f,h)=>h);let l=!1,c=0;const A=this._roots;for(let u=0,f=A.length;u{const m=this.resolveTriangleIndex(d);Mr(o,m*3,a,l)}:d=>{Mr(o,d*3,a,l)},A=vo.getPrimitive(),u=e.geometry.index,f=e.geometry.attributes.position,h=e.indirect?d=>{const m=e.resolveTriangleIndex(d);Mr(A,m*3,u,f)}:d=>{Mr(A,d*3,u,f)};if(s){const d=(m,g,p,v,w,_,x,b)=>{for(let B=p,S=p+v;BUy.intersectsBox(r),intersectsTriangle:r=>Uy.intersectsTriangle(r)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,r={},i={},s=0,o=1/0){return(this.indirect?Sme:gme)(this,e,t,r,i,s,o)}closestPointToPoint(e,t={},r=0,i=1/0){return Jpe(this,e,t,r,i)}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(r=>{tr(0,new Float32Array(r),CO),e.union(CO)}),e}}function TO(n,e,t){return n===null?null:(n.point.applyMatrix4(e.matrixWorld),n.distance=n.point.distanceTo(t.ray.origin),n.object=e,n)}const Fy=new $u,IO=new $,RO=new He,Rme=dn.prototype.raycast,Ume=Ese.prototype.raycast,UO=new $,ei=new dn,Py=[];function Fme(n,e){this.isBatchedMesh?Pme.call(this,n,e):Lme.call(this,n,e)}function Pme(n,e){if(this.boundsTrees){const t=this.boundsTrees,r=this._drawInfo,i=this._drawRanges,s=this.matrixWorld;ei.material=this.material,ei.geometry=this.geometry;const o=ei.geometry.boundsTree,a=ei.geometry.drawRange;ei.geometry.boundingSphere===null&&(ei.geometry.boundingSphere=new Mi);for(let l=0,c=r.length;l{const e=n.attributes.position,t=n.index,r=new Kr,i=new $,s=new $,o=new $,a=[];for(let l=0;l{const e=n.geometry.clone();let t=[];if(Array.isArray(n.material))for(let i=0;i{n.isMesh&&(n.geometry.userData.faceNormals=null,n.geometry.dispose(),n.geometry.disposeBoundsTree(),n.parent&&n.parent.remove(n),n.userData.cancelMesh&&Nw(n.userData.cancelMesh))},QG=n=>{var e,t;n.userData.cullingClone&&(Nw(n.userData.cullingClone),n.userData.cullingClone=null,Nw(n.userData.cullingCloneP),n.userData.cullingCloneP=null,Nw(n.userData.cullingCloneN),n.userData.cullingCloneN=null,((e=n.userData)==null?void 0:e.clippedIndexGeometry)!=null&&(n.userData.clippedIndexGeometry=null),((t=n.userData)==null?void 0:t.origIndexBuffer)!=null&&(n.userData.origIndexBuffer=null))},Vme=async n=>{if(n==null){console.warn("Null parameter for meshes was provided. Skipping mesh culling.");return}if(!Array.isArray(n)){console.warn("No valid mesh array was provided. Skipping mesh culling.");return}if(n.length==0){console.warn("No mesh array with elements was provided. Skipping mesh culling.");return}const e=[];Pm=n[0].parent,Pm.lines!=null&&(Pm.lines.forEach(i=>{i.visible=!1}),Pm.lines.length=0),n.forEach(i=>{if(i.userData.cullLayer!=null){i.userData.origIndexBuffer==null&&(i.userData.origIndexBuffer=i.geometry.index.clone()),e[i.userData.cullLayer]==null&&(e[i.userData.cullLayer]={origMeshes:[],cloneMeshes:[],posMeshes:[],negMeshes:[],scaleMeshes:[],positionMeshes:[]}),i.userData.cullingClone==null&&(i.userData.cullingClone=Gme(i),i.userData.cullingCloneP=i.userData.cullingClone.clone(),i.userData.cullingCloneN=i.userData.cullingClone.clone());const s=i.userData.cullingClone,o=i.userData.cullingCloneP,a=i.userData.cullingCloneN;o.material=Qme,a.userData.cancelMesh=o,a.material=Hme,o.userData.maxCullDistance=a.userData.maxCullDistance=i.userData.maxCullDistance,e[i.userData.cullLayer].origMeshes.push(i),e[i.userData.cullLayer].cloneMeshes.push(s),e[i.userData.cullLayer].posMeshes.push(o),e[i.userData.cullLayer].negMeshes.push(a),i.geometry.setIndex(i.userData.origIndexBuffer)}});for(let i=e.length-1;i>=0;i--)e[i]==null&&e.splice(i,1);let t=[];const r=[];for(let i=e.length-1;i>=0;i--){if(t.length!=0||e.length>=1)for(let s=0;s{i.geom.setIndex(i.index)})},jme=n=>{let e=Ome,t=kme;return n&&(isNaN(n)?Array.isArray(n)&&(isNaN(n[0])||(e=n[0]),isNaN(n[1])||(t=n[1])):e=n),[e,t]},Wme=(n,e,t,r,i,s,o=!1)=>{const a=[],l=jme(s);let c=l[0],A=l[1];Ly.far=c+A;for(let f=0;f=0;v--)c-p[v].distance>=p[v].object.userData.maxCullDistance&&p.splice(v,1);if(p.length===0){for(let v=0;v<3;v++)a.push(n[h+v]);break}else{const v=p.map(w=>w.object);for(let w=0;ww).length===0){for(let w=0;w<3;w++)a.push(n[h+w]);break}if(m===0)d=p.map(w=>w.object);else if(d=p.map(w=>{if(d.indexOf(w.object)!==-1)return w.object}),d=d.filter(w=>w),m===2&&d.filter(w=>w).length===0)for(let w=0;w<3;w++)a.push(n[h+w]);o&&Kme(ZB,nm.clone().multiplyScalar(-1),Ly.far,16711680,Pm)}}}const u=new Uint32Array(a);return new ct(u,1,!1)};function Kme(n,e,t,r,i){i.lines==null&&(i.lines=[]);let s=new $;s.addVectors(n,e.clone().multiplyScalar(t));const o=[];o.push(n),o.push(s);const a=new Jt().setFromPoints(o),l=[];l.push(new Qe(0)),l.push(new Qe(16777215));let c=new Ac({color:r});var A=new Yd(a,c);A.renderOrder=100,i.add(A),i.lines.push(A)}function Xme(n,e=10){if(n<=0)return[];const t=n,r=[{w:e,h:e,x:0,y:0}];function i(o,a,l,c){if(a<=0)return;const A=o.w/2,u=[{w:A,h:A,x:l,y:c},{w:A,h:A,x:l+A,y:c},{w:A,h:A,x:l,y:c+A},{w:A,h:A,x:l+A,y:c+A}];r.push(...u);const f=r.find(p=>p.x===l&&p.y===c&&p.w===o.w&&p.h===o.h);if(r.splice(r.indexOf(f),1),n<=r.length)return;const h=Math.max(...r.map(p=>p.w)),d=r.find(p=>p.w===h),m=d.x,g=d.y;i({w:d.w,h:d.h},a-1,m,g)}if(n==1)return{squares:r,fill:1};for(i({w:e,h:e},t,0,0),r.sort((o,a)=>a.w-o.w);r.length>n;)r.pop();const s=r.reduce((o,a)=>o+a.w*a.h,0)/(e*e);return{squares:r,fill:s}}class P1{constructor(e,t){Ne(this,"width");Ne(this,"height");Ne(this,"cameraRTT",null);Ne(this,"sceneRTT",null);Ne(this,"materials",[]);Ne(this,"quads",[]);Ne(this,"renderer",null);Ne(this,"rtTexture",null);this.width=e,this.height=t}_addPlane(e,t=0){if(!this.sceneRTT)return;const r=new qi({side:_i,transparent:!0,opacity:1,color:new Qe(1,1,1)});this.materials.push(r);const i=new cc(1,1),s=new dn(i,r);s.position.z=t*1e-4,s.scale.set(this.width,this.height,1),this.quads.push(s),this.sceneRTT.add(s)}render(e,t,r,i,s=!0){var c;const o=ut(e);if(o.length===0&&(e=ut(P1.createSolidColorTexture(r,this.width,this.height))),this.renderer==null){this.sceneRTT=new Gg,this.cameraRTT=new v0(-this.width/2,this.width/2,this.height/2,-this.height/2,-1e4,1e4),this.cameraRTT.position.z=100,this.sceneRTT.add(this.cameraRTT);for(let A=0;A{A==null||A.scale.set(this.width,this.height,1)}),this.renderer.setSize(this.width,this.height);if(o.length>this.materials.length){const A=o.length-this.materials.length;for(let u=0;uo.length)for(let A=o.length;A{var i;(i=r.map)==null||i.dispose(),r.map=null})}destroy(){var e,t;this.cameraRTT=null,(e=this.sceneRTT)==null||e.clear(),this.sceneRTT=null,this.materials.forEach(r=>{var i;(i=r.map)==null||i.dispose(),r.map=null}),this.quads.forEach(r=>{var i;(i=this.sceneRTT)==null||i.remove(r),r=null}),this.materials.length=0,this.quads.length=0,(t=this.renderer)==null||t.dispose(),this.renderer=null,this.rtTexture=null}static createSolidColorTexture(e,t,r){const i=t*r,s=new Uint8Array(4*i),o=Math.floor(e.r*255),a=Math.floor(e.g*255),l=Math.floor(e.b*255);for(let A=0;Atypeof window>"u"?await Zme({meshes:e,atlasSize:r,mtoon:i,transparentMaterial:s,transparentTexture:o}):await Jme({backColor:n,meshes:e,atlasSize:r,mtoon:i,includeNonTexturedMeshesInAtlas:t,transparentMaterial:s,transparentTexture:o,twoSidedMaterial:a}),Zme=async({meshes:n,atlasSize:e,mtoon:t,transparentMaterial:r,transparentTexture:i})=>{const s=e,o=["diffuse"],a=[];n.forEach(b=>{const B=b.material;let S=a.find(I=>I.material===B);if(!S)a.push({material:B,mesh:b});else{const{dest:I}=L1({meshes:[S.mesh,b]});S.mesh.geometry=I}});const l=Object.fromEntries(o.map(b=>[b,d2({width:s,height:s,transparent:i})])),c=Math.floor(Math.sqrt(n.length)+1),A=s/c,u=new Map(a.map((b,B)=>{const S=new We(B%c,Math.floor(B/c)).multiplyScalar(1/c),I=new We(S.x+1/c,S.y+1/c);return[b.mesh,{min:S,max:I}]})),f=[],h=[];a.forEach(b=>{const{min:B,max:S}=u.get(b.mesh);h.push(S),f.push(B)});const d=new We(Math.max(...h.map(b=>b.x)),Math.max(...h.map(b=>b.y))),m=new We(Math.min(...f.map(b=>b.x)),Math.min(...f.map(b=>b.y))),g=1/(d.x-m.x),p=1/(d.y-m.y),v=A*g,w=A*p,_=new Map(a.map(b=>{let{min:B,max:S}=u.get(b.mesh);return B.x=B.x*g,B.y=B.y*p,S.x=S.x*g,S.y=S.y*p,[b.mesh,{min:B,max:S}]}));a.forEach(b=>{const{material:B,mesh:S}=b,{min:I,max:M}=_.get(S);o.forEach(y=>{const E=l[y];E.globalCompositeOperation="source-over";let R=tx(B,yT[y].find(F=>tx(B,F)));if(R!==""&&R!==void 0)try{const F=new Uint8ClampedArray(R.data),O=new ImageData(F,v,w),z=document.createElement("canvas");z.width=v,z.height=w;const j=z.getContext("2d");j.putImageData(O,0,0),j.save(),E.drawImage(z,I.x*s,I.y*s,v,w)}catch(F){console.error("error",F)}else E.fillStyle=y==="diffuse"?`#${B.color.clone().getHexString()}`:y==="normal"?"#bcbcff":y==="orm"?`#${new Qe(B.aoMapIntensity,B.roughness,B.metalness).getHexString()}`:"#7F7F7F",E.fillRect(I.x*s,I.y*s,v,w)});const L=S.geometry,D=L.attributes.uv;if(D)for(let y=0;y{const B=new Un(l[b].canvas);return B.flipY=!1,[b,B]})));return{bakeObjects:a,textures:x,uvs:_}},Jme=async({backColor:n,includeNonTexturedMeshesInAtlas:e=!1,meshes:t,atlasSize:r,mtoon:i,transparentMaterial:s,transparentTexture:o,twoSidedMaterial:a})=>{const l=r,c=i?["diffuse"]:["diffuse","orm","normal"],A=[];let u=null;t.forEach(F=>{F=F.clone();const O=F.material.length==null?F.material:F.material[0];i&&u==null&&O.type=="ShaderMaterial"&&(u=O.clone());let z=A.find(j=>{j.material});if(!z)A.push({material:O,mesh:F});else{const{dest:j}=L1({meshes:[z.mesh,F]});z.mesh.geometry=j}});const f=Object.fromEntries(c.map(F=>[F,d2({width:l,height:l,transparent:o&&F=="diffuse"})])),h=new Set,d=new Map,m=A.map(F=>{const O=F.mesh.geometry;if(e==!1){if(!F.mesh.visible)return h.add(F.mesh),[F.mesh,0];let z=!0;for(const j of c)for(const Q of yT[j])if(tx(F.material,Q)&&z){z=!1;break}if(z){const j=F.material;if(j instanceof mr)return[F.mesh,2];if(d.size==0)return d.set(j,[F.mesh]),[F.mesh,1];for(let[Q,C]of Array.from(d.entries()))if((()=>Q.color.r.toFixed(5)==j.color.r.toFixed(5)&&Q.color.g.toFixed(5)==j.color.g.toFixed(5)&&Q.color.b.toFixed(5)==j.color.b.toFixed(5)&&Q.emissive.equals(j.emissive)&&Q.aoMapIntensity==j.aoMapIntensity&&Q.metalness==j.metalness&&Q.normalScale.equals(j.normalScale)&&Q.roughness==j.roughness&&Q.transparent==j.transparent&&Q.vertexColors==j.vertexColors)())return C.push(F.mesh),[F.mesh,0];return d.set(j,[F.mesh]),[F.mesh,1]}}return[F.mesh,O.index?O.index.count/3:O.attributes.position.count/3]}).sort((F,O)=>O[1]-F[1]),g=m.filter(([,F])=>F!=0),{squares:p,fill:v}=Xme(g.length,l);console.log("squaresplit",v);const w=p.map(F=>({x:F.x,y:F.y,width:F.w,height:F.h})),_=new Map(w.map((F,O)=>[m[O][0],F]));d.forEach(F=>{if(F.length>1){const O=_.get(F[0]);F.forEach(z=>{_.set(z,O)})}});const x=new Map(Array.from(_.entries()).map(([F,O])=>{const z=new We(O.x,O.y),j=new We(O.x+O.width,O.y+O.height);return[F,{min:z,max:j}]})),b=[];Array.from(_.keys()).forEach(F=>{if(h.has(F))return;const{min:O,max:z}=x.get(F);b.push(O)});const B=new We(Math.min(...b.map(F=>F.x)),Math.min(...b.map(F=>F.y))),S=1/(l-B.x),I=1/(l-B.y),M=new Map(Array.from(_.keys()).map(F=>{if(h.has(F))return;let{min:O,max:z}=x.get(F);return O.x=O.x*S,O.y=O.y*I,z.x=z.x*S,z.y=z.y*I,[F,{min:O,max:z}]}).filter(F=>F));let L=!1;const D=new P1(l,l);Array.from(_.keys()).forEach(F=>{const O=A.find(re=>re.mesh===F),{material:z}=O;let j,Q;const C=M.get(F);if(C?(j=C.min,Q=C.max):(j=new We(0,0),Q=new We(0,0)),!h.has(O.mesh)){const re=_.get(F).width,ue=_.get(F).height;c.forEach(le=>{var H;const me=f[le];me.globalCompositeOperation="source-over";let ie,ge=new Qe(1,1,1);switch(le){case"diffuse":ie=z.color||n,(H=z.uniforms)!=null&&H.litFactor?ge=z.uniforms.litFactor.value:ge=z.color;break;case"normal":ie=new Qe(12369151);break;case"orm":ie=new Qe(0,z.roughness,z.metalness);break;default:ie=new Qe(1,1,1);break}let _e=Yme(z,yT[le].find(fe=>tx(z,fe)));L==!1&&le=="normal"&&_e!=null&&(L=!0);const se=D.render(_e,ge,ie,le=="diffuse"&&o,le!="normal");createImageBitmap(se).then(fe=>me.drawImage(fe,j.x*l,j.y*l,re,ue))})}const W=F.geometry.clone();F.geometry=W;const ee=W.attributes.uv.clone();if(W.attributes.uv=ee,ee)for(let re=0;re{const O=new Un(f[F].canvas);return O.flipY=!1,[F,O]}))),y=a?_i:Hs;let E;const R=s?"transparent":"opaque";return i?(E=new Od({map:T.diffuse,transparent:s,side:y}),u==null&&(u=new xG),u.side=y,u.uniforms.map=T.diffuse,u.uniforms.shadeMultiplyTexture=T.diffuse,u.transparent=s,o&&!s&&(E.alphaTest=.5,u.alphaTest=.5),E.userData.vrmMaterial=u,E.userData.shadeTexture=T.uniformColor,E.name="mToon_"+R,E.map.name=E.name):(E=new Od({map:T.diffuse,roughnessMap:T.orm,metalnessMap:T.orm,normalMap:L?T.normal:null,transparent:s,side:y}),o&&!s&&(E.alphaTest=.5),E.name="standard_"+R,E.roughnessMap!=null&&(E.roughnessMap.name=E.name+"_orm"),E.normalMap!=null&&(E.normalMap.name=E.name+"_normal")),{bakeObjects:A,material:E}};function HG(n){const e=new Map;for(const r of n.skeleton.bones){const i=r.clone(!1);e.set(r,i)}n.skeleton.bones[0].traverse(r=>{if(r.type!=="Bone")return;const i=e.get(r);for(const s of r.children){const o=e.get(s);o&&i.add(o)}});const t=new FA(n.skeleton.bones.map(r=>e.get(r)));return t.boneInverses=n.skeleton.boneInverses,t.pose(),t}function zG(n,e){const t=new Map;new $(-1,1,-1),new He,new $;let r=0;n.forEach(l=>{if(l.skeleton){var c=HG(l);const A=c.bones;c.bones.forEach((u,f)=>{var h;if(A.indexOf(u)!==-1){const d=t.get(u.name);if(d==null){const m={index:r,boneInverses:c.boneInverses[f],bone:u.clone(!1),parentName:((h=u.parent)==null?void 0:h.type)=="Bone"?u.parent.name:null};r++,t.set(u.name,m)}else u.userData.VRMcolliders!=null&&(d.bone.userData.VRMcolliders==null?d.bone.userData.VRMcolliders=u.userData.VRMcolliders:u.userData.VRMcollidersID!=d.bone.userData.VRMcollidersID&&(d.bone.userData.VRMcolliders=[...d.bone.userData.VRMcolliders,...u.userData.VRMcolliders]))}})}});const i=[],s=[];[...t.values()].forEach(l=>{var c;if(i.push(l.bone),s.push(l.boneInverses),l.parentName!=null){const A=(c=t.get(l.parentName))==null?void 0:c.bone;A&&A.add(l.bone)}});const a=new FA(i,s);return a.bones.forEach(l=>{var A;const c=(A=l.userData)==null?void 0:A.vrm0RestPosition;c&&l.position.set(-c.x,c.y,-c.z),l.position.set(l.position.x*e,l.position.y*e,l.position.z*e)}),a}function qme(n,e){if(!e.skeleton)return;const t=new Map;if(e.skeleton){e.skeleton.bones.forEach((o,a)=>{const l=n.bones.filter(A=>A.name===o.name),c=l.length>0?n.bones.indexOf(l[0]):-1;t.set(a,c)});const r=[],i=e.geometry.attributes.skinIndex.array;for(let o=0;oe.indexOf(t)===r)}function ege(n){const t=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array].filter(r=>n.constructor===r);return t.length&&t[0]||null}function nx(n,e){const t=[];for(let s=0;ss.name===r.name);return i?t.bones.indexOf(i):-1}async function rge(n,e,t){const{scale:r,isVrm0:i,mergeAppliedMorphs:s}=t,o=[],a=[],l=kd(n,"SkinnedMesh"),c=jG(e),A=VG(e).map(h=>h.id);l.forEach(h=>{const d=h.clone();o.push(d),Array.isArray(h.material)?a.push(...h.material):a.push(h.material)});const u=zG(o,r),f=new Lt;return f.name="AvatarRoot",o.forEach(h=>{var L,D;const d=new Jt,m={};for(const T in h.geometry.attributes){const y=h.geometry.attributes[T];m[T]=y.clone()}const g={merge:new Set,keep:new Set(c),remove:new Set};if(s){if(!h.morphTargetDictionary||!h.morphTargetInfluences)return;A.forEach(T=>{const y=h.morphTargetDictionary[T];if(y!==void 0&&h.morphTargetInfluences[y]>0)g.merge.add(T);else return g.remove.add(T),null})}if((L=h.userData)!=null&&L.isVRM0)for(let T=0;T[T,T.morphTargetDictionary||{}])),morphTargetInfluences:new Map(l.map(T=>[T,T.morphTargetInfluences||[]])),index:null,animations:{}},{dest:v,destMorphToMerge:w}=L1({meshes:[h],scale:r,morphTargetsProcess:g},i);if(i)for(let T=0;Th.name===e.userData.boneName),s=e.userData.globalPosition,o=e.userData.globalScale||new $(1,1,1),a=e.userData.globalRotationMatrix;t.add(r.bones[0]);const l=[],c=[],A=t.geometry.attributes.position.array,u=new $,f=e.userData.isVRM0?-1:1;for(let h=0;hE.id);for(const E in I){const R=I[E],F=R.meshArray;if(F.length>0){const{bakeObjects:O,material:z}=await $me({transparentColor:r,atlasSize:R.size,meshes:F,mtoon:R.isMtoon,includeNonTexturedMeshesInAtlas:l,transparentMaterial:R.transparentMaterial,transparentTexture:b,twoSidedMaterial:d}),j=O.map(le=>le.mesh),Q=[],C={merge:new Set,keep:new Set(Object.keys(M)),remove:new Set};j.forEach(le=>{if(le.type=="Mesh"&&(le=sge(S,le)),Q.push(le),u){if(!le.morphTargetDictionary||!le.morphTargetInfluences)return;L.forEach(fe=>{const Ae=le.morphTargetDictionary[fe];if(Ae!==void 0&&le.morphTargetInfluences[Ae]>0)C.merge.add(fe);else return C.remove.add(fe),null})}const me=le.geometry,ie=me.index.array,ge=GG(le.geometry.index.array),_e=[];for(let fe=0;fe{const me=ue.morphTargetDictionary[le];me!==void 0&&(ue.userData.bindMorphs.new[le]={index:me,primitives:[ue.id]})}),B.userData.atlasMaterial.push(z)}}const D=(y=Object.values(e).find(E=>{var R;return(R=E==null?void 0:E.vrm)==null?void 0:R.expressionManager}))==null?void 0:y.vrm.expressionManager;return B.userData.expressionManagerToClone=D,B.add(S.bones[0]),B}function VG(n){var t;return((t=Object.values(n).filter(r=>r)[0])==null?void 0:t.traitInfo.manifestData.getAllBlendShapeTraits())||[]}function jG(n){const e=Object.values(n).map(i=>i==null?void 0:i.vrm).filter(i=>!!i).map(i=>{var s;return(s=i.expressionManager)==null?void 0:s.expressionMap}),t={};let r=[];for(const i of e)if(i)for(const s of Object.values(i)){if(r.includes(s.expressionName))continue;r.push(s.expressionName);const o=s._binds;!o||o.length==0||o.forEach(a=>{function l(A){const f=a.primitives.map(h=>h.morphTargetDictionary).filter(h=>!!h).find(h=>Object.values(h).includes(A));if(f)return Object.entries(f).find(([,h])=>h==A)}const c=l(a.index);c&&(t[c[0]]={index:c[1],primitives:a.primitives.map(A=>A.id)})})}return t}function PO({meshes:n,sourceMorphTargetDictionaries:e,destMorphTargetDictionary:t}){const r=[];return Object.entries(t).map(([i,s])=>{const o=n.find(l=>e.get(l).hasOwnProperty(i)),a=o.morphTargetDictionary[i];r[s]=o.morphTargetInfluences[a]}),r}function age({sourceAttributes:n}){const e=new Set,t=Array.from(n.values());t.forEach(i=>{Object.keys(i).forEach(s=>e.add(s))});const r={};return Array.from(e.keys()).map(i=>{r[i]=Kz(t.map(s=>s[i]).flat().filter(s=>s!==void 0))}),r}function LO(n){const{sourceMorphTargetDictionaries:e,morphTargetsProcess:t}=n,r=new Set;Array.from(e.values()).forEach(o=>{Object.keys(o).forEach(a=>{if(!t)r.add(a);else{if(t.remove.has(a)||t.merge.has(a))return;t.keep.has(a)&&r.add(a)}})});const s={};return Array.from(r.keys()).map((o,a)=>{s[o]=a}),s}function DO({meshes:n,sourceMorphTargetDictionaries:e,sourceMorphAttributes:t,destMorphTargetDictionary:r,scale:i}){const s=new Set;Array.from(t.values()).forEach(A=>{Object.keys(A).forEach(u=>s.add(u))});const a=Array.from(s),l={};a.forEach(A=>{l[A]=[],Object.entries(r).forEach(([u,f])=>{l[A][f]=[],n.forEach(h=>{let d;const m=e.get(h);if(m.hasOwnProperty(u)&&h.geometry.morphAttributes[A]){const g=m[u];d=h.geometry.morphAttributes[A][g]}else{const g=h.geometry.attributes[A],p=new g.array.constructor(new Array(g.array.length).fill(0));d=new ct(p,g.itemSize,g.normalized)}l[A][f].push(d)})})});const c={};return a.forEach(A=>{c[A]=[];for(let u=0;u{const i=r.geometry.index;for(var s=0;s{var h;if(i+=f.geometry.attributes.uv.count,(h=f.userData)!=null&&h.isVRM0)for(let d=0;d[f,f.geometry.attributes])),morphAttributes:new Map(n.map(f=>[f,f.geometry.morphAttributes])),morphTargetDictionaries:new Map(n.map(f=>[f,f.morphTargetDictionary||{}])),morphTargetInfluences:new Map(n.map(f=>[f,f.morphTargetInfluences||[]]))},o={attributes:null,morphTargetDictionary:null,morphAttributes:null,morphTargetInfluences:null,index:null,animations:{}};o.attributes=age({sourceAttributes:s.attributes});const a=LO({sourceMorphTargetDictionaries:s.morphTargetDictionaries,morphTargetsProcess:{remove:(t==null?void 0:t.remove)||new Set,keep:(t==null?void 0:t.keep)||new Set,merge:(t==null?void 0:t.merge)||new Set}});o.morphTargetDictionary=a,o.morphAttributes=DO({meshes:n,sourceMorphAttributes:s.morphAttributes,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:a,scale:e}),o.morphTargetInfluences=PO({meshes:n,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:a}),o.index=lge({meshes:n});const l={morphAttributes:{},morphTargetDictionaries:{},morphTargetInfluences:null};let c=new Set((t==null?void 0:t.keep)||[]);t==null||t.merge.forEach(f=>{c.add(f)});const A=LO({sourceMorphTargetDictionaries:s.morphTargetDictionaries,morphTargetsProcess:{remove:new Set,keep:c,merge:new Set}});l.morphAttributes=DO({meshes:n,sourceMorphAttributes:s.morphAttributes,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:A,scale:e});const u=PO({meshes:n,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:A});return l.morphTargetInfluences=u,l.morphTargetDictionaries=A,o.animations={},{source:s,dest:o,destMorphToMerge:l}}function ut(n){return n==null?[]:Array.isArray(n)?n:[n]}function cge(n,e){let t=n.children.slice();t.forEach(r=>n.remove(r)),n.add(e),t.forEach(r=>n.add(r))}async function Age(n,e){const r=await new PA().load(e);r.colorSpace=Ut,r.flipY=!1,n.traverse(i=>{if(i instanceof dn){const s=Array.isArray(i.material)?i.material:[i.material];for(let o=0;o{const e=[];for(const t in n){const r=n[t].vrm;if(r){const i=r.data.cullingLayer;i>=0&&r.data.cullingMeshes.map(s=>{s.userData.cullLayer=i,s.userData.cullDistance=r.data.cullingDistance,s.userData.maxCullDistance=r.data.maxCullingDistance,e.push(s)})}}Vme(e)};function uge(n){const e=[],t=[],r=[],i=[];let s=!1;return n.forEach(o=>{var c;const l=ut(o.material)[0];l.type=="ShaderMaterial"?l.transparent==!0?(i.push(o),s=!0):(r.push(o),((c=l.uniforms.alphaTest)==null?void 0:c.value)!=0&&(s=!0)):l.transparent==!0?(t.push(o),s=!0):(e.push(o),l.alphaTest!=0&&(s=!0))}),{stdMesh:e,stdTranspMesh:t,mToonMesh:r,mToonTranspMesh:i,requiresTransparency:s}}function fge(n){const e=[],t=[],r=[],i=[],s=[],o=[];return n.forEach(a=>{ut(a.material).forEach(c=>{c.type=="ShaderMaterial"?c.transparent==!0?o.push(c):c.uniforms.alphaTest.value!=0?s.push(c):i.push(c):c.transparent==!0?r.push(c):c.alphaTest!=0?t.push(c):e.push(c)})}),{stdMats:e,stdCutoutpMats:t,stdTranspMats:r,mToonMats:i,mToonCutoutMats:s,mToonTranspMats:o}}function NO(n,e){n.data==null?n.data=e:n.data={...n.data,...e}}function hge(n,e){if(n.data!=null)return n.data[e]}function dge(n){const e=hge(n,"cullingMeshes");e&&(e.forEach(t=>{QG(t)}),n.data.cullingMeshes=null)}function Nn(n){switch(n){case 1:return 128;case 2:return 256;case 3:return 512;case 4:return 1024;case 5:return 2048;case 6:return 4096;case 7:return 8192;case 8:return 16384;default:return 4096}}function pge(n){const e=n.scene;dge(n),e.traverse(t=>{t.material&&wT(t.material),t.geometry&&(QG(t),t.geometry.dispose(),t.geometry.disposeBoundsTree())}),e.parent&&e.parent.remove(e),B0.deepDispose(e),n.expressionManager&&n.expressionManager.expressions.forEach(t=>{t._binds&&t._binds.forEach(r=>{r.primitives&&r.primitives.forEach(i=>{i.geometry.dispose(),i.material&&wT(i.material)})})});for(const t in n)n[t]=null}const wT=n=>{var e,t,r,i,s,o;if(n.length)for(let a=0;a{let e,t,r=0;return Array.isArray(n)?(e=n[0]||0,t=n[1]||0,r=n[2]||0):(typeof n=="string"||n instanceof String)&&n.split("-").forEach(s=>{switch(s=s.toLowerCase(),s){case"left":e=-1;break;case"right":e=1;break;case"bottom":case"down":t=-1;break;case"top":case"up":t=1;break;case"back":case"backward":r=-1;break;case"front":case"forward":r=1;break;default:console.warn("unkown cameraPosition name: "+s+" in: "+n+". Please use left, right, bottom, top, back or front");break}}),new $(e,t,r)},WG=()=>{const n=new Date().getTime(),e=Math.random().toString(36).substr(2,9);return n+"-"+e},mge=n=>{var t,r,i,s,o,a,l,c,A,u,f;const e=n.humanoid.humanBones;e.hips.node.parent.name="rootBone",e.upperChest==null&&e.neck.node.parent!=e.chest&&(e.neck.node.parent!=e.chest.node?e.upperChest={node:e.neck.node.parent}:e.upperChest!=null&&(e.upperChest={node:e.neck.node.parent},e.chest={node:e.neck.node.parent.parent})),e.leftShoulder==null&&(e.leftUpperArm.node.parent!=((t=e.chest)==null?void 0:t.node)&&e.leftUpperArm.node.parent!=((r=e.upperChest)==null?void 0:r.node)&&e.leftUpperArm.node.parent!=((i=e.spine)==null?void 0:i.node)&&e.leftUpperArm.node.parent!=((s=e.neck)==null?void 0:s.node)&&e.leftUpperArm.node.parent!=((o=e.head)==null?void 0:o.node),e.leftShoulder={node:e.leftUpperArm.node.parent}),e.rightShoulder==null&&(e.rightUpperArm.node.parent!=((a=e.chest)==null?void 0:a.node)&&e.rightUpperArm.node.parent!=((l=e.upperChest)==null?void 0:l.node)&&e.rightUpperArm.node.parent!=((c=e.spine)==null?void 0:c.node)&&e.rightUpperArm.node.parent!=((A=e.neck)==null?void 0:A.node)&&e.rightUpperArm.node.parent!=((u=e.head)==null?void 0:u.node),e.rightShoulder={node:e.rightUpperArm.node.parent});for(let h in Jg)h=h.charAt(0).toLowerCase()+h.slice(1),(f=e[h])!=null&&f.node&&(e[h].node.name=h)};function KG({candidates:n,predicate:e}){if(!n.length)return null;const t=n.shift();return e(t)?t:(n=n.concat(t.children),KG({candidates:n,predicate:e}))}function XG(n,e){return KG({candidates:[n],predicate:t=>t.name===e})}function YG({candidates:n,predicate:e,results:t=[]}){if(!n.length)return t;const r=n.shift();return e(r)&&t.push(r),n=n.concat(r.children),YG({candidates:n,predicate:e,results:t})}function kd(n,e){return YG({candidates:[n],predicate:t=>ut(e).includes(t.type)})}function gge(n,e){if(!n.morphTargetDictionary)return!1;for(const t of Object.keys(n.morphTargetDictionary))if(e[t])return!0;return!1}function d2({width:n,height:e,transparent:t}){const r=document.createElement("canvas");r.width=n,r.height=e;const i=r.getContext("2d");return i.fillStyle="white",t&&(i.globalAlpha=0),i.fillRect(0,0,r.width,r.height),i.globalAlpha=1,i}const vge={mixamorigHips:"hips",mixamorigSpine:"spine",mixamorigSpine1:"chest",mixamorigSpine2:"upperChest",mixamorigNeck:"neck",mixamorigHead:"head",mixamorigLeftShoulder:"leftShoulder",mixamorigLeftArm:"leftUpperArm",mixamorigLeftForeArm:"leftLowerArm",mixamorigLeftHand:"leftHand",mixamorigLeftHandThumb1:"leftThumbMetacarpal",mixamorigLeftHandThumb2:"leftThumbProximal",mixamorigLeftHandThumb3:"leftThumbDistal",mixamorigLeftHandIndex1:"leftIndexProximal",mixamorigLeftHandIndex2:"leftIndexIntermediate",mixamorigLeftHandIndex3:"leftIndexDistal",mixamorigLeftHandMiddle1:"leftMiddleProximal",mixamorigLeftHandMiddle2:"leftMiddleIntermediate",mixamorigLeftHandMiddle3:"leftMiddleDistal",mixamorigLeftHandRing1:"leftRingProximal",mixamorigLeftHandRing2:"leftRingIntermediate",mixamorigLeftHandRing3:"leftRingDistal",mixamorigLeftHandPinky1:"leftLittleProximal",mixamorigLeftHandPinky2:"leftLittleIntermediate",mixamorigLeftHandPinky3:"leftLittleDistal",mixamorigRightShoulder:"rightShoulder",mixamorigRightArm:"rightUpperArm",mixamorigRightForeArm:"rightLowerArm",mixamorigRightHand:"rightHand",mixamorigRightHandPinky1:"rightLittleProximal",mixamorigRightHandPinky2:"rightLittleIntermediate",mixamorigRightHandPinky3:"rightLittleDistal",mixamorigRightHandRing1:"rightRingProximal",mixamorigRightHandRing2:"rightRingIntermediate",mixamorigRightHandRing3:"rightRingDistal",mixamorigRightHandMiddle1:"rightMiddleProximal",mixamorigRightHandMiddle2:"rightMiddleIntermediate",mixamorigRightHandMiddle3:"rightMiddleDistal",mixamorigRightHandIndex1:"rightIndexProximal",mixamorigRightHandIndex2:"rightIndexIntermediate",mixamorigRightHandIndex3:"rightIndexDistal",mixamorigRightHandThumb1:"rightThumbMetacarpal",mixamorigRightHandThumb2:"rightThumbProximal",mixamorigRightHandThumb3:"rightThumbDistal",mixamorigLeftUpLeg:"leftUpperLeg",mixamorigLeftLeg:"leftLowerLeg",mixamorigLeftFoot:"leftFoot",mixamorigLeftToeBase:"leftToes",mixamorigRightUpLeg:"rightUpperLeg",mixamorigRightLeg:"rightLowerLeg",mixamorigRightFoot:"rightFoot",mixamorigRightToeBase:"rightToes"};function $G(n,e,t){var m;const r=ku.findByName(n,"mixamo.com");if(r==null)return null;const i=[],s=new nt,o=new nt,a=new nt,l=new $,c=e.getObjectByName("mixamorigHips").position.y,A=(m=t.humanoid)==null?void 0:m.getNormalizedBoneNode("hips").getWorldPosition(l).y,u=t.scene.getWorldPosition(l).y,h=Math.abs(A-u)/c;return r.tracks.forEach(g=>{const p=g.clone(),v=p.name.split("."),w=v[0],x=vge[w],b=e.getObjectByName(w);if(x!=null){const B=v[1];if(b.getWorldQuaternion(s).invert(),b.parent.getWorldQuaternion(o),p instanceof nl){for(let S=0;S{p.values[L+S]=M})}i.push(new nl(`${x}.${B}`,p.times,p.values.map((S,I)=>{var M;return((M=t.meta)==null?void 0:M.metaVersion)==="0"&&I%2===0?-S:S})))}else if(p instanceof ic){const S=p.values.map((I,M)=>{var L;return(((L=t.meta)==null?void 0:L.metaVersion)==="0"&&M%3!==1?-I:I)*h});i.push(new ic(`${x}.${B}`,p.times,S))}}}),new ku("vrmAnimation",r.duration,i)}const yge=new Hae,wge=new Xz,qB=.2,_ge=n=>Math.floor(Math.random()*n);class OO{constructor(e,t,r,i,s,o,a){var l,c,A,u;this.mixer=new woe(t),this.actions=[],this.to=null,this.from=null,this.vrm=r,this.animationManager=e,this.mixamoModel=null,this.fadeOutActions=null,this.newAnimationWeight=1,this.neckBone=(c=(l=r==null?void 0:r.humanoid)==null?void 0:l.humanBones)==null?void 0:c.neck,this.spineBone=(u=(A=r==null?void 0:r.humanoid)==null?void 0:A.humanBones)==null?void 0:u.spine,this.timeScale=1,i&&(this.setAnimations(i,null,null,a),this.to=this.actions[s],o!=-1&&(this.from=this.actions[o],this.from.reset(),this.from.time=e.getFromActionTime(),this.from.play(),this.to.weight=e.getWeightIn(),this.from.weight=e.getWeightOut()),this.actions[s].reset(),this.actions[s].time=e.getToActionTime(),this.actions[s].play())}setTimeScale(e){this.timeScale=e,this.actions.forEach(t=>{t.timeScale=e})}setMouseLookEnabled(e){this.setAnimations(this.animations,this.mixamoModel,e)}setAnimations(e,t=null,r=null,i=!1){if(r=r??this.animationManager.mouseLookEnabled,this.animations=e,t!=null){if(this.vrm!=null){const s=$G(e,t,this.vrm);s&&(e=[s],this.mixamoModel=t)}}else{const s=[];e.forEach(o=>{s.push(o.clone())}),e=s}if(r&&e[0].tracks.map((s,o)=>{(s.name==="neck.quaternion"||s.name==="spine.quaternion")&&e[0].tracks.splice(o,1)}),i){this.actions.forEach(s=>{s.weight=0,s.stop()}),this.actions=[],this.newAnimationWeight=1;for(let s=0;s{r.weight=1-this.newAnimationWeight}),this.newAnimationWeight>=1&&(this.newAnimationWeight=1,this.fadeOutActions.forEach(r=>{r.weight=0,r.stop()}),this.fadeOutActions=null),this.actions.forEach(r=>{r.weight=this.newAnimationWeight})),this.from!=null&&(this.from.weight=t),this.to!=null&&(this.to.weight=e),this.mixer.update(1/30)}reset(){this.mixer.setTime(0),this.to.paused=!0}resume(){this.to.paused=!1}setTime(e){this.mixer.setTime(e)}getTime(){return this.mixer.time}dispose(){this.animationManager.disposeAnimation(this)}}class xge{constructor(){this.animationPaths=[],this.defaultAnimations=[],this.lastAnimID=null,this.mainControl=null,this.animationControl=null,this.animations=null,this.paused=!1,this.scale=1,this.curLoadAnim=0,this.currentAnimationName="",this.weightIn=NaN,this.weightOut=NaN,this.lastAnimID=-1,this.curAnimID=0,this.animationControls=[],this.started=!1,this.mouseLookEnabled=!1,this.mixamoModel=null,this.mixamoAnimations=null,this.currentClip=null,setInterval(()=>{this.update()},1e3/30)}enableMouseLook(e){this.mouseLookEnabled=e,this.animationControls.forEach(t=>{t.setMouseLookEnabled(e)})}setScale(e){this.scale=e}async loadAnimation(e,t,r=0,i=!0,s="",o=""){const a=s+(s!=""?"/":"")+ut(e)[0];o=o==""?Kl(a):o,this.currentAnimationName=o;const c=await(i?yge:wge).loadAsync(a);c.scale.set(this.scale,this.scale,this.scale),this._scaleOffsetHips(c.animations);const A=ku.findByName(c.animations,"mixamo.com");A!=null?(this.mixamoModel=c.clone(),this.mixamoAnimations=c.animations,this.currentClip=A):(this.mixamoModel=null,this.animations=c.animations,this.currentClip=c.animations[0]),this.mainControl==null&&(this.curAnimID=0,this.lastAnimID=-1,this.mainControl=new OO(this,c,null,c.animations,this.curAnimID,this.lastAnimID,t),this.animationControls.push(this.mainControl)),this.animationControls.forEach(u=>{u.setAnimations(c.animations,this.mixamoModel,this.mouseLookEnabled,t)}),this.setTime(r),t?this.pause():this.play()}getCurrentClip(){return this.currentClip}getCurrentClipDuration(){return this.currentClip?this.currentClip.duration:0}getCurrentAnimationName(){return this.currentAnimationName}clearCurrentAnimations(){this.animationPaths=this.defaultAnimations,this.animationControls=[],this.mainControl=null}storeAnimationPaths(e,t,r=!0){const i=ut(e);r?this.animationPaths=[...this.defaultAnimations,...i.map(s=>`${t}/${s}`)]:this.animationPaths=i.map(s=>t!=""?`${t}/${s}`:s)}storeDefaultAnimationPaths(e,t){const r=ut(e);this.defaultAnimations=r.map(i=>t!=""?`${t}/${i}`:i),this.animationPaths=this.defaultAnimations}loadNextAnimation(){this.curLoadAnim==this.animationPaths.length-1?this.curLoadAnim=0:this.curLoadAnim++,this.loadAnimation(this.animationPaths[this.curLoadAnim])}loadPreviousAnimation(){this.curLoadAnim==0?this.curLoadAnim=this.animationPaths.length-1:this.curLoadAnim--,this.loadAnimation(this.animationPaths[this.curLoadAnim])}enableScreenshot(){this.animationControls.forEach(e=>{e.reset()})}disableScreenshot(){this.animationControls.forEach(e=>{e.resume()})}_scaleOffsetHips(e){e.forEach(t=>{for(let r=0;rr.vrm===e);t!==-1&&this.animationControls.splice(t,1)[0].dispose()}getFromActionTime(){return this.mainControl.actions[this.lastAnimID].time}getToActionTime(){return this.mainControl?this.mainControl.actions[this.curAnimID].time:.1}getWeightIn(){return this.weightIn}getWeightOut(){return this.weightOut}disposeAnimation(e){if(e!=null){const t=this.animationControls.indexOf(e);t!=-1&&this.animationControls.splice(t,1)}}dispose(){this.animationControls.forEach(e=>{e.dispose()})}animRandomizer(e){setTimeout(()=>{this.lastAnimID=this.curAnimID,this.curAnimID=_ge(this.animations.length),this.curAnimID!=this.lastAnimID&&this.animationControls.forEach(t=>{t.from=t.actions[this.lastAnimID],t.to=t.actions[this.curAnimID],this.weightIn=0,this.weightOut=1,t.to.play(),t.to.reset()}),this.animRandomizer(this.animations[this.curAnimID].duration-qB)},e*1e3)}pause(){this.paused=!0}play(){this.paused=!1}isPaused(){return this.paused}setTime(e){this.mainControl&&this.animationControls.forEach(t=>{t.setTime(e)})}setFrame(e){this.setTime(e*30)}setSpeed(e){this.mainControl&&this.animationControls.forEach(t=>{t.setTimeScale(e)})}update(e=!1){(this.mainControl&&!this.paused||e)&&(this.animationControls.forEach(t=>{t.update(this.weightIn,this.weightOut)}),this.weightIn<1?this.weightIn+=1/(30*qB):this.weightIn=1,this.weightOut>0?this.weightOut-=1/(30*qB):this.weightOut=0)}}const bge={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` varying vec2 vUv; @@ -4936,7 +4936,7 @@ void main() { gl_FragColor = opacity * texel; - }`};class qd{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const Sge=new g0(-1,1,1,-1,0,1);class Mge extends Jt{constructor(){super(),this.setAttribute("position",new xn([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new xn([0,2,0,0,2,0],2))}}const Cge=new Mge;class d2{constructor(e){this._mesh=new dn(Cge,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,Sge)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class Tge extends qd{constructor(e,t){super(),this.textureID=t!==void 0?t:"tDiffuse",e instanceof mr?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=NR.clone(e.uniforms),this.material=new mr({name:e.name!==void 0?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new d2(this.material)}render(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class OO extends qd{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,r){const i=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0);let o,a;this.inverse?(o=0,a=1):(o=1,a=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),s.buffers.stencil.setFunc(i.ALWAYS,o,4294967295),s.buffers.stencil.setClear(a),s.buffers.stencil.setLocked(!0),e.setRenderTarget(r),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.color.setMask(!0),s.buffers.depth.setMask(!0),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(i.EQUAL,1,4294967295),s.buffers.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),s.buffers.stencil.setLocked(!0)}}class Ige extends qd{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class Rge{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){const r=e.getSize(new je);this._width=r.width,this._height=r.height,t=new el(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:ka}),t.texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new Tge(Bge),this.copyPass.material.blending=jl,this.clock=new jR}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t 0.0 ? (1.0 - depthEdgeCoefficient * dei) : (1.0 + normalEdgeCoefficient * nei); gl_FragColor = texel * coefficient; } - `})}}function Ly(n,e,t){const r=new el(n.x,n.y,t?{depthTexture:new kR(n.x,n.y),depthBuffer:!0}:void 0);return r.texture.format=e,r.texture.minFilter=Kr,r.texture.magFilter=Kr,r.texture.generateMipmaps=!1,r.stencilBuffer=!1,r}class Pge extends qd{constructor(e){super(),this.resolution=e,this.fsQuad=new d2(this.material())}setResolution(e){this.resolution=e}render(e,t,r){const i=this.fsQuad.material.uniforms;i.tDiffuse.value=r.texture,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear()),this.fsQuad.render(e)}material(){return new mr({uniforms:{tDiffuse:{value:null},resolution:{value:new Pt(this.resolution.x,this.resolution.y,1/this.resolution.x,1/this.resolution.y)}},vertexShader:` + `})}}function Dy(n,e,t){const r=new tl(n.x,n.y,t?{depthTexture:new HR(n.x,n.y),depthBuffer:!0}:void 0);return r.texture.format=e,r.texture.minFilter=Xr,r.texture.magFilter=Xr,r.texture.generateMipmaps=!1,r.stencilBuffer=!1,r}class Uge extends qd{constructor(e){super(),this.resolution=e,this.fsQuad=new p2(this.material())}setResolution(e){this.resolution=e}render(e,t,r){const i=this.fsQuad.material.uniforms;i.tDiffuse.value=r.texture,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear()),this.fsQuad.render(e)}material(){return new mr({uniforms:{tDiffuse:{value:null},resolution:{value:new Pt(this.resolution.x,this.resolution.y,1/this.resolution.x,1/this.resolution.y)}},vertexShader:` varying vec2 vUv; void main() { vUv = uv; @@ -5023,12 +5023,12 @@ void main() { texel.rgb = pow(texel.rgb, vec3(1.0 / 2.2)); gl_FragColor = texel; } - `})}}const nm=new $;class Lge{constructor(e){We(this,"camera",null);We(this,"frameOffset",{min:.2,max:.2});We(this,"boneOffsets");We(this,"cameraDir",new $);We(this,"frameTarget",null);this.camera=e||new Fr,this.boneOffsets={head:null,neck:null,chest:null,hips:null,spine:null,leftUpperLeg:null,leftLowerLeg:null,leftFoot:null,rightUpperLeg:null,rightLowerLeg:null,rightFoot:null}}setupCamera(e,t,r=30){this.camera.position.copy(e),this.camera.lookAt(t),this.camera.fov=r}async calculateBoneOffsets(e,t){for(const r in this.boneOffsets){const i=await this._getMinMaxOffsetByBone(e,r,t);console.log("result",i),this.boneOffsets[r]=i}}setFrameTarget(e){this.frameTarget=e}frameCloseupShot(){this.frameShot("head","head")}frameMediumShot(){this.frameShot("chest","head")}frameCowboyShot(){this.frameShot("hips","head")}frameFullShot(){this.frameShot("leftFoot","head")}frameShot(e,t,r=null,i=!1,s=!0){if(!this.frameTarget){console.error("No target object provided, Call setFrameTarget() first;");return}const o=this._getBoneWorldPositionWithOffset(this.frameTarget,e,i),a=this._getBoneWorldPositionWithOffset(this.frameTarget,t,s);o.y-=this.frameOffset.max,a.y+=this.frameOffset.min,r=r||new $(0,0,0),this.positionCameraBetweenPoints(o,a,r)}setBottomFrameOffset(e){this.frameOffset.min=e}setTopFrameOffset(e){this.frameOffset.max=e}_getBoneWorldPositionWithOffset(e,t,r){const i=this._getFirstBoneWithName(t,e);if(!i||!this.boneOffsets[t])return console.error(`Bone with name '${t}' not found in the model.`),new $;const s=new $;i.getWorldPosition(s);const o=r?this.boneOffsets[t].max:this.boneOffsets[t].min;return s.y+=o.y,s}_getFirstBoneWithName(e,t=void 0){let r=null;const i=t||this.frameTarget;if(!i){console.error("_getFirstBoneWithName: No target object provided, Call setFrameTarget() first or provide a targetObject parameter;");return}return i.traverse(s=>{if(s instanceof ia){if(!s.geometry){console.error("Invalid skinned mesh found in children.");return}const o=s.skeleton.bones.findIndex(a=>a.name===e);if(o!==-1){r=s.skeleton.bones[o];return}}}),r}async _getMinMaxOffsetByBone(e,t,r){return new Promise(async(i,s)=>{(!e||!e.traverse)&&(console.error("Invalid parent object provided."),s(null));const o=new $(1/0,1/0,1/0),a=new $(-1/0,-1/0,-1/0),l=[];e.traverse(async u=>{u instanceof ia&&(l.push(this._saveBonesPos(u.skeleton)),u.skeleton.pose())});let c=0;await(u=>new Promise(f=>setTimeout(f,u)))(10),e.traverse(u=>{if(u instanceof ia){if(!u.geometry){console.error("Invalid skinned mesh found in children.");return}const f=u.skeleton.bones.findIndex(g=>g.name===t);if(f===-1){console.error(`Bone with name '${t}' not found in one of the skinned meshes.`);return}const h=u.geometry.getAttribute("position"),d=u.geometry.getAttribute("skinWeight"),m=u.geometry.getAttribute("skinIndex");for(let g=0;g=r){const _=u.skeleton.bones[f],x=new $().setFromMatrixPosition(_.matrixWorld),b=p.clone().sub(x);o.min(b),a.max(b)}}this._restoreSavedPose(l[c],u.skeleton),c++}}),i({min:o,max:a})})}_saveBonesPos(e){let t=[];return e.bones.forEach(r=>{t.push({position:r.position.clone(),rotation:r.rotation.clone(),scale:r.scale.clone()})}),t}_restoreSavedPose(e,t){e&&t.bones.forEach((r,i)=>{r.position.copy(e[i].position),r.rotation.copy(e[i].rotation),r.scale.copy(e[i].scale)})}positionCameraBetweenPoints(e,t,r,i=30){const s=new Qn;s.expandByPoint(e),s.expandByPoint(t),this.camera.fov=i;const o=this.camera.fov*(Math.PI/180),l=s.getSize(new $).length()/(2*Math.tan(o/2));s.getCenter(nm),this.camera.position.copy(nm),r.y*=.5,this.camera.lookAt(nm.clone().sub(r));const c=new $;this.camera.getWorldDirection(c),this.camera.position.addScaledVector(c,-l),this.camera.updateProjectionMatrix()}setCamera(e,t,r=30){this.camera.position.copy(e),this.camera.fov=r,nm.set(0,0,-1),this.cameraDir=nm.applyQuaternion(this.camera.quaternion),this.cameraDir.normalize(),this.camera.position.x-=this.cameraDir.x*t,this.camera.position.z-=this.cameraDir.z*t}setCameraFrameWithName(e,t){switch(e.toLowerCase()){case"fullshot":this.frameShot("leftFoot","head",t);break;case"cowboyshot":this.frameShot("hips","head",t);break;case"mediumshot":this.frameShot("chest","head",t);break;case"mediumcloseup":case"mediumcloseupshot":this.frameShot("chest","head",t,!0);break;case"closeup":case"closeupshot":this.frameShot("head","head",t);break;default:console.warn("unkown cameraFrame: "+e+". Please use fullShot, cowboyShot, mediumShot, mediumCloseup or closeup"),this.frameShot("leftFoot","head",t);break}}copyCamera(e){this.camera.position.copy(e.position),this.camera.quaternion.copy(e.quaternion),"fov"in e&&(this.camera.fov=e.fov)}}const nx=4096;class Dge{constructor(e,t,r){const i=new v0({preserveDrawingBuffer:!0,antialias:!1,alpha:!0});this.pixelSize=r,this.domElement=i.domElement;const s=new je(nx,nx);i.setClearColor(0,0),i.outputColorSpace=Mr,i.setSize(s.x,s.y),i.setPixelRatio(window.devicePixelRatio);let o=s.clone().divideScalar(r);o.x|=0,o.y|=0;const a=new Rge(i);a.addPass(new Uge(e,t)),this._renderPixelPass=new Fge(o,e,t),this._pixelPass=new Pge(o),a.addPass(this._renderPixelPass),a.addPass(this._pixelPass),this.renderer=i,this.composer=a}setSize(e,t){let i=new je(e,t).clone().divideScalar(this.pixelSize);i.x|=0,i.y|=0,this.renderer.setSize(e,t),this._renderPixelPass.setResolution(i),this._pixelPass.setResolution(i)}setPixelSize(e){this.pixelSize=e}render(){this.composer.render()}}class Nge{constructor(e,t){We(this,"cameraFrameManager");this.renderer=new v0({preserveDrawingBuffer:!0,antialias:!0,alpha:!0}),this.renderer.setClearAlpha(0),this.renderer.premultipliedAlpha=!1,this.scene=t,this.characterManager=e,this.renderer.outputColorSpace=Ut,this.renderer.setSize(nx,nx);const r=new Fr(30,1,.1,1e3);this.textureLoader=new FA,this.sceneBackground=new ke(.1,.1,.1),this.sceneBackgroundAlpha=1,this.usesBackgroundImage=!1,this.backgroundMaterial=new qi({color:16777215,transparent:!0,opacity:.5});const i=new cc(1e3,1e3),s=new dn(i,this.backgroundMaterial);s.renderOrder=-1,this.backgroundPlane=s,this.pixelRenderer=new Dge(t,r,20),this.cameraFrameManager=new Lge(r),this.cameraFrameManager.setFrameTarget(this.characterManager.characterModel)}setScene(e){this.scene=e}get camera(){return this.cameraFrameManager.camera}setupCamera(e,t,r=30){this.cameraFrameManager.setupCamera(e,t,r)}_getCharacterMinMax(){let e=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY;return this.characterManager.characterModel.traverse(r=>{r.geometry&&(r.geometry.computeBoundingBox(),r.geometry.boundingBox&&(r.geometry.boundingBox.applyMatrix4(r.matrixWorld),r.geometry.boundingBox.min.yt&&(t=r.geometry.boundingBox.max.y)))}),{minY:e,maxY:t}}_getBoneWorldPosition(e,t=void 0){const r=this.cameraFrameManager._getFirstBoneWithName(e,t);return r!=null?new $().setFromMatrixPosition(r.matrixWorld):(console.warn(`Bone with name '${e}' not found in one of the skinned meshes.`),new $(0,0,0))}setBackground(e){if(Array.isArray(e)){const t=e[3]==null?1:e[3];this.setBackgroundColor(e[0],e[1],e[2],t)}else this.setBackgroundImage(e)}setBackgroundColor(e,t,r,i){const s=new ke(e,t,r,i);this.sceneBackground=s,i==null&&(i=1),i>1&&(i=1),i<0&&(i=0),this.sceneBackgroundAlpha=i,this.backgroundMaterial.color=s,this.usesBackgroundImage=!1}setBackgroundImage(e){return new Promise(async(t,r)=>{try{const i=await this.texureLoader.load(e);i&&(i.wrapS=i.wrapT=zs,this.sceneBackground=i,this.usesBackgroundImage=!0,this.sceneBackgroundAlpha=1,t())}catch(i){console.error("Error loading background image: ",i),r(i)}})}_setBackground(){if(this.usesBackgroundImage==!1&&this.sceneBackgroundAlpha!=1)if(this.sceneBackgroundAlpha==0)this.scene.background=null;else{this.scene.background=null,this.scene.add(this.backgroundPlane),this.backgroundPlane.position.copy(this.camera.position);var e=new $(0,0,-1);e.applyQuaternion(this.camera.quaternion);var t=100;this.backgroundPlane.position.addScaledVector(e,t),this.backgroundPlane.lookAt(this.camera.position)}else this.scene.background=this.sceneBackground}_restoreBackground(){this.scene.background=null,this.usesBackgroundImage==!1&&this.sceneBackgroundAlpha!=1&&this.scene.remove(this.backgroundPlane)}getImageData(e,t,r=null){return this._createImage(e,t,r).split("base64,")[1]}_createImage(e,t,r=null){const i=e/t;typeof r=="number"&&this.pixelRenderer.setPixelSize(r),this.renderer.setSize(e,t),this.pixelRenderer.setSize(e,t);const s="image/png";this.camera.aspect=i,this.camera.updateProjectionMatrix();const o=typeof r=="number"?this.pixelRenderer:this.renderer;try{this._setBackground(),o.render(this.scene,this.camera);let a=o.domElement.toDataURL(s);return this._restoreBackground(),a}catch(a){return console.error(a),null}}savePixelScreenshot(e,t,r,i){this.pixelRenderer.setPixelSize(i),this.pixelRenderer.setSize(t,r);const s=this._createImage(t,r,!0),o="image/octet-stream",a="image/png";this.saveFile(s.replace(a,o),e+".png")}saveScreenshot(e,t,r){const i=this._createImage(t,r),s="image/octet-stream",o="image/png";this.saveFile(i.replace(o,s),e+".png")}getScreenshotImage(e,t){const r=this._createImage(e,t),i=new Image;return i.src=r,i}getScreenshotTexture(e,t){const r=this.getScreenshotImage(e,t),i=new Un(r);return i.needsUpdate=!0,i}getScreenshotBlob(e,t){const r=this._createImage(e,t),i=a8.Buffer.from(r.replace(/^data:image\/\w+;base64,/,""),"base64");return new Blob([i],{type:"image/jpeg"})}saveFile(e,t){const r=document.createElement("a");typeof r.download=="string"?(document.body.appendChild(r),r.download=t,r.href=e,r.click(),document.body.removeChild(r)):window.open(e,"_blank").document.write(""+t+"")}}const Oge=2;class kge{constructor(e=.5,t=.5,r=1,i=5){this.vrmBlinkers=[],this.mode="ready",this.clock=new jR,this.closeTime=e,this.openTime=t,this.continuity=r,this.randomness=i,this._eyeOpen=1,this._blinkCounter=0,this.isTakingScreenShot=!1,this.update()}addVRM(e){this.vrmBlinkers.push(e)}removeVRM(e){const t=this.vrmBlinkers.indexOf(e);t!==-1&&this.vrmBlinkers.splice(t,1)}enableScreenshot(){this.isTakingScreenShot=!0,this._eyeOpen=Oge,this._updateBlinkers()}disableScreenshot(){this.isTakingScreenShot=!1}update(){setInterval(()=>{if(this.isTakingScreenShot)return;const e=this.clock.getDelta();switch(this.mode){case"closing":this._eyeOpen>0?this._eyeOpen-=e/this.closeTime:(this._eyeOpen=0,this.mode="open"),this._updateBlinkers();break;case"open":this._eyeOpen<1?this._eyeOpen+=e/this.openTime:(this._eyeOpen=1,this.mode="ready"),this._updateBlinkers();break;case"ready":this._blinkCounter+=e,this._blinkCounter>=this.continuity&&(Math.floor(Math.random()*this.randomness)===0&&(this.mode="closing"),this._blinkCounter=0);break}},1e3/30)}_updateBlinkers(){this.vrmBlinkers.forEach(e=>{e.expressionManager.setValue(ni.Blink,1-this._eyeOpen),e.expressionManager.update()})}}function $G(){return($G=Object.assign||function(n){for(var e=1;e0?u+s.byteLength:0;f%8&&(f+=8-f%8);let h=[],d=new DataView(new ArrayBuffer(24*n.levels.length)),m=(f||u+s.byteLength)+t.byteLength;for(let v=0;v0?f:0),!0),p.setBigUint64(60,BigInt(t.byteLength),!0),new Uint8Array(im([new Uint8Array(ei).buffer,g,d.buffer,a,s,new ArrayBuffer(f>0?f-(u+s.byteLength):0),t,...h]))}var wT,_T,Wge={enableDebug:!1,isUASTC:!0,isKTX2File:!0,isInputSRGB:!0,generateMipmap:!0,needSupercompression:!0,isSetKTX2SRGBTransferFunc:!0},xT=new OffscreenCanvas(128,128),zO=xT.getContext("2d",{willReadFrequently:!0}),ZG=typeof document>"u";function Kge(n){return createImageBitmap(n).then(function(e){return xT.width=e.width,xT.height=e.height,zO.drawImage(e,0,0),zO.getImageData(0,0,e.width,e.height)})}function Xge(n,e){return e===void 0&&(e={}),$ge().then(function(t){var r=new t.BasisEncoder;return Yge(e,r),r.setTexType(wT.cBASISTexType2D),Qge(n,ArrayBuffer)&&(n=new Blob([n])),Kge(n).then(function(i){r.setSliceSourceImage(0,new Uint8Array(i.data),i.width,i.height,_T.RAW);var s=new Uint8Array(10485760),o=r.encode(s);if(o===0)throw"encode failed";var a=new Uint8Array(s.buffer,0,o),l=Gge(s);if(e.kvData){for(var c in e.kvData)l.keyValue[c]=e.kvData[c];a=jge(l,{keepWriter:!0})}return a})})}function Yge(n,e){n===void 0&&(n={}),(n=Hge({},Wge,n)).enableDebug!==void 0&&e.setDebug(n.enableDebug),n.isUASTC!==void 0&&e.setUASTC(n.isUASTC),n.isKTX2File!==void 0&&e.setCreateKTX2File(n.isKTX2File),n.isSetKTX2SRGBTransferFunc!==void 0&&e.setKTX2SRGBTransferFunc(n.isSetKTX2SRGBTransferFunc),n.generateMipmap!==void 0&&e.setMipGen(n.generateMipmap),n.isYFlip!==void 0&&e.setYFlip(n.isYFlip),n.qualityLevel!==void 0&&e.setQualityLevel(n.qualityLevel),n.compressionLevel!==void 0&&e.setCompressionLevel(n.compressionLevel),n.needSupercompression!==void 0&&e.setKTX2UASTCSupercompression(n.needSupercompression),n.isNormalMap!==void 0&&e.setNormalMap(n.isNormalMap)}var JB=null;function $ge(){return JB||(JB=new Promise(function(n,e){ZG?(importScripts("https://mdn.alipayobjects.com/rms/afts/file/A*SrRkQarYYl4AAAAAAAAAAAAAARQnAQ/basis_encoder.js"),fetch("https://mdn.alipayobjects.com/rms/afts/file/A*qFWbTrA0hZYAAAAAAAAAAAAAARQnAQ/basis_encoder.wasm").then(function(t){return t.arrayBuffer()}).then(function(t){BASIS({wasmBinary:t}).then(function(r){r.initializeBasis(),n(r)}).catch(e)}).catch(e)):Promise.all([fetch("https://mdn.alipayobjects.com/rms/afts/file/A*SrRkQarYYl4AAAAAAAAAAAAAARQnAQ/basis_encoder.js").then(function(t){return t.text()}),fetch("https://mdn.alipayobjects.com/rms/afts/file/A*qFWbTrA0hZYAAAAAAAAAAAAAARQnAQ/basis_encoder.wasm").then(function(t){return t.arrayBuffer()})]).then(function(t){var r=t[0],i=t[1],s=document.createElement("script");s.onload=function(){BASIS({wasmBinary:i}).then(function(o){o.initializeBasis(),n(o)}).catch(e)},s.src=URL.createObjectURL(new Blob([r])),s.onerror=e,document.body.appendChild(s)}).catch(e)})),JB}ZG&&self.addEventListener("message",function(n){Xge(n.data).then(function(e){self.postMessage(e)}).catch(function(e){self.postMessage({error:e})})});class Zge{constructor(e,t){if(this.gl=e,this.libktx=null,e!==void 0)if(t===void 0&&LIBKTX!==void 0&&(t=LIBKTX),t!==void 0)this.initializied=this.init(e,t);else{console.error("Failed to initalize KTXDecoder: ktx library undefined");return}else{console.error("Failed to initalize KTXDecoder: WebGL context undefined");return}}async init(e,t){this.libktx=await t({preinitializedWebGLContext:e}),this.libktx.GL.makeContextCurrent(this.libktx.GL.createContext(e.canvas,{majorVersion:2}))}stringToUastcFlags(e){return e==="FASTER"?this.libktx.UastcFlags.LEVEL_FASTER.value:e==="FASTEST"?this.libktx.UastcFlags.LEVEL_FASTEST.value:e==="SLOWER"?this.libktx.UastcFlags.LEVEL_SLOWER.value:e==="SLOWEST"?this.libktx.UastcFlags.LEVEL_VERYSLOW.value:this.libktx.UastcFlags.LEVEL_DEFAULT.value}stringToSupercmpScheme(e){return e==="Zstd"?this.libktx.SupercmpScheme.ZSTD:e==="Zlib"?this.libktx.SupercmpScheme.ZLIB:e==="BasisLZ"?this.libktx.SupercmpScheme.BASIS_LZ:this.libktx.SupercmpScheme.NONE}transcodeRGBA(e){if(!e.needsTranscoding)return;const t=this.libktx.TranscodeTarget.RGBA8888;e.transcodeBasis(t,0)!=this.libktx.ErrorCode.SUCCESS&&console.warn("Texture transcode failed. See console for details.")}transcode(e){if(e.gpuFormat="RGBA8888",e.needsTranscoding){let t,r=!1,i=!1,s=!1,o=!1,a=!1;r=!!this.gl.getExtension("WEBGL_compressed_texture_astc"),i=!!this.gl.getExtension("WEBGL_compressed_texture_etc1"),s=!!this.gl.getExtension("WEBGL_compressed_texture_s3tc"),o=!!this.gl.getExtension("EXT_texture_compression_bptc"),a=!!this.gl.getExtension("WEBGL_compressed_texture_pvrtc")||!!this.gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),r?(t=this.libktx.TranscodeTarget.ASTC_4x4_RGBA,e.gpuFormat="ASTC_4x4_RGBA"):o?(t=this.libktx.TranscodeTarget.BC7_RGBA,e.gpuFormat="BC7_RGBA"):s?(t=this.libktx.TranscodeTarget.BC1_OR_3,e.gpuFormat="BC1_OR_3"):a?(t=this.libktx.TranscodeTarget.PVRTC1_4_RGBA,e.gpuFormat="PVRTC1_4_RGBA"):i?(t=this.libktx.TranscodeTarget.ETC,e.gpuFormat="ETC"):(t=this.libktx.TranscodeTarget.RGBA8888,e.gpuFormat="RGBA8888"),e.transcodeBasis(t,0)!=this.libktx.ErrorCode.SUCCESS&&console.warn("Texture transcode failed. See console for details.")}}async loadKtxFromUri(e){await this.initializied;const t=await fetch(e),r=new Uint8Array(await t.arrayBuffer()),i=new this.libktx.ktxTexture(r);this.transcode(i);let s=i.glUpload();if(s.texture==null){console.error("Could not load KTX data");return}return s.texture.levels=Math.log2(i.baseWidth),s.texture.width=i.baseWidth,s.texture.height=i.baseHeight,s.texture.gpuSize=i.dataSize,s.texture.gpuFormat=i.gpuFormat,s.texture.isSRGB=i.isSRGB,s.texture}async loadKtxFromBuffer(e){await this.initializied;const t=new this.libktx.ktxTexture(e);this.transcode(t);const r=t.glUpload();if(r.texture==null){console.error("Could not load KTX data");return}return r.texture.levels=Math.log2(t.baseWidth),r.texture.width=t.baseWidth,r.texture.height=t.baseHeight,r.texture.gpuSize=t.dataSize,r.texture.gpuFormat=t.gpuFormat,r.texture.isSRGB=t.isSRGB,r.texture}async compress(e,t,r,i,s={}){const o=new this.libktx.ktxTexture(e,t,r,i,s.srgb);if(!s.hasOwnProperty("basisu_options")){const c=new this.libktx.ktxBasisParams;c.uastc=!1,c.noSSE=!0,c.verbose=!1,c.qualityLevel=100,c.compressionLevel=2,s.basisu_options=c}s.hasOwnProperty("compression_level")||(s.compression_level=18),s.hasOwnProperty("supercmp_scheme")||(s.supercmp_scheme=this.libktx.SupercmpScheme.NONE),console.log(s);const a=o.compressBasisU(s.basisu_options,s.supercmp_scheme,s.compression_level);return Uint8ClampedArray.from(a)}}class Jge{constructor(){this.ktxEncoder=null,this.libktx=null,this.init()}async init(){const t=document.createElement("canvas").getContext("webgl"),r=new Zge(t,window.LIBKTX);await r.init(t,window.LIBKTX),this.ktxEncoder=r,this.libktx=r.libktx}async compress(e,t,r,i,s={}){const o=await new this.libktx.ktxBasisParams,a=s;return o.uastc=a.uastc!==void 0?a.uastc:!1,o.noSSE=a.noSSE!==void 0?a.noSSE:!1,o.verbose=a.verbose!==void 0?a.verbose:!1,o.normalMap=a.normalMap!==void 0?a.normalMap:!1,o.compressionLevel=a.compressionLevel!==void 0?a.compressionLevel:1,o.qualityLevel=a.qualityLevel!==void 0?a.qualityLevel:60,o.maxEndpoints=a.ETC1SmaxEndpoints!==void 0?a.ETC1SmaxEndpoints:0,o.endpointRDOThreshold=a.ETC1SEndpointRdoThreshold!==void 0?a.ETC1SEndpointRdoThreshold:1.25,o.maxSelectors=a.ETC1SMaxSelectors!==void 0?a.ETC1SMaxSelectors:0,o.selectorRDOThreshold=a.ETC1SSelectorRdoThreshold!==void 0?a.ETC1SSelectorRdoThreshold:1.25,o.noEndpointRDO=a.ETC1SNoEndpointRdo!==void 0?a.ETC1SNoEndpointRdo:!1,o.noSelectorRDO=a.ETC1SNoSelectorRdo!==void 0?a.ETC1SNoSelectorRdo:!1,o.uastcFlags=this.ktxEncoder.stringToUastcFlags(a.uastcFlags),o.uastcRDO=o.uastcRDO!==void 0?o.uastcRDO:!1,o.uastcRDOQualityScalar=a.uastcRDOQualityScalar!==void 0?a.uastcRDOQualityScalar:1,o.uastcRDODictSize=a.uastcRDODictSize!==void 0?a.uastcRDOQualityScalar:4096,o.uastcRDOMaxSmoothBlockErrorScale=a.uastcRDOMaxSmoothBlockErrorScale!==void 0?a.uastcRDOMaxSmoothBlockErrorScale:10,o.uastcRDOMaxSmoothBlockStdDev=a.uastcRDOMaxSmoothBlockStdDev!==void 0?a.uastcRDOMaxSmoothBlockStdDev:18,o.uastcRDODontFavorSimplerModes=a.uastcRDODontFavorSimplerModes!==void 0?a.uastcRDODontFavorSimplerModes:!1,s.basisu_options=o,s.hasOwnProperty("supercmp_scheme")?s.supercmp_scheme=this.ktxEncoder.stringToSupercmpScheme(s.supercmp_scheme):s.supercmp_scheme=this.libktx.SupercmpScheme.NONE,await this.ktxEncoder.compress(e,t,r,i,s)}}var Jn;(function(n){n[n.ARRAY_BUFFER=34962]="ARRAY_BUFFER",n[n.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.LINEAR=9729]="LINEAR",n[n.REPEAT=10497]="REPEAT"})(Jn||(Jn={}));const bT="blend_",GO="vrmColliderSphere";function qge(n){var e;return{title:n.name,version:"v0",author:((e=n.authors)==null?void 0:e.length)>0?n.authors.join(", "):"",reference:n.references!=null?n.references.join(", "):"",contactInformation:n.contactInformation!=null?n.contactInformation:"",otherPermissionUrl:n.otherPermissionUrl,allowedUserName:n.avatarPermission!=null?n.avatarPermission:"",violentUssageName:n.allowExcessivelyViolentUsage?"Allow":"Disallow",sexualUssageName:n.allowExcessivelySexualUsage?"Allow":"Disallow",commercialUssageName:n.commercialUsage=="personalProfit"||n.commercialUsage=="corporation"?"Allow":"Disallow",licenseName:n.copyrightInformation,otherLicenseUrl:n.otherLicenseUrl,metaVersion:"0"}}function e0e(n){const e=[];for(const t in n.humanBones)e.push({bone:t,node:n.humanBones[t].node});return{humanBones:e}}function t0e(n){switch(n){case"happy":return"joy";case"sad":return"sorrow";case"relaxed":return"fun";case"aa":return"a";case"ih":return"i";case"ou":return"u";case"ee":return"e";case"oh":return"o";default:return n}}function n0e(n){if(n.includes("Thumb")){if(n.includes("Metacarpal"))return n.replace("Metacarpal","Proximal");if(n.includes("Proximal"))return n.replace("Proximal","Intermediate")}return n}class r0e{async parse(e,t,r,i,s,o,a){var ne;const l=qge(e.meta),c=e0e(e.humanoid),A=e.materials,u=[],f={generator:"UniGLTF-2.0.0",version:"2.0"};if(t)if(c)if(l){if(!A)throw new Error("materials is undefined or null")}else throw new Error("meta is undefined or null");else throw new Error("humanoid is undefined or null");else throw new Error("avatar is undefined or null");const h=A.filter((Y,de,ae)=>ae.findIndex(Ee=>Ee.name===Y.name.replace(" (Outline)",""))===de).map(Y=>Y),d=h.map(Y=>Y.name),m=r?{name:"icon",imageBitmap:r.image}:null,g=h.filter(Y=>Y.map).map(Y=>{if(!Y.map)throw new Error(Y.name+" map is null");return{name:Y.name,imageBitmap:Y.map.image}}),p=h.filter(Y=>Y.userData.shadeTexture).map(Y=>{if(!Y.userData.shadeTexture)throw new Error(Y.userData.shadeTexture+" map is null");return{name:Y.name+"_shade",imageBitmap:Y.userData.shadeTexture.image}}),v=h.filter(Y=>Y.roughnessMap).map(Y=>Y.roughnessMap?{name:Y.name+"_orm",imageBitmap:Y.roughnessMap.image}:null),w=h.filter(Y=>Y.roughnessMap).map(Y=>Y.normalMap?{name:Y.name+"_normal",imageBitmap:Y.normalMap.image}:null),_=[...g,...p,...v,...w].filter(Y=>Y!==null),x=c0e(_,m,s?"image/ktx2":"image/png"),b=A0e(x),B=u0e(x,s),M=l0e(h,_),I=t.children.filter(Y=>Y.children.length>0&&Y.children[0].type===Di.Bone)[0],S=JG(I).filter(Y=>Y.name!==GO),L=S.map(Y=>Y.name),D=S.map(Y=>{const de=Y.children.filter(ae=>ae.name!==GO).map(ae=>L.indexOf(ae.name));return{name:Y.name,rotation:[Y.quaternion.x,Y.quaternion.y,Y.quaternion.z,Y.quaternion.w],scale:[Y.scale.x,Y.scale.y,Y.scale.z],translation:[Y.position.x,Y.position.y,Y.position.z],children:de.length>0?de:void 0}}),T=[],y=t.children.filter(Y=>Y.type===Di.Group||Y.type===Di.SkinnedMesh),E=[];y.forEach((Y,de)=>{const ae=Y.type===Di.Group?Y.children[0]:Y,Ee=ae.geometry.attributes,V=new Ic(Ee.position,Jn.FLOAT,An.POSITION,Ba.VEC3,ae.name,void 0);E.push(V);const U=E.length-1,N=Ee.normal.array,K=new Float32Array(N.length);for(let Ce=0;CeCe):[Y]).forEach(Ce=>{if(!Ce.geometry.index)throw new Error(Ce.name+" geometry.index is null");E.push(new Ic(Ce.geometry.index,Jn.UNSIGNED_INT,An.INDEX,Ba.SCALAR,ae.name,Ce.name))}),ae.morphTargetDictionary||(ae.morphTargetDictionary={},ae.morphTargetInfluences=[],ae.geometry.morphAttributes={},ae.updateMorphTargets()),ae.geometry.userData.targetNames=[];const ve=(Ce,Le,Re,$e)=>{const ce=[],Pe=[];for(let Me=0;Me0){const Me=[...ce].sort((De,Ze)=>De-Ze),Te=[];for(let De=0;De({mesh:0,index:Ee.index,weight:Ee.weight*100}));if(ae.length>0){let Ee=!1;for(const V in ni)if(Y===ni[V]&&Y!=="surprised"){u.push({name:Y,presetName:t0e(Y),binds:ae,isBinary:de.isBinary}),Ee=!0;break}Ee===!1&&u.push({name:Y,presetName:"unknown",binds:ae,isBinary:de.isBinary})}}y.forEach(Y=>{const de=Y.type===Di.Group?Y.children[0]:Y,ae=new Float32Array(de.skeleton.boneInverses.map(Ee=>Ee.elements).flat());E.push(new Ic(new ct(ae,16),Jn.FLOAT,An.BIND_MATRIX,Ba.MAT4,de.name,de.name))}),T.push(...E.map(Y=>({componentType:Y.valueType,count:Y.attribute.count,max:Y.max,min:Y.min,normalized:!1,type:Y.accessorsType})));const R=o0e(y,E,d);y.forEach((Y,de)=>{D.push({mesh:de,name:Y.name,rotation:[Y.quaternion.x,Y.quaternion.y,Y.quaternion.z,Y.quaternion.w],scale:[Y.scale.x,Y.scale.y,Y.scale.z],skin:de,translation:[Y.position.x,Y.position.y,Y.position.z]})});const F=a0e(y,E,L),O={humanBones:[]};c.humanBones.forEach(Y=>{L.indexOf(Y.node.name)!=-1&&O.humanBones.push({bone:n0e(Y.bone),node:L.indexOf(Y.node.name),useDefaultValues:!0})});const z={floatProperties:{_DstBlend:.5,_ShadeShift:.5,_ShadeToony:.5,_ShadingGradeRate:.5},keywordMap:{_NORMALMAP:!1,MTOON_OUTLINE_COLOR_FIXED:!0,MTOON_OUTLINE_WIDTH_WORLD:!0},name:"VRMCombinedMat",renderQueue:2e3,shader:"VRM/MToon",tagMap:{RenderType:"Opaque"},textureProperties:{_MainTex:0,_ShadeTexture:0},vectorProperties:{_Color:[1,1,1,1],_EmissionColor:[0,0,0,1],_EmissionMap:[0,0,1,1],_MainTex:[0,0,1,1],_OutlineColor:[0,0,0,1],_OutlineWidthTexture:[0,0,1,1],_ReceiveShadowTexture:[0,0,1,1],_RimColor:[0,0,0,1],_RimTexture:[0,0,1,1],_ShadeColor:[.9,.9,.9,1]}},j={name:"STDCombinedMat",shader:"VRM_USE_GLTFSHADER"},H=[];h.forEach(Y=>{Y.type=="ShaderMaterial"?H.push(Object.assign({},z)):H.push(Object.assign({},j))});const C=l,W={};i.forEach(Y=>{for(let de=0;deY.isSkinnedMesh))==null?void 0:ne.skeleton)||null;for(let Y=0;Y{const V=Ee.sphere;ae.colliders.push({radius:V.radius*o,offset:{x:V.offset[0]*o,y:V.offset[1]*o,z:V.offset[2]*o}})}),ee.push(ae)}}console.log("COLLIDER GROUPS",ee);const re=Y=>{for(let de=0;de{var V;const de=Y.settings,ae={bones:[],center:-1,colliderGroups:[],dragForce:de.dragForce,gravityDir:{x:de.gravityDir.x,y:de.gravityDir.y,z:de.gravityDir.z},gravityPower:de.gravityPower,hitRadius:de.hitRadius,stiffiness:de.stiffness};for(const U of Y.bones){const N=re(U.name);if(N===-1){console.warn("Spring bone "+U.name+" was removed during cleanup process. Skipping.");return}ae.bones.push(N)}const Ee=[];Y.colliderGroups.forEach(U=>{const N=U.colliders[0];if(N!=null){const K=N.parent,oe=ee.findIndex(pe=>pe.name===K.name);oe!=-1?Ee.includes(oe)||Ee.push(oe):console.warn("No collider group for bone name: ",K.name+" was found")}else console.warn("No colliders definition were present in vrm file file for: ",Y.name+" spring bones")}),ae.colliderGroups.push(...Ee),ae.center=re((V=Y.center)==null?void 0:V.name),ae.center==-1&&console.debug("no center bone for spring bone "+Y.name),ue.push(ae)});const le={boneGroups:ue,colliderGroups:ee};console.log(le),C.texture=m?x.length-1:void 0;const me=await Promise.all(_.map(async Y=>({buffer:s?await VO(Y.imageBitmap):jO(Y.imageBitmap),type:An.IMAGE})));E.forEach((Y,de)=>{Y.buffer?me.push({buffer:Y.buffer,typeString:"",type:Y.type}):Y.sparse&&(me.push({buffer:Y.sparse.indices,typeString:"indices",type:Y.type,count:Y.sparse.count}),me.push({buffer:Y.sparse.values,typeString:"values",type:Y.type})),me.length-1}),m&&me.push({buffer:s?await VO(m.imageBitmap):jO(m.imageBitmap),type:An.IMAGE});let ie=0,ge=0,_e=0,se=0;const Q=me.map(Y=>{const de={buffer:0,byteLength:Y.buffer.byteLength,byteOffset:ie,target:Y.type===An.IMAGE||Y.type===An.BIND_MATRIX||Y.typeString==="indices"||Y.typeString==="values"?void 0:Y.type===An.INDEX?Jn.ELEMENT_ARRAY_BUFFER:Jn.ARRAY_BUFFER};return ie+=Y.buffer.byteLength,Y.type===An.IMAGE?(x[ge++].bufferView=se,se++):E[_e].sparse?(T[_e].sparse==null&&(T[_e].sparse={}),Y.typeString==="indices"&&(T[_e].sparse.count=Y.count,T[_e].sparse[Y.typeString]={bufferView:se,byteOffset:0,componentType:Jn.UNSIGNED_INT}),Y.typeString==="values"&&(T[_e].sparse[Y.typeString]={bufferView:se,byteOffset:0}),Y.typeString==="values"&&_e++,se++):(E[_e].bufferIndex=se,T[_e].bufferView=se,_e++,se++),de}),fe=f0e(t,D);i0e(C);const Ae=["KHR_materials_unlit","KHR_texture_transform","VRM"];s&&Ae.push("KHR_texture_basisu");for(const Y of F){const de=T.filter(ae=>ae.type=="MAT4");for(let ae of de)if(Y.joints.length!=ae.count)throw new Error(`The number of joints in the skin is not equal to the number of Accessors of type MAT4. Got ${Y.joints.length} when accessors show ${ae.count} This is usually because of a bone count mismatch in your VRMs!`)}const Z={accessors:T,asset:f,buffers:[{byteLength:ie}],bufferViews:Q,extensions:{VRM:{blendShapeMaster:{blendShapeGroups:u},firstPerson:{firstPersonBone:44,firstPersonBoneOffset:new $,lookAtHorizontalInner:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtHorizontalOuter:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtTypeName:"Bone",lookAtVerticalDown:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtVerticalUp:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10}},materialProperties:H,humanoid:O,meta:C,secondaryAnimation:le,specVersion:"0.0"}},extensionsUsed:Ae,images:x,materials:M,meshes:R,nodes:D,samplers:b,scenes:fe,skins:F,textures:B};console.log("output",Z);const q=new WO(BT(JSON.stringify(Z,void 0,2)),"JSON"),he=new WO(Pm(me.map(Y=>Y.buffer)),"BIN\0"),X=Pm([q.buffer,he.buffer]),G=Pm([BT("glTF"),ET(2,4),ET(X.byteLength+12,4)]);a(Pm([G,X]))}}function i0e(n){n.title=n.title||"Character",n.version=n.version||"1",n.author=n.author||"Anon",n.contactInformation=n.contactInformation||"",n.reference=n.reference||"",n.allowedUserName=n.allowedUserName||"Everyone",n.violentUssageName=n.violentUssageName||"Disallow",n.sexualUssageName=n.sexualUssageName||"Disallow",n.commercialUssageName=n.commercialUssageName||"Disallow",n.otherPermissionUrl=n.otherPermissionUrl||"",n.licenseName=n.licenseName||"Redistribution_Prohibited",n.otherLicenseUrl=n.otherLicenseUrl||""}function JG(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>JG(e)).flat())}const s0e=new Jge;async function VO(n){const e=await createImageBitmap(n),t=document.createElement("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0);const i=r.getImageData(0,0,t.width,t.height),s=new Uint8Array(i.data.buffer);return await s0e.compress(s,t.width,t.height,4,{normalMap:!1,uastc:!1,qualityLevel:50,compressionLevel:2,uastcFlags:"DEFAULT",compressionUASTC_Rdo_Level:18,uastcRDO:!1,uastcRDOQualityScalar:1,uastcRDODictSize:4096,uastcRDOMaxSmoothBlockErrorScale:10,uastcRDOMaxSmoothBlockStdDev:18,uastcRDODontFavorSimplerModes:!1,ETC1SQualityLevel:128,ETC1SmaxEndpoints:0,ETC1SEndpointRdoThreshold:1.25,ETC1SMaxSelectors:0,ETC1SSelectorRdoThreshold:1.25,ETC1SNoEndpointRdo:!1,ETC1SNoSelectorRdo:!1,supercmp_scheme:"Zstd"})}function jO(n){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0);const t=e.toDataURL("image/png"),r=atob(t.split(",")[1]),i=(4-r.length%4)%4,s=new ArrayBuffer(r.length+i),o=new DataView(s);for(let a=0;a4?c=r[a*n.itemSize+l]:l===0?c=n.getX(a):l===1?c=n.getY(a):l===2?c=n.getZ(a):c=n.getW(a),e===Jn.UNSIGNED_SHORT?o.setUint16(i,c,!0):e===Jn.UNSIGNED_INT?o.setUint32(i,c,!0):o.setFloat32(i,c,!0),i+=t}return s}class WO{constructor(e,t){this.data=e,this.type=t;const r=this.padBuffer(this.data,t==="JSON"?32:0);this.buffer=Pm([ET(r.byteLength,4),BT(this.type),r])}padBuffer(e,t){const r=Math.ceil(e.byteLength/4)*4;if(e.byteLength===r)return e;const i=new ArrayBuffer(r);return new Uint8Array(i).set(new Uint8Array(e)),new Uint8Array(i).fill(t,e.byteLength),i}}const KO=n=>{const e=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],t=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY];for(let r=0;rn.map(r=>{const i=r.type===Di.Group?r.children[0]:r,s=r.type===Di.Group?r.children.map(o=>o):[r];return{name:r.name,primitives:s.map(o=>{const a=e.map(c=>c.meshName===i.name?c.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(An.SKIN_INDEX),NORMAL:a.indexOf(An.NORMAL),POSITION:a.indexOf(An.POSITION),TEXCOORD_0:a.indexOf(An.UV),WEIGHTS_0:a.indexOf(An.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(c=>c.type===An.INDEX&&c.meshName===i.name?c.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(c=>{const A=e.map(h=>h.type===An.BLEND_NORMAL&&h.meshName===i.name?h.name:null).indexOf(bT+c),u=e.map(h=>h.type===An.BLEND_POSITION&&h.meshName===i.name?h.name:null).indexOf(bT+c),f={};return u!==-1&&(f.POSITION=u),A!==-1&&(f.NORMAL=A),f}):void 0}})}}),a0e=(n,e,t)=>n.map(r=>{const i=r.type===Di.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===An.BIND_MATRIX?s.meshName:null).indexOf(i.name),joints:i.skeleton.bones.map(s=>t.indexOf(s.name)).filter(s=>s!==-1),skeleton:t.indexOf(i.skeleton.bones[0].name)}}),l0e=(n,e)=>n.map(t=>{let r,i=null;if(t=t.userData.vrmMaterial?t.userData.vrmMaterial:t,t.type==="ShaderMaterial")i={},i.shadeMultiplyTexture={index:e.map(d=>d.name).indexOf(t.uniforms.shadeMultiplyTexture.name)},r=t.color?[1,1,1,1]:void 0;else{const h=t;r=h.color?[h.color.r,h.color.g,h.color.b,1]:void 0}let s=-1;t.map?s=e.map(h=>h.name).indexOf(t.name):t.uniforms&&t.uniforms.map&&(s=e.map(h=>h.name).indexOf(t.uniforms.map.name));let o=-1;t.roughnessMap&&(o=e.map(h=>h.name).indexOf(t.name+"_orm"));let a=-1;t.normalMap&&(a=e.map(h=>h.name).indexOf(t.name+"_normal"));const l=s>=0?{extensions:{KHR_texture_transform:{offset:[0,0],scale:[1,1]}},index:s,texCoord:0}:void 0,c={baseColorFactor:r,baseColorTexture:l},A=o>=0?{index:o,texCoord:0}:void 0,u=a>=0?{index:a,texCoord:0}:void 0;if(A)c.metallicRoughnessTexture=A;else{const h=(()=>{switch(t.type){case zh.MeshStandardMaterial:return t.metalness;case zh.MeshBasicMaterial:return 0;default:return 0}})(),d=(()=>{switch(t.type){case zh.MeshStandardMaterial:return t.roughness;case zh.MeshBasicMaterial:return .9;default:return .9}})();c.metallicFactor=h,c.roughnessFactor=d}const f={alphaCutoff:t.alphaTest>0?t.alphaTest:void 0,alphaMode:t.transparent?"BLEND":t.alphaTest>0?"MASK":"OPAQUE",doubleSided:t.side===2,extensions:t.type==="ShaderMaterial"?{KHR_materials_unlit:{}}:void 0,name:t.name,pbrMetallicRoughness:c};return u&&(f.normalTexture=u),f}),c0e=(n,e,t)=>(e?n.concat(e):n).filter(r=>r&&r.imageBitmap).map(r=>({bufferView:-1,mimeType:t,name:r.name})),A0e=n=>n.map(()=>({magFilter:Jn.LINEAR,minFilter:Jn.LINEAR,wrapS:Jn.REPEAT,wrapT:Jn.REPEAT})),u0e=(n,e)=>e?n.map((t,r)=>({sampler:0,extensions:{KHR_texture_basisu:{source:r}}})):n.map((t,r)=>({sampler:0,source:r})),f0e=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===Di.Object3D||r.type===Di.SkinnedMesh||r.type===Di.Group||r.type===Di.Bone).map(r=>t.indexOf(r.name))}]};function h0e(n,e,t){var a,l;const r=[],i=[];for(const c in n)((l=(a=n[c])==null?void 0:a.vrm)==null?void 0:l.meta)!=null&&(n[c].vrm.meta.authors!=null?i.push(n[c].vrm.meta):r.push(n[c].vrm.meta));r.length+i.length==1&&(r.length==1?r[0].title!=null&&(t=r[0].title):i[0].name!=null&&(t=i[0].name)),e!=null&&(e.authors!=null?i.push(e):r.push(e));const s=p0e(r),o=d0e(s,i);return o.licenseUrl="https://vrm.dev/licenses/1.0/",o.name=t,o}function d0e(n,e){let{authors:t=[],otherLicenseUrl:r=[],contactInformation:i=[],references:s=[],allowExcessivelyViolentUsage:o=void 0,allowExcessivelySexualUsage:a=void 0,commercialUsage:l=void 0,copyrightInformation:c="",avatarPermission:A=void 0,otherPermissionUrl:u=[]}=n,f,h,d,m="unnecessary",g,p=[];e.forEach(M=>{t=t.concat(ut(M.authors)),r=r.concat(ut(M.otherLicenseUrl)),i=i.concat(ut(M.contactInformation)),s=s.concat(ut(M.references)),u=u.concat(ut(M.otherPermissionUrl)),M.allowExcessivelyViolentUsage===!1&&(o=!1),M.allowExcessivelySexualUsage===!1&&(a=!1),l=Nl(v0e,l,M.commercialUsage),c=Nl(qG,c,M.copyrightInformation),A=Nl(y0e,A,M.avatarPermission),M.allowAntisocialOrHateUsage===!1&&(f=f=!1),M.allowPoliticalOrReligiousUsage===!1&&(h=h=!1),M.allowRedistribution===!1&&(d=d=!1),M.creditNotation==="required"&&(m="required"),p=p.concat(ut(M.thirdPartyLicenses)),g=Nl(g0e,g,M.modification)});const v=[...new Set(t)].filter(M=>M!=""&&M!=null&&M!="undefined"),w=[...new Set(r)].filter(M=>M!=""&&M!=null&&M!="undefined"),_=[...new Set(i)].filter(M=>M!=""&&M!=null&&M!="undefined"),x=[...new Set(s)].filter(M=>M!=""&&M!=null&&M!="undefined"),b=[...new Set(u)].filter(M=>M!=""&&M!=null&&M!="undefined"),B=[...new Set(p)].filter(M=>M!=""&&M!=null&&M!="undefined");return{authors:v,otherLicenseUrl:w.length==0?"":w.join(", "),contactInformation:_.length==0?"":_.join(", "),references:x,otherPermissionUrl:b.length==0?"":b.join(", "),thirdPartyLicenses:B.length==0?"":B.join(", "),allowExcessivelyViolentUsage:o,allowExcessivelySexualUsage:a,commercialUsage:l,copyrightInformation:c,avatarPermission:A,allowAntisocialOrHateUsage:f,allowPoliticalOrReligiousUsage:h,allowRedistribution:d,creditNotation:m,modification:g}}function p0e(n){let e=[],t=[],r=[],i=[],s=[],o,a,l,c,A;n.forEach(g=>{e=e.concat(ut(g.author)),t=t.concat(ut(g.contactInformation)),r=r.concat(ut(g.reference)),i=i.concat(ut(g.otherPermissionUrl)),s=s.concat(ut(g.otherLicenseUrl)),o=Nl(w0e,o,g.allowedUsername),a=Nl(eS,a,g.violentUssageName),l=Nl(eS,l,g.sexualUssageName),c=Nl(eS,c,g.commercialUssageName),A=Nl(qG,A,g.licenseName)});const u=[...new Set(e)].filter(g=>g!=""&&g!=null&&g!="undefined"),f=[...new Set(t)].filter(g=>g!=""&&g!=null&&g!="undefined"),h=[...new Set(r)].filter(g=>g!=""&&g!=null&&g!="undefined"),d=[...new Set(i)].filter(g=>g!=""&&g!=null&&g!="undefined"),m=[...new Set(s)].filter(g=>g!=""&&g!=null&&g!="undefined");return{authors:u,otherLicenseUrl:m,contactInformation:f,references:h,allowExcessivelyViolentUsage:a==="Allow",allowExcessivelySexualUsage:l==="Allow",commercialUsage:c==="Allow"?"personalProfit":"personalNonProfit",copyrightInformation:A,avatarPermission:m0e(o),otherPermissionUrl:d}}function m0e(n){if(n=="OnlyAuthor")return"onlyAuthor";if(n=="ExplicitlyLicensedPerson")return"onlySeparatelyLicensedPerson";if(n=="Everyone")return"everyone"}const g0e={prohibited:0,allowModification:1,allowModificationRedistribution:2},v0e={personalNonProfit:0,personalProfit:1,corporation:2},y0e={onlyAuthor:0,onlySeparatelyLicensedPerson:1,everyone:2},w0e={OnlyAuthor:0,ExplicitlyLicensedPerson:1,Everyone:2},eS={Disallow:0,Allow:1},qG={Redistribution_Prohibited:0,Other:1,CC_BY_NC_ND:2,CC_BY_ND:3,CC_BY_NC_SA:4,CC_BY_SA:5,CC_BY_NC:6,CC_BY:7,CC0:8};function Nl(n,e,t){return e===void 0?t:t==null||!(t in n)||n[e]{r.userData.origIndexBuffer&&t.push(r.userData.origIndexBuffer)}),e.traverse(r=>{r.userData.origIndexBuffer&&(r.userData.origIndexBuffer=t.shift())}),e}function _0e(n){const e=eV(n);let t;const r=[];e.traverse(s=>{if(!t&&s.isSkinnedMesh&&(t=HG(s)),s.isSkinnedMesh){if(s.geometry=s.geometry.clone(),s.skeleton=t,r.push(s),Array.isArray(s.material)){const o=s.material;s.material=new Nd,s.material.map=o[0].map}s.userData.origIndexBuffer&&s.geometry.setIndex(s.userData.origIndexBuffer)}});const i=new ri;return r.forEach(s=>{i.add(s)}),i.add(t.bones[0]),i}async function x0e(n,e,t){const r=await p2(n,t),i=await tV(r,e,t);return new Blob([i],{type:"model/gltf-binary"})}function b0e(n,e,t,r){return new Promise(async(i,s)=>{const o=`${t&&t!==""?t:"AvatarCreatorModel"}`;E0e(n,e,r).then(a=>{rV(a,`${o}.vrm`),i()})})}async function E0e(n,e,t){const r=await p2(n,e,t);return tV(r,e,t)}function p2(n,e,t){const r=eV(n);t.mergeAppliedMorphs=!0;const{createTextureAtlas:i=!0}=t;return i?lge(r,e,t):(console.log("no atlas"),sge(r,e,t))}async function B0e(n,e="",t){const r=`${e&&e!==""?e:"AvatarCreatorModel"}`,{optimized:i=!0}=t,s=i?await p2(n,t):_0e(n);S0e(s).then(o=>{if(o instanceof ArrayBuffer)rV(o,`${r}.glb`);else{const a=JSON.stringify(o,null,2);U0e(a,`${r}.gltf`)}})}function S0e(n){return new Promise(e=>new $R().parse(n,r=>{e(r)},r=>{console.error("Error parsing",r)},{trs:!1,onlyVisible:!1,truncateDrawRange:!0,binary:!0,forcePowerOfTwoTextures:!1,maxTextureSize:1024}))}function M0e(n){var r,i;const e=[];for(const s in n)if(((i=(r=n[s])==null?void 0:r.vrm)==null?void 0:i.springBoneManager)!=null){const o=n[s].vrm.springBoneManager.joints;for(const a of o)e.some(c=>c.name===a.bone.name)||e.push({name:a.bone.name,settings:a.settings,bone:a.bone,colliderGroups:a.colliderGroups,center:a.center})}const t=[];return e.forEach(s=>{if(e.find(a=>{var l;return a.name==((l=s.bone.parent)==null?void 0:l.name)})==null){t.push({bones:[s],settings:s.settings,center:s.center,colliderGroups:s.colliderGroups,name:s.bone.name});return}}),e.map(s=>{const o=t.find(a=>a.bones.find(l=>{var c;return l.name==((c=s.bone.parent)==null?void 0:c.name)})!=null);o!=null&&o.bones.push({name:s.name,bone:s.bone})}),t}function C0e(n){var r,i;const e=[];for(const s in n)if(((i=(r=n[s])==null?void 0:r.vrm)==null?void 0:i.springBoneManager)!=null){const o=n[s].vrm.springBoneManager.joints;for(const a of o)e.some(c=>c.name===a.bone.name)||e.push({name:a.bone.name,settings:a.settings,bone:a.bone,colliderGroups:a.colliderGroups,center:a.center})}const t=[];return e.forEach(s=>{for(const o in Zg)if(s.bone.parent.name==Zg[o]){t.push(s);break}}),t}function T0e(n){const e={};return n.skeleton.bones.map(t=>{for(const r in Zg)if(Zg[r]===t.name){e[t.name]={node:t};break}}),e}function I0e(n,e,t){const r=Od(n,"SkinnedMesh");return{humanBones:T0e(r[0]),materials:n.userData.atlasMaterial,meta:R0e(e),...t.mergeAppliedMorphs?{expressionManager:L0e(n)}:{}}}function R0e(n){return n=n||{},{...{authors:["CharacterStudio"],metaVersion:"1",version:"v1",name:"CharacterCreator",licenseUrl:"https://vrm.dev/licenses/1.0/",commercialUssageName:"personalNonProfit",contactInformation:"https://m3org.com/",allowExcessivelyViolentUsage:!1,allowExcessivelySexualUsage:!1,allowPoliticalOrReligiousUsage:!1,allowAntisocialOrHateUsage:!1,creditNotation:"required",allowRedistribution:!1,modification:"prohibited"},...n}}function tV(n,e,t){const{screenshot:r=null,isVrm0:i=!1,vrmMeta:s=null,scale:o=1,vrmName:a="CharacterCreator"}=t,l=h0e(e,s,a);return new Promise(async c=>{const A=t.outputVRM0??t.isVrm0??!0,u=A?new r0e:new xpe,f={...P0e(e),...I0e(n,l,t)};let h;n.traverse(g=>{g.isSkinnedMesh&&(h=g)}),(()=>{for(let g=0;g{g.updateMatrix(),g.updateMatrixWorld()}),h.skeleton.calculateInverses(),h.skeleton.computeBoneTexture(),h.skeleton.update()})();const m=A?M0e(e):C0e(e);A?u.parse(f,n,r,m,t.ktxCompression,o,g=>{c(g)}):u.parse(f,n,r,g=>{c(g)})})}function nV(n,e){const t=document.createElement("a");t.style.display="none",document.body.appendChild(t),t.href=URL.createObjectURL(n),t.download=e,t.click()}function U0e(n,e){nV(new Blob([n],{type:"text/plain"}),e)}function rV(n,e){nV(F0e(n),e)}function F0e(n){return new Blob([n],{type:"application/octet-stream"})}function P0e(n){for(const e in n)if(n[e].vrm)return n[e].vrm}function L0e(n){const e=new $_;let t=n.userData.expressionManagerToClone;if(!t){t=new $_;for(const r of Object.values(ni)){const i=new Y_(r);t.registerExpression(i)}}e.copy(t),n.userData.expressionManagerToClone=null;for(const r of n.children){if(!r.isMesh&&!r.isSkinnedMesh||!r.morphTargetDictionary)continue;const i=r.userData.bindMorphs;if(!i||!yge(r,i.old))continue;const o=(c,A)=>{var u;return((u=c.find(f=>f.index==A))==null?void 0:u.weight)||0},a=Object.entries(ni).flat(),l=Object.keys(i.old).filter(c=>a.includes(c));for(const c of Object.keys(t.expressionMap)){const A=t.expressionMap[c];if(!A)continue;const u=A._binds;if(!u||u.length==0){e.unregisterExpression(A);continue}for(const f of l){const h=i.new[f]||i.new[f.toLowerCase()],d=i.old[f]||i.old[f.toLowerCase()];if(h){const m=[];n.traverse(v=>{!v.isMesh&&!v.isSkinnedMesh||h.primitives.includes(v.id)&&m.push(v)}),e.unregisterExpression(A),A._binds=[];const g=o(u,d.index),p=new Y_(A.expressionName);p.copy(A),console.log("adding bind",A.expressionName),p.addBind(new tT({index:h.index,weight:g,primitives:m})),e.registerExpression(p)}else e.unregisterExpression(A)}}}return e}function iV(n,e){return e&&n?n.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):n||e}const D0e=n=>{const t=n.parser.json.meshes,r=n.parser.associations;n.scene.traverse(i=>{var s;if(i instanceof ia&&i.morphTargetDictionary){let o=!1;const a=r.get(i);if(typeof a>"u")return;const l=a.meshes||0,c=a.primitives||0,A=t[l],u=A==null?void 0:A.primitives[c];if((s=u==null?void 0:u.extras)!=null&&s.targetNames){const f=u.extras.targetNames;for(let h=0;h{var e,t;(e=n.parser.json.extensions)!=null&&e.VRM?O0e(n):(t=n.parser.json.extensions)!=null&&t.VRMC_vrm?k0e(n):console.warn("No valid vrm file was provided")},O0e=n=>{var a,l,c;const e=n.parser.json,t=n.scene,r=e.nodes,i=(c=(l=(a=e.extensions)==null?void 0:a.VRM)==null?void 0:l.secondaryAnimation)==null?void 0:c.colliderGroups,s=[],o=r.map(A=>sV(A.name,s));i!=null&&i.forEach(A=>{const u=o[A.node],f=KG(t,u);if(f!=null){const h=A.colliders;f.userData.VRMcolliders=h.map(d=>({sphere:{radius:d.radius,offset:[d.offset.x,d.offset.y,d.offset.z]}}))}f.userData.VRMcollidersID=jG()})},k0e=n=>{var l,c,A,u;const e=n.parser.json,t=n.scene,r=e.nodes,i=(c=(l=e.extensions)==null?void 0:l.VRMC_springBone)==null?void 0:c.colliderGroups,s=(u=(A=e.extensions)==null?void 0:A.VRMC_springBone)==null?void 0:u.colliders,o=[],a=r.map(f=>sV(f.name,o));i!=null&&i.forEach(f=>{const h=ut(f.colliders);let d=-1,m=null;h.forEach(g=>{if(d!=s[g].node){d=s[g].node;const p=a[d];m=KG(t,p),m.userData.VRMcolliders=[]}if(m!=null){const p=s[g].shape;for(const v in p){const w=p[v];w!=null&&w.offset&&(w.offset[0]=-w.offset[0])}m.userData.VRMcollidersID=jG(),m.userData.VRMcolliders.push(p)}else console.error("no node with name "+a[d]+" was found")})})},H0e=n=>{const e=[];return n.scene.traverse(t=>{var r;(r=t.userData)!=null&&r.VRMcolliders&&t.userData.VRMcolliders.length>0&&e.push(t)}),e},sV=(n,e)=>{const t=Ct.sanitizeNodeName(n||"");return t in e?t+"_"+ ++e[t]:(e[t]=0,t)},rx=[0,400,560,2400,4800],ix=[0,500,700,3e3,6e3],ST=[],Ml=[],m2=1024,oV=44100;for(let n=0;n{requestAnimationFrame(t),this.update(r,i)};t()}start(e){this.audioContext=new AudioContext,this.mediaStreamSource=this.audioContext.createMediaStreamSource(e),this.meter=sx.createAudioMeter(this.audioContext),this.mediaStreamSource.connect(this.meter)}startFromAudioFile(e){this.audioContext||(this.audioContext=new AudioContext),this.userSpeechAnalyzer||(this.userSpeechAnalyzer=this.audioContext.createAnalyser()),this.userSpeechAnalyzer.smoothingTimeConstant=.5,this.userSpeechAnalyzer.fftSize=m2,this.mediaStreamSource&&this.mediaStreamSource.stop(),this.audioContext.decodeAudioData(e).then(t=>{this.mediaStreamSource=this.audioContext.createBufferSource(),this.mediaStreamSource.buffer=t,this.meter=sx.createAudioMeter(this.audioContext),this.mediaStreamSource.connect(this.meter),this.mediaStreamSource.connect(this.audioContext.destination),this.mediaStreamSource.start(),this.mediaStreamSource.connect(this.userSpeechAnalyzer)})}destroy(){var e,t,r;return(e=this.meter)==null||e.shutdown(),this.meter=null,(t=this.mediaStreamSource)==null||t.disconnect(),((r=this.audioContext)==null?void 0:r.close().catch(()=>{}))||Promise.resolve()}update(e){if(this.meter){const{volume:t}=this.meter;if(t<.01)this.vrm.expressionManager.setValue(ni.Oh,0),this.vrm.expressionManager.setValue(ni.Ah,0),this.vrm.expressionManager.setValue(ni.Ee,0);else{const{ah:r,oh:i,ee:s}=this.update2();this.vrm.expressionManager.setValue(ni.Oh,i),this.vrm.expressionManager.setValue(ni.Ah,r),this.vrm.expressionManager.setValue(ni.Ee,s),this.vrm.expressionManager.update(e)}}}update2(){function e(c){const u=new Float32Array(c.length);for(let f=0;f0&&(i[c]+=r[A]);i[c]/=Ml[c+1]-Ml[c]}for(let c=0;c0&&(s[c]+=r[A]);i[c]/=Ml[c+1]-Ml[c],s[c]=s[c]/(ST[c+1]-ST[c])}const o=Math.max(s[1],i[1])>.2?1-2*Math.max(i[2],s[2]):(1-2*Math.max(i[2],s[2]))*5*Math.max(i[1],s[1]),a=3*Math.max(i[3],s[3]),l=.8*(Math.max(i[1],s[1])-Math.max(i[3],s[3]));return{oh:o,ee:l,ah:a}}static createAudioMeter(e){const t=e.createScriptProcessor(512);return t.onaudioprocess=r=>{const i=r.inputBuffer.getChannelData(0),s=i.length;let o=0,a;for(let c=0;c=t.clipLevel&&(t.clipping=!0,t.lastClip=window.performance.now()),o+=a*a;const l=Math.sqrt(o/s);t.volume=Math.max(l,t.volume*t.averaging)},t.clipping=!1,t.lastClip=0,t.volume=0,t.clipLevel=.98,t.averaging=.95,t.clipLag=750,t.connect(e.destination),t.checkClipping=()=>t.clipping?(t.lastClip+t.clipLag{t.disconnect(),t.onaudioprocess=null},t}}const tS=new $;class Q0e{constructor(e,t,r){this.bonesInfo=[],this.curMousePos=new je,this.hotzoneSection=s(),this.enabled=!1,this.userActivated=!1,this.lookInterest=1,this.hasInterest=!0,this.interestSpeed=.3,this.onCanvas=!0,this.camera=r,this.maxLookPercent={neck:{maxy:15,miny:10,maxx:30,minx:10},spine:{maxy:0,miny:0,maxx:30,minx:10},left:{maxy:15,miny:20,maxx:35,minx:35},right:{maxy:15,miny:20,maxx:35,minx:35}},window.addEventListener("mousemove",o=>{this.curMousePos={x:o.clientX,y:o.clientY}});const i=document.getElementById(t);i&&(i.addEventListener("mouseleave",()=>{this.onCanvas=!1}),i.addEventListener("mouseenter",()=>{this.onCanvas=!0})),window.addEventListener("resize",()=>{this.hotzoneSection=s()});function s(){const o=window.innerWidth*e/100,a=(window.innerWidth-o)/2;return{xStart:a,xEnd:window.innerWidth-a,yStart:50,yEnd:window.innerHeight-80}}}setActive(e){console.log("is activating"),this.userActivated=e}setCamera(e){this.camera=e}addVRM(e){const t=e.data.isVRM0||!1,r=e.humanoid.humanBones;t||(r.neck.node.userData.inverseLookAt=!0,r.spine.node.userData.inverseLookAt=!0,r.leftEye&&(r.leftEye.node.userData.inverseLookAt=!0),r.rightEye&&(r.rightEye.node.userData.inverseLookAt=!0));const i={vrm:e,neckBone:r.neck.node,spineBone:r.spine.node,leftEyeBone:r.leftEye?r.leftEye.node:null,rightEyeBone:r.rightEye?r.rightEye.node:null};this.bonesInfo.push(i)}removeVRM(e){const t=this.bonesInfo.find(r=>r.vrm===e);if(t){const r=this.bonesInfo.indexOf(t);this.bonesInfo.splice(r,1)}}_getMouseDegrees(e,t,r){let i=0,s=0,o,a,l,c,A={x:window.innerWidth,y:window.innerHeight};return e<=A.x/2&&(o=A.x/2-e,a=o/(A.x/2)*100,i=r.maxx*a/100*-1),e>=A.x/2&&(o=e-A.x/2,a=o/(A.x/2)*100,i=r.minx*a/100),t<=A.y/2&&(l=A.y/2-t,c=l/(A.y/2)*100,s=r.maxy*.5*c/100*-1),t>=A.y/2&&(l=t-A.y/2,c=l/(A.y/2)*100,s=r.miny*c/100),{x:i,y:s}}lerp(e,t,r){return(1-r)*e+r*t}_moveJoint(e,t){const r=e.userData.inverseLookAt===!0?1:-1;if(Object.keys(e).length!==0){const i=(this.camera.position.y-1.8)*window.innerHeight/2;let s=this._getMouseDegrees(this.curMousePos.x,this.curMousePos.y-i,t);const o=.8;e.rotation.y=this.lerp(Bt.degToRad(s.x),e.rotation.y,o),e.rotation.x=this.lerp(Bt.degToRad(s.y*r),e.rotation.x,o)}}update(){tS.set(0,0,1),tS.applyQuaternion(this.camera.quaternion);const e=tS.z>0;this.curMousePos.x>this.hotzoneSection.xStart&&this.curMousePos.xthis.hotzoneSection.yStart&&this.curMousePos.y{this._moveJoint(t.neckBone,this.maxLookPercent.neck),this._moveJoint(t.spineBone,this.maxLookPercent.spine),this._moveJoint(t.leftEyeBone,this.maxLookPercent.left),this._moveJoint(t.rightEyeBone,this.maxLookPercent.right)})}}class z0e{constructor(e){We(this,"targetVRMMeshes",[]);We(this,"baseTexture",null);We(this,"textures",[]);We(this,"applied",new Map);We(this,"imageDataRenderer");this.characterManager=e,this.imageDataRenderer=new U1(512,512)}get scene(){return this.characterManager.parentModel}get manifest(){return this.characterManager.manifestData}get targetMaterial(){if(!this.targetVRMMeshes.length)throw new Error("No target meshes found, call setTargetVRM");let e=this.targetVRMMeshes.map(r=>ut(r.material)).flat(),t=e[0];if(t.map)return t;for(let r=1;r{r instanceof ia&&(t&&t.length?t.includes(r.name)&&this.targetVRMMeshes.push(r):this.targetVRMMeshes.push(r))})}async update(){const e=this.targetMaterial,t=e.map.image,r=t.width,i=t.height;this.imageDataRenderer.clearRenderer(),this.imageDataRenderer.width=r,this.imageDataRenderer.height=i;const s=this.imageDataRenderer.render(this.textures,e.color||new ke(1,1,1),new ke(1,1,1),!0,!0);s||console.error("Failed to update OverlayTextureManager, ImageData is undefined");const o=h2({width:r,height:i,transparent:!0}),a=await createImageBitmap(s);o.drawImage(a,0,0);const l=new Un(o.canvas);l.colorSpace=Ut,l.flipY=!1,l.needsUpdate=!0,this.targetMaterial.map=l}async loadOverlayTexture(e,t){const r=new FA,i=e.getAllDecals().find(l=>l.id===t);if(!i)throw new Error("Decal "+t+" not found in trait group");if(this.targetVRMMeshes.length===0)throw new Error("No target meshes found");const s=i.directory;if(!s)throw new Error("Decal not found in trait group");const o=iV(this.manifest.getTraitsDirectory(),s),a=await r.loadAsync(o);return a.colorSpace=Ut,a.flipY=!1,this.textures.length||this.textures.push(this.targetMaterial.map.clone()),this.textures.push(a),this.applied.set(t,a),this.update()}removeOverlayTexture(e){if(this.applied.has(e)){const t=this.applied.get(e);if(!t)return this.applied.delete(e),Promise.resolve();this.textures.splice(this.textures.indexOf(t),1),this.applied.delete(e)}return this.update()}removeAllOverlayedTextures(){this.textures=[this.textures[0]],this.applied.clear(),this.update()}}class G0e{constructor(e){We(this,"traitRestrictions");We(this,"restrictionMaps",{});We(this,"itemRestrictions",new Map);We(this,"manifestData");We(this,"logRules",()=>{const e=[];for(const t in this.restrictionMaps){const r=this.restrictionMaps[t];r.restrictedTypes.size&&e.push(`Trait: ${r.group.trait} is restrciting traits ${Array.from(r.restrictedTraits.values()).join(", ")}`),r.restrictedTypes.size&&e.push(`Trait: ${r.group.trait} also restricts types ${Array.from(r.restrictedTypes.values()).join(", ")}`)}this.itemRestrictions.forEach((t,r)=>{e.push(`Item ${r} is restricting item ${Array.from(t.values()).join(", ")}`)}),console.log(e.join(` -`))});We(this,"_setupSpecificItemRestrictions",()=>{const e=this.manifestData.getAllTraitOptions();e.forEach(t=>{this.itemRestrictions.set(t.id,new Set)});for(const t of e){if(!t._restrictedItems||t._restrictedItems.length==0)continue;const r=new Set;for(const i of t._restrictedItems){if(!e.find(o=>o.id==i)){console.warn(`[${t.traitGroup.trait}] Restricted item ${i} not found`);continue}r.add(i)}if(this.itemRestrictions.set(t.id,r),r.size>0)for(const i of r){const s=this.itemRestrictions.get(i);s&&(s.has(t.id)||s.add(t.id))}}this.itemRestrictions.forEach((t,r)=>{t.size==0&&this.itemRestrictions.delete(r)})});We(this,"createTraitRestriction",e=>{if(this.restrictionMaps[e.trait])return this.restrictionMaps[e.trait];const t=new V0e(this,e);return e.restrictions=t,this.restrictionMaps[e.trait]=t,t});We(this,"getForbiddenTraits",e=>{const t=new Set;for(const r in this.restrictionMaps){if(!e.includes(r))continue;const i=this.restrictionMaps[r];for(const s of i.restrictedTraits)t.add(s)}return Array.from(t.values())});We(this,"getForbiddenTypes",e=>{const t=new Set;for(const r in this.restrictionMaps){if(!e.includes(r))continue;const i=this.restrictionMaps[r];for(const s of i.restrictedTraits)t.add(s)}return Array.from(t.values())});We(this,"_validateTraitRestrictions",()=>{const e={};if(this.traitRestrictions)for(const t in this.traitRestrictions)e[t]==null&&(e[t]={restrictedTraits:[],restrictedTypes:[]}),e[t].restrictedTraits=ut(this.traitRestrictions[t].restrictedTraits).filter(r=>!!r),e[t].restrictedTypes=ut(this.traitRestrictions[t].restrictedTypes).filter(r=>!!r);this.traitRestrictions=e});this.manifestData=e,this.traitRestrictions=e.traitRestrictions||{},this._validateTraitRestrictions()}_init(){this._setupSpecificItemRestrictions(),this.logRules()}}class V0e{constructor(e,t){We(this,"group");We(this,"restrictedTraits");We(this,"restrictedTypes");We(this,"isTraitAllowed",e=>!this.restrictedTraits.has(e));We(this,"isTypeAllowed",e=>!this.restrictedTypes.has(e));We(this,"isReverseTraitAllowed",e=>{const t=this.manifestRestrictions.restrictionMaps[e];if(t){const r=t.isTraitAllowed(this.traitId);return{allowed:r,blockingTrait:r?void 0:this.traitId}}return{allowed:!0,blockingTrait:void 0}});We(this,"isReverseTypeAllowed",(e,t)=>{if(!e)return{allowed:!0};const r=this.manifestRestrictions.restrictionMaps[t];if(r){const i=r.isTypeAllowed(e);return{allowed:i,blockingType:i?void 0:this.traitId}}return{allowed:!0}});We(this,"isItemAllowed",(e,t)=>{if(!e)return!0;const r=this.manifestRestrictions.itemRestrictions.get(e);return r?!r.has(t):!0});We(this,"isReverseItemAllowed",(e,t)=>{if(!e)return{allowed:!0,blockingItemId:void 0};const r=this.manifestRestrictions.itemRestrictions.get(t);if(r){const i=!r.has(e);return{allowed:i,blockingItemId:i?void 0:e}}return{allowed:!0,blockingItemId:void 0}});We(this,"isReverseAllowed",(e,t,r,i)=>{const s=this.isReverseTraitAllowed(t),o=this.isReverseTypeAllowed(e,t),a=this.isReverseItemAllowed(r,i);return{allowed:s.allowed&&o.allowed&&a.allowed,blocking:{blockingTrait:s.blockingTrait,blockingType:o.blockingType,blockingItemId:a.blockingItemId}}});var r,i;this.manifestRestrictions=e,this.group=t,this.restrictedTraits=new Set(((r=this.manifestRestrictions.traitRestrictions[t.trait])==null?void 0:r.restrictedTraits)||[]),this.restrictedTypes=new Set(((i=this.manifestRestrictions.traitRestrictions[t.trait])==null?void 0:i.restrictedTypes)||[]);for(const s in this.manifestRestrictions.traitRestrictions){if(s==t.trait)continue;const o=this.manifestRestrictions.traitRestrictions[s];for(const a of this.restrictedTraits){const l=this.manifestRestrictions.restrictionMaps[a];l&&(l.restrictedTraits.has(t.trait)||l.restrictedTraits.add(s))}o.restrictedTraits.includes(t.trait)&&!this.restrictedTraits.has(s)&&this.restrictedTraits.add(s)}}get manifestData(){return this.manifestRestrictions.manifestData}get traitId(){return this.group.trait}}class nS{constructor(e){const{assetsLocation:t,traitsDirectory:r,thumbnailsDirectory:i,traitIconsDirectorySvg:s,animationPath:o,exportScale:a,displayScale:l,initialTraits:c,requiredTraits:A,randomTraits:u,colliderTraits:f,lipSyncTraits:h,blinkerTraits:d,traitRestrictions:m,defaultCullingLayer:g,defaultCullingDistance:p,offset:v,vrmMeta:w,traits:_,textureCollections:x,decalCollections:b,colorCollections:B,canDownload:M=!0,downloadOptions:I={}}=e;this.assetsLocation=t,this.traitsDirectory=r,this.thumbnailsDirectory=i,this.traitIconsDirectorySvg=s,this.displayScale=l||a||1,this.animationPath=ut(o),this.requiredTraits=ut(A),this.randomTraits=ut(u),this.initialTraits=c||[...new Set(this.requiredTraits.concat(this.randomTraits))],this.colliderTraits=ut(f),this.lipSyncTraits=ut(h),this.blinkerTraits=ut(d),this.traitRestrictions=m,this.defaultCullingLayer=g,this.defaultCullingDistance=p,this.offset=v,this.canDownload=M,this.downloadOptions=I;const S=()=>{const D=[];for(const T in _)D.push(_[T].trait);return D};this.allTraits=S(),S(),(()=>{I.vrmMeta=I.vrmMeta||w,I.scale=I.scale||a||1,I.mToonAtlasSize=I.mToonAtlasSize||2048,I.mToonAtlasSizeTransp=I.mToonAtlasSizeTransp||1024,I.stdAtlasSize=I.stdAtlasSize||2048,I.stdAtlasSizeTransp=I.stdAtlasSizeTransp||1024,I.exportStdAtlas=I.exportStdAtlas||!1,I.exportMtoonAtlas=I.exportMtoonAtlas||!0,I.screenshotFaceDistance=I.screenshotFaceDistance||1,I.screenshotFaceOffset=I.screenshotFaceOffset||[0,0,0],I.screenshotResolution=I.screenshotResolution||[512,512],I.screenshotBackground=I.screenshotBackground||[.1,.1,.1],I.screenshotFOV=I.screenshotFOV||75,!I.exportStdAtlas&&!I.exportMtoonAtlas&&(I.exportMtoonAtlas=!0)})(),this.manifestRestrictions=new G0e(this),this.textureTraits=[],this.textureTraitsMap=null,this.createTextureTraits(x),this.decalTraits=[],this.decalTraitsMap=null,this.createDecalTraits(b),this.colorTraits=[],this.colorTraitsMap=null,this.createColorTraits(B),this.modelTraits=[],this.modelTraitsMap=null,this.createModelTraits(_),this.manifestRestrictions._init()}appendManifestData(e,t){e.textureTraits.forEach(r=>{const i=this.getTextureGroup(r.trait);i!=null?i.appendCollection(r,t):(this.textureTraits.push(r),this.textureTraitsMap.set(r.trait,r))}),e.colorTraits.forEach(r=>{const i=this.getColorGroup(r.trait);i!=null?i.appendCollection(r,t):(this.colorTraits.push(r),this.colorTraitsMap.set(r.trait,r))}),e.modelTraits.forEach(r=>{const i=this.getModelGroup(r.trait);i!=null?i.appendCollection(r,t):(this.modelTraits.push(r),this.modelTraitsMap.set(r.trait,r))}),console.log(e)}getExportOptions(){return this.downloadOptions}getGroupModelTraits(){return this.modelTraits}getInitialTraits(){return this.getRandomTraits(this.initialTraits)}getAllTraits(){return this.getRandomTraits(this.allTraits)}getTraitOptionById(e){return this.getAllTraitOptions().find(t=>t.id==e)}getTraitOptionsByType(e){return this.getAllTraitOptions().filter(t=>t.type==e)}getAllTraitOptions(){return this.modelTraits.map(e=>e==null?void 0:e.getCollection()).flat()}getAllBlendShapeTraits(){return this.modelTraits.map(e=>e.getCollection()).flat().map(e=>e.blendshapeTraits).flat().map(e=>e==null?void 0:e.collection).flat().filter(e=>!!e)}isColliderRequired(e){return this.colliderTraits.indexOf(e)!=-1}isLipsyncTrait(e){return this.lipSyncTraits.indexOf(e)!=-1}async getNFTraitOptionsFromURL(e,t){const r=await this._fetchJson(e);return this.getNFTraitOptionsFromObject(r,t)}getNFTraitOptionsFromObject(e,t){const r=e.attributes;if(r){t=ut(t);const i=[];return r.forEach(s=>{if(t.indexOf(s.trait_type)==-1){const o=this.getTraitOption(s.trait_type,s.value);o&&i.push(o)}}),i}else return console.warn("No attiributes parameter was found in ",e),null}getRandomTraits(e){const t=[];return(e||this.randomTraits).forEach(i=>{const s=this.getRandomTrait(i);s&&t.push(s)}),this._filterTraitOptions(t)}getRandomTrait(e){var r,i;const t=this.getModelGroup(e);if(t){const s=t.getRandomTrait();if(s){const o=(r=s.targetTextureCollection)==null?void 0:r.getRandomTrait(),a=(i=s.targetColorCollection)==null?void 0:i.getRandomTrait();return new rS(s,o,a)}else return null}else return console.warn("No trait group with name "+e+" was found."),null}async _fetchJson(e){return await(await fetch(e)).json()}getTraitOption(e,t){var i,s;const r=this.getModelTrait(e,t);if(r){const o=(i=r.targetTextureCollection)==null?void 0:i.getRandomTrait(),a=(s=r.targetColorCollection)==null?void 0:s.getRandomTrait();return new rS(r,o,a)}return null}_filterTraitOptions(e){const t=[],r=[];for(let i=0;i0&&console.log("options were filtered to fullfill restrictions: ",r),t}getCustomTraitOption(e,t){const r=this.getCustomModelTrait(e,t);return r?new rS(r,null,null):null}getCustomModelTrait(e,t){var r;return(r=this.getModelGroup(e))==null?void 0:r.getCustomTrait(t)}getModelTrait(e,t){var r;return(r=this.getModelGroup(e))==null?void 0:r.getTrait(t)}getModelTraits(e){const t=this.getModelGroup(e);return t?t.getCollection():(console.warn("No model group with name "+e),null)}getModelGroup(e){return this.modelTraitsMap.get(e)}getTextureTrait(e,t){var r;return(r=this.getTextureGroup(e))==null?void 0:r.getTrait(t)}getTextureGroup(e){return this.textureTraitsMap.get(e)}getDecalTrait(e,t){var r;return(r=this.getDecalGroup(e))==null?void 0:r.getTrait(t)}getDecalGroup(e){return this.decalTraitsMap.get(e)}getColorTrait(e,t){var r;return(r=this.getColorGroup(e))==null?void 0:r.getTrait(t)}getColorGroup(e){return this.colorTraitsMap.get(e)}getTraitsDirectory(){let e=(this.assetsLocation||"")+(this.traitsDirectory||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getThumbnailsDirectory(){let e=(this.assetsLocation||"")+(this.thumbnailsDirectory||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getTraitIconsDirectorySvg(){let e=(this.assetsLocation||"")+(this.traitIconsDirectorySvg||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getAssetsDirectory(){let e=this.assetsLocation||"";return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getDecalsDirectory(){let e=(this.assetsLocation||"")+(this.decalDirectory||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}createModelTraits(e,t=!1){t&&(this.modelTraits=[]);let r=!1;ut(e).forEach(i=>{var o,a;const s=new j0e(this,i);this.modelTraits.push(s),r&&((o=s.getAllDecals())!=null&&o.length)?console.warn("Detected multiple traits with decals; only one trait with decals is supported at the moment"):(a=s.getAllDecals())!=null&&a.length||(r=!0)}),this.modelTraitsMap=new Map(this.modelTraits.map(i=>[i.trait,i])),this.modelTraits.forEach(i=>{this.manifestRestrictions.createTraitRestriction(i)})}createTextureTraits(e,t=!1){t&&(this.textureTraits=[]),ut(e).forEach(r=>{this.textureTraits.push(new W0e(this,r))}),this.textureTraitsMap=new Map(this.textureTraits.map(r=>[r.trait,r]))}createDecalTraits(e,t=!1){t&&(this.decalTraits=[]),ut(e).forEach(r=>{this.decalTraits.push(new K0e(this,r))}),this.decalTraitsMap=new Map(this.decalTraits.map(r=>[r.trait,r]))}createColorTraits(e,t=!1){t&&(this.colorTraits=[]),ut(e).forEach(r=>{this.colorTraits.push(new X0e(this,r))}),this.colorTraitsMap=new Map(this.colorTraits.map(r=>[r.trait,r]))}}class j0e{constructor(e,t){We(this,"collection");We(this,"manifestData");We(this,"restrictions");const{trait:r,name:i,iconSvg:s,cameraTarget:o={distance:3,height:1},cullingDistance:a,cullingLayer:l,collection:c}=t;this.manifestData=e,this.isRequired=e.requiredTraits.indexOf(r)!==-1,this.trait=r,this.name=i,this.iconSvg=s,this.fullIconSvg=e.getTraitIconsDirectorySvg()+s,this.cameraTarget=o,this.cullingDistance=a,this.cullingLayer=l,this.collection=[],this.collectionMap=null,this.createCollection(c)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Model with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Model with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),ut(e).forEach(r=>{this.collection.push(new XO(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getCustomTrait(e){return new XO(this,{directory:e,fullDirectory:e,id:"_custom",name:"Custom"})}getTrait(e){return this.collectionMap.get(e)}getAllDecals(){return this.collection.map(t=>t.targetDecalCollection).flat().map(t=>t==null?void 0:t.collection).flat().filter(t=>!!t)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}getCollection(){return this.collection}}class W0e{constructor(e,t){const{trait:r,collection:i}=t;r?this.trait=r:(console.warn("TraitTexturesGroup is missing property trait"),this.trait="undefined"+Math.floor(Math.random()*10)),this.manifestData=e,this.collection=[],this.collectionMap=null,this.createCollection(i)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Texture with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Texture with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),ut(e).forEach(r=>{this.collection.push(new aV(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class K0e{constructor(e,t){We(this,"trait");We(this,"collection");We(this,"collectionMap");const{trait:r,collection:i}=t;this.manifestData=e,r?this.trait=r:(console.warn("DecalTextureGroup is missing property trait"),this.trait="undefined"+Math.floor(Math.random()*10)),this.collection=[],this.collectionMap=null,this.createCollection(i)}appendCollection(e,t=!1){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Texture with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Texture with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),ut(e).forEach(r=>{this.collection.push(new Z0e(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class X0e{constructor(e,t){const{trait:r,collection:i}=t;this.manifestData=e,this.trait=r,this.collection=[],this.collectionMap=null,this.createCollection(i)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Color with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Color with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),ut(e).forEach(r=>{this.collection.push(new J0e(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class XO{constructor(e,t){We(this,"type");We(this,"blendshapeTraits",[]);We(this,"decalMeshNameTargets",[]);We(this,"targetDecalCollection",null);We(this,"traitGroup");We(this,"blendshapeTraitsMap",new Map);We(this,"_restrictedItems",[]);const{id:r,type:i="",directory:s,name:o,thumbnail:a,cullingDistance:l,cullingLayer:c,textureCollection:A,blendshapeTraits:u,colorCollection:f,decalCollection:h,decalMeshNameTargets:d,fullDirectory:m,fullThumbnail:g,restrictedItems:p}=t;if(this.manifestData=e.manifestData,this.traitGroup=e,this.decalMeshNameTargets=ut(d),this.id=r,this.directory=s,this._restrictedItems=p||[],m)this.fullDirectory=m;else if(Array.isArray(s)){this.fullDirectory=[];for(let v=0;vnew Y0e(this,v)),this.blendshapeTraitsMap=new Map(this.blendshapeTraits.map(v=>[v.trait,v])))}isRestricted(e){var t,r;return!(e==null||(t=this.traitGroup.restrictions)!=null&&t.isTraitAllowed(e.traitGroup.trait)||(r=this.traitGroup.restrictions)!=null&&r.isTypeAllowed(e.type))}getGroupBlendShapeTraits(){return this.blendshapeTraits}getBlendShapes(e){var t,r;return(r=(t=this.blendshapeTraitsMap)==null?void 0:t.get(e))==null?void 0:r.collection}getBlendShape(e,t){var r,i;return(i=(r=this.blendshapeTraitsMap)==null?void 0:r.get(e))==null?void 0:i.getTrait(t)}}class Y0e{constructor(e,t){We(this,"trait");We(this,"name");We(this,"isBlendShapeGroup",!0);We(this,"collection",[]);We(this,"cameraTarget",null);We(this,"collectionMap",null);const{trait:r,name:i,collection:s,cameraTarget:o=e.traitGroup.cameraTarget||{distance:3,height:1}}=t;this.modelTrait=e,this.trait=r,this.name=i,this.cameraTarget=o,this.createCollection(s)}createCollection(e,t=!1){t&&(this.collection=[]),ut(e).forEach(r=>{this.collection.push(new $0e(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class $0e{constructor(e,t){We(this,"id");We(this,"name");We(this,"fullThumbnail");We(this,"isBlendShape",!0);const{id:r,name:i,fullThumbnail:s}=t;r||console.warn("BlendShapeTrait is missing id, parent trait: "+e.trait),i||console.warn("BlendShapeTrait is missing name, parent trait: "+e.trait),this.parentGroup=e,this.id=r,this.fullThumbnail=s,this.name=i}getGroupId(){return this.parentGroup.trait}}class aV{constructor(e,t){const{id:r,directory:i,fullDirectory:s,name:o,thumbnail:a}=t;if(this.traitGroup=e,this.id=r,this.directory=i,s)this.fullDirectory=s;else if(Array.isArray(i)){this.fullDirectory=[];for(let l=0;l{e.traverse(i=>{if(i.isMesh||i.isSkinnedMesh){const s=i;if(!s.morphTargetDictionary||!s.morphTargetInfluences)return;const o=s.morphTargetDictionary[t.id];o!=null&&(s.morphTargetInfluences[o]=r?1:0)}})});this._start(e)}async _start(e){const{parentModel:t=null,renderCamera:r=null,manifestURL:i=null}=e;this.rootModel=new Lt,this.characterModel=new Lt,this.parentModel=t,t&&t.add(this.rootModel),this.lipSync=null,this.lookAtManager=null,this.animationManager=new Ege,this.screenshotManager=new Nge(this,t||this.rootModel),this.overlayedTextureManager=new z0e(this),this.blinkManager=new kge(.1,.1,.5,5),this.rootModel.add(this.characterModel),this.renderCamera=r,this.manifestData=null,this.manifest=null,i&&(this.loadManifest(i),this.animationManager.setScale(this.manifestData.displayScale)),this.avatar={},this.storedAvatar={},this.traitLoadManager=new eve;const s=new ri;s.renderOrder=1e4,this.rootModel.add(s),this.vrmHelperRoot=s}togglePauseSpringBoneAnimation(e){for(const[t,r]of Object.entries(this.avatar))r.vrm.springBoneManager&&(r.vrm.springBoneManager.paused=e)}update(e){var t,r,i;if(this.lookAtManager!=null&&this.lookAtManager.update(),this.avatar){for(const s in this.avatar)if(((t=this.avatar[s])==null?void 0:t.vrm)!=null){if((r=this.avatar[s].vrm.springBoneManager)!=null&&r.paused)return;(i=this.avatar[s].vrm.springBoneManager)==null||i.update(e)}}}addLookAtMouse(e,t,r,i=!0){var s;this.lookAtManager=new Q0e(e,t,r),this.lookAtManager.enabled=!0;for(const o in this.avatar)((s=this.avatar[o])==null?void 0:s.vrm)!=null&&this.lookAtManager.addVRM(this.avatar[o].vrm)}toggleCharacterLookAtMouse(e){this.lookAtManager!=null?(this.lookAtManager.setActive(e),this.animationManager&&this.animationManager.enableMouseLook(e)):console.warn("toggleCharacterLookAtMouse() was called, but no lookAtManager exist. Make sure to set it up first with addLookArMous()")}savePortraitScreenshot(e,t,r,i=1,s=0){this.blinkManager.enableScreenshot(),this.characterModel.traverse(o=>{o.isSkinnedMesh&&o.skeleton.bones.filter(l=>l.name==="head")[0].getWorldPosition(xl)}),xl.z+=.3,xl.y+=s,this.screenshotManager.cameraFrameManager.setCamera(xl,i),this.screenshotManager.saveScreenshot(e,t,r),this.blinkManager.disableScreenshot()}cameraRaycastCulling(e,t,r=!0){if(this.renderCamera==null){console.warn("No camera was set in character manager. Please call setRenderCamera(camera) before calling this function");return}const i=()=>{this.characterModel.traverse(c=>{c.isMesh&&c.userData.origIndexBuffer&&(c.userData.clippedIndexGeometry=c.geometry.index.clone(),c.geometry.setIndex(c.userData.origIndexBuffer))})},s=()=>{this.characterModel.traverse(c=>{c.isMesh&&c.userData.origIndexBuffer&&c.geometry.setIndex(c.userData.clippedIndexGeometry)})},o=(c,A)=>{for(let u=0;u{var m,g;const u=c.object,f=c.face,h=[f.a,f.b,f.c],d=(g=(m=u.userData)==null?void 0:m.clippedIndexGeometry)==null?void 0:g.array;if(d!=null){const p=o(d,h),v=Array.from(d);if(p==-1&&!A){const w=[...v,...h];u.userData.clippedIndexGeometry=new ct(new Uint32Array(w),1,!1)}p!=1&&A&&(v.splice(p,3),u.userData.clippedIndexGeometry=new ct(new Uint32Array(v),1,!1))}};iS.x=e,iS.y=t,i(),YO.setFromCamera(iS,this.renderCamera);const l=YO.intersectObjects(this.characterModel.children);if(l.length>0){const c=l[0];a(c,r)}s()}removeCurrentCharacter(){const e=[];for(const t in this.avatar)e.push(new Nw({traitGroupID:t,traitModel:null}));e.forEach(t=>{this._addLoadedData(t)}),this.avatar={}}removeCurrentManifest(){this.removeCurrentCharacter(),this.manifest=null,this.manifestData=null,this.animationManager&&this.animationManager.clearCurrentAnimations()}canDownload(){var e;return((e=this.manifestData)==null?void 0:e.canDownload)||!0}downloadVRM(e,t=null){return new Promise(async(r,i)=>{if(this.canDownload())try{t=t||{};const o={...this.manifestData.getExportOptions(),...t};o.screenshot=this._getPortaitScreenshotTexture(!1,o),console.log(o),await b0e(this.characterModel,this.avatar,e,o),r()}catch(s){console.error("Error downloading VRM:",s.message),i(new Error("Failed to download VRM."))}else{const s="Download not supported.";console.error(s),i(new Error(s))}})}downloadGLB(e,t=null){if(console.log("XXX fix glb downloader"),this.canDownload()){t=t||{};const r={...this.manifestData.getExportOptions(),...t};B0e(this.characterModel,e,r)}else console.error("Download not supported")}getAvatarSelection(){var t;var e={};for(const r in this.avatar)e[r]={name:this.avatar[r].name,id:(t=this.avatar[r].traitInfo)==null?void 0:t.id};return e}getBoneTriangleCount(){let e=0,t=new Set;for(const r in this.avatar)this.avatar[r].model.traverse(i=>{i.isMesh&&(e+=i.geometry.index.array.length),i.isSkinnedMesh&&i.skeleton.bones.forEach(s=>{t.add(s.name)})});return{triangles:e/3,bones:t.size}}getGroupTraits(){if(this.manifestData)return this.manifestData.getGroupModelTraits()}getBlendShapeGroupTraits(e,t){var r;return this.manifestData?(r=this.manifestData.getModelTrait(e,t))==null?void 0:r.getGroupBlendShapeTraits():[]}getCurrentCharacterModel(){return this.characterModel}isTraitGroupRequired(e){const t=this.manifestData.getModelGroup(e);return!!(t!=null&&t.isRequired)}getTraits(e){return this.manifestData?this.manifestData.getModelTraits(e):(console.warn("No manifest file has been loaded, please load it before trait models."),null)}getCurrentTraitID(e){var t,r;return(r=(t=this.avatar[e])==null?void 0:t.traitInfo)==null?void 0:r.id}getCurrentTraitData(e){var t;return(t=this.avatar[e])==null?void 0:t.traitInfo}getCurrentBlendShapeTraitData(e){var t;return((t=this.avatar[e])==null?void 0:t.blendShapeTraitsInfo)||{}}getCurrentTraitVRM(e){var t;return(t=this.avatar[e])==null?void 0:t.vrm}setParentModel(e){e.add(this.rootModel),this.parentModel=e,this.screenshotManager&&this.screenshotManager.setScene(this.parentModel)}setRenderCamera(e){this.renderCamera=e}loadRandomTraits(){return new Promise(async(e,t)=>{if(this.manifestData){const r=this.manifestData.getRandomTraits();await this._loadTraits(r),e()}else{const r="No manifest was loaded, random traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadRandomTrait(e){return new Promise(async(t,r)=>{if(this.manifestData){const i=this.manifestData.getRandomTrait(e);await this._loadTraits(ut(i)),t()}else{const i="No manifest was loaded, random traits cannot be loaded.";console.error(i),r(new Error(i))}})}loadTraitsFromNFT(e,t=!0,r=null){return new Promise(async(i,s)=>{try{if(this.manifestData){const o=this.manifestData.getNFTraitOptionsFromURL(e,r);await this._loadTraits(o,t),i()}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}}catch(o){s(o)}})}loadTraitsFromNFTObject(e,t=!0,r=null){return new Promise(async(i,s)=>{if(this.manifestData)try{const o=this.manifestData.getNFTraitOptionsFromObject(e,r);await this._loadTraits(o,t),i()}catch(o){console.error("Error loading traits from NFT object:",o.message),s(new Error("Failed to load traits from NFT object."))}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}})}loadInitialTraits(){return new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getInitialTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadAllTraits(){return console.log("load all"),new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getAllTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadBlendShapeTrait(e,t,r){if(!this.avatar[e]){console.warn(`Trait with name: ${e} was not found or not selected.`);return}if(!this.manifestData){console.warn("No manifest data was found.");return}try{this._loadBlendShapeTrait(e,t,r)}catch{console.error("Error loading blendshape trait "+e,t,r)}}removeBlendShapeTrait(e,t){this.avatar[e]?this._loadBlendShapeTrait(e,t,null):console.warn(`No trait with name: ${e} was found.`)}_getTraitAllowedRules(e,t){var i;const r=[];for(const s in this.avatar){const o=this.avatar[s],a=(i=o.traitInfo.traitGroup.restrictions)==null?void 0:i.isReverseAllowed(o.traitInfo.type,e,o.traitInfo.id,t);a&&!(a!=null&&a.allowed)&&r.push(a)}return r.length?r:[{allowed:!0,blocking:{}}]}_checkRestrictionsBeforeLoad(e,t){const r=this._getTraitAllowedRules(e,t);if(!r[0].allowed)for(const i of r){if(i.blocking.blockingTrait&&this.removeTrait(i.blocking.blockingTrait),i.blocking.blockingItemId){const s=this.manifestData.getTraitOptionById(i.blocking.blockingItemId);s&&this.removeTrait(s.traitGroup.trait)}if(i.blocking.blockingType&&this.manifestData.getTraitOptionsByType(i.blocking.blockingType).length)for(const o in this.avatar)this.avatar[o].traitInfo.type==i.blocking.blockingType&&this.removeTrait(o)}}loadTrait(e,t,r=!1){return new Promise(async(i,s)=>{if(this.manifestData)try{const o=this.manifestData.getTraitOption(e,t);this._checkRestrictionsBeforeLoad(e,t),o&&(await this._loadTraits(ut(o),r),i())}catch(o){console.error("Error loading specific trait:",o.message),s(new Error("Failed to load specific trait."))}else{const o="No manifest was loaded, specific trait cannot be loaded.";console.error(o),s(new Error(o))}})}loadCustomTrait(e,t){return new Promise(async(r,i)=>{if(this.manifestData)try{const s=this.manifestData.getCustomTraitOption(e,t);s&&(await this._loadTraits(ut(s)),r())}catch(s){console.error("Error loading custom trait:",s.message),i(new Error("Failed to load custom trait."))}else{const s="No manifest was loaded, custom trait cannot be loaded.";console.error(s),i(new Error(s))}})}loadCustomTexture(e,t){return new Promise(async(r,i)=>{var o;const s=(o=this.avatar[e])==null?void 0:o.model;if(s)await fge(s,t),r();else{const a="No Group Trait with name "+e+" was found.";console.warn(a),i(new Error(a))}})}setTraitColor(e,t){var i;const r=(i=this.avatar[e])==null?void 0:i.model;if(r)try{const s=new ke(t);r.traverse(o=>{o.isMesh&&(o.material.type==="MeshStandardMaterial"?Array.isArray(o.material)?o.material.forEach(a=>{a.color=s}):o.material.color=s:(o.material[0].uniforms.litFactor.value=s,o.material[0].uniforms.shadeColorFactor.value=new ke(s.r*.8,s.g*.8,s.b*.8)))})}catch(s){throw console.error("Error setting trait color:",s.message),new Error("Failed to set trait color.")}else{const s="No Group Trait with name "+e+" was found.";throw console.warn(s),new Error(s)}}removeTrait(e,t=!1){if(this.isTraitGroupRequired(e)&&!t){console.warn(`No trait with name: ${e} is not removable.`);return}if(this.manifestData.getModelGroup(e)){const i=new Nw({traitGroupID:e,traitModel:null});this._addLoadedData(i),$B(this.avatar)}else console.warn(`No trait with name: ${e} was found.`)}updateCullHiddenMeshes(){$B(this.avatar)}loadOptimizerManifest(){this.manifest={colliderTraits:["CUSTOM"],traits:[{name:"Custom",trait:"CUSTOM",collection:[]}]},this.manifestData=new nS(this.manifest)}getCurrentOptimizerCharacterModel(){var e;return(e=this.avatar.CUSTOM)==null?void 0:e.vrm}loadOptimizerCharacter(e){return this.loadCustomTrait("CUSTOM",e)}setManifest(e){return this.removeCurrentCharacter(),new Promise(async(t,r)=>{try{if(this.manifest=e,this.manifest){if(this.manifestData=new nS(this.manifest),this.animationManager)try{await this._animationManagerSetup(this.manifest.animationPath,this.manifest.assetsLocation,this.manifestData.displayScale)}catch(i){console.error("Error loading animations: "+i)}t()}else{const i="Failed to fetch or parse the manifest.";console.error(i),r(new Error(i))}}catch(i){console.error("Error setting manifest:",i.message),r(new Error("Failed to set the manifest."))}})}appendManifest(e,t){return new Promise(async(r,i)=>{try{t?this.manifest={...this.manifest||{},manifest:e}:this.manifest={manifest:e,...this.manifest||{}};const s=new nS(e);this.manifestData.appendManifestData(s),r()}catch(s){console.error("Error setting manifest:",s.message),i(new Error("Failed to set the manifest."))}})}loadManifest(e){return new Promise(async(t,r)=>{try{const i=await this._fetchManifest(e);this.setManifest(i).then(()=>{t()})}catch(i){console.error("Error loading manifest:",i.message),r(new Error("Failed to load the manifest."))}})}loadAppendManifest(e,t){return new Promise(async(r,i)=>{try{const s=await this._fetchManifest(e);this.appendManifest(s,t).then(()=>{r()})}catch(s){console.error("Error loading manifest:",s.message),i(new Error("Failed to load the manifest."))}})}async soloTargetGroupTrait(e){const t=ut(e),r=[];for(const i in this.avatar)t.includes(i)&&r.push(this.manifestData.getTraitOption(i,this.avatar[i].traitInfo.id));await this._loadTraits(r,!0)}storeCurrentAvatar(){this.storedAvatar={...this.avatar}}async loadStoredAvatar(){const e=[];for(const t in this.storedAvatar)e.push(this.manifestData.getTraitOption(t,this.storedAvatar[t].traitInfo.id));console.log(e),this._loadTraits(e,!0)}async _loadTraits(e,t=!1){console.log("laoded traits:",e),await this.traitLoadManager.loadTraitOptions(ut(e)).then(r=>{t&&this.getGroupTraits().forEach(s=>{r.some(a=>{var l;return((l=a.traitModel)==null?void 0:l.traitGroup.trait)===s.trait})||this.avatar[s.trait]!=null&&r.push(new Nw({traitGroupID:s.trait,traitModel:null}))}),r.forEach(i=>{this._addLoadedData(i)}),$B(this.avatar)})}async _loadBlendShapeTrait(e,t,r){const i=this.avatar[e];if(!i){console.warn(`Trait with name: ${e} was not found or not selected.`);return}if(i.blendShapeTraitsInfo||(i.blendShapeTraitsInfo={}),i.blendShapeTraitsInfo[t]&&this.toggleBinaryBlendShape(i.model,i.blendShapeTraitsInfo[t],!1),r==null){delete this.avatar[e].blendShapeTraitsInfo[t];return}const s=i.traitInfo.getBlendShape(t,r);if(!s){console.warn(`Blendshape with name: ${r} was not found.`);return}this.toggleBinaryBlendShape(i.model,s,!0),this.avatar[e].blendShapeTraitsInfo[s.getGroupId()]=s}async _animationManagerSetup(e,t,r){const i=ut(e);this.animationManager&&(this.animationManager.setScale(r),e.length>0&&(this.animationManager.storeAnimationPaths(i,t||""),await this.animationManager.loadAnimation(i,!1,0,i[0].endsWith(".fbx"),t||"")))}async _fetchManifest(e){return await(await fetch(e)).json()}_getPortaitScreenshotTexture(e,t){this.blinkManager.enableScreenshot(),this.characterModel.traverse(u=>{u.isSkinnedMesh&&u.skeleton.bones.filter(h=>h.name==="head")[0].getWorldPosition(xl)});const{screenshotResolution:r,screenshotFaceDistance:i,screenshotFaceOffset:s,screenshotBackground:o,screenshotFOV:a}=t,l=r[0],c=r[1];xl.x+=s[0],xl.y+=s[1],xl.z+=s[2],this.screenshotManager.setBackground(o),this.screenshotManager.cameraFrameManager.setCamera(xl,i,a);const A=e?this.screenshotManager.getScreenshotBlob(l,c):this.screenshotManager.getScreenshotTexture(l,c);return this.blinkManager.disableScreenshot(),A}_setupWireframeMaterial(e){e.origMat=e.material;const t=()=>{const o=.1+Math.random()*.9,a=.1+Math.random()*(1-.1),l=.1+Math.random()*(1-.1);return new ke(o,a,l)},r=new qi({color:t(),wireframe:!0,wireframeLinewidth:.2}),i=e.material;e.setDebugMode=s=>{s?e.material.length?(e.material[0]=r,e.material[1]=r):e.material=r:e.material=i}}_VRMBaseSetup(e,t,r,i,s){var a,l;let o=e.userData.vrm;if(e.userData.vrm==null)return console.error("No valid VRM was provided for "+r+" trait, skipping file."),null;if(DO(o,{isVRM0:((a=o.meta)==null?void 0:a.metaVersion)==="0"}),this.manifestData.isColliderRequired(r)&&N0e(e),this._applySpringBoneColliders(o),vge(o),D0e(e),this._unregisterMorphTargetsFromManifest(o),this.manifestData.isLipsyncTrait(r)&&(this.lipSync=new sx(o)),this._modelBaseSetup(o,t,r,i,s),((l=o.meta)==null?void 0:l.metaVersion)==="0"){if(o.humanoid.humanBones.hips.node.parent==o.scene){const c=new Lt;c.name="newRootNode",uge(o.scene,c),c.add(o.humanoid.humanBones.hips.node)}o.humanoid.humanBones.hips.node.parent.rotateY(3.14159),o.scene.traverse(c=>{if(c.isSkinnedMesh){for(let A=0;A{for(const s of r){if(i.colliderGroups.find(a=>a.name===s.name))return;i.colliderGroups.indexOf(s)===-1&&i.colliderGroups.push(s)}})}Object.entries(this.avatar).map(([r,i])=>{var a;const s=[];if((a=i.vrm.springBoneManager)!=null&&a.colliderGroups.length&&s.push(...i.vrm.springBoneManager.colliderGroups),s.length){t(s);return}const o=H0e(i.vrm);o.length!=0&&o.forEach(l=>{if(!e.springBoneManager)return;const c={colliders:[],name:l.name};for(const A of l.children)A instanceof Pw&&c.colliders.indexOf(A)===-1&&c.colliders.push(A);c.colliders.length&&t([c])})})}_unregisterMorphTargetsFromManifest(e){var s;const t=this.manifestData.getAllBlendShapeTraits(),r=(s=e.expressionManager)==null?void 0:s.expressions;if(t.length==0||!r)return;const i=[];for(const o of r)t.map(a=>a.id).includes(o.expressionName)&&i.push(o);for(const o of i)e.expressionManager.unregisterExpression(o)}_modelBaseSetup(e,t,r,i,s){const o=[],a=ut(t.cullingIgnore),l=[];t.meshTargets&&ut(t.meshTargets).map(u=>{const f=e.scene.getObjectByName(u);f!=null&&f.isMesh&&o.push(f)}),e.scene.traverse(u=>{!t.meshTargets&&u.isMesh&&o.push(u),u.frustumCulled=!1,u.isMesh&&(this._setupWireframeMaterial(u),a.indexOf(u.name)===-1&&l.push(u))});const c=this.manifest,A=this.manifestData.getModelGroup(r);DO(e,{cullingLayer:t.cullingLayer!=null?t.cullingLayer:A.cullingLayer!=null?A.cullingLayer:c.defaultCullingLayer!=null?c.defaultCullingLayer:-1,cullingDistance:t.cullingDistance!=null?t.cullingDistance:A.cullingDistance!=null?A.cullingDistance:c.defaultCullingDistance!=null?c.defaultCullingDistance:null,maxCullingDistance:t.maxCullingDistance!=null?t.maxCullingDistance:A.maxCullingDistance!=null?A.maxCullingDistance:c.maxCullingDistance!=null?c.maxCullingDistance:1/0,cullingMeshes:l}),o.map((u,f)=>{if(i){const h=i[f]||i[0];h!=null&&ut(u.material).map(d=>{tve(d,h)})}if(s){const h=s[f]||s[0];h!=null&&(u.material[0].uniforms.litFactor.value=h,u.material[0].uniforms.shadeColorFactor.value=new ke(h.r*.8,h.g*.8,h.b*.8))}})}_applyManagers(e){this.blinkManager.addVRM(e),this.lookAtManager&&this.lookAtManager.addVRM(e),this.animationManager&&this.animationManager.addVRM(e)}_displayModel(e){if(e){const t=e.scene;this.characterModel.attach(t)}}_positionModel(e){const t=this.manifestData.displayScale;e.scene.scale.set(t,t,t)}_disposeTrait(e){this.blinkManager.removeVRM(e),this.lookAtManager&&this.lookAtManager.removeVRM(e),this.animationManager&&this.animationManager.removeVRM(e),gge(e)}_addLoadedData(e){const{traitGroupID:t,traitModel:r,textureTrait:i,colorTrait:s,models:o,textures:a,colors:l}=e;if(r==null){this.avatar[t]&&this.avatar[t].vrm&&(this._disposeTrait(this.avatar[t].vrm),delete this.avatar[t]);return}let c=null;o.map(A=>{A!=null&&(c=this._VRMBaseSetup(A,r,t,a,l))}),c!=null&&(this.avatar[t]&&this.avatar[t].vrm&&this._disposeTrait(this.avatar[t].vrm),this._positionModel(c),this._displayModel(c),this._applyManagers(c),this.overlayedTextureManager&&r.targetDecalCollection&&this.overlayedTextureManager.setTargetVRM(c,r.decalMeshNameTargets),this.avatar[t]={traitInfo:r,blendShapeTraitsInfo:{},textureInfo:i,colorInfo:s,name:r.name,model:c&&c.scene,vrm:c})}}class eve{constructor(){const e=new Hz;e.onProgress=(i,s,o)=>{this.setLoadPercentage(Math.round(s/o*100))};const t=new Kz(e);t.crossOrigin="anonymous",t.register(i=>new mpe(i,{autoUpdateHumanBones:!0}));const r=new FA(e);this.loadPercentager=0,this.loadingManager=e,this.gltfLoader=t,this.textureLoader=r,this.isLoading=!1}setLoadPercentage(e){this.loadPercentager=e}loadTraitOptions(e){return new Promise(t=>{this.isLoading=!0;const r=[],i=e.map(async(s,o)=>{var A,u,f;if(s==null){r[o]=null;return}const a=await Promise.all(ut((A=s==null?void 0:s.traitModel)==null?void 0:A.fullDirectory).map(async h=>{try{return await this.gltfLoader.loadAsync(h)}catch(d){return console.error(`Error loading modelsss ${h}:`,d),null}})),l=await Promise.all(ut((u=s==null?void 0:s.traitTexture)==null?void 0:u.fullDirectory).map(h=>new Promise(d=>{this.textureLoader.load(h,m=>{m.flipY=!1,m.colorSpace=Ut,d(m)},null,m=>{console.error("error loading texture: ",m),d(null)})}))),c=ut((f=s==null?void 0:s.traitColor)==null?void 0:f.value).map(h=>new ke(h));r[o]=new Nw({traitGroupID:s==null?void 0:s.traitModel.traitGroup.trait,traitModel:s==null?void 0:s.traitModel,textureTrait:s==null?void 0:s.traitTexture,colorTrait:s==null?void 0:s.traitColor,models:a,textures:l,colors:c})});Promise.allSettled(i).then(()=>{this.setLoadPercentage(100),t(r),this.isLoading=!1}).catch(s=>{this.setLoadPercentage(100),console.error("An error occurred:",s),t(r),this.isLoading=!1})})}}class Nw{constructor(e){const{traitGroupID:t,traitModel:r,textureTrait:i,colorTrait:s,models:o,textures:a,colors:l}=e;this.traitGroupID=t,this.traitModel=r,this.textureTrait=i,this.colorTrait=s,this.models=o,this.textures=a,this.colors=l}}function tve(n,e){if(n.type==="Shadermaterial"&&!n.isMToonMaterial){console.warn("XXX set material texture to shader material",n);return}n.map=e,n.needsUpdate=!0}class nve extends soe{constructor(e){super(e),this.type=ka}parse(e){const o=function(M,I){switch(M){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(I||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(I||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(I||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(I||""))}},A=` -`,u=function(M,I,S){I=I||1024;let D=M.pos,T=-1,y=0,E="",R=String.fromCharCode.apply(null,new Uint16Array(M.subarray(D,D+128)));for(;0>(T=R.indexOf(A))&&y=M.byteLength||!(E=u(M)))&&o(1,"no header found"),(R=E.match(I))||o(3,"bad initial token"),y.valid|=1,y.programtype=R[1],y.string+=E+` -`;E=u(M),E!==!1;){if(y.string+=E+` + `})}}const rm=new $;class Fge{constructor(e){Ne(this,"camera",null);Ne(this,"frameOffset",{min:.2,max:.2});Ne(this,"boneOffsets");Ne(this,"cameraDir",new $);Ne(this,"frameTarget",null);this.camera=e||new Fr,this.boneOffsets={head:null,neck:null,chest:null,hips:null,spine:null,leftUpperLeg:null,leftLowerLeg:null,leftFoot:null,rightUpperLeg:null,rightLowerLeg:null,rightFoot:null}}setupCamera(e,t,r=30){this.camera.position.copy(e),this.camera.lookAt(t),this.camera.fov=r}async calculateBoneOffsets(e,t){for(const r in this.boneOffsets){const i=await this._getMinMaxOffsetByBone(e,r,t);console.log("result",i),this.boneOffsets[r]=i}}setFrameTarget(e){this.frameTarget=e}frameCloseupShot(){this.frameShot("head","head")}frameMediumShot(){this.frameShot("chest","head")}frameCowboyShot(){this.frameShot("hips","head")}frameFullShot(){this.frameShot("leftFoot","head")}frameShot(e,t,r=null,i=!1,s=!0){if(!this.frameTarget){console.error("No target object provided, Call setFrameTarget() first;");return}const o=this._getBoneWorldPositionWithOffset(this.frameTarget,e,i),a=this._getBoneWorldPositionWithOffset(this.frameTarget,t,s);o.y-=this.frameOffset.max,a.y+=this.frameOffset.min,r=r||new $(0,0,0),this.positionCameraBetweenPoints(o,a,r)}setBottomFrameOffset(e){this.frameOffset.min=e}setTopFrameOffset(e){this.frameOffset.max=e}_getBoneWorldPositionWithOffset(e,t,r){const i=this._getFirstBoneWithName(t,e);if(!i||!this.boneOffsets[t])return console.error(`Bone with name '${t}' not found in the model.`),new $;const s=new $;i.getWorldPosition(s);const o=r?this.boneOffsets[t].max:this.boneOffsets[t].min;return s.y+=o.y,s}_getFirstBoneWithName(e,t=void 0){let r=null;const i=t||this.frameTarget;if(!i){console.error("_getFirstBoneWithName: No target object provided, Call setFrameTarget() first or provide a targetObject parameter;");return}return i.traverse(s=>{if(s instanceof sa){if(!s.geometry){console.error("Invalid skinned mesh found in children.");return}const o=s.skeleton.bones.findIndex(a=>a.name===e);if(o!==-1){r=s.skeleton.bones[o];return}}}),r}async _getMinMaxOffsetByBone(e,t,r){return new Promise(async(i,s)=>{(!e||!e.traverse)&&(console.error("Invalid parent object provided."),s(null));const o=new $(1/0,1/0,1/0),a=new $(-1/0,-1/0,-1/0),l=[];e.traverse(async u=>{u instanceof sa&&(l.push(this._saveBonesPos(u.skeleton)),u.skeleton.pose())});let c=0;await(u=>new Promise(f=>setTimeout(f,u)))(10),e.traverse(u=>{if(u instanceof sa){if(!u.geometry){console.error("Invalid skinned mesh found in children.");return}const f=u.skeleton.bones.findIndex(g=>g.name===t);if(f===-1){console.error(`Bone with name '${t}' not found in one of the skinned meshes.`);return}const h=u.geometry.getAttribute("position"),d=u.geometry.getAttribute("skinWeight"),m=u.geometry.getAttribute("skinIndex");for(let g=0;g=r){const _=u.skeleton.bones[f],x=new $().setFromMatrixPosition(_.matrixWorld),b=p.clone().sub(x);o.min(b),a.max(b)}}this._restoreSavedPose(l[c],u.skeleton),c++}}),i({min:o,max:a})})}_saveBonesPos(e){let t=[];return e.bones.forEach(r=>{t.push({position:r.position.clone(),rotation:r.rotation.clone(),scale:r.scale.clone()})}),t}_restoreSavedPose(e,t){e&&t.bones.forEach((r,i)=>{r.position.copy(e[i].position),r.rotation.copy(e[i].rotation),r.scale.copy(e[i].scale)})}positionCameraBetweenPoints(e,t,r,i=30){const s=new Hn;s.expandByPoint(e),s.expandByPoint(t),this.camera.fov=i;const o=this.camera.fov*(Math.PI/180),l=s.getSize(new $).length()/(2*Math.tan(o/2));s.getCenter(rm),this.camera.position.copy(rm),r.y*=.5,this.camera.lookAt(rm.clone().sub(r));const c=new $;this.camera.getWorldDirection(c),this.camera.position.addScaledVector(c,-l),this.camera.updateProjectionMatrix()}setCamera(e,t,r=30){this.camera.position.copy(e),this.camera.fov=r,rm.set(0,0,-1),this.cameraDir=rm.applyQuaternion(this.camera.quaternion),this.cameraDir.normalize(),this.camera.position.x-=this.cameraDir.x*t,this.camera.position.z-=this.cameraDir.z*t}setCameraFrameWithName(e,t){switch(e.toLowerCase()){case"fullshot":this.frameShot("leftFoot","head",t);break;case"cowboyshot":this.frameShot("hips","head",t);break;case"mediumshot":this.frameShot("chest","head",t);break;case"mediumcloseup":case"mediumcloseupshot":this.frameShot("chest","head",t,!0);break;case"closeup":case"closeupshot":this.frameShot("head","head",t);break;default:console.warn("unkown cameraFrame: "+e+". Please use fullShot, cowboyShot, mediumShot, mediumCloseup or closeup"),this.frameShot("leftFoot","head",t);break}}copyCamera(e){this.camera.position.copy(e.position),this.camera.quaternion.copy(e.quaternion),"fov"in e&&(this.camera.fov=e.fov)}}const rx=4096;class Pge{constructor(e,t,r){const i=new y0({preserveDrawingBuffer:!0,antialias:!1,alpha:!0});this.pixelSize=r,this.domElement=i.domElement;const s=new We(rx,rx);i.setClearColor(0,0),i.outputColorSpace=Sr,i.setSize(s.x,s.y),i.setPixelRatio(window.devicePixelRatio);let o=s.clone().divideScalar(r);o.x|=0,o.y|=0;const a=new Tge(i);a.addPass(new Ige(e,t)),this._renderPixelPass=new Rge(o,e,t),this._pixelPass=new Uge(o),a.addPass(this._renderPixelPass),a.addPass(this._pixelPass),this.renderer=i,this.composer=a}setSize(e,t){let i=new We(e,t).clone().divideScalar(this.pixelSize);i.x|=0,i.y|=0,this.renderer.setSize(e,t),this._renderPixelPass.setResolution(i),this._pixelPass.setResolution(i)}setPixelSize(e){this.pixelSize=e}render(){this.composer.render()}}class Lge{constructor(e,t){Ne(this,"cameraFrameManager");this.renderer=new y0({preserveDrawingBuffer:!0,antialias:!0,alpha:!0}),this.renderer.setClearAlpha(0),this.renderer.premultipliedAlpha=!1,this.scene=t,this.characterManager=e,this.renderer.outputColorSpace=Ut,this.renderer.setSize(rx,rx);const r=new Fr(30,1,.1,1e3);this.textureLoader=new PA,this.sceneBackground=new Qe(.1,.1,.1),this.sceneBackgroundAlpha=1,this.usesBackgroundImage=!1,this.backgroundMaterial=new qi({color:16777215,transparent:!0,opacity:.5});const i=new cc(1e3,1e3),s=new dn(i,this.backgroundMaterial);s.renderOrder=-1,this.backgroundPlane=s,this.pixelRenderer=new Pge(t,r,20),this.cameraFrameManager=new Fge(r),this.cameraFrameManager.setFrameTarget(this.characterManager.characterModel)}setScene(e){this.scene=e}get camera(){return this.cameraFrameManager.camera}setupCamera(e,t,r=30){this.cameraFrameManager.setupCamera(e,t,r)}_getCharacterMinMax(){let e=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY;return this.characterManager.characterModel.traverse(r=>{r.geometry&&(r.geometry.computeBoundingBox(),r.geometry.boundingBox&&(r.geometry.boundingBox.applyMatrix4(r.matrixWorld),r.geometry.boundingBox.min.yt&&(t=r.geometry.boundingBox.max.y)))}),{minY:e,maxY:t}}_getBoneWorldPosition(e,t=void 0){const r=this.cameraFrameManager._getFirstBoneWithName(e,t);return r!=null?new $().setFromMatrixPosition(r.matrixWorld):(console.warn(`Bone with name '${e}' not found in one of the skinned meshes.`),new $(0,0,0))}setBackground(e){if(Array.isArray(e)){const t=e[3]==null?1:e[3];this.setBackgroundColor(e[0],e[1],e[2],t)}else this.setBackgroundImage(e)}setBackgroundColor(e,t,r,i){const s=new Qe(e,t,r,i);this.sceneBackground=s,i==null&&(i=1),i>1&&(i=1),i<0&&(i=0),this.sceneBackgroundAlpha=i,this.backgroundMaterial.color=s,this.usesBackgroundImage=!1}setBackgroundImage(e){return new Promise(async(t,r)=>{try{const i=await this.texureLoader.load(e);i&&(i.wrapS=i.wrapT=zs,this.sceneBackground=i,this.usesBackgroundImage=!0,this.sceneBackgroundAlpha=1,t())}catch(i){console.error("Error loading background image: ",i),r(i)}})}_setBackground(){if(this.usesBackgroundImage==!1&&this.sceneBackgroundAlpha!=1)if(this.sceneBackgroundAlpha==0)this.scene.background=null;else{this.scene.background=null,this.scene.add(this.backgroundPlane),this.backgroundPlane.position.copy(this.camera.position);var e=new $(0,0,-1);e.applyQuaternion(this.camera.quaternion);var t=100;this.backgroundPlane.position.addScaledVector(e,t),this.backgroundPlane.lookAt(this.camera.position)}else this.scene.background=this.sceneBackground}_restoreBackground(){this.scene.background=null,this.usesBackgroundImage==!1&&this.sceneBackgroundAlpha!=1&&this.scene.remove(this.backgroundPlane)}getImageData(e,t,r=null){return this._createImage(e,t,r).split("base64,")[1]}_createImage(e,t,r=null){const i=e/t;typeof r=="number"&&this.pixelRenderer.setPixelSize(r),this.renderer.setSize(e,t),this.pixelRenderer.setSize(e,t);const s="image/png";this.camera.aspect=i,this.camera.updateProjectionMatrix();const o=typeof r=="number"?this.pixelRenderer:this.renderer;try{this._setBackground(),o.render(this.scene,this.camera);let a=o.domElement.toDataURL(s);return this._restoreBackground(),a}catch(a){return console.error(a),null}}savePixelScreenshot(e,t,r,i){this.pixelRenderer.setPixelSize(i),this.pixelRenderer.setSize(t,r);const s=this._createImage(t,r,!0),o="image/octet-stream",a="image/png";this.saveFile(s.replace(a,o),e+".png")}saveScreenshot(e,t,r){const i=this._createImage(t,r),s="image/octet-stream",o="image/png";this.saveFile(i.replace(o,s),e+".png")}getScreenshotImage(e,t){const r=this._createImage(e,t),i=new Image;return i.src=r,i}getScreenshotTexture(e,t){const r=this.getScreenshotImage(e,t),i=new Un(r);return i.needsUpdate=!0,i}getScreenshotBlob(e,t){const r=this._createImage(e,t),i=l8.Buffer.from(r.replace(/^data:image\/\w+;base64,/,""),"base64");return new Blob([i],{type:"image/jpeg"})}saveFile(e,t){const r=document.createElement("a");typeof r.download=="string"?(document.body.appendChild(r),r.download=t,r.href=e,r.click(),document.body.removeChild(r)):window.open(e,"_blank").document.write(""+t+"")}}const Dge=2;class Nge{constructor(e=.5,t=.5,r=1,i=5){this.vrmBlinkers=[],this.mode="ready",this.clock=new y1,this.closeTime=e,this.openTime=t,this.continuity=r,this.randomness=i,this._eyeOpen=1,this._blinkCounter=0,this.isTakingScreenShot=!1,this.update()}addVRM(e){this.vrmBlinkers.push(e)}removeVRM(e){const t=this.vrmBlinkers.indexOf(e);t!==-1&&this.vrmBlinkers.splice(t,1)}enableScreenshot(){this.isTakingScreenShot=!0,this._eyeOpen=Dge,this._updateBlinkers()}disableScreenshot(){this.isTakingScreenShot=!1}update(){setInterval(()=>{if(this.isTakingScreenShot)return;const e=this.clock.getDelta();switch(this.mode){case"closing":this._eyeOpen>0?this._eyeOpen-=e/this.closeTime:(this._eyeOpen=0,this.mode="open"),this._updateBlinkers();break;case"open":this._eyeOpen<1?this._eyeOpen+=e/this.openTime:(this._eyeOpen=1,this.mode="ready"),this._updateBlinkers();break;case"ready":this._blinkCounter+=e,this._blinkCounter>=this.continuity&&(Math.floor(Math.random()*this.randomness)===0&&(this.mode="closing"),this._blinkCounter=0);break}},1e3/30)}_updateBlinkers(){this.vrmBlinkers.forEach(e=>{e.expressionManager.setValue(Wr.Blink,1-this._eyeOpen),e.expressionManager.update()})}}class Oge{constructor(){Ne(this,"vrmEmotion");Ne(this,"mode");Ne(this,"clock");Ne(this,"continuous",!1);Ne(this,"emotionPlaying",null);Ne(this,"emotionValue",0);Ne(this,"intensity",1);Ne(this,"emotionTime",.1);Ne(this,"isTakingScreenShot",!1);Ne(this,"_nextEmotion",null);Ne(this,"_nextEmotionTime",0);Ne(this,"_nextEmotionValue",0);Ne(this,"_nextIntensity",1);Ne(this,"_nextIsContinuous",!1);this.vrmEmotion=[],this.mode="ready",this.clock=new y1,this.isTakingScreenShot=!1,this.update()}get availableEmotions(){var r;const e=Object.keys(Wr).map(i=>i.toLowerCase()),t=[];for(const i of this.vrmEmotion)for(const s of e){if(s==="blink"||t.includes(s))continue;const o=(r=i.expressionManager)==null?void 0:r.getExpression(s);o&&o._binds.length>0&&t.push(s)}return t}addVRM(e){e.expressionManager&&this.vrmEmotion.push(e)}hasEmotion(e){return this.availableEmotions.some(t=>t===e)}removeVRM(e){const t=this.vrmEmotion.indexOf(e);t!==-1&&this.vrmEmotion.splice(t,1)}enableScreenshot(){this.isTakingScreenShot=!0,this.emotionPlaying=null,this._updateEmotions()}disableScreenshot(){this.isTakingScreenShot=!1}_isBlink(e){return e==="blink"}playEmotion(e,t=void 0,r=!1,i=1){if(!this.hasEmotion(e)){console.warn(`Emotion ${e} not available`);return}if(this._isBlink(e)){console.warn("Blink is handled by the BlinkManager, ignoring");return}if(e===this.emotionPlaying&&i===this.intensity)return;const s=Math.min(1,Math.max(0,i));if(this.mode==="animating"&&this.emotionPlaying){this.continuous=!1,this._nextEmotion=e,this._nextEmotionTime=t||this.emotionTime,this._nextEmotionValue=0,this._nextIntensity=s,this._nextIsContinuous=r||!1,this.mode="transition";return}this.emotionPlaying=e,this.intensity=s,t&&(this.emotionTime=t),this.continuous=r||!1,this.mode="animating"}_setIsReady(){this.emotionValue=0,this.intensity=1,this.emotionPlaying=null,this.continuous=!1,this.mode="ready"}_removeNextEmotion(){this._nextEmotion=null,this._nextIntensity=1,this._nextEmotionValue=0,this._nextEmotionTime=0,this._nextIsContinuous=!1}update(){setInterval(()=>{if(this.isTakingScreenShot)return;const e=this.clock.getDelta();switch(this.mode){case"animating":this.emotionPlaying?(this.emotionValue=this.intensity&&(this.mode="stopping")):this._setIsReady(),this._updateEmotions();break;case"stopping":this.emotionPlaying?(this.emotionValue>0&&(this.emotionValue-=e/this.emotionTime,this.emotionValue=Math.max(0,this.emotionValue)),this.emotionValue<=0&&this._setIsReady()):this._setIsReady(),this._updateEmotions();break;case"transition":this._nextEmotion?(this._nextEmotionValue0?this.emotionValue-=e/this._nextEmotionTime:(this.emotionValue=this._nextEmotionValue,this.emotionTime=this._nextEmotionTime,this.emotionPlaying=this._nextEmotion,this.intensity=this._nextIntensity,this.continuous=this._nextIsContinuous,this.mode="animating",this._removeNextEmotion())):this.emotionPlaying&&(this.mode="animating"),this._updateEmotions()}},1e3/30)}_updateEmotions(){this.emotionPlaying&&this.vrmEmotion.forEach(e=>{var t,r,i;this._nextEmotion&&((t=e.expressionManager)==null||t.setValue(this._nextEmotion,this._nextEmotionValue)),(r=e.expressionManager)==null||r.setValue(this.emotionPlaying,this.emotionValue),(i=e.expressionManager)==null||i.update()})}}function ZG(){return(ZG=Object.assign||function(n){for(var e=1;e0?u+s.byteLength:0;f%8&&(f+=8-f%8);let h=[],d=new DataView(new ArrayBuffer(24*n.levels.length)),m=(f||u+s.byteLength)+t.byteLength;for(let v=0;v0?f:0),!0),p.setBigUint64(60,BigInt(t.byteLength),!0),new Uint8Array(sm([new Uint8Array(ti).buffer,g,d.buffer,a,s,new ArrayBuffer(f>0?f-(u+s.byteLength):0),t,...h]))}var xT,bT,jge={enableDebug:!1,isUASTC:!0,isKTX2File:!0,isInputSRGB:!0,generateMipmap:!0,needSupercompression:!0,isSetKTX2SRGBTransferFunc:!0},ET=new OffscreenCanvas(128,128),GO=ET.getContext("2d",{willReadFrequently:!0}),JG=typeof document>"u";function Wge(n){return createImageBitmap(n).then(function(e){return ET.width=e.width,ET.height=e.height,GO.drawImage(e,0,0),GO.getImageData(0,0,e.width,e.height)})}function Kge(n,e){return e===void 0&&(e={}),Yge().then(function(t){var r=new t.BasisEncoder;return Xge(e,r),r.setTexType(xT.cBASISTexType2D),Qge(n,ArrayBuffer)&&(n=new Blob([n])),Wge(n).then(function(i){r.setSliceSourceImage(0,new Uint8Array(i.data),i.width,i.height,bT.RAW);var s=new Uint8Array(10485760),o=r.encode(s);if(o===0)throw"encode failed";var a=new Uint8Array(s.buffer,0,o),l=zge(s);if(e.kvData){for(var c in e.kvData)l.keyValue[c]=e.kvData[c];a=Vge(l,{keepWriter:!0})}return a})})}function Xge(n,e){n===void 0&&(n={}),(n=kge({},jge,n)).enableDebug!==void 0&&e.setDebug(n.enableDebug),n.isUASTC!==void 0&&e.setUASTC(n.isUASTC),n.isKTX2File!==void 0&&e.setCreateKTX2File(n.isKTX2File),n.isSetKTX2SRGBTransferFunc!==void 0&&e.setKTX2SRGBTransferFunc(n.isSetKTX2SRGBTransferFunc),n.generateMipmap!==void 0&&e.setMipGen(n.generateMipmap),n.isYFlip!==void 0&&e.setYFlip(n.isYFlip),n.qualityLevel!==void 0&&e.setQualityLevel(n.qualityLevel),n.compressionLevel!==void 0&&e.setCompressionLevel(n.compressionLevel),n.needSupercompression!==void 0&&e.setKTX2UASTCSupercompression(n.needSupercompression),n.isNormalMap!==void 0&&e.setNormalMap(n.isNormalMap)}var eM=null;function Yge(){return eM||(eM=new Promise(function(n,e){JG?(importScripts("https://mdn.alipayobjects.com/rms/afts/file/A*SrRkQarYYl4AAAAAAAAAAAAAARQnAQ/basis_encoder.js"),fetch("https://mdn.alipayobjects.com/rms/afts/file/A*qFWbTrA0hZYAAAAAAAAAAAAAARQnAQ/basis_encoder.wasm").then(function(t){return t.arrayBuffer()}).then(function(t){BASIS({wasmBinary:t}).then(function(r){r.initializeBasis(),n(r)}).catch(e)}).catch(e)):Promise.all([fetch("https://mdn.alipayobjects.com/rms/afts/file/A*SrRkQarYYl4AAAAAAAAAAAAAARQnAQ/basis_encoder.js").then(function(t){return t.text()}),fetch("https://mdn.alipayobjects.com/rms/afts/file/A*qFWbTrA0hZYAAAAAAAAAAAAAARQnAQ/basis_encoder.wasm").then(function(t){return t.arrayBuffer()})]).then(function(t){var r=t[0],i=t[1],s=document.createElement("script");s.onload=function(){BASIS({wasmBinary:i}).then(function(o){o.initializeBasis(),n(o)}).catch(e)},s.src=URL.createObjectURL(new Blob([r])),s.onerror=e,document.body.appendChild(s)}).catch(e)})),eM}JG&&self.addEventListener("message",function(n){Kge(n.data).then(function(e){self.postMessage(e)}).catch(function(e){self.postMessage({error:e})})});class $ge{constructor(e,t){if(this.gl=e,this.libktx=null,e!==void 0)if(t===void 0&&LIBKTX!==void 0&&(t=LIBKTX),t!==void 0)this.initializied=this.init(e,t);else{console.error("Failed to initalize KTXDecoder: ktx library undefined");return}else{console.error("Failed to initalize KTXDecoder: WebGL context undefined");return}}async init(e,t){this.libktx=await t({preinitializedWebGLContext:e}),this.libktx.GL.makeContextCurrent(this.libktx.GL.createContext(e.canvas,{majorVersion:2}))}stringToUastcFlags(e){return e==="FASTER"?this.libktx.UastcFlags.LEVEL_FASTER.value:e==="FASTEST"?this.libktx.UastcFlags.LEVEL_FASTEST.value:e==="SLOWER"?this.libktx.UastcFlags.LEVEL_SLOWER.value:e==="SLOWEST"?this.libktx.UastcFlags.LEVEL_VERYSLOW.value:this.libktx.UastcFlags.LEVEL_DEFAULT.value}stringToSupercmpScheme(e){return e==="Zstd"?this.libktx.SupercmpScheme.ZSTD:e==="Zlib"?this.libktx.SupercmpScheme.ZLIB:e==="BasisLZ"?this.libktx.SupercmpScheme.BASIS_LZ:this.libktx.SupercmpScheme.NONE}transcodeRGBA(e){if(!e.needsTranscoding)return;const t=this.libktx.TranscodeTarget.RGBA8888;e.transcodeBasis(t,0)!=this.libktx.ErrorCode.SUCCESS&&console.warn("Texture transcode failed. See console for details.")}transcode(e){if(e.gpuFormat="RGBA8888",e.needsTranscoding){let t,r=!1,i=!1,s=!1,o=!1,a=!1;r=!!this.gl.getExtension("WEBGL_compressed_texture_astc"),i=!!this.gl.getExtension("WEBGL_compressed_texture_etc1"),s=!!this.gl.getExtension("WEBGL_compressed_texture_s3tc"),o=!!this.gl.getExtension("EXT_texture_compression_bptc"),a=!!this.gl.getExtension("WEBGL_compressed_texture_pvrtc")||!!this.gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),r?(t=this.libktx.TranscodeTarget.ASTC_4x4_RGBA,e.gpuFormat="ASTC_4x4_RGBA"):o?(t=this.libktx.TranscodeTarget.BC7_RGBA,e.gpuFormat="BC7_RGBA"):s?(t=this.libktx.TranscodeTarget.BC1_OR_3,e.gpuFormat="BC1_OR_3"):a?(t=this.libktx.TranscodeTarget.PVRTC1_4_RGBA,e.gpuFormat="PVRTC1_4_RGBA"):i?(t=this.libktx.TranscodeTarget.ETC,e.gpuFormat="ETC"):(t=this.libktx.TranscodeTarget.RGBA8888,e.gpuFormat="RGBA8888"),e.transcodeBasis(t,0)!=this.libktx.ErrorCode.SUCCESS&&console.warn("Texture transcode failed. See console for details.")}}async loadKtxFromUri(e){await this.initializied;const t=await fetch(e),r=new Uint8Array(await t.arrayBuffer()),i=new this.libktx.ktxTexture(r);this.transcode(i);let s=i.glUpload();if(s.texture==null){console.error("Could not load KTX data");return}return s.texture.levels=Math.log2(i.baseWidth),s.texture.width=i.baseWidth,s.texture.height=i.baseHeight,s.texture.gpuSize=i.dataSize,s.texture.gpuFormat=i.gpuFormat,s.texture.isSRGB=i.isSRGB,s.texture}async loadKtxFromBuffer(e){await this.initializied;const t=new this.libktx.ktxTexture(e);this.transcode(t);const r=t.glUpload();if(r.texture==null){console.error("Could not load KTX data");return}return r.texture.levels=Math.log2(t.baseWidth),r.texture.width=t.baseWidth,r.texture.height=t.baseHeight,r.texture.gpuSize=t.dataSize,r.texture.gpuFormat=t.gpuFormat,r.texture.isSRGB=t.isSRGB,r.texture}async compress(e,t,r,i,s={}){const o=new this.libktx.ktxTexture(e,t,r,i,s.srgb);if(!s.hasOwnProperty("basisu_options")){const c=new this.libktx.ktxBasisParams;c.uastc=!1,c.noSSE=!0,c.verbose=!1,c.qualityLevel=100,c.compressionLevel=2,s.basisu_options=c}s.hasOwnProperty("compression_level")||(s.compression_level=18),s.hasOwnProperty("supercmp_scheme")||(s.supercmp_scheme=this.libktx.SupercmpScheme.NONE),console.log(s);const a=o.compressBasisU(s.basisu_options,s.supercmp_scheme,s.compression_level);return Uint8ClampedArray.from(a)}}class Zge{constructor(){this.ktxEncoder=null,this.libktx=null,this.init()}async init(){const t=document.createElement("canvas").getContext("webgl"),r=new $ge(t,window.LIBKTX);await r.init(t,window.LIBKTX),this.ktxEncoder=r,this.libktx=r.libktx}async compress(e,t,r,i,s={}){const o=await new this.libktx.ktxBasisParams,a=s;return o.uastc=a.uastc!==void 0?a.uastc:!1,o.noSSE=a.noSSE!==void 0?a.noSSE:!1,o.verbose=a.verbose!==void 0?a.verbose:!1,o.normalMap=a.normalMap!==void 0?a.normalMap:!1,o.compressionLevel=a.compressionLevel!==void 0?a.compressionLevel:1,o.qualityLevel=a.qualityLevel!==void 0?a.qualityLevel:60,o.maxEndpoints=a.ETC1SmaxEndpoints!==void 0?a.ETC1SmaxEndpoints:0,o.endpointRDOThreshold=a.ETC1SEndpointRdoThreshold!==void 0?a.ETC1SEndpointRdoThreshold:1.25,o.maxSelectors=a.ETC1SMaxSelectors!==void 0?a.ETC1SMaxSelectors:0,o.selectorRDOThreshold=a.ETC1SSelectorRdoThreshold!==void 0?a.ETC1SSelectorRdoThreshold:1.25,o.noEndpointRDO=a.ETC1SNoEndpointRdo!==void 0?a.ETC1SNoEndpointRdo:!1,o.noSelectorRDO=a.ETC1SNoSelectorRdo!==void 0?a.ETC1SNoSelectorRdo:!1,o.uastcFlags=this.ktxEncoder.stringToUastcFlags(a.uastcFlags),o.uastcRDO=o.uastcRDO!==void 0?o.uastcRDO:!1,o.uastcRDOQualityScalar=a.uastcRDOQualityScalar!==void 0?a.uastcRDOQualityScalar:1,o.uastcRDODictSize=a.uastcRDODictSize!==void 0?a.uastcRDOQualityScalar:4096,o.uastcRDOMaxSmoothBlockErrorScale=a.uastcRDOMaxSmoothBlockErrorScale!==void 0?a.uastcRDOMaxSmoothBlockErrorScale:10,o.uastcRDOMaxSmoothBlockStdDev=a.uastcRDOMaxSmoothBlockStdDev!==void 0?a.uastcRDOMaxSmoothBlockStdDev:18,o.uastcRDODontFavorSimplerModes=a.uastcRDODontFavorSimplerModes!==void 0?a.uastcRDODontFavorSimplerModes:!1,s.basisu_options=o,s.hasOwnProperty("supercmp_scheme")?s.supercmp_scheme=this.ktxEncoder.stringToSupercmpScheme(s.supercmp_scheme):s.supercmp_scheme=this.libktx.SupercmpScheme.NONE,await this.ktxEncoder.compress(e,t,r,i,s)}}var qn;(function(n){n[n.ARRAY_BUFFER=34962]="ARRAY_BUFFER",n[n.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.LINEAR=9729]="LINEAR",n[n.REPEAT=10497]="REPEAT"})(qn||(qn={}));const BT="blend_",VO="vrmColliderSphere";function Jge(n){var e;return{title:n.name,version:"v0",author:((e=n.authors)==null?void 0:e.length)>0?n.authors.join(", "):"",reference:n.references!=null?n.references.join(", "):"",contactInformation:n.contactInformation!=null?n.contactInformation:"",otherPermissionUrl:n.otherPermissionUrl,allowedUserName:n.avatarPermission!=null?n.avatarPermission:"",violentUssageName:n.allowExcessivelyViolentUsage?"Allow":"Disallow",sexualUssageName:n.allowExcessivelySexualUsage?"Allow":"Disallow",commercialUssageName:n.commercialUsage=="personalProfit"||n.commercialUsage=="corporation"?"Allow":"Disallow",licenseName:n.copyrightInformation,otherLicenseUrl:n.otherLicenseUrl,metaVersion:"0"}}function qge(n){const e=[];for(const t in n.humanBones)e.push({bone:t,node:n.humanBones[t].node});return{humanBones:e}}function e0e(n){switch(n){case"happy":return"joy";case"sad":return"sorrow";case"relaxed":return"fun";case"aa":return"a";case"ih":return"i";case"ou":return"u";case"ee":return"e";case"oh":return"o";default:return n}}function t0e(n){if(n.includes("Thumb")){if(n.includes("Metacarpal"))return n.replace("Metacarpal","Proximal");if(n.includes("Proximal"))return n.replace("Proximal","Intermediate")}return n}class n0e{async parse(e,t,r,i,s,o,a){var ne;const l=Jge(e.meta),c=qge(e.humanoid),A=e.materials,u=[],f={generator:"UniGLTF-2.0.0",version:"2.0"};if(t)if(c)if(l){if(!A)throw new Error("materials is undefined or null")}else throw new Error("meta is undefined or null");else throw new Error("humanoid is undefined or null");else throw new Error("avatar is undefined or null");const h=A.filter((Y,de,ae)=>ae.findIndex(Ee=>Ee.name===Y.name.replace(" (Outline)",""))===de).map(Y=>Y),d=h.map(Y=>Y.name),m=r?{name:"icon",imageBitmap:r.image}:null,g=h.filter(Y=>Y.map).map(Y=>{if(!Y.map)throw new Error(Y.name+" map is null");return{name:Y.name,imageBitmap:Y.map.image}}),p=h.filter(Y=>Y.userData.shadeTexture).map(Y=>{if(!Y.userData.shadeTexture)throw new Error(Y.userData.shadeTexture+" map is null");return{name:Y.name+"_shade",imageBitmap:Y.userData.shadeTexture.image}}),v=h.filter(Y=>Y.roughnessMap).map(Y=>Y.roughnessMap?{name:Y.name+"_orm",imageBitmap:Y.roughnessMap.image}:null),w=h.filter(Y=>Y.roughnessMap).map(Y=>Y.normalMap?{name:Y.name+"_normal",imageBitmap:Y.normalMap.image}:null),_=[...g,...p,...v,...w].filter(Y=>Y!==null),x=l0e(_,m,s?"image/ktx2":"image/png"),b=c0e(x),B=A0e(x,s),S=a0e(h,_),I=t.children.filter(Y=>Y.children.length>0&&Y.children[0].type===Di.Bone)[0],M=qG(I).filter(Y=>Y.name!==VO),L=M.map(Y=>Y.name),D=M.map(Y=>{const de=Y.children.filter(ae=>ae.name!==VO).map(ae=>L.indexOf(ae.name));return{name:Y.name,rotation:[Y.quaternion.x,Y.quaternion.y,Y.quaternion.z,Y.quaternion.w],scale:[Y.scale.x,Y.scale.y,Y.scale.z],translation:[Y.position.x,Y.position.y,Y.position.z],children:de.length>0?de:void 0}}),T=[],y=t.children.filter(Y=>Y.type===Di.Group||Y.type===Di.SkinnedMesh),E=[];y.forEach((Y,de)=>{const ae=Y.type===Di.Group?Y.children[0]:Y,Ee=ae.geometry.attributes,V=new Ic(Ee.position,qn.FLOAT,An.POSITION,Sa.VEC3,ae.name,void 0);E.push(V);const U=E.length-1,N=Ee.normal.array,K=new Float32Array(N.length);for(let Ce=0;CeCe):[Y]).forEach(Ce=>{if(!Ce.geometry.index)throw new Error(Ce.name+" geometry.index is null");E.push(new Ic(Ce.geometry.index,qn.UNSIGNED_INT,An.INDEX,Sa.SCALAR,ae.name,Ce.name))}),ae.morphTargetDictionary||(ae.morphTargetDictionary={},ae.morphTargetInfluences=[],ae.geometry.morphAttributes={},ae.updateMorphTargets()),ae.geometry.userData.targetNames=[];const ve=(Ce,Le,Re,$e)=>{const ce=[],Pe=[];for(let Se=0;Se0){const Se=[...ce].sort((De,Ze)=>De-Ze),Te=[];for(let De=0;De({mesh:0,index:Ee.index,weight:Ee.weight*100}));if(ae.length>0){let Ee=!1;for(const V in Wr)if(Y===Wr[V]&&Y!=="surprised"){u.push({name:Y,presetName:e0e(Y),binds:ae,isBinary:de.isBinary}),Ee=!0;break}Ee===!1&&u.push({name:Y,presetName:"unknown",binds:ae,isBinary:de.isBinary})}}y.forEach(Y=>{const de=Y.type===Di.Group?Y.children[0]:Y,ae=new Float32Array(de.skeleton.boneInverses.map(Ee=>Ee.elements).flat());E.push(new Ic(new ct(ae,16),qn.FLOAT,An.BIND_MATRIX,Sa.MAT4,de.name,de.name))}),T.push(...E.map(Y=>({componentType:Y.valueType,count:Y.attribute.count,max:Y.max,min:Y.min,normalized:!1,type:Y.accessorsType})));const R=s0e(y,E,d);y.forEach((Y,de)=>{D.push({mesh:de,name:Y.name,rotation:[Y.quaternion.x,Y.quaternion.y,Y.quaternion.z,Y.quaternion.w],scale:[Y.scale.x,Y.scale.y,Y.scale.z],skin:de,translation:[Y.position.x,Y.position.y,Y.position.z]})});const F=o0e(y,E,L),O={humanBones:[]};c.humanBones.forEach(Y=>{L.indexOf(Y.node.name)!=-1&&O.humanBones.push({bone:t0e(Y.bone),node:L.indexOf(Y.node.name),useDefaultValues:!0})});const z={floatProperties:{_DstBlend:.5,_ShadeShift:.5,_ShadeToony:.5,_ShadingGradeRate:.5},keywordMap:{_NORMALMAP:!1,MTOON_OUTLINE_COLOR_FIXED:!0,MTOON_OUTLINE_WIDTH_WORLD:!0},name:"VRMCombinedMat",renderQueue:2e3,shader:"VRM/MToon",tagMap:{RenderType:"Opaque"},textureProperties:{_MainTex:0,_ShadeTexture:0},vectorProperties:{_Color:[1,1,1,1],_EmissionColor:[0,0,0,1],_EmissionMap:[0,0,1,1],_MainTex:[0,0,1,1],_OutlineColor:[0,0,0,1],_OutlineWidthTexture:[0,0,1,1],_ReceiveShadowTexture:[0,0,1,1],_RimColor:[0,0,0,1],_RimTexture:[0,0,1,1],_ShadeColor:[.9,.9,.9,1]}},j={name:"STDCombinedMat",shader:"VRM_USE_GLTFSHADER"},Q=[];h.forEach(Y=>{Y.type=="ShaderMaterial"?Q.push(Object.assign({},z)):Q.push(Object.assign({},j))});const C=l,W={};i.forEach(Y=>{for(let de=0;deY.isSkinnedMesh))==null?void 0:ne.skeleton)||null;for(let Y=0;Y{const V=Ee.sphere;ae.colliders.push({radius:V.radius*o,offset:{x:V.offset[0]*o,y:V.offset[1]*o,z:V.offset[2]*o}})}),ee.push(ae)}}console.log("COLLIDER GROUPS",ee);const re=Y=>{for(let de=0;de{var V;const de=Y.settings,ae={bones:[],center:-1,colliderGroups:[],dragForce:de.dragForce,gravityDir:{x:de.gravityDir.x,y:de.gravityDir.y,z:de.gravityDir.z},gravityPower:de.gravityPower,hitRadius:de.hitRadius,stiffiness:de.stiffness};for(const U of Y.bones){const N=re(U.name);if(N===-1){console.warn("Spring bone "+U.name+" was removed during cleanup process. Skipping.");return}ae.bones.push(N)}const Ee=[];Y.colliderGroups.forEach(U=>{const N=U.colliders[0];if(N!=null){const K=N.parent,oe=ee.findIndex(pe=>pe.name===K.name);oe!=-1?Ee.includes(oe)||Ee.push(oe):console.warn("No collider group for bone name: ",K.name+" was found")}else console.warn("No colliders definition were present in vrm file file for: ",Y.name+" spring bones")}),ae.colliderGroups.push(...Ee),ae.center=re((V=Y.center)==null?void 0:V.name),ae.center==-1&&console.debug("no center bone for spring bone "+Y.name),ue.push(ae)});const le={boneGroups:ue,colliderGroups:ee};console.log(le),C.texture=m?x.length-1:void 0;const me=await Promise.all(_.map(async Y=>({buffer:s?await jO(Y.imageBitmap):WO(Y.imageBitmap),type:An.IMAGE})));E.forEach((Y,de)=>{Y.buffer?me.push({buffer:Y.buffer,typeString:"",type:Y.type}):Y.sparse&&(me.push({buffer:Y.sparse.indices,typeString:"indices",type:Y.type,count:Y.sparse.count}),me.push({buffer:Y.sparse.values,typeString:"values",type:Y.type})),me.length-1}),m&&me.push({buffer:s?await jO(m.imageBitmap):WO(m.imageBitmap),type:An.IMAGE});let ie=0,ge=0,_e=0,se=0;const H=me.map(Y=>{const de={buffer:0,byteLength:Y.buffer.byteLength,byteOffset:ie,target:Y.type===An.IMAGE||Y.type===An.BIND_MATRIX||Y.typeString==="indices"||Y.typeString==="values"?void 0:Y.type===An.INDEX?qn.ELEMENT_ARRAY_BUFFER:qn.ARRAY_BUFFER};return ie+=Y.buffer.byteLength,Y.type===An.IMAGE?(x[ge++].bufferView=se,se++):E[_e].sparse?(T[_e].sparse==null&&(T[_e].sparse={}),Y.typeString==="indices"&&(T[_e].sparse.count=Y.count,T[_e].sparse[Y.typeString]={bufferView:se,byteOffset:0,componentType:qn.UNSIGNED_INT}),Y.typeString==="values"&&(T[_e].sparse[Y.typeString]={bufferView:se,byteOffset:0}),Y.typeString==="values"&&_e++,se++):(E[_e].bufferIndex=se,T[_e].bufferView=se,_e++,se++),de}),fe=u0e(t,D);r0e(C);const Ae=["KHR_materials_unlit","KHR_texture_transform","VRM"];s&&Ae.push("KHR_texture_basisu");for(const Y of F){const de=T.filter(ae=>ae.type=="MAT4");for(let ae of de)if(Y.joints.length!=ae.count)throw new Error(`The number of joints in the skin is not equal to the number of Accessors of type MAT4. Got ${Y.joints.length} when accessors show ${ae.count} This is usually because of a bone count mismatch in your VRMs!`)}const J={accessors:T,asset:f,buffers:[{byteLength:ie}],bufferViews:H,extensions:{VRM:{blendShapeMaster:{blendShapeGroups:u},firstPerson:{firstPersonBone:44,firstPersonBoneOffset:new $,lookAtHorizontalInner:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtHorizontalOuter:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtTypeName:"Bone",lookAtVerticalDown:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtVerticalUp:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10}},materialProperties:Q,humanoid:O,meta:C,secondaryAnimation:le,specVersion:"0.0"}},extensionsUsed:Ae,images:x,materials:S,meshes:R,nodes:D,samplers:b,scenes:fe,skins:F,textures:B};console.log("output",J);const q=new KO(ST(JSON.stringify(J,void 0,2)),"JSON"),he=new KO(Lm(me.map(Y=>Y.buffer)),"BIN\0"),X=Lm([q.buffer,he.buffer]),G=Lm([ST("glTF"),MT(2,4),MT(X.byteLength+12,4)]);a(Lm([G,X]))}}function r0e(n){n.title=n.title||"Character",n.version=n.version||"1",n.author=n.author||"Anon",n.contactInformation=n.contactInformation||"",n.reference=n.reference||"",n.allowedUserName=n.allowedUserName||"Everyone",n.violentUssageName=n.violentUssageName||"Disallow",n.sexualUssageName=n.sexualUssageName||"Disallow",n.commercialUssageName=n.commercialUssageName||"Disallow",n.otherPermissionUrl=n.otherPermissionUrl||"",n.licenseName=n.licenseName||"Redistribution_Prohibited",n.otherLicenseUrl=n.otherLicenseUrl||""}function qG(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>qG(e)).flat())}const i0e=new Zge;async function jO(n){const e=await createImageBitmap(n),t=document.createElement("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0);const i=r.getImageData(0,0,t.width,t.height),s=new Uint8Array(i.data.buffer);return await i0e.compress(s,t.width,t.height,4,{normalMap:!1,uastc:!1,qualityLevel:50,compressionLevel:2,uastcFlags:"DEFAULT",compressionUASTC_Rdo_Level:18,uastcRDO:!1,uastcRDOQualityScalar:1,uastcRDODictSize:4096,uastcRDOMaxSmoothBlockErrorScale:10,uastcRDOMaxSmoothBlockStdDev:18,uastcRDODontFavorSimplerModes:!1,ETC1SQualityLevel:128,ETC1SmaxEndpoints:0,ETC1SEndpointRdoThreshold:1.25,ETC1SMaxSelectors:0,ETC1SSelectorRdoThreshold:1.25,ETC1SNoEndpointRdo:!1,ETC1SNoSelectorRdo:!1,supercmp_scheme:"Zstd"})}function WO(n){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0);const t=e.toDataURL("image/png"),r=atob(t.split(",")[1]),i=(4-r.length%4)%4,s=new ArrayBuffer(r.length+i),o=new DataView(s);for(let a=0;a4?c=r[a*n.itemSize+l]:l===0?c=n.getX(a):l===1?c=n.getY(a):l===2?c=n.getZ(a):c=n.getW(a),e===qn.UNSIGNED_SHORT?o.setUint16(i,c,!0):e===qn.UNSIGNED_INT?o.setUint32(i,c,!0):o.setFloat32(i,c,!0),i+=t}return s}class KO{constructor(e,t){this.data=e,this.type=t;const r=this.padBuffer(this.data,t==="JSON"?32:0);this.buffer=Lm([MT(r.byteLength,4),ST(this.type),r])}padBuffer(e,t){const r=Math.ceil(e.byteLength/4)*4;if(e.byteLength===r)return e;const i=new ArrayBuffer(r);return new Uint8Array(i).set(new Uint8Array(e)),new Uint8Array(i).fill(t,e.byteLength),i}}const XO=n=>{const e=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],t=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY];for(let r=0;rn.map(r=>{const i=r.type===Di.Group?r.children[0]:r,s=r.type===Di.Group?r.children.map(o=>o):[r];return{name:r.name,primitives:s.map(o=>{const a=e.map(c=>c.meshName===i.name?c.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(An.SKIN_INDEX),NORMAL:a.indexOf(An.NORMAL),POSITION:a.indexOf(An.POSITION),TEXCOORD_0:a.indexOf(An.UV),WEIGHTS_0:a.indexOf(An.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(c=>c.type===An.INDEX&&c.meshName===i.name?c.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(c=>{const A=e.map(h=>h.type===An.BLEND_NORMAL&&h.meshName===i.name?h.name:null).indexOf(BT+c),u=e.map(h=>h.type===An.BLEND_POSITION&&h.meshName===i.name?h.name:null).indexOf(BT+c),f={};return u!==-1&&(f.POSITION=u),A!==-1&&(f.NORMAL=A),f}):void 0}})}}),o0e=(n,e,t)=>n.map(r=>{const i=r.type===Di.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===An.BIND_MATRIX?s.meshName:null).indexOf(i.name),joints:i.skeleton.bones.map(s=>t.indexOf(s.name)).filter(s=>s!==-1),skeleton:t.indexOf(i.skeleton.bones[0].name)}}),a0e=(n,e)=>n.map(t=>{let r,i=null;if(t=t.userData.vrmMaterial?t.userData.vrmMaterial:t,t.type==="ShaderMaterial")i={},i.shadeMultiplyTexture={index:e.map(d=>d.name).indexOf(t.uniforms.shadeMultiplyTexture.name)},r=t.color?[1,1,1,1]:void 0;else{const h=t;r=h.color?[h.color.r,h.color.g,h.color.b,1]:void 0}let s=-1;t.map?s=e.map(h=>h.name).indexOf(t.name):t.uniforms&&t.uniforms.map&&(s=e.map(h=>h.name).indexOf(t.uniforms.map.name));let o=-1;t.roughnessMap&&(o=e.map(h=>h.name).indexOf(t.name+"_orm"));let a=-1;t.normalMap&&(a=e.map(h=>h.name).indexOf(t.name+"_normal"));const l=s>=0?{extensions:{KHR_texture_transform:{offset:[0,0],scale:[1,1]}},index:s,texCoord:0}:void 0,c={baseColorFactor:r,baseColorTexture:l},A=o>=0?{index:o,texCoord:0}:void 0,u=a>=0?{index:a,texCoord:0}:void 0;if(A)c.metallicRoughnessTexture=A;else{const h=(()=>{switch(t.type){case Vh.MeshStandardMaterial:return t.metalness;case Vh.MeshBasicMaterial:return 0;default:return 0}})(),d=(()=>{switch(t.type){case Vh.MeshStandardMaterial:return t.roughness;case Vh.MeshBasicMaterial:return .9;default:return .9}})();c.metallicFactor=h,c.roughnessFactor=d}const f={alphaCutoff:t.alphaTest>0?t.alphaTest:void 0,alphaMode:t.transparent?"BLEND":t.alphaTest>0?"MASK":"OPAQUE",doubleSided:t.side===2,extensions:t.type==="ShaderMaterial"?{KHR_materials_unlit:{}}:void 0,name:t.name,pbrMetallicRoughness:c};return u&&(f.normalTexture=u),f}),l0e=(n,e,t)=>(e?n.concat(e):n).filter(r=>r&&r.imageBitmap).map(r=>({bufferView:-1,mimeType:t,name:r.name})),c0e=n=>n.map(()=>({magFilter:qn.LINEAR,minFilter:qn.LINEAR,wrapS:qn.REPEAT,wrapT:qn.REPEAT})),A0e=(n,e)=>e?n.map((t,r)=>({sampler:0,extensions:{KHR_texture_basisu:{source:r}}})):n.map((t,r)=>({sampler:0,source:r})),u0e=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===Di.Object3D||r.type===Di.SkinnedMesh||r.type===Di.Group||r.type===Di.Bone).map(r=>t.indexOf(r.name))}]};function f0e(n,e,t){var a,l;const r=[],i=[];for(const c in n)((l=(a=n[c])==null?void 0:a.vrm)==null?void 0:l.meta)!=null&&(n[c].vrm.meta.authors!=null?i.push(n[c].vrm.meta):r.push(n[c].vrm.meta));r.length+i.length==1&&(r.length==1?r[0].title!=null&&(t=r[0].title):i[0].name!=null&&(t=i[0].name)),e!=null&&(e.authors!=null?i.push(e):r.push(e));const s=d0e(r),o=h0e(s,i);return o.licenseUrl="https://vrm.dev/licenses/1.0/",o.name=t,o}function h0e(n,e){let{authors:t=[],otherLicenseUrl:r=[],contactInformation:i=[],references:s=[],allowExcessivelyViolentUsage:o=void 0,allowExcessivelySexualUsage:a=void 0,commercialUsage:l=void 0,copyrightInformation:c="",avatarPermission:A=void 0,otherPermissionUrl:u=[]}=n,f,h,d,m="unnecessary",g,p=[];e.forEach(S=>{t=t.concat(ut(S.authors)),r=r.concat(ut(S.otherLicenseUrl)),i=i.concat(ut(S.contactInformation)),s=s.concat(ut(S.references)),u=u.concat(ut(S.otherPermissionUrl)),S.allowExcessivelyViolentUsage===!1&&(o=!1),S.allowExcessivelySexualUsage===!1&&(a=!1),l=Nl(g0e,l,S.commercialUsage),c=Nl(eV,c,S.copyrightInformation),A=Nl(v0e,A,S.avatarPermission),S.allowAntisocialOrHateUsage===!1&&(f=f=!1),S.allowPoliticalOrReligiousUsage===!1&&(h=h=!1),S.allowRedistribution===!1&&(d=d=!1),S.creditNotation==="required"&&(m="required"),p=p.concat(ut(S.thirdPartyLicenses)),g=Nl(m0e,g,S.modification)});const v=[...new Set(t)].filter(S=>S!=""&&S!=null&&S!="undefined"),w=[...new Set(r)].filter(S=>S!=""&&S!=null&&S!="undefined"),_=[...new Set(i)].filter(S=>S!=""&&S!=null&&S!="undefined"),x=[...new Set(s)].filter(S=>S!=""&&S!=null&&S!="undefined"),b=[...new Set(u)].filter(S=>S!=""&&S!=null&&S!="undefined"),B=[...new Set(p)].filter(S=>S!=""&&S!=null&&S!="undefined");return{authors:v,otherLicenseUrl:w.length==0?"":w.join(", "),contactInformation:_.length==0?"":_.join(", "),references:x,otherPermissionUrl:b.length==0?"":b.join(", "),thirdPartyLicenses:B.length==0?"":B.join(", "),allowExcessivelyViolentUsage:o,allowExcessivelySexualUsage:a,commercialUsage:l,copyrightInformation:c,avatarPermission:A,allowAntisocialOrHateUsage:f,allowPoliticalOrReligiousUsage:h,allowRedistribution:d,creditNotation:m,modification:g}}function d0e(n){let e=[],t=[],r=[],i=[],s=[],o,a,l,c,A;n.forEach(g=>{e=e.concat(ut(g.author)),t=t.concat(ut(g.contactInformation)),r=r.concat(ut(g.reference)),i=i.concat(ut(g.otherPermissionUrl)),s=s.concat(ut(g.otherLicenseUrl)),o=Nl(y0e,o,g.allowedUsername),a=Nl(nM,a,g.violentUssageName),l=Nl(nM,l,g.sexualUssageName),c=Nl(nM,c,g.commercialUssageName),A=Nl(eV,A,g.licenseName)});const u=[...new Set(e)].filter(g=>g!=""&&g!=null&&g!="undefined"),f=[...new Set(t)].filter(g=>g!=""&&g!=null&&g!="undefined"),h=[...new Set(r)].filter(g=>g!=""&&g!=null&&g!="undefined"),d=[...new Set(i)].filter(g=>g!=""&&g!=null&&g!="undefined"),m=[...new Set(s)].filter(g=>g!=""&&g!=null&&g!="undefined");return{authors:u,otherLicenseUrl:m,contactInformation:f,references:h,allowExcessivelyViolentUsage:a==="Allow",allowExcessivelySexualUsage:l==="Allow",commercialUsage:c==="Allow"?"personalProfit":"personalNonProfit",copyrightInformation:A,avatarPermission:p0e(o),otherPermissionUrl:d}}function p0e(n){if(n=="OnlyAuthor")return"onlyAuthor";if(n=="ExplicitlyLicensedPerson")return"onlySeparatelyLicensedPerson";if(n=="Everyone")return"everyone"}const m0e={prohibited:0,allowModification:1,allowModificationRedistribution:2},g0e={personalNonProfit:0,personalProfit:1,corporation:2},v0e={onlyAuthor:0,onlySeparatelyLicensedPerson:1,everyone:2},y0e={OnlyAuthor:0,ExplicitlyLicensedPerson:1,Everyone:2},nM={Disallow:0,Allow:1},eV={Redistribution_Prohibited:0,Other:1,CC_BY_NC_ND:2,CC_BY_ND:3,CC_BY_NC_SA:4,CC_BY_SA:5,CC_BY_NC:6,CC_BY:7,CC0:8};function Nl(n,e,t){return e===void 0?t:t==null||!(t in n)||n[e]{r.userData.origIndexBuffer&&t.push(r.userData.origIndexBuffer)}),e.traverse(r=>{r.userData.origIndexBuffer&&(r.userData.origIndexBuffer=t.shift())}),e}function w0e(n){const e=tV(n);let t;const r=[];e.traverse(s=>{if(!t&&s.isSkinnedMesh&&(t=HG(s)),s.isSkinnedMesh){if(s.geometry=s.geometry.clone(),s.skeleton=t,r.push(s),Array.isArray(s.material)){const o=s.material;s.material=new Od,s.material.map=o[0].map}s.userData.origIndexBuffer&&s.geometry.setIndex(s.userData.origIndexBuffer)}});const i=new ri;return r.forEach(s=>{i.add(s)}),i.add(t.bones[0]),i}async function _0e(n,e,t){const r=await m2(n,t),i=await nV(r,e,t);return new Blob([i],{type:"model/gltf-binary"})}function x0e(n,e,t,r){return new Promise(async(i,s)=>{const o=`${t&&t!==""?t:"AvatarCreatorModel"}`;b0e(n,e,r).then(a=>{iV(a,`${o}.vrm`),i()})})}async function b0e(n,e,t){const r=await m2(n,e,t);return nV(r,e,t)}function m2(n,e,t){const r=tV(n);t.mergeAppliedMorphs=!0;const{createTextureAtlas:i=!0}=t;return i?oge(r,e,t):(console.log("no atlas"),rge(r,e,t))}async function E0e(n,e="",t){const r=`${e&&e!==""?e:"AvatarCreatorModel"}`,{optimized:i=!0}=t,s=i?await m2(n,t):w0e(n);B0e(s).then(o=>{if(o instanceof ArrayBuffer)iV(o,`${r}.glb`);else{const a=JSON.stringify(o,null,2);R0e(a,`${r}.gltf`)}})}function B0e(n){return new Promise(e=>new ZR().parse(n,r=>{e(r)},r=>{console.error("Error parsing",r)},{trs:!1,onlyVisible:!1,truncateDrawRange:!0,binary:!0,forcePowerOfTwoTextures:!1,maxTextureSize:1024}))}function M0e(n){var r,i;const e=[];for(const s in n)if(((i=(r=n[s])==null?void 0:r.vrm)==null?void 0:i.springBoneManager)!=null){const o=n[s].vrm.springBoneManager.joints;for(const a of o)e.some(c=>c.name===a.bone.name)||e.push({name:a.bone.name,settings:a.settings,bone:a.bone,colliderGroups:a.colliderGroups,center:a.center})}const t=[];return e.forEach(s=>{if(e.find(a=>{var l;return a.name==((l=s.bone.parent)==null?void 0:l.name)})==null){t.push({bones:[s],settings:s.settings,center:s.center,colliderGroups:s.colliderGroups,name:s.bone.name});return}}),e.map(s=>{const o=t.find(a=>a.bones.find(l=>{var c;return l.name==((c=s.bone.parent)==null?void 0:c.name)})!=null);o!=null&&o.bones.push({name:s.name,bone:s.bone})}),t}function S0e(n){var r,i;const e=[];for(const s in n)if(((i=(r=n[s])==null?void 0:r.vrm)==null?void 0:i.springBoneManager)!=null){const o=n[s].vrm.springBoneManager.joints;for(const a of o)e.some(c=>c.name===a.bone.name)||e.push({name:a.bone.name,settings:a.settings,bone:a.bone,colliderGroups:a.colliderGroups,center:a.center})}const t=[];return e.forEach(s=>{for(const o in Jg)if(s.bone.parent.name==Jg[o]){t.push(s);break}}),t}function C0e(n){const e={};return n.skeleton.bones.map(t=>{for(const r in Jg)if(Jg[r]===t.name){e[t.name]={node:t};break}}),e}function T0e(n,e,t){const r=kd(n,"SkinnedMesh");return{humanBones:C0e(r[0]),materials:n.userData.atlasMaterial,meta:I0e(e),...t.mergeAppliedMorphs?{expressionManager:P0e(n)}:{}}}function I0e(n){return n=n||{},{...{authors:["CharacterStudio"],metaVersion:"1",version:"v1",name:"CharacterCreator",licenseUrl:"https://vrm.dev/licenses/1.0/",commercialUssageName:"personalNonProfit",contactInformation:"https://m3org.com/",allowExcessivelyViolentUsage:!1,allowExcessivelySexualUsage:!1,allowPoliticalOrReligiousUsage:!1,allowAntisocialOrHateUsage:!1,creditNotation:"required",allowRedistribution:!1,modification:"prohibited"},...n}}function nV(n,e,t){const{screenshot:r=null,isVrm0:i=!1,vrmMeta:s=null,scale:o=1,vrmName:a="CharacterCreator"}=t,l=f0e(e,s,a);return new Promise(async c=>{const A=t.outputVRM0??t.isVrm0??!0,u=A?new n0e:new wpe,f={...F0e(e),...T0e(n,l,t)};let h;n.traverse(g=>{g.isSkinnedMesh&&(h=g)}),(()=>{for(let g=0;g{g.updateMatrix(),g.updateMatrixWorld()}),h.skeleton.calculateInverses(),h.skeleton.computeBoneTexture(),h.skeleton.update()})();const m=A?M0e(e):S0e(e);A?u.parse(f,n,r,m,t.ktxCompression,o,g=>{c(g)}):u.parse(f,n,r,g=>{c(g)})})}function rV(n,e){const t=document.createElement("a");t.style.display="none",document.body.appendChild(t),t.href=URL.createObjectURL(n),t.download=e,t.click()}function R0e(n,e){rV(new Blob([n],{type:"text/plain"}),e)}function iV(n,e){rV(U0e(n),e)}function U0e(n){return new Blob([n],{type:"application/octet-stream"})}function F0e(n){for(const e in n)if(n[e].vrm)return n[e].vrm}function P0e(n){const e=new Z_;let t=n.userData.expressionManagerToClone;if(!t){t=new Z_;for(const r of Object.values(Wr)){const i=new $_(r);t.registerExpression(i)}}e.copy(t),n.userData.expressionManagerToClone=null;for(const r of n.children){if(!r.isMesh&&!r.isSkinnedMesh||!r.morphTargetDictionary)continue;const i=r.userData.bindMorphs;if(!i||!gge(r,i.old))continue;const o=(c,A)=>{var u;return((u=c.find(f=>f.index==A))==null?void 0:u.weight)||0},a=Object.entries(Wr).flat(),l=Object.keys(i.old).filter(c=>a.includes(c));for(const c of Object.keys(t.expressionMap)){const A=t.expressionMap[c];if(!A)continue;const u=A._binds;if(!u||u.length==0){e.unregisterExpression(A);continue}for(const f of l){const h=i.new[f]||i.new[f.toLowerCase()],d=i.old[f]||i.old[f.toLowerCase()];if(h){const m=[];n.traverse(v=>{!v.isMesh&&!v.isSkinnedMesh||h.primitives.includes(v.id)&&m.push(v)}),e.unregisterExpression(A),A._binds=[];const g=o(u,d.index),p=new $_(A.expressionName);p.copy(A),console.log("adding bind",A.expressionName),p.addBind(new rT({index:h.index,weight:g,primitives:m})),e.registerExpression(p)}else e.unregisterExpression(A)}}}return e}function sV(n,e){return e&&n?n.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):n||e}const L0e=n=>{const t=n.parser.json.meshes,r=n.parser.associations;n.scene.traverse(i=>{var s;if(i instanceof sa&&i.morphTargetDictionary){let o=!1;const a=r.get(i);if(typeof a>"u")return;const l=a.meshes||0,c=a.primitives||0,A=t[l],u=A==null?void 0:A.primitives[c];if((s=u==null?void 0:u.extras)!=null&&s.targetNames){const f=u.extras.targetNames;for(let h=0;h{var e,t;(e=n.parser.json.extensions)!=null&&e.VRM?N0e(n):(t=n.parser.json.extensions)!=null&&t.VRMC_vrm?O0e(n):console.warn("No valid vrm file was provided")},N0e=n=>{var a,l,c;const e=n.parser.json,t=n.scene,r=e.nodes,i=(c=(l=(a=e.extensions)==null?void 0:a.VRM)==null?void 0:l.secondaryAnimation)==null?void 0:c.colliderGroups,s=[],o=r.map(A=>oV(A.name,s));i!=null&&i.forEach(A=>{const u=o[A.node],f=XG(t,u);if(f!=null){const h=A.colliders;f.userData.VRMcolliders=h.map(d=>({sphere:{radius:d.radius,offset:[d.offset.x,d.offset.y,d.offset.z]}}))}f.userData.VRMcollidersID=WG()})},O0e=n=>{var l,c,A,u;const e=n.parser.json,t=n.scene,r=e.nodes,i=(c=(l=e.extensions)==null?void 0:l.VRMC_springBone)==null?void 0:c.colliderGroups,s=(u=(A=e.extensions)==null?void 0:A.VRMC_springBone)==null?void 0:u.colliders,o=[],a=r.map(f=>oV(f.name,o));i!=null&&i.forEach(f=>{const h=ut(f.colliders);let d=-1,m=null;h.forEach(g=>{if(d!=s[g].node){d=s[g].node;const p=a[d];m=XG(t,p),m.userData.VRMcolliders=[]}if(m!=null){const p=s[g].shape;for(const v in p){const w=p[v];w!=null&&w.offset&&(w.offset[0]=-w.offset[0])}m.userData.VRMcollidersID=WG(),m.userData.VRMcolliders.push(p)}else console.error("no node with name "+a[d]+" was found")})})},k0e=n=>{const e=[];return n.scene.traverse(t=>{var r;(r=t.userData)!=null&&r.VRMcolliders&&t.userData.VRMcolliders.length>0&&e.push(t)}),e},oV=(n,e)=>{const t=Ct.sanitizeNodeName(n||"");return t in e?t+"_"+ ++e[t]:(e[t]=0,t)},ix=[0,400,560,2400,4800],sx=[0,500,700,3e3,6e3],CT=[],Sl=[],g2=1024,aV=44100;for(let n=0;n{requestAnimationFrame(t),this.update(r,i)};t()}start(e){this.audioContext=new AudioContext,this.mediaStreamSource=this.audioContext.createMediaStreamSource(e),this.meter=ox.createAudioMeter(this.audioContext),this.mediaStreamSource.connect(this.meter)}startFromAudioFile(e){this.audioContext||(this.audioContext=new AudioContext),this.userSpeechAnalyzer||(this.userSpeechAnalyzer=this.audioContext.createAnalyser()),this.userSpeechAnalyzer.smoothingTimeConstant=.5,this.userSpeechAnalyzer.fftSize=g2,this.mediaStreamSource&&this.mediaStreamSource.stop(),this.audioContext.decodeAudioData(e).then(t=>{this.mediaStreamSource=this.audioContext.createBufferSource(),this.mediaStreamSource.buffer=t,this.meter=ox.createAudioMeter(this.audioContext),this.mediaStreamSource.connect(this.meter),this.mediaStreamSource.connect(this.audioContext.destination),this.mediaStreamSource.start(),this.mediaStreamSource.connect(this.userSpeechAnalyzer)})}destroy(){var e,t,r;return(e=this.meter)==null||e.shutdown(),this.meter=null,(t=this.mediaStreamSource)==null||t.disconnect(),((r=this.audioContext)==null?void 0:r.close().catch(()=>{}))||Promise.resolve()}update(e){if(this.meter){const{volume:t}=this.meter;if(t<.01)this.vrm.expressionManager.setValue(Wr.Oh,0),this.vrm.expressionManager.setValue(Wr.Ah,0),this.vrm.expressionManager.setValue(Wr.Ee,0);else{const{ah:r,oh:i,ee:s}=this.update2();this.vrm.expressionManager.setValue(Wr.Oh,i),this.vrm.expressionManager.setValue(Wr.Ah,r),this.vrm.expressionManager.setValue(Wr.Ee,s),this.vrm.expressionManager.update(e)}}}update2(){function e(c){const u=new Float32Array(c.length);for(let f=0;f0&&(i[c]+=r[A]);i[c]/=Sl[c+1]-Sl[c]}for(let c=0;c0&&(s[c]+=r[A]);i[c]/=Sl[c+1]-Sl[c],s[c]=s[c]/(CT[c+1]-CT[c])}const o=Math.max(s[1],i[1])>.2?1-2*Math.max(i[2],s[2]):(1-2*Math.max(i[2],s[2]))*5*Math.max(i[1],s[1]),a=3*Math.max(i[3],s[3]),l=.8*(Math.max(i[1],s[1])-Math.max(i[3],s[3]));return{oh:o,ee:l,ah:a}}static createAudioMeter(e){const t=e.createScriptProcessor(512);return t.onaudioprocess=r=>{const i=r.inputBuffer.getChannelData(0),s=i.length;let o=0,a;for(let c=0;c=t.clipLevel&&(t.clipping=!0,t.lastClip=window.performance.now()),o+=a*a;const l=Math.sqrt(o/s);t.volume=Math.max(l,t.volume*t.averaging)},t.clipping=!1,t.lastClip=0,t.volume=0,t.clipLevel=.98,t.averaging=.95,t.clipLag=750,t.connect(e.destination),t.checkClipping=()=>t.clipping?(t.lastClip+t.clipLag{t.disconnect(),t.onaudioprocess=null},t}}const rM=new $;class Q0e{constructor(e,t,r){this.bonesInfo=[],this.curMousePos=new We,this.hotzoneSection=s(),this.enabled=!1,this.userActivated=!1,this.lookInterest=1,this.hasInterest=!0,this.interestSpeed=.3,this.onCanvas=!0,this.camera=r,this.maxLookPercent={neck:{maxy:15,miny:10,maxx:30,minx:10},spine:{maxy:0,miny:0,maxx:30,minx:10},left:{maxy:15,miny:20,maxx:35,minx:35},right:{maxy:15,miny:20,maxx:35,minx:35}},window.addEventListener("mousemove",o=>{this.curMousePos={x:o.clientX,y:o.clientY}});const i=document.getElementById(t);i&&(i.addEventListener("mouseleave",()=>{this.onCanvas=!1}),i.addEventListener("mouseenter",()=>{this.onCanvas=!0})),window.addEventListener("resize",()=>{this.hotzoneSection=s()});function s(){const o=window.innerWidth*e/100,a=(window.innerWidth-o)/2;return{xStart:a,xEnd:window.innerWidth-a,yStart:50,yEnd:window.innerHeight-80}}}setActive(e){console.log("is activating"),this.userActivated=e}setCamera(e){this.camera=e}addVRM(e){const t=e.data.isVRM0||!1,r=e.humanoid.humanBones;t||(r.neck.node.userData.inverseLookAt=!0,r.spine.node.userData.inverseLookAt=!0,r.leftEye&&(r.leftEye.node.userData.inverseLookAt=!0),r.rightEye&&(r.rightEye.node.userData.inverseLookAt=!0));const i={vrm:e,neckBone:r.neck.node,spineBone:r.spine.node,leftEyeBone:r.leftEye?r.leftEye.node:null,rightEyeBone:r.rightEye?r.rightEye.node:null};this.bonesInfo.push(i)}removeVRM(e){const t=this.bonesInfo.find(r=>r.vrm===e);if(t){const r=this.bonesInfo.indexOf(t);this.bonesInfo.splice(r,1)}}_getMouseDegrees(e,t,r){let i=0,s=0,o,a,l,c,A={x:window.innerWidth,y:window.innerHeight};return e<=A.x/2&&(o=A.x/2-e,a=o/(A.x/2)*100,i=r.maxx*a/100*-1),e>=A.x/2&&(o=e-A.x/2,a=o/(A.x/2)*100,i=r.minx*a/100),t<=A.y/2&&(l=A.y/2-t,c=l/(A.y/2)*100,s=r.maxy*.5*c/100*-1),t>=A.y/2&&(l=t-A.y/2,c=l/(A.y/2)*100,s=r.miny*c/100),{x:i,y:s}}lerp(e,t,r){return(1-r)*e+r*t}_moveJoint(e,t){const r=e.userData.inverseLookAt===!0?1:-1;if(Object.keys(e).length!==0){const i=(this.camera.position.y-1.8)*window.innerHeight/2;let s=this._getMouseDegrees(this.curMousePos.x,this.curMousePos.y-i,t);const o=.8;e.rotation.y=this.lerp(Bt.degToRad(s.x),e.rotation.y,o),e.rotation.x=this.lerp(Bt.degToRad(s.y*r),e.rotation.x,o)}}update(){rM.set(0,0,1),rM.applyQuaternion(this.camera.quaternion);const e=rM.z>0;this.curMousePos.x>this.hotzoneSection.xStart&&this.curMousePos.xthis.hotzoneSection.yStart&&this.curMousePos.y{this._moveJoint(t.neckBone,this.maxLookPercent.neck),this._moveJoint(t.spineBone,this.maxLookPercent.spine),this._moveJoint(t.leftEyeBone,this.maxLookPercent.left),this._moveJoint(t.rightEyeBone,this.maxLookPercent.right)})}}class H0e{constructor(e){Ne(this,"targetVRMMeshes",[]);Ne(this,"baseTexture",null);Ne(this,"textures",[]);Ne(this,"applied",new Map);Ne(this,"imageDataRenderer");this.characterManager=e,this.imageDataRenderer=new P1(512,512)}get scene(){return this.characterManager.parentModel}get manifest(){return this.characterManager.manifestData}get targetMaterial(){if(!this.targetVRMMeshes.length)throw new Error("No target meshes found, call setTargetVRM");let e=this.targetVRMMeshes.map(r=>ut(r.material)).flat(),t=e[0];if(t.map)return t;for(let r=1;r{r instanceof sa&&(t&&t.length?t.includes(r.name)&&this.targetVRMMeshes.push(r):this.targetVRMMeshes.push(r))})}async update(){const e=this.targetMaterial,t=e.map.image,r=t.width,i=t.height;this.imageDataRenderer.clearRenderer(),this.imageDataRenderer.width=r,this.imageDataRenderer.height=i;const s=this.imageDataRenderer.render(this.textures,e.color||new Qe(1,1,1),new Qe(1,1,1),!0,!0);s||console.error("Failed to update OverlayTextureManager, ImageData is undefined");const o=d2({width:r,height:i,transparent:!0}),a=await createImageBitmap(s);o.drawImage(a,0,0);const l=new Un(o.canvas);l.colorSpace=Ut,l.flipY=!1,l.needsUpdate=!0,this.targetMaterial.map=l}async loadOverlayTexture(e,t){const r=new PA,i=e.getAllDecals().find(l=>l.id===t);if(!i)throw new Error("Decal "+t+" not found in trait group");if(this.targetVRMMeshes.length===0)throw new Error("No target meshes found");const s=i.directory;if(!s)throw new Error("Decal not found in trait group");const o=sV(this.manifest.getTraitsDirectory(),s),a=await r.loadAsync(o);return a.colorSpace=Ut,a.flipY=!1,this.textures.length||this.textures.push(this.targetMaterial.map.clone()),this.textures.push(a),this.applied.set(t,a),this.update()}removeOverlayTexture(e){if(this.applied.has(e)){const t=this.applied.get(e);if(!t)return this.applied.delete(e),Promise.resolve();this.textures.splice(this.textures.indexOf(t),1),this.applied.delete(e)}return this.update()}removeAllOverlayedTextures(){this.textures=[this.textures[0]],this.applied.clear(),this.update()}}class z0e{constructor(e){Ne(this,"traitRestrictions");Ne(this,"restrictionMaps",{});Ne(this,"itemRestrictions",new Map);Ne(this,"manifestData");Ne(this,"logRules",()=>{const e=[];for(const t in this.restrictionMaps){const r=this.restrictionMaps[t];r.restrictedTypes.size&&e.push(`Trait: ${r.group.trait} is restrciting traits ${Array.from(r.restrictedTraits.values()).join(", ")}`),r.restrictedTypes.size&&e.push(`Trait: ${r.group.trait} also restricts types ${Array.from(r.restrictedTypes.values()).join(", ")}`)}this.itemRestrictions.forEach((t,r)=>{e.push(`Item ${r} is restricting item ${Array.from(t.values()).join(", ")}`)}),console.log(e.join(` +`))});Ne(this,"_setupSpecificItemRestrictions",()=>{const e=this.manifestData.getAllTraitOptions();e.forEach(t=>{this.itemRestrictions.set(t.id,new Set)});for(const t of e){if(!t._restrictedItems||t._restrictedItems.length==0)continue;const r=new Set;for(const i of t._restrictedItems){if(!e.find(o=>o.id==i)){console.warn(`[${t.traitGroup.trait}] Restricted item ${i} not found`);continue}r.add(i)}if(this.itemRestrictions.set(t.id,r),r.size>0)for(const i of r){const s=this.itemRestrictions.get(i);s&&(s.has(t.id)||s.add(t.id))}}this.itemRestrictions.forEach((t,r)=>{t.size==0&&this.itemRestrictions.delete(r)})});Ne(this,"createTraitRestriction",e=>{if(this.restrictionMaps[e.trait])return this.restrictionMaps[e.trait];const t=new G0e(this,e);return e.restrictions=t,this.restrictionMaps[e.trait]=t,t});Ne(this,"getForbiddenTraits",e=>{const t=new Set;for(const r in this.restrictionMaps){if(!e.includes(r))continue;const i=this.restrictionMaps[r];for(const s of i.restrictedTraits)t.add(s)}return Array.from(t.values())});Ne(this,"getForbiddenTypes",e=>{const t=new Set;for(const r in this.restrictionMaps){if(!e.includes(r))continue;const i=this.restrictionMaps[r];for(const s of i.restrictedTraits)t.add(s)}return Array.from(t.values())});Ne(this,"_validateTraitRestrictions",()=>{const e={};if(this.traitRestrictions)for(const t in this.traitRestrictions)e[t]==null&&(e[t]={restrictedTraits:[],restrictedTypes:[]}),e[t].restrictedTraits=ut(this.traitRestrictions[t].restrictedTraits).filter(r=>!!r),e[t].restrictedTypes=ut(this.traitRestrictions[t].restrictedTypes).filter(r=>!!r);this.traitRestrictions=e});this.manifestData=e,this.traitRestrictions=e.traitRestrictions||{},this._validateTraitRestrictions()}_init(){this._setupSpecificItemRestrictions(),this.logRules()}}class G0e{constructor(e,t){Ne(this,"group");Ne(this,"restrictedTraits");Ne(this,"restrictedTypes");Ne(this,"isTraitAllowed",e=>!this.restrictedTraits.has(e));Ne(this,"isTypeAllowed",e=>!this.restrictedTypes.has(e));Ne(this,"isReverseTraitAllowed",e=>{const t=this.manifestRestrictions.restrictionMaps[e];if(t){const r=t.isTraitAllowed(this.traitId);return{allowed:r,blockingTrait:r?void 0:this.traitId}}return{allowed:!0,blockingTrait:void 0}});Ne(this,"isReverseTypeAllowed",(e,t)=>{if(!e)return{allowed:!0};const r=this.manifestRestrictions.restrictionMaps[t];if(r){const i=r.isTypeAllowed(e);return{allowed:i,blockingType:i?void 0:this.traitId}}return{allowed:!0}});Ne(this,"isItemAllowed",(e,t)=>{if(!e)return!0;const r=this.manifestRestrictions.itemRestrictions.get(e);return r?!r.has(t):!0});Ne(this,"isReverseItemAllowed",(e,t)=>{if(!e)return{allowed:!0,blockingItemId:void 0};const r=this.manifestRestrictions.itemRestrictions.get(t);if(r){const i=!r.has(e);return{allowed:i,blockingItemId:i?void 0:e}}return{allowed:!0,blockingItemId:void 0}});Ne(this,"isReverseAllowed",(e,t,r,i)=>{const s=this.isReverseTraitAllowed(t),o=this.isReverseTypeAllowed(e,t),a=this.isReverseItemAllowed(r,i);return{allowed:s.allowed&&o.allowed&&a.allowed,blocking:{blockingTrait:s.blockingTrait,blockingType:o.blockingType,blockingItemId:a.blockingItemId}}});var r,i;this.manifestRestrictions=e,this.group=t,this.restrictedTraits=new Set(((r=this.manifestRestrictions.traitRestrictions[t.trait])==null?void 0:r.restrictedTraits)||[]),this.restrictedTypes=new Set(((i=this.manifestRestrictions.traitRestrictions[t.trait])==null?void 0:i.restrictedTypes)||[]);for(const s in this.manifestRestrictions.traitRestrictions){if(s==t.trait)continue;const o=this.manifestRestrictions.traitRestrictions[s];for(const a of this.restrictedTraits){const l=this.manifestRestrictions.restrictionMaps[a];l&&(l.restrictedTraits.has(t.trait)||l.restrictedTraits.add(s))}o.restrictedTraits.includes(t.trait)&&!this.restrictedTraits.has(s)&&this.restrictedTraits.add(s)}}get manifestData(){return this.manifestRestrictions.manifestData}get traitId(){return this.group.trait}}class iM{constructor(e){const{assetsLocation:t,traitsDirectory:r,thumbnailsDirectory:i,traitIconsDirectorySvg:s,animationPath:o,exportScale:a,displayScale:l,initialTraits:c,requiredTraits:A,randomTraits:u,colliderTraits:f,lipSyncTraits:h,blinkerTraits:d,traitRestrictions:m,defaultCullingLayer:g,defaultCullingDistance:p,offset:v,vrmMeta:w,traits:_,textureCollections:x,decalCollections:b,colorCollections:B,canDownload:S=!0,downloadOptions:I={}}=e;this.assetsLocation=t,this.traitsDirectory=r,this.thumbnailsDirectory=i,this.traitIconsDirectorySvg=s,this.displayScale=l||a||1,this.animationPath=ut(o),this.requiredTraits=ut(A),this.randomTraits=ut(u),this.initialTraits=c||[...new Set(this.requiredTraits.concat(this.randomTraits))],this.colliderTraits=ut(f),this.lipSyncTraits=ut(h),this.blinkerTraits=ut(d),this.traitRestrictions=m,this.defaultCullingLayer=g,this.defaultCullingDistance=p,this.offset=v,this.canDownload=S,this.downloadOptions=I;const M=()=>{const D=[];for(const T in _)D.push(_[T].trait);return D};this.allTraits=M(),M(),(()=>{I.vrmMeta=I.vrmMeta||w,I.scale=I.scale||a||1,I.mToonAtlasSize=I.mToonAtlasSize||2048,I.mToonAtlasSizeTransp=I.mToonAtlasSizeTransp||1024,I.stdAtlasSize=I.stdAtlasSize||2048,I.stdAtlasSizeTransp=I.stdAtlasSizeTransp||1024,I.exportStdAtlas=I.exportStdAtlas||!1,I.exportMtoonAtlas=I.exportMtoonAtlas||!0,I.screenshotFaceDistance=I.screenshotFaceDistance||1,I.screenshotFaceOffset=I.screenshotFaceOffset||[0,0,0],I.screenshotResolution=I.screenshotResolution||[512,512],I.screenshotBackground=I.screenshotBackground||[.1,.1,.1],I.screenshotFOV=I.screenshotFOV||75,!I.exportStdAtlas&&!I.exportMtoonAtlas&&(I.exportMtoonAtlas=!0)})(),this.manifestRestrictions=new z0e(this),this.textureTraits=[],this.textureTraitsMap=null,this.createTextureTraits(x),this.decalTraits=[],this.decalTraitsMap=null,this.createDecalTraits(b),this.colorTraits=[],this.colorTraitsMap=null,this.createColorTraits(B),this.modelTraits=[],this.modelTraitsMap=null,this.createModelTraits(_),this.manifestRestrictions._init()}appendManifestData(e,t){e.textureTraits.forEach(r=>{const i=this.getTextureGroup(r.trait);i!=null?i.appendCollection(r,t):(this.textureTraits.push(r),this.textureTraitsMap.set(r.trait,r))}),e.colorTraits.forEach(r=>{const i=this.getColorGroup(r.trait);i!=null?i.appendCollection(r,t):(this.colorTraits.push(r),this.colorTraitsMap.set(r.trait,r))}),e.modelTraits.forEach(r=>{const i=this.getModelGroup(r.trait);i!=null?i.appendCollection(r,t):(this.modelTraits.push(r),this.modelTraitsMap.set(r.trait,r))}),console.log(e)}getExportOptions(){return this.downloadOptions}getGroupModelTraits(){return this.modelTraits}getInitialTraits(){return this.getRandomTraits(this.initialTraits)}getAllTraits(){return this.getRandomTraits(this.allTraits)}getTraitOptionById(e){return this.getAllTraitOptions().find(t=>t.id==e)}getTraitOptionsByType(e){return this.getAllTraitOptions().filter(t=>t.type==e)}getAllTraitOptions(){return this.modelTraits.map(e=>e==null?void 0:e.getCollection()).flat()}getAllBlendShapeTraits(){return this.modelTraits.map(e=>e.getCollection()).flat().map(e=>e.blendshapeTraits).flat().map(e=>e==null?void 0:e.collection).flat().filter(e=>!!e)}isColliderRequired(e){return this.colliderTraits.indexOf(e)!=-1}isLipsyncTrait(e){return this.lipSyncTraits.indexOf(e)!=-1}async getNFTraitOptionsFromURL(e,t){const r=await this._fetchJson(e);return this.getNFTraitOptionsFromObject(r,t)}getNFTraitOptionsFromObject(e,t){const r=e.attributes;if(r){t=ut(t);const i=[];return r.forEach(s=>{if(t.indexOf(s.trait_type)==-1){const o=this.getTraitOption(s.trait_type,s.value);o&&i.push(o)}}),i}else return console.warn("No attiributes parameter was found in ",e),null}getRandomTraits(e){const t=[];return(e||this.randomTraits).forEach(i=>{const s=this.getRandomTrait(i);s&&t.push(s)}),this._filterTraitOptions(t)}getRandomTrait(e){var r,i;const t=this.getModelGroup(e);if(t){const s=t.getRandomTrait();if(s){const o=(r=s.targetTextureCollection)==null?void 0:r.getRandomTrait(),a=(i=s.targetColorCollection)==null?void 0:i.getRandomTrait();return new sM(s,o,a)}else return null}else return console.warn("No trait group with name "+e+" was found."),null}async _fetchJson(e){return await(await fetch(e)).json()}getTraitOption(e,t){var i,s;const r=this.getModelTrait(e,t);if(r){const o=(i=r.targetTextureCollection)==null?void 0:i.getRandomTrait(),a=(s=r.targetColorCollection)==null?void 0:s.getRandomTrait();return new sM(r,o,a)}return null}_filterTraitOptions(e){const t=[],r=[];for(let i=0;i0&&console.log("options were filtered to fullfill restrictions: ",r),t}getCustomTraitOption(e,t){const r=this.getCustomModelTrait(e,t);return r?new sM(r,null,null):null}getCustomModelTrait(e,t){var r;return(r=this.getModelGroup(e))==null?void 0:r.getCustomTrait(t)}getModelTrait(e,t){var r;return(r=this.getModelGroup(e))==null?void 0:r.getTrait(t)}getModelTraits(e){const t=this.getModelGroup(e);return t?t.getCollection():(console.warn("No model group with name "+e),null)}getModelGroup(e){return this.modelTraitsMap.get(e)}getTextureTrait(e,t){var r;return(r=this.getTextureGroup(e))==null?void 0:r.getTrait(t)}getTextureGroup(e){return this.textureTraitsMap.get(e)}getDecalTrait(e,t){var r;return(r=this.getDecalGroup(e))==null?void 0:r.getTrait(t)}getDecalGroup(e){return this.decalTraitsMap.get(e)}getColorTrait(e,t){var r;return(r=this.getColorGroup(e))==null?void 0:r.getTrait(t)}getColorGroup(e){return this.colorTraitsMap.get(e)}getTraitsDirectory(){let e=(this.assetsLocation||"")+(this.traitsDirectory||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getThumbnailsDirectory(){let e=(this.assetsLocation||"")+(this.thumbnailsDirectory||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getTraitIconsDirectorySvg(){let e=(this.assetsLocation||"")+(this.traitIconsDirectorySvg||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getAssetsDirectory(){let e=this.assetsLocation||"";return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getDecalsDirectory(){let e=(this.assetsLocation||"")+(this.decalDirectory||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}createModelTraits(e,t=!1){t&&(this.modelTraits=[]);let r=!1;ut(e).forEach(i=>{var o,a;const s=new V0e(this,i);this.modelTraits.push(s),r&&((o=s.getAllDecals())!=null&&o.length)?console.warn("Detected multiple traits with decals; only one trait with decals is supported at the moment"):(a=s.getAllDecals())!=null&&a.length||(r=!0)}),this.modelTraitsMap=new Map(this.modelTraits.map(i=>[i.trait,i])),this.modelTraits.forEach(i=>{this.manifestRestrictions.createTraitRestriction(i)})}createTextureTraits(e,t=!1){t&&(this.textureTraits=[]),ut(e).forEach(r=>{this.textureTraits.push(new j0e(this,r))}),this.textureTraitsMap=new Map(this.textureTraits.map(r=>[r.trait,r]))}createDecalTraits(e,t=!1){t&&(this.decalTraits=[]),ut(e).forEach(r=>{this.decalTraits.push(new W0e(this,r))}),this.decalTraitsMap=new Map(this.decalTraits.map(r=>[r.trait,r]))}createColorTraits(e,t=!1){t&&(this.colorTraits=[]),ut(e).forEach(r=>{this.colorTraits.push(new K0e(this,r))}),this.colorTraitsMap=new Map(this.colorTraits.map(r=>[r.trait,r]))}}class V0e{constructor(e,t){Ne(this,"collection");Ne(this,"manifestData");Ne(this,"restrictions");const{trait:r,name:i,iconSvg:s,cameraTarget:o={distance:3,height:1},cullingDistance:a,cullingLayer:l,collection:c}=t;this.manifestData=e,this.isRequired=e.requiredTraits.indexOf(r)!==-1,this.trait=r,this.name=i,this.iconSvg=s,this.fullIconSvg=e.getTraitIconsDirectorySvg()+s,this.cameraTarget=o,this.cullingDistance=a,this.cullingLayer=l,this.collection=[],this.collectionMap=null,this.createCollection(c)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Model with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Model with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),ut(e).forEach(r=>{this.collection.push(new YO(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getCustomTrait(e){return new YO(this,{directory:e,fullDirectory:e,id:"_custom",name:"Custom"})}getTrait(e){return this.collectionMap.get(e)}getAllDecals(){return this.collection.map(t=>t.targetDecalCollection).flat().map(t=>t==null?void 0:t.collection).flat().filter(t=>!!t)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}getCollection(){return this.collection}}class j0e{constructor(e,t){const{trait:r,collection:i}=t;r?this.trait=r:(console.warn("TraitTexturesGroup is missing property trait"),this.trait="undefined"+Math.floor(Math.random()*10)),this.manifestData=e,this.collection=[],this.collectionMap=null,this.createCollection(i)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Texture with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Texture with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),ut(e).forEach(r=>{this.collection.push(new lV(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class W0e{constructor(e,t){Ne(this,"trait");Ne(this,"collection");Ne(this,"collectionMap");const{trait:r,collection:i}=t;this.manifestData=e,r?this.trait=r:(console.warn("DecalTextureGroup is missing property trait"),this.trait="undefined"+Math.floor(Math.random()*10)),this.collection=[],this.collectionMap=null,this.createCollection(i)}appendCollection(e,t=!1){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Texture with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Texture with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),ut(e).forEach(r=>{this.collection.push(new $0e(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class K0e{constructor(e,t){const{trait:r,collection:i}=t;this.manifestData=e,this.trait=r,this.collection=[],this.collectionMap=null,this.createCollection(i)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Color with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Color with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),ut(e).forEach(r=>{this.collection.push(new Z0e(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class YO{constructor(e,t){Ne(this,"type");Ne(this,"blendshapeTraits",[]);Ne(this,"decalMeshNameTargets",[]);Ne(this,"targetDecalCollection",null);Ne(this,"traitGroup");Ne(this,"blendshapeTraitsMap",new Map);Ne(this,"_restrictedItems",[]);const{id:r,type:i="",directory:s,name:o,thumbnail:a,cullingDistance:l,cullingLayer:c,textureCollection:A,blendshapeTraits:u,colorCollection:f,decalCollection:h,decalMeshNameTargets:d,fullDirectory:m,fullThumbnail:g,restrictedItems:p}=t;if(this.manifestData=e.manifestData,this.traitGroup=e,this.decalMeshNameTargets=ut(d),this.id=r,this.directory=s,this._restrictedItems=p||[],m)this.fullDirectory=m;else if(Array.isArray(s)){this.fullDirectory=[];for(let v=0;vnew X0e(this,v)),this.blendshapeTraitsMap=new Map(this.blendshapeTraits.map(v=>[v.trait,v])))}isRestricted(e){var t,r;return!(e==null||(t=this.traitGroup.restrictions)!=null&&t.isTraitAllowed(e.traitGroup.trait)||(r=this.traitGroup.restrictions)!=null&&r.isTypeAllowed(e.type))}getGroupBlendShapeTraits(){return this.blendshapeTraits}getBlendShapes(e){var t,r;return(r=(t=this.blendshapeTraitsMap)==null?void 0:t.get(e))==null?void 0:r.collection}getBlendShape(e,t){var r,i;return(i=(r=this.blendshapeTraitsMap)==null?void 0:r.get(e))==null?void 0:i.getTrait(t)}}class X0e{constructor(e,t){Ne(this,"trait");Ne(this,"name");Ne(this,"isBlendShapeGroup",!0);Ne(this,"collection",[]);Ne(this,"cameraTarget",null);Ne(this,"collectionMap",null);const{trait:r,name:i,collection:s,cameraTarget:o=e.traitGroup.cameraTarget||{distance:3,height:1}}=t;this.modelTrait=e,this.trait=r,this.name=i,this.cameraTarget=o,this.createCollection(s)}createCollection(e,t=!1){t&&(this.collection=[]),ut(e).forEach(r=>{this.collection.push(new Y0e(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class Y0e{constructor(e,t){Ne(this,"id");Ne(this,"name");Ne(this,"fullThumbnail");Ne(this,"isBlendShape",!0);const{id:r,name:i,fullThumbnail:s}=t;r||console.warn("BlendShapeTrait is missing id, parent trait: "+e.trait),i||console.warn("BlendShapeTrait is missing name, parent trait: "+e.trait),this.parentGroup=e,this.id=r,this.fullThumbnail=s,this.name=i}getGroupId(){return this.parentGroup.trait}}class lV{constructor(e,t){const{id:r,directory:i,fullDirectory:s,name:o,thumbnail:a}=t;if(this.traitGroup=e,this.id=r,this.directory=i,s)this.fullDirectory=s;else if(Array.isArray(i)){this.fullDirectory=[];for(let l=0;l{e.traverse(i=>{if(i.isMesh||i.isSkinnedMesh){const s=i;if(!s.morphTargetDictionary||!s.morphTargetInfluences)return;const o=s.morphTargetDictionary[t.id];o!=null&&(s.morphTargetInfluences[o]=r?1:0)}})});this._start(e)}async _start(e){const{parentModel:t=null,renderCamera:r=null,manifestURL:i=null}=e;this.rootModel=new Lt,this.characterModel=new Lt,this.parentModel=t,t&&t.add(this.rootModel),this.lipSync=null,this.lookAtManager=null,this.animationManager=new xge,this.screenshotManager=new Lge(this,t||this.rootModel),this.overlayedTextureManager=new H0e(this),this.blinkManager=new Nge(.1,.1,.5,5),this.emotionManager=new Oge,this.rootModel.add(this.characterModel),this.renderCamera=r,this.manifestData=null,this.manifest=null,i&&(this.loadManifest(i),this.animationManager.setScale(this.manifestData.displayScale)),this.avatar={},this.storedAvatar={},this.traitLoadManager=new q0e;const s=new ri;s.renderOrder=1e4,this.rootModel.add(s),this.vrmHelperRoot=s}togglePauseSpringBoneAnimation(e){for(const[t,r]of Object.entries(this.avatar))r.vrm.springBoneManager&&(r.vrm.springBoneManager.paused=e)}update(e){var t,r,i;if(this.lookAtManager!=null&&this.lookAtManager.update(),this.avatar){for(const s in this.avatar)if(((t=this.avatar[s])==null?void 0:t.vrm)!=null){if((r=this.avatar[s].vrm.springBoneManager)!=null&&r.paused)return;(i=this.avatar[s].vrm.springBoneManager)==null||i.update(e)}}}addLookAtMouse(e,t,r,i=!0){var s;this.lookAtManager=new Q0e(e,t,r),this.lookAtManager.enabled=!0;for(const o in this.avatar)((s=this.avatar[o])==null?void 0:s.vrm)!=null&&this.lookAtManager.addVRM(this.avatar[o].vrm)}toggleCharacterLookAtMouse(e){this.lookAtManager!=null?(this.lookAtManager.setActive(e),this.animationManager&&this.animationManager.enableMouseLook(e)):console.warn("toggleCharacterLookAtMouse() was called, but no lookAtManager exist. Make sure to set it up first with addLookArMous()")}savePortraitScreenshot(e,t,r,i=1,s=0){this.blinkManager.enableScreenshot(),this.characterModel.traverse(o=>{o.isSkinnedMesh&&o.skeleton.bones.filter(l=>l.name==="head")[0].getWorldPosition(xl)}),xl.z+=.3,xl.y+=s,this.screenshotManager.cameraFrameManager.setCamera(xl,i),this.screenshotManager.saveScreenshot(e,t,r),this.blinkManager.disableScreenshot()}cameraRaycastCulling(e,t,r=!0){if(this.renderCamera==null){console.warn("No camera was set in character manager. Please call setRenderCamera(camera) before calling this function");return}const i=()=>{this.characterModel.traverse(c=>{c.isMesh&&c.userData.origIndexBuffer&&(c.userData.clippedIndexGeometry=c.geometry.index.clone(),c.geometry.setIndex(c.userData.origIndexBuffer))})},s=()=>{this.characterModel.traverse(c=>{c.isMesh&&c.userData.origIndexBuffer&&c.geometry.setIndex(c.userData.clippedIndexGeometry)})},o=(c,A)=>{for(let u=0;u{var m,g;const u=c.object,f=c.face,h=[f.a,f.b,f.c],d=(g=(m=u.userData)==null?void 0:m.clippedIndexGeometry)==null?void 0:g.array;if(d!=null){const p=o(d,h),v=Array.from(d);if(p==-1&&!A){const w=[...v,...h];u.userData.clippedIndexGeometry=new ct(new Uint32Array(w),1,!1)}p!=1&&A&&(v.splice(p,3),u.userData.clippedIndexGeometry=new ct(new Uint32Array(v),1,!1))}};oM.x=e,oM.y=t,i(),$O.setFromCamera(oM,this.renderCamera);const l=$O.intersectObjects(this.characterModel.children);if(l.length>0){const c=l[0];a(c,r)}s()}removeCurrentCharacter(){const e=[];for(const t in this.avatar)e.push(new Ow({traitGroupID:t,traitModel:null}));e.forEach(t=>{this._addLoadedData(t)}),this.avatar={}}removeCurrentManifest(){this.removeCurrentCharacter(),this.manifest=null,this.manifestData=null,this.animationManager&&this.animationManager.clearCurrentAnimations()}canDownload(){var e;return((e=this.manifestData)==null?void 0:e.canDownload)||!0}downloadVRM(e,t=null){return new Promise(async(r,i)=>{if(this.canDownload())try{t=t||{};const o={...this.manifestData.getExportOptions(),...t};o.screenshot=this._getPortaitScreenshotTexture(!1,o),console.log(o),await x0e(this.characterModel,this.avatar,e,o),r()}catch(s){console.error("Error downloading VRM:",s.message),i(new Error("Failed to download VRM."))}else{const s="Download not supported.";console.error(s),i(new Error(s))}})}downloadGLB(e,t=null){if(console.log("XXX fix glb downloader"),this.canDownload()){t=t||{};const r={...this.manifestData.getExportOptions(),...t};E0e(this.characterModel,e,r)}else console.error("Download not supported")}getAvatarSelection(){var t;var e={};for(const r in this.avatar)e[r]={name:this.avatar[r].name,id:(t=this.avatar[r].traitInfo)==null?void 0:t.id};return e}getBoneTriangleCount(){let e=0,t=new Set;for(const r in this.avatar)this.avatar[r].model.traverse(i=>{i.isMesh&&(e+=i.geometry.index.array.length),i.isSkinnedMesh&&i.skeleton.bones.forEach(s=>{t.add(s.name)})});return{triangles:e/3,bones:t.size}}getGroupTraits(){if(this.manifestData)return this.manifestData.getGroupModelTraits()}getBlendShapeGroupTraits(e,t){var r;return this.manifestData?(r=this.manifestData.getModelTrait(e,t))==null?void 0:r.getGroupBlendShapeTraits():[]}getCurrentCharacterModel(){return this.characterModel}isTraitGroupRequired(e){const t=this.manifestData.getModelGroup(e);return!!(t!=null&&t.isRequired)}getTraits(e){return this.manifestData?this.manifestData.getModelTraits(e):(console.warn("No manifest file has been loaded, please load it before trait models."),null)}getCurrentTraitID(e){var t,r;return(r=(t=this.avatar[e])==null?void 0:t.traitInfo)==null?void 0:r.id}getCurrentTraitData(e){var t;return(t=this.avatar[e])==null?void 0:t.traitInfo}getCurrentBlendShapeTraitData(e){var t;return((t=this.avatar[e])==null?void 0:t.blendShapeTraitsInfo)||{}}getCurrentTraitVRM(e){var t;return(t=this.avatar[e])==null?void 0:t.vrm}setParentModel(e){e.add(this.rootModel),this.parentModel=e,this.screenshotManager&&this.screenshotManager.setScene(this.parentModel)}setRenderCamera(e){this.renderCamera=e}loadRandomTraits(){return new Promise(async(e,t)=>{if(this.manifestData){const r=this.manifestData.getRandomTraits();await this._loadTraits(r),e()}else{const r="No manifest was loaded, random traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadRandomTrait(e){return new Promise(async(t,r)=>{if(this.manifestData){const i=this.manifestData.getRandomTrait(e);await this._loadTraits(ut(i)),t()}else{const i="No manifest was loaded, random traits cannot be loaded.";console.error(i),r(new Error(i))}})}loadTraitsFromNFT(e,t=!0,r=null){return new Promise(async(i,s)=>{try{if(this.manifestData){const o=this.manifestData.getNFTraitOptionsFromURL(e,r);await this._loadTraits(o,t),i()}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}}catch(o){s(o)}})}loadTraitsFromNFTObject(e,t=!0,r=null){return new Promise(async(i,s)=>{if(this.manifestData)try{const o=this.manifestData.getNFTraitOptionsFromObject(e,r);await this._loadTraits(o,t),i()}catch(o){console.error("Error loading traits from NFT object:",o.message),s(new Error("Failed to load traits from NFT object."))}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}})}loadInitialTraits(){return new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getInitialTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadAllTraits(){return console.log("load all"),new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getAllTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadBlendShapeTrait(e,t,r){if(!this.avatar[e]){console.warn(`Trait with name: ${e} was not found or not selected.`);return}if(!this.manifestData){console.warn("No manifest data was found.");return}try{this._loadBlendShapeTrait(e,t,r)}catch{console.error("Error loading blendshape trait "+e,t,r)}}removeBlendShapeTrait(e,t){this.avatar[e]?this._loadBlendShapeTrait(e,t,null):console.warn(`No trait with name: ${e} was found.`)}_getTraitAllowedRules(e,t){var i;const r=[];for(const s in this.avatar){const o=this.avatar[s],a=(i=o.traitInfo.traitGroup.restrictions)==null?void 0:i.isReverseAllowed(o.traitInfo.type,e,o.traitInfo.id,t);a&&!(a!=null&&a.allowed)&&r.push(a)}return r.length?r:[{allowed:!0,blocking:{}}]}_checkRestrictionsBeforeLoad(e,t){const r=this._getTraitAllowedRules(e,t);if(!r[0].allowed)for(const i of r){if(i.blocking.blockingTrait&&this.removeTrait(i.blocking.blockingTrait),i.blocking.blockingItemId){const s=this.manifestData.getTraitOptionById(i.blocking.blockingItemId);s&&this.removeTrait(s.traitGroup.trait)}if(i.blocking.blockingType&&this.manifestData.getTraitOptionsByType(i.blocking.blockingType).length)for(const o in this.avatar)this.avatar[o].traitInfo.type==i.blocking.blockingType&&this.removeTrait(o)}}loadTrait(e,t,r=!1){return new Promise(async(i,s)=>{if(this.manifestData)try{const o=this.manifestData.getTraitOption(e,t);this._checkRestrictionsBeforeLoad(e,t),o&&(await this._loadTraits(ut(o),r),i())}catch(o){console.error("Error loading specific trait:",o.message),s(new Error("Failed to load specific trait."))}else{const o="No manifest was loaded, specific trait cannot be loaded.";console.error(o),s(new Error(o))}})}loadCustomTrait(e,t){return new Promise(async(r,i)=>{if(this.manifestData)try{const s=this.manifestData.getCustomTraitOption(e,t);s&&(await this._loadTraits(ut(s)),r())}catch(s){console.error("Error loading custom trait:",s.message),i(new Error("Failed to load custom trait."))}else{const s="No manifest was loaded, custom trait cannot be loaded.";console.error(s),i(new Error(s))}})}loadCustomTexture(e,t){return new Promise(async(r,i)=>{var o;const s=(o=this.avatar[e])==null?void 0:o.model;if(s)await Age(s,t),r();else{const a="No Group Trait with name "+e+" was found.";console.warn(a),i(new Error(a))}})}setTraitColor(e,t){var i;const r=(i=this.avatar[e])==null?void 0:i.model;if(r)try{const s=new Qe(t);r.traverse(o=>{o.isMesh&&(o.material.type==="MeshStandardMaterial"?Array.isArray(o.material)?o.material.forEach(a=>{a.color=s}):o.material.color=s:(o.material[0].uniforms.litFactor.value=s,o.material[0].uniforms.shadeColorFactor.value=new Qe(s.r*.8,s.g*.8,s.b*.8)))})}catch(s){throw console.error("Error setting trait color:",s.message),new Error("Failed to set trait color.")}else{const s="No Group Trait with name "+e+" was found.";throw console.warn(s),new Error(s)}}removeTrait(e,t=!1){if(this.isTraitGroupRequired(e)&&!t){console.warn(`No trait with name: ${e} is not removable.`);return}if(this.manifestData.getModelGroup(e)){const i=new Ow({traitGroupID:e,traitModel:null});this._addLoadedData(i),JB(this.avatar)}else console.warn(`No trait with name: ${e} was found.`)}updateCullHiddenMeshes(){JB(this.avatar)}loadOptimizerManifest(){this.manifest={colliderTraits:["CUSTOM"],traits:[{name:"Custom",trait:"CUSTOM",collection:[]}]},this.manifestData=new iM(this.manifest)}getCurrentOptimizerCharacterModel(){var e;return(e=this.avatar.CUSTOM)==null?void 0:e.vrm}loadOptimizerCharacter(e){return this.loadCustomTrait("CUSTOM",e)}setManifest(e){return this.removeCurrentCharacter(),new Promise(async(t,r)=>{try{if(this.manifest=e,this.manifest){if(this.manifestData=new iM(this.manifest),this.animationManager)try{await this._animationManagerSetup(this.manifest.animationPath,this.manifest.assetsLocation,this.manifestData.displayScale)}catch(i){console.error("Error loading animations: "+i)}t()}else{const i="Failed to fetch or parse the manifest.";console.error(i),r(new Error(i))}}catch(i){console.error("Error setting manifest:",i.message),r(new Error("Failed to set the manifest."))}})}appendManifest(e,t){return new Promise(async(r,i)=>{try{t?this.manifest={...this.manifest||{},manifest:e}:this.manifest={manifest:e,...this.manifest||{}};const s=new iM(e);this.manifestData.appendManifestData(s),r()}catch(s){console.error("Error setting manifest:",s.message),i(new Error("Failed to set the manifest."))}})}loadManifest(e){return new Promise(async(t,r)=>{try{const i=await this._fetchManifest(e);this.setManifest(i).then(()=>{t()})}catch(i){console.error("Error loading manifest:",i.message),r(new Error("Failed to load the manifest."))}})}loadAppendManifest(e,t){return new Promise(async(r,i)=>{try{const s=await this._fetchManifest(e);this.appendManifest(s,t).then(()=>{r()})}catch(s){console.error("Error loading manifest:",s.message),i(new Error("Failed to load the manifest."))}})}async soloTargetGroupTrait(e){const t=ut(e),r=[];for(const i in this.avatar)t.includes(i)&&r.push(this.manifestData.getTraitOption(i,this.avatar[i].traitInfo.id));await this._loadTraits(r,!0)}storeCurrentAvatar(){this.storedAvatar={...this.avatar}}async loadStoredAvatar(){const e=[];for(const t in this.storedAvatar)e.push(this.manifestData.getTraitOption(t,this.storedAvatar[t].traitInfo.id));console.log(e),this._loadTraits(e,!0)}async _loadTraits(e,t=!1){console.log("laoded traits:",e),await this.traitLoadManager.loadTraitOptions(ut(e)).then(r=>{t&&this.getGroupTraits().forEach(s=>{r.some(a=>{var l;return((l=a.traitModel)==null?void 0:l.traitGroup.trait)===s.trait})||this.avatar[s.trait]!=null&&r.push(new Ow({traitGroupID:s.trait,traitModel:null}))}),r.forEach(i=>{this._addLoadedData(i)}),JB(this.avatar)})}async _loadBlendShapeTrait(e,t,r){const i=this.avatar[e];if(!i){console.warn(`Trait with name: ${e} was not found or not selected.`);return}if(i.blendShapeTraitsInfo||(i.blendShapeTraitsInfo={}),i.blendShapeTraitsInfo[t]&&this.toggleBinaryBlendShape(i.model,i.blendShapeTraitsInfo[t],!1),r==null){delete this.avatar[e].blendShapeTraitsInfo[t];return}const s=i.traitInfo.getBlendShape(t,r);if(!s){console.warn(`Blendshape with name: ${r} was not found.`);return}this.toggleBinaryBlendShape(i.model,s,!0),this.avatar[e].blendShapeTraitsInfo[s.getGroupId()]=s}async _animationManagerSetup(e,t,r){const i=ut(e);this.animationManager&&(this.animationManager.setScale(r),e.length>0&&(this.animationManager.storeAnimationPaths(i,t||""),await this.animationManager.loadAnimation(i,!1,0,i[0].endsWith(".fbx"),t||"")))}async _fetchManifest(e){return await(await fetch(e)).json()}_getPortaitScreenshotTexture(e,t){this.blinkManager.enableScreenshot(),this.characterModel.traverse(u=>{u.isSkinnedMesh&&u.skeleton.bones.filter(h=>h.name==="head")[0].getWorldPosition(xl)});const{screenshotResolution:r,screenshotFaceDistance:i,screenshotFaceOffset:s,screenshotBackground:o,screenshotFOV:a}=t,l=r[0],c=r[1];xl.x+=s[0],xl.y+=s[1],xl.z+=s[2],this.screenshotManager.setBackground(o),this.screenshotManager.cameraFrameManager.setCamera(xl,i,a);const A=e?this.screenshotManager.getScreenshotBlob(l,c):this.screenshotManager.getScreenshotTexture(l,c);return this.blinkManager.disableScreenshot(),A}_setupWireframeMaterial(e){e.origMat=e.material;const t=()=>{const o=.1+Math.random()*.9,a=.1+Math.random()*(1-.1),l=.1+Math.random()*(1-.1);return new Qe(o,a,l)},r=new qi({color:t(),wireframe:!0,wireframeLinewidth:.2}),i=e.material;e.setDebugMode=s=>{s?e.material.length?(e.material[0]=r,e.material[1]=r):e.material=r:e.material=i}}_VRMBaseSetup(e,t,r,i,s){var a,l;let o=e.userData.vrm;if(e.userData.vrm==null)return console.error("No valid VRM was provided for "+r+" trait, skipping file."),null;if(NO(o,{isVRM0:((a=o.meta)==null?void 0:a.metaVersion)==="0"}),this.manifestData.isColliderRequired(r)&&D0e(e),this._applySpringBoneColliders(o),mge(o),L0e(e),this._unregisterMorphTargetsFromManifest(o),this.manifestData.isLipsyncTrait(r)&&(this.lipSync=new ox(o)),this._modelBaseSetup(o,t,r,i,s),((l=o.meta)==null?void 0:l.metaVersion)==="0"){if(o.humanoid.humanBones.hips.node.parent==o.scene){const c=new Lt;c.name="newRootNode",cge(o.scene,c),c.add(o.humanoid.humanBones.hips.node)}o.humanoid.humanBones.hips.node.parent.rotateY(3.14159),o.scene.traverse(c=>{if(c.isSkinnedMesh){for(let A=0;A{for(const s of r){if(i.colliderGroups.find(a=>a.name===s.name))return;i.colliderGroups.indexOf(s)===-1&&i.colliderGroups.push(s)}})}Object.entries(this.avatar).map(([r,i])=>{var a;const s=[];if((a=i.vrm.springBoneManager)!=null&&a.colliderGroups.length&&s.push(...i.vrm.springBoneManager.colliderGroups),s.length){t(s);return}const o=k0e(i.vrm);o.length!=0&&o.forEach(l=>{if(!e.springBoneManager)return;const c={colliders:[],name:l.name};for(const A of l.children)A instanceof Lw&&c.colliders.indexOf(A)===-1&&c.colliders.push(A);c.colliders.length&&t([c])})})}_unregisterMorphTargetsFromManifest(e){var s;const t=this.manifestData.getAllBlendShapeTraits(),r=(s=e.expressionManager)==null?void 0:s.expressions;if(t.length==0||!r)return;const i=[];for(const o of r)t.map(a=>a.id).includes(o.expressionName)&&i.push(o);for(const o of i)e.expressionManager.unregisterExpression(o)}_modelBaseSetup(e,t,r,i,s){const o=[],a=ut(t.cullingIgnore),l=[];t.meshTargets&&ut(t.meshTargets).map(u=>{const f=e.scene.getObjectByName(u);f!=null&&f.isMesh&&o.push(f)}),e.scene.traverse(u=>{!t.meshTargets&&u.isMesh&&o.push(u),u.frustumCulled=!1,u.isMesh&&(this._setupWireframeMaterial(u),a.indexOf(u.name)===-1&&l.push(u))});const c=this.manifest,A=this.manifestData.getModelGroup(r);NO(e,{cullingLayer:t.cullingLayer!=null?t.cullingLayer:A.cullingLayer!=null?A.cullingLayer:c.defaultCullingLayer!=null?c.defaultCullingLayer:-1,cullingDistance:t.cullingDistance!=null?t.cullingDistance:A.cullingDistance!=null?A.cullingDistance:c.defaultCullingDistance!=null?c.defaultCullingDistance:null,maxCullingDistance:t.maxCullingDistance!=null?t.maxCullingDistance:A.maxCullingDistance!=null?A.maxCullingDistance:c.maxCullingDistance!=null?c.maxCullingDistance:1/0,cullingMeshes:l}),o.map((u,f)=>{if(i){const h=i[f]||i[0];h!=null&&ut(u.material).map(d=>{eve(d,h)})}if(s){const h=s[f]||s[0];h!=null&&(u.material[0].uniforms.litFactor.value=h,u.material[0].uniforms.shadeColorFactor.value=new Qe(h.r*.8,h.g*.8,h.b*.8))}})}_applyManagers(e){this.blinkManager.addVRM(e),this.emotionManager.addVRM(e),this.lookAtManager&&this.lookAtManager.addVRM(e),this.animationManager&&this.animationManager.addVRM(e)}_displayModel(e){if(e){const t=e.scene;this.characterModel.attach(t)}}_positionModel(e){const t=this.manifestData.displayScale;e.scene.scale.set(t,t,t)}_disposeTrait(e){this.blinkManager.removeVRM(e),this.emotionManager.removeVRM(e),this.lookAtManager&&this.lookAtManager.removeVRM(e),this.animationManager&&this.animationManager.removeVRM(e),pge(e)}_addLoadedData(e){const{traitGroupID:t,traitModel:r,textureTrait:i,colorTrait:s,models:o,textures:a,colors:l}=e;if(r==null){this.avatar[t]&&this.avatar[t].vrm&&(this._disposeTrait(this.avatar[t].vrm),delete this.avatar[t]);return}let c=null;o.map(A=>{A!=null&&(c=this._VRMBaseSetup(A,r,t,a,l))}),c!=null&&(this.avatar[t]&&this.avatar[t].vrm&&this._disposeTrait(this.avatar[t].vrm),this._positionModel(c),this._displayModel(c),this._applyManagers(c),this.overlayedTextureManager&&r.targetDecalCollection&&this.overlayedTextureManager.setTargetVRM(c,r.decalMeshNameTargets),this.avatar[t]={traitInfo:r,blendShapeTraitsInfo:{},textureInfo:i,colorInfo:s,name:r.name,model:c&&c.scene,vrm:c})}}class q0e{constructor(){const e=new Hz;e.onProgress=(i,s,o)=>{this.setLoadPercentage(Math.round(s/o*100))};const t=new Xz(e);t.crossOrigin="anonymous",t.register(i=>new dpe(i,{autoUpdateHumanBones:!0}));const r=new PA(e);this.loadPercentager=0,this.loadingManager=e,this.gltfLoader=t,this.textureLoader=r,this.isLoading=!1}setLoadPercentage(e){this.loadPercentager=e}loadTraitOptions(e){return new Promise(t=>{this.isLoading=!0;const r=[],i=e.map(async(s,o)=>{var A,u,f;if(s==null){r[o]=null;return}const a=await Promise.all(ut((A=s==null?void 0:s.traitModel)==null?void 0:A.fullDirectory).map(async h=>{try{return await this.gltfLoader.loadAsync(h)}catch(d){return console.error(`Error loading modelsss ${h}:`,d),null}})),l=await Promise.all(ut((u=s==null?void 0:s.traitTexture)==null?void 0:u.fullDirectory).map(h=>new Promise(d=>{this.textureLoader.load(h,m=>{m.flipY=!1,m.colorSpace=Ut,d(m)},null,m=>{console.error("error loading texture: ",m),d(null)})}))),c=ut((f=s==null?void 0:s.traitColor)==null?void 0:f.value).map(h=>new Qe(h));r[o]=new Ow({traitGroupID:s==null?void 0:s.traitModel.traitGroup.trait,traitModel:s==null?void 0:s.traitModel,textureTrait:s==null?void 0:s.traitTexture,colorTrait:s==null?void 0:s.traitColor,models:a,textures:l,colors:c})});Promise.allSettled(i).then(()=>{this.setLoadPercentage(100),t(r),this.isLoading=!1}).catch(s=>{this.setLoadPercentage(100),console.error("An error occurred:",s),t(r),this.isLoading=!1})})}}class Ow{constructor(e){const{traitGroupID:t,traitModel:r,textureTrait:i,colorTrait:s,models:o,textures:a,colors:l}=e;this.traitGroupID=t,this.traitModel=r,this.textureTrait=i,this.colorTrait=s,this.models=o,this.textures=a,this.colors=l}}function eve(n,e){if(n.type==="Shadermaterial"&&!n.isMToonMaterial){console.warn("XXX set material texture to shader material",n);return}n.map=e,n.needsUpdate=!0}class tve extends roe{constructor(e){super(e),this.type=Ha}parse(e){const o=function(S,I){switch(S){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(I||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(I||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(I||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(I||""))}},A=` +`,u=function(S,I,M){I=I||1024;let D=S.pos,T=-1,y=0,E="",R=String.fromCharCode.apply(null,new Uint16Array(S.subarray(D,D+128)));for(;0>(T=R.indexOf(A))&&y=S.byteLength||!(E=u(S)))&&o(1,"no header found"),(R=E.match(I))||o(3,"bad initial token"),y.valid|=1,y.programtype=R[1],y.string+=E+` +`;E=u(S),E!==!1;){if(y.string+=E+` `,E.charAt(0)==="#"){y.comments+=E+` -`;continue}if((R=E.match(S))&&(y.gamma=parseFloat(R[1])),(R=E.match(L))&&(y.exposure=parseFloat(R[1])),(R=E.match(D))&&(y.valid|=2,y.format=R[1]),(R=E.match(T))&&(y.valid|=4,y.height=parseInt(R[1],10),y.width=parseInt(R[2],10)),y.valid&2&&y.valid&4)break}return y.valid&2||o(3,"missing format specifier"),y.valid&4||o(3,"missing image size specifier"),y},h=function(M,I,S){const L=I;if(L<8||L>32767||M[0]!==2||M[1]!==2||M[2]&128)return new Uint8Array(M);L!==(M[2]<<8|M[3])&&o(3,"wrong scanline width");const D=new Uint8Array(4*I*S);D.length||o(4,"unable to allocate buffer space");let T=0,y=0;const E=4*L,R=new Uint8Array(4),F=new Uint8Array(E);let O=S;for(;O>0&&yM.byteLength&&o(1),R[0]=M[y++],R[1]=M[y++],R[2]=M[y++],R[3]=M[y++],(R[0]!=2||R[1]!=2||(R[2]<<8|R[3])!=L)&&o(3,"bad rgbe scanline format");let z=0,j;for(;z128;if(C&&(j-=128),(j===0||z+j>E)&&o(3,"bad scanline data"),C){const W=M[y++];for(let ee=0;ee{p.mapping=Og,p.colorSpace=Mr,e.environment=p}),e.environmentIntensity=.5;const t=new Gz(16777215,.8);e.add(t);const r=new VR(16777215,.8);r.position.set(0,1,1),e.add(r);const i=new Lt;e.add(i);const s=new Fr(30,window.innerWidth/window.innerHeight,.1,1e3);s.position.set(0,1.3,2);const o=new q0e({parentModel:e,createAnimationManager:!0,renderCamera:s});o.addLookAtMouse(80,n,s,!0);const a=document.getElementById(n),l=new v0({canvas:a,antialias:!0,alpha:!0,preserveDrawingBuffer:!0}),c=new Soe(s,l.domElement);c.minDistance=1,c.maxDistance=4,c.maxPolarAngle=Math.PI/2,c.enablePan=!0,c.target=new $(0,1,0),c.enableDamping=!0,c.dampingFactor=.1;const A=new $(-.5,0,-.5),u=new $(.5,1.7,.5),f=()=>{l.setSize(window.innerWidth,window.innerHeight),s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix()};window.addEventListener("resize",f),l.setSize(window.innerWidth,window.innerHeight),l.setPixelRatio(window.devicePixelRatio),l.outputColorSpace=Ut;const h=new jR,d=()=>{requestAnimationFrame(d);const p=h.getDelta();c.target.clamp(A,u),c==null||c.update(),o.update(p),l.render(e,s)};d();const m=p=>{const v=p.ctrlKey,w=a.getBoundingClientRect(),_=(p.clientX-w.left)/w.width*2-1,x=-((p.clientY-w.top)/w.height)*2+1;o.cameraRaycastCulling(_,x,v)};async function g(){}return g(),a.addEventListener("click",m),{scene:e,camera:s,controls:c,characterManager:o,sceneElements:i,clock:h}}function Dy(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var lV={exports:{}};/*! +`;continue}if((R=E.match(M))&&(y.gamma=parseFloat(R[1])),(R=E.match(L))&&(y.exposure=parseFloat(R[1])),(R=E.match(D))&&(y.valid|=2,y.format=R[1]),(R=E.match(T))&&(y.valid|=4,y.height=parseInt(R[1],10),y.width=parseInt(R[2],10)),y.valid&2&&y.valid&4)break}return y.valid&2||o(3,"missing format specifier"),y.valid&4||o(3,"missing image size specifier"),y},h=function(S,I,M){const L=I;if(L<8||L>32767||S[0]!==2||S[1]!==2||S[2]&128)return new Uint8Array(S);L!==(S[2]<<8|S[3])&&o(3,"wrong scanline width");const D=new Uint8Array(4*I*M);D.length||o(4,"unable to allocate buffer space");let T=0,y=0;const E=4*L,R=new Uint8Array(4),F=new Uint8Array(E);let O=M;for(;O>0&&yS.byteLength&&o(1),R[0]=S[y++],R[1]=S[y++],R[2]=S[y++],R[3]=S[y++],(R[0]!=2||R[1]!=2||(R[2]<<8|R[3])!=L)&&o(3,"bad rgbe scanline format");let z=0,j;for(;z128;if(C&&(j-=128),(j===0||z+j>E)&&o(3,"bad scanline data"),C){const W=S[y++];for(let ee=0;ee{p.mapping=kg,p.colorSpace=Sr,e.environment=p}),e.environmentIntensity=.5;const t=new Vz(16777215,.8);e.add(t);const r=new WR(16777215,.8);r.position.set(0,1,1),e.add(r);const i=new Lt;e.add(i);const s=new Fr(30,window.innerWidth/window.innerHeight,.1,1e3);s.position.set(0,1.3,2);const o=new J0e({parentModel:e,createAnimationManager:!0,renderCamera:s});o.addLookAtMouse(80,n,s,!0);const a=document.getElementById(n),l=new y0({canvas:a,antialias:!0,alpha:!0,preserveDrawingBuffer:!0}),c=new Eoe(s,l.domElement);c.minDistance=1,c.maxDistance=4,c.maxPolarAngle=Math.PI/2,c.enablePan=!0,c.target=new $(0,1,0),c.enableDamping=!0,c.dampingFactor=.1;const A=new $(-.5,0,-.5),u=new $(.5,1.7,.5),f=()=>{l.setSize(window.innerWidth,window.innerHeight),s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix()};window.addEventListener("resize",f),l.setSize(window.innerWidth,window.innerHeight),l.setPixelRatio(window.devicePixelRatio),l.outputColorSpace=Ut;const h=new y1,d=()=>{requestAnimationFrame(d);const p=h.getDelta();c.target.clamp(A,u),c==null||c.update(),o.update(p),l.render(e,s)};d();const m=p=>{const v=p.ctrlKey,w=a.getBoundingClientRect(),_=(p.clientX-w.left)/w.width*2-1,x=-((p.clientY-w.top)/w.height)*2+1;o.cameraRaycastCulling(_,x,v)};async function g(){}return g(),a.addEventListener("click",m),{scene:e,camera:s,controls:c,characterManager:o,sceneElements:i,clock:h}}function Ny(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var cV={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files @@ -5038,9 +5038,9 @@ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/js JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE -*/(function(n,e){(function(t){n.exports=t()})(function(){return function t(r,i,s){function o(c,A){if(!i[c]){if(!r[c]){var u=typeof Dy=="function"&&Dy;if(!A&&u)return u(c,!0);if(a)return a(c,!0);var f=new Error("Cannot find module '"+c+"'");throw f.code="MODULE_NOT_FOUND",f}var h=i[c]={exports:{}};r[c][0].call(h.exports,function(d){var m=r[c][1][d];return o(m||d)},h,h.exports,t,r,i,s)}return i[c].exports}for(var a=typeof Dy=="function"&&Dy,l=0;l>2,h=(3&c)<<4|A>>4,d=1>6:64,m=2>4,A=(15&f)<<4|(h=a.indexOf(l.charAt(m++)))>>2,u=(3&h)<<6|(d=a.indexOf(l.charAt(m++))),v[g++]=c,h!==64&&(v[g++]=A),d!==64&&(v[g++]=u);return v}},{"./support":30,"./utils":32}],2:[function(t,r,i){var s=t("./external"),o=t("./stream/DataWorker"),a=t("./stream/Crc32Probe"),l=t("./stream/DataLengthProbe");function c(A,u,f,h,d){this.compressedSize=A,this.uncompressedSize=u,this.crc32=f,this.compression=h,this.compressedContent=d}c.prototype={getContentWorker:function(){var A=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),u=this;return A.on("end",function(){if(this.streamInfo.data_length!==u.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),A},getCompressedWorker:function(){return new o(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},c.createWorkerFrom=function(A,u,f){return A.pipe(new a).pipe(new l("uncompressedSize")).pipe(u.compressWorker(f)).pipe(new l("compressedSize")).withStreamInfo("compression",u)},r.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,r,i){var s=t("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,r,i){var s=t("./utils"),o=function(){for(var a,l=[],c=0;c<256;c++){a=c;for(var A=0;A<8;A++)a=1&a?3988292384^a>>>1:a>>>1;l[c]=a}return l}();r.exports=function(a,l){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?function(c,A,u,f){var h=o,d=f+u;c^=-1;for(var m=f;m>>8^h[255&(c^A[m])];return-1^c}(0|l,a,a.length,0):function(c,A,u,f){var h=o,d=f+u;c^=-1;for(var m=f;m>>8^h[255&(c^A.charCodeAt(m))];return-1^c}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(t,r,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(t,r,i){var s=null;s=typeof Promise<"u"?Promise:t("lie"),r.exports={Promise:s}},{lie:37}],7:[function(t,r,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=t("pako"),a=t("./utils"),l=t("./stream/GenericWorker"),c=s?"uint8array":"array";function A(u,f){l.call(this,"FlateWorker/"+u),this._pako=null,this._pakoAction=u,this._pakoOptions=f,this.meta={}}i.magic="\b\0",a.inherits(A,l),A.prototype.processChunk=function(u){this.meta=u.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(c,u.data),!1)},A.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},A.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},A.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var u=this;this._pako.onData=function(f){u.push({data:f,meta:u.meta})}},i.compressWorker=function(u){return new A("Deflate",u)},i.uncompressWorker=function(){return new A("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,r,i){function s(h,d){var m,g="";for(m=0;m>>=8;return g}function o(h,d,m,g,p,v){var w,_,x=h.file,b=h.compression,B=v!==c.utf8encode,M=a.transformTo("string",v(x.name)),I=a.transformTo("string",c.utf8encode(x.name)),S=x.comment,L=a.transformTo("string",v(S)),D=a.transformTo("string",c.utf8encode(S)),T=I.length!==x.name.length,y=D.length!==S.length,E="",R="",F="",O=x.dir,z=x.date,j={crc32:0,compressedSize:0,uncompressedSize:0};d&&!m||(j.crc32=h.crc32,j.compressedSize=h.compressedSize,j.uncompressedSize=h.uncompressedSize);var H=0;d&&(H|=8),B||!T&&!y||(H|=2048);var C=0,W=0;O&&(C|=16),p==="UNIX"?(W=798,C|=function(P,re){var ue=P;return P||(ue=re?16893:33204),(65535&ue)<<16}(x.unixPermissions,O)):(W=20,C|=function(P){return 63&(P||0)}(x.dosPermissions)),w=z.getUTCHours(),w<<=6,w|=z.getUTCMinutes(),w<<=5,w|=z.getUTCSeconds()/2,_=z.getUTCFullYear()-1980,_<<=4,_|=z.getUTCMonth()+1,_<<=5,_|=z.getUTCDate(),T&&(R=s(1,1)+s(A(M),4)+I,E+="up"+s(R.length,2)+R),y&&(F=s(1,1)+s(A(L),4)+D,E+="uc"+s(F.length,2)+F);var ee="";return ee+=` -\0`,ee+=s(H,2),ee+=b.magic,ee+=s(w,2),ee+=s(_,2),ee+=s(j.crc32,4),ee+=s(j.compressedSize,4),ee+=s(j.uncompressedSize,4),ee+=s(M.length,2),ee+=s(E.length,2),{fileRecord:u.LOCAL_FILE_HEADER+ee+M+E,dirRecord:u.CENTRAL_FILE_HEADER+s(W,2)+ee+s(L.length,2)+"\0\0\0\0"+s(C,4)+s(g,4)+M+E+L}}var a=t("../utils"),l=t("../stream/GenericWorker"),c=t("../utf8"),A=t("../crc32"),u=t("../signature");function f(h,d,m,g){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=d,this.zipPlatform=m,this.encodeFileName=g,this.streamFiles=h,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(f,l),f.prototype.push=function(h){var d=h.meta.percent||0,m=this.entriesCount,g=this._sources.length;this.accumulate?this.contentBuffer.push(h):(this.bytesWritten+=h.data.length,l.prototype.push.call(this,{data:h.data,meta:{currentFile:this.currentFile,percent:m?(d+100*(m-g-1))/m:100}}))},f.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var d=this.streamFiles&&!h.file.dir;if(d){var m=o(h,d,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(h){this.accumulate=!1;var d=this.streamFiles&&!h.file.dir,m=o(h,d,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),d)this.push({data:function(g){return u.DATA_DESCRIPTOR+s(g.crc32,4)+s(g.compressedSize,4)+s(g.uncompressedSize,4)}(h),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var h=this.bytesWritten,d=0;d=this.index;l--)c=(c<<8)+this.byteAt(l);return this.index+=a,c},readString:function(a){return s.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=o},{"../utils":32}],19:[function(t,r,i){var s=t("./Uint8ArrayReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,r,i){var s=t("./DataReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},o.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},o.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=o},{"../utils":32,"./DataReader":18}],21:[function(t,r,i){var s=t("./ArrayReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(t,r,i){var s=t("../utils"),o=t("../support"),a=t("./ArrayReader"),l=t("./StringReader"),c=t("./NodeBufferReader"),A=t("./Uint8ArrayReader");r.exports=function(u){var f=s.getTypeOf(u);return s.checkSupport(f),f!=="string"||o.uint8array?f==="nodebuffer"?new c(u):o.uint8array?new A(s.transformTo("uint8array",u)):new a(s.transformTo("array",u)):new l(u)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,r,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,r,i){var s=t("./GenericWorker"),o=t("../utils");function a(l){s.call(this,"ConvertWorker to "+l),this.destType=l}o.inherits(a,s),a.prototype.processChunk=function(l){this.push({data:o.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(t,r,i){var s=t("./GenericWorker"),o=t("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(a,s),a.prototype.processChunk=function(l){this.streamInfo.crc32=o(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,r,i){var s=t("../utils"),o=t("./GenericWorker");function a(l){o.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}s.inherits(a,o),a.prototype.processChunk=function(l){if(l){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+l.data.length}o.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(t,r,i){var s=t("../utils"),o=t("./GenericWorker");function a(l){o.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(A){c.dataIsReady=!0,c.data=A,c.max=A&&A.length||0,c.type=s.getTypeOf(A),c.isPaused||c._tickAndRepeat()},function(A){c.error(A)})}s.inherits(a,o),a.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,c=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(t,r,i){function s(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,a){return this._listeners[o].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,a){if(this._listeners[o])for(var l=0;l "+o:o}},r.exports=s},{}],29:[function(t,r,i){var s=t("../utils"),o=t("./ConvertWorker"),a=t("./GenericWorker"),l=t("../base64"),c=t("../support"),A=t("../external"),u=null;if(c.nodestream)try{u=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(d,m){return new A.Promise(function(g,p){var v=[],w=d._internalType,_=d._outputType,x=d._mimeType;d.on("data",function(b,B){v.push(b),m&&m(B)}).on("error",function(b){v=[],p(b)}).on("end",function(){try{var b=function(B,M,I){switch(B){case"blob":return s.newBlob(s.transformTo("arraybuffer",M),I);case"base64":return l.encode(M);default:return s.transformTo(B,M)}}(_,function(B,M){var I,S=0,L=null,D=0;for(I=0;I"u")i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(s),i.blob=o.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!t("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(t,r,i){for(var s=t("./utils"),o=t("./support"),a=t("./nodejsUtils"),l=t("./stream/GenericWorker"),c=new Array(256),A=0;A<256;A++)c[A]=252<=A?6:248<=A?5:240<=A?4:224<=A?3:192<=A?2:1;c[254]=c[254]=1;function u(){l.call(this,"utf-8 decode"),this.leftOver=null}function f(){l.call(this,"utf-8 encode")}i.utf8encode=function(h){return o.nodebuffer?a.newBufferFrom(h,"utf-8"):function(d){var m,g,p,v,w,_=d.length,x=0;for(v=0;v<_;v++)(64512&(g=d.charCodeAt(v)))==55296&&v+1<_&&(64512&(p=d.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(p-56320),v++),x+=g<128?1:g<2048?2:g<65536?3:4;for(m=o.uint8array?new Uint8Array(x):new Array(x),v=w=0;w>>6:(g<65536?m[w++]=224|g>>>12:(m[w++]=240|g>>>18,m[w++]=128|g>>>12&63),m[w++]=128|g>>>6&63),m[w++]=128|63&g);return m}(h)},i.utf8decode=function(h){return o.nodebuffer?s.transformTo("nodebuffer",h).toString("utf-8"):function(d){var m,g,p,v,w=d.length,_=new Array(2*w);for(m=g=0;m>10&1023,_[g++]=56320|1023&p)}return _.length!==g&&(_.subarray?_=_.subarray(0,g):_.length=g),s.applyFromCharCode(_)}(h=s.transformTo(o.uint8array?"uint8array":"array",h))},s.inherits(u,l),u.prototype.processChunk=function(h){var d=s.transformTo(o.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var m=d;(d=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),d.set(m,this.leftOver.length)}else d=this.leftOver.concat(d);this.leftOver=null}var g=function(v,w){var _;for((w=w||v.length)>v.length&&(w=v.length),_=w-1;0<=_&&(192&v[_])==128;)_--;return _<0||_===0?w:_+c[v[_]]>w?_:w}(d),p=d;g!==d.length&&(o.uint8array?(p=d.subarray(0,g),this.leftOver=d.subarray(g,d.length)):(p=d.slice(0,g),this.leftOver=d.slice(g,d.length))),this.push({data:i.utf8decode(p),meta:h.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=u,s.inherits(f,l),f.prototype.processChunk=function(h){this.push({data:i.utf8encode(h.data),meta:h.meta})},i.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,r,i){var s=t("./support"),o=t("./base64"),a=t("./nodejsUtils"),l=t("./external");function c(m){return m}function A(m,g){for(var p=0;p>8;this.dir=!!(16&this.externalFileAttributes),h==0&&(this.dosPermissions=63&this.externalFileAttributes),h==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var h=s(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=h.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=h.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=h.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=h.readInt(4))}},readExtraFields:function(h){var d,m,g,p=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4>>6:(h<65536?f[g++]=224|h>>>12:(f[g++]=240|h>>>18,f[g++]=128|h>>>12&63),f[g++]=128|h>>>6&63),f[g++]=128|63&h);return f},i.buf2binstring=function(u){return A(u,u.length)},i.binstring2buf=function(u){for(var f=new s.Buf8(u.length),h=0,d=f.length;h>10&1023,v[d++]=56320|1023&m)}return A(v,d)},i.utf8border=function(u,f){var h;for((f=f||u.length)>u.length&&(f=u.length),h=f-1;0<=h&&(192&u[h])==128;)h--;return h<0||h===0?f:h+l[u[h]]>f?h:f}},{"./common":41}],43:[function(t,r,i){r.exports=function(s,o,a,l){for(var c=65535&s|0,A=s>>>16&65535|0,u=0;a!==0;){for(a-=u=2e3>>1:o>>>1;a[l]=o}return a}();r.exports=function(o,a,l,c){var A=s,u=c+l;o^=-1;for(var f=c;f>>8^A[255&(o^a[f])];return-1^o}},{}],46:[function(t,r,i){var s,o=t("../utils/common"),a=t("./trees"),l=t("./adler32"),c=t("./crc32"),A=t("./messages"),u=0,f=4,h=0,d=-2,m=-1,g=4,p=2,v=8,w=9,_=286,x=30,b=19,B=2*_+1,M=15,I=3,S=258,L=S+I+1,D=42,T=113,y=1,E=2,R=3,F=4;function O(Q,fe){return Q.msg=A[fe],fe}function z(Q){return(Q<<1)-(4Q.avail_out&&(Ae=Q.avail_out),Ae!==0&&(o.arraySet(Q.output,fe.pending_buf,fe.pending_out,Ae,Q.next_out),Q.next_out+=Ae,fe.pending_out+=Ae,Q.total_out+=Ae,Q.avail_out-=Ae,fe.pending-=Ae,fe.pending===0&&(fe.pending_out=0))}function C(Q,fe){a._tr_flush_block(Q,0<=Q.block_start?Q.block_start:-1,Q.strstart-Q.block_start,fe),Q.block_start=Q.strstart,H(Q.strm)}function W(Q,fe){Q.pending_buf[Q.pending++]=fe}function ee(Q,fe){Q.pending_buf[Q.pending++]=fe>>>8&255,Q.pending_buf[Q.pending++]=255&fe}function P(Q,fe){var Ae,Z,q=Q.max_chain_length,he=Q.strstart,X=Q.prev_length,G=Q.nice_match,ne=Q.strstart>Q.w_size-L?Q.strstart-(Q.w_size-L):0,Y=Q.window,de=Q.w_mask,ae=Q.prev,Ee=Q.strstart+S,V=Y[he+X-1],U=Y[he+X];Q.prev_length>=Q.good_match&&(q>>=2),G>Q.lookahead&&(G=Q.lookahead);do if(Y[(Ae=fe)+X]===U&&Y[Ae+X-1]===V&&Y[Ae]===Y[he]&&Y[++Ae]===Y[he+1]){he+=2,Ae++;do;while(Y[++he]===Y[++Ae]&&Y[++he]===Y[++Ae]&&Y[++he]===Y[++Ae]&&Y[++he]===Y[++Ae]&&Y[++he]===Y[++Ae]&&Y[++he]===Y[++Ae]&&Y[++he]===Y[++Ae]&&Y[++he]===Y[++Ae]&&hene&&--q!=0);return X<=Q.lookahead?X:Q.lookahead}function re(Q){var fe,Ae,Z,q,he,X,G,ne,Y,de,ae=Q.w_size;do{if(q=Q.window_size-Q.lookahead-Q.strstart,Q.strstart>=ae+(ae-L)){for(o.arraySet(Q.window,Q.window,ae,ae,0),Q.match_start-=ae,Q.strstart-=ae,Q.block_start-=ae,fe=Ae=Q.hash_size;Z=Q.head[--fe],Q.head[fe]=ae<=Z?Z-ae:0,--Ae;);for(fe=Ae=ae;Z=Q.prev[--fe],Q.prev[fe]=ae<=Z?Z-ae:0,--Ae;);q+=ae}if(Q.strm.avail_in===0)break;if(X=Q.strm,G=Q.window,ne=Q.strstart+Q.lookahead,Y=q,de=void 0,de=X.avail_in,Y=I)for(he=Q.strstart-Q.insert,Q.ins_h=Q.window[he],Q.ins_h=(Q.ins_h<=I&&(Q.ins_h=(Q.ins_h<=I)if(Z=a._tr_tally(Q,Q.strstart-Q.match_start,Q.match_length-I),Q.lookahead-=Q.match_length,Q.match_length<=Q.max_lazy_match&&Q.lookahead>=I){for(Q.match_length--;Q.strstart++,Q.ins_h=(Q.ins_h<=I&&(Q.ins_h=(Q.ins_h<=I&&Q.match_length<=Q.prev_length){for(q=Q.strstart+Q.lookahead-I,Z=a._tr_tally(Q,Q.strstart-1-Q.prev_match,Q.prev_length-I),Q.lookahead-=Q.prev_length-1,Q.prev_length-=2;++Q.strstart<=q&&(Q.ins_h=(Q.ins_h<Q.pending_buf_size-5&&(Ae=Q.pending_buf_size-5);;){if(Q.lookahead<=1){if(re(Q),Q.lookahead===0&&fe===u)return y;if(Q.lookahead===0)break}Q.strstart+=Q.lookahead,Q.lookahead=0;var Z=Q.block_start+Ae;if((Q.strstart===0||Q.strstart>=Z)&&(Q.lookahead=Q.strstart-Z,Q.strstart=Z,C(Q,!1),Q.strm.avail_out===0)||Q.strstart-Q.block_start>=Q.w_size-L&&(C(Q,!1),Q.strm.avail_out===0))return y}return Q.insert=0,fe===f?(C(Q,!0),Q.strm.avail_out===0?R:F):(Q.strstart>Q.block_start&&(C(Q,!1),Q.strm.avail_out),y)}),new me(4,4,8,4,ue),new me(4,5,16,8,ue),new me(4,6,32,32,ue),new me(4,4,16,16,le),new me(8,16,32,32,le),new me(8,16,128,128,le),new me(8,32,128,256,le),new me(32,128,258,1024,le),new me(32,258,258,4096,le)],i.deflateInit=function(Q,fe){return se(Q,fe,v,15,8,0)},i.deflateInit2=se,i.deflateReset=_e,i.deflateResetKeep=ge,i.deflateSetHeader=function(Q,fe){return Q&&Q.state?Q.state.wrap!==2?d:(Q.state.gzhead=fe,h):d},i.deflate=function(Q,fe){var Ae,Z,q,he;if(!Q||!Q.state||5>8&255),W(Z,Z.gzhead.time>>16&255),W(Z,Z.gzhead.time>>24&255),W(Z,Z.level===9?2:2<=Z.strategy||Z.level<2?4:0),W(Z,255&Z.gzhead.os),Z.gzhead.extra&&Z.gzhead.extra.length&&(W(Z,255&Z.gzhead.extra.length),W(Z,Z.gzhead.extra.length>>8&255)),Z.gzhead.hcrc&&(Q.adler=c(Q.adler,Z.pending_buf,Z.pending,0)),Z.gzindex=0,Z.status=69):(W(Z,0),W(Z,0),W(Z,0),W(Z,0),W(Z,0),W(Z,Z.level===9?2:2<=Z.strategy||Z.level<2?4:0),W(Z,3),Z.status=T);else{var X=v+(Z.w_bits-8<<4)<<8;X|=(2<=Z.strategy||Z.level<2?0:Z.level<6?1:Z.level===6?2:3)<<6,Z.strstart!==0&&(X|=32),X+=31-X%31,Z.status=T,ee(Z,X),Z.strstart!==0&&(ee(Z,Q.adler>>>16),ee(Z,65535&Q.adler)),Q.adler=1}if(Z.status===69)if(Z.gzhead.extra){for(q=Z.pending;Z.gzindex<(65535&Z.gzhead.extra.length)&&(Z.pending!==Z.pending_buf_size||(Z.gzhead.hcrc&&Z.pending>q&&(Q.adler=c(Q.adler,Z.pending_buf,Z.pending-q,q)),H(Q),q=Z.pending,Z.pending!==Z.pending_buf_size));)W(Z,255&Z.gzhead.extra[Z.gzindex]),Z.gzindex++;Z.gzhead.hcrc&&Z.pending>q&&(Q.adler=c(Q.adler,Z.pending_buf,Z.pending-q,q)),Z.gzindex===Z.gzhead.extra.length&&(Z.gzindex=0,Z.status=73)}else Z.status=73;if(Z.status===73)if(Z.gzhead.name){q=Z.pending;do{if(Z.pending===Z.pending_buf_size&&(Z.gzhead.hcrc&&Z.pending>q&&(Q.adler=c(Q.adler,Z.pending_buf,Z.pending-q,q)),H(Q),q=Z.pending,Z.pending===Z.pending_buf_size)){he=1;break}he=Z.gzindexq&&(Q.adler=c(Q.adler,Z.pending_buf,Z.pending-q,q)),he===0&&(Z.gzindex=0,Z.status=91)}else Z.status=91;if(Z.status===91)if(Z.gzhead.comment){q=Z.pending;do{if(Z.pending===Z.pending_buf_size&&(Z.gzhead.hcrc&&Z.pending>q&&(Q.adler=c(Q.adler,Z.pending_buf,Z.pending-q,q)),H(Q),q=Z.pending,Z.pending===Z.pending_buf_size)){he=1;break}he=Z.gzindexq&&(Q.adler=c(Q.adler,Z.pending_buf,Z.pending-q,q)),he===0&&(Z.status=103)}else Z.status=103;if(Z.status===103&&(Z.gzhead.hcrc?(Z.pending+2>Z.pending_buf_size&&H(Q),Z.pending+2<=Z.pending_buf_size&&(W(Z,255&Q.adler),W(Z,Q.adler>>8&255),Q.adler=0,Z.status=T)):Z.status=T),Z.pending!==0){if(H(Q),Q.avail_out===0)return Z.last_flush=-1,h}else if(Q.avail_in===0&&z(fe)<=z(Ae)&&fe!==f)return O(Q,-5);if(Z.status===666&&Q.avail_in!==0)return O(Q,-5);if(Q.avail_in!==0||Z.lookahead!==0||fe!==u&&Z.status!==666){var G=Z.strategy===2?function(ne,Y){for(var de;;){if(ne.lookahead===0&&(re(ne),ne.lookahead===0)){if(Y===u)return y;break}if(ne.match_length=0,de=a._tr_tally(ne,0,ne.window[ne.strstart]),ne.lookahead--,ne.strstart++,de&&(C(ne,!1),ne.strm.avail_out===0))return y}return ne.insert=0,Y===f?(C(ne,!0),ne.strm.avail_out===0?R:F):ne.last_lit&&(C(ne,!1),ne.strm.avail_out===0)?y:E}(Z,fe):Z.strategy===3?function(ne,Y){for(var de,ae,Ee,V,U=ne.window;;){if(ne.lookahead<=S){if(re(ne),ne.lookahead<=S&&Y===u)return y;if(ne.lookahead===0)break}if(ne.match_length=0,ne.lookahead>=I&&0ne.lookahead&&(ne.match_length=ne.lookahead)}if(ne.match_length>=I?(de=a._tr_tally(ne,1,ne.match_length-I),ne.lookahead-=ne.match_length,ne.strstart+=ne.match_length,ne.match_length=0):(de=a._tr_tally(ne,0,ne.window[ne.strstart]),ne.lookahead--,ne.strstart++),de&&(C(ne,!1),ne.strm.avail_out===0))return y}return ne.insert=0,Y===f?(C(ne,!0),ne.strm.avail_out===0?R:F):ne.last_lit&&(C(ne,!1),ne.strm.avail_out===0)?y:E}(Z,fe):s[Z.level].func(Z,fe);if(G!==R&&G!==F||(Z.status=666),G===y||G===R)return Q.avail_out===0&&(Z.last_flush=-1),h;if(G===E&&(fe===1?a._tr_align(Z):fe!==5&&(a._tr_stored_block(Z,0,0,!1),fe===3&&(j(Z.head),Z.lookahead===0&&(Z.strstart=0,Z.block_start=0,Z.insert=0))),H(Q),Q.avail_out===0))return Z.last_flush=-1,h}return fe!==f?h:Z.wrap<=0?1:(Z.wrap===2?(W(Z,255&Q.adler),W(Z,Q.adler>>8&255),W(Z,Q.adler>>16&255),W(Z,Q.adler>>24&255),W(Z,255&Q.total_in),W(Z,Q.total_in>>8&255),W(Z,Q.total_in>>16&255),W(Z,Q.total_in>>24&255)):(ee(Z,Q.adler>>>16),ee(Z,65535&Q.adler)),H(Q),0=Ae.w_size&&(he===0&&(j(Ae.head),Ae.strstart=0,Ae.block_start=0,Ae.insert=0),Y=new o.Buf8(Ae.w_size),o.arraySet(Y,fe,de-Ae.w_size,Ae.w_size,0),fe=Y,de=Ae.w_size),X=Q.avail_in,G=Q.next_in,ne=Q.input,Q.avail_in=de,Q.next_in=0,Q.input=fe,re(Ae);Ae.lookahead>=I;){for(Z=Ae.strstart,q=Ae.lookahead-(I-1);Ae.ins_h=(Ae.ins_h<>>=I=M>>>24,w-=I,(I=M>>>16&255)===0)E[A++]=65535&M;else{if(!(16&I)){if(!(64&I)){M=_[(65535&M)+(v&(1<>>=I,w-=I),w<15&&(v+=y[l++]<>>=I=M>>>24,w-=I,!(16&(I=M>>>16&255))){if(!(64&I)){M=x[(65535&M)+(v&(1<>>=I,w-=I,(I=A-u)>3,v&=(1<<(w-=S<<3))-1,s.next_in=l,s.next_out=A,s.avail_in=l>>24&255)+(D>>>8&65280)+((65280&D)<<8)+((255&D)<<24)}function v(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(D){var T;return D&&D.state?(T=D.state,D.total_in=D.total_out=T.total=0,D.msg="",T.wrap&&(D.adler=1&T.wrap),T.mode=d,T.last=0,T.havedict=0,T.dmax=32768,T.head=null,T.hold=0,T.bits=0,T.lencode=T.lendyn=new s.Buf32(m),T.distcode=T.distdyn=new s.Buf32(g),T.sane=1,T.back=-1,f):h}function _(D){var T;return D&&D.state?((T=D.state).wsize=0,T.whave=0,T.wnext=0,w(D)):h}function x(D,T){var y,E;return D&&D.state?(E=D.state,T<0?(y=0,T=-T):(y=1+(T>>4),T<48&&(T&=15)),T&&(T<8||15=F.wsize?(s.arraySet(F.window,T,y-F.wsize,F.wsize,0),F.wnext=0,F.whave=F.wsize):(E<(R=F.wsize-F.wnext)&&(R=E),s.arraySet(F.window,T,y-E,R,F.wnext),(E-=R)?(s.arraySet(F.window,T,y-E,E,0),F.wnext=E,F.whave=F.wsize):(F.wnext+=R,F.wnext===F.wsize&&(F.wnext=0),F.whave>>8&255,y.check=a(y.check,he,2,0),C=H=0,y.mode=2;break}if(y.flags=0,y.head&&(y.head.done=!1),!(1&y.wrap)||(((255&H)<<8)+(H>>8))%31){D.msg="incorrect header check",y.mode=30;break}if((15&H)!=8){D.msg="unknown compression method",y.mode=30;break}if(C-=4,Q=8+(15&(H>>>=4)),y.wbits===0)y.wbits=Q;else if(Q>y.wbits){D.msg="invalid window size",y.mode=30;break}y.dmax=1<>8&1),512&y.flags&&(he[0]=255&H,he[1]=H>>>8&255,y.check=a(y.check,he,2,0)),C=H=0,y.mode=3;case 3:for(;C<32;){if(z===0)break e;z--,H+=E[F++]<>>8&255,he[2]=H>>>16&255,he[3]=H>>>24&255,y.check=a(y.check,he,4,0)),C=H=0,y.mode=4;case 4:for(;C<16;){if(z===0)break e;z--,H+=E[F++]<>8),512&y.flags&&(he[0]=255&H,he[1]=H>>>8&255,y.check=a(y.check,he,2,0)),C=H=0,y.mode=5;case 5:if(1024&y.flags){for(;C<16;){if(z===0)break e;z--,H+=E[F++]<>>8&255,y.check=a(y.check,he,2,0)),C=H=0}else y.head&&(y.head.extra=null);y.mode=6;case 6:if(1024&y.flags&&(z<(P=y.length)&&(P=z),P&&(y.head&&(Q=y.head.extra_len-y.length,y.head.extra||(y.head.extra=new Array(y.head.extra_len)),s.arraySet(y.head.extra,E,F,P,Q)),512&y.flags&&(y.check=a(y.check,E,P,F)),z-=P,F+=P,y.length-=P),y.length))break e;y.length=0,y.mode=7;case 7:if(2048&y.flags){if(z===0)break e;for(P=0;Q=E[F+P++],y.head&&Q&&y.length<65536&&(y.head.name+=String.fromCharCode(Q)),Q&&P>9&1,y.head.done=!0),D.adler=y.check=0,y.mode=12;break;case 10:for(;C<32;){if(z===0)break e;z--,H+=E[F++]<>>=7&C,C-=7&C,y.mode=27;break}for(;C<3;){if(z===0)break e;z--,H+=E[F++]<>>=1)){case 0:y.mode=14;break;case 1:if(S(y),y.mode=20,T!==6)break;H>>>=2,C-=2;break e;case 2:y.mode=17;break;case 3:D.msg="invalid block type",y.mode=30}H>>>=2,C-=2;break;case 14:for(H>>>=7&C,C-=7&C;C<32;){if(z===0)break e;z--,H+=E[F++]<>>16^65535)){D.msg="invalid stored block lengths",y.mode=30;break}if(y.length=65535&H,C=H=0,y.mode=15,T===6)break e;case 15:y.mode=16;case 16:if(P=y.length){if(z>>=5,C-=5,y.ndist=1+(31&H),H>>>=5,C-=5,y.ncode=4+(15&H),H>>>=4,C-=4,286>>=3,C-=3}for(;y.have<19;)y.lens[X[y.have++]]=0;if(y.lencode=y.lendyn,y.lenbits=7,Ae={bits:y.lenbits},fe=c(0,y.lens,0,19,y.lencode,0,y.work,Ae),y.lenbits=Ae.bits,fe){D.msg="invalid code lengths set",y.mode=30;break}y.have=0,y.mode=19;case 19:for(;y.have>>16&255,ie=65535&q,!((le=q>>>24)<=C);){if(z===0)break e;z--,H+=E[F++]<>>=le,C-=le,y.lens[y.have++]=ie;else{if(ie===16){for(Z=le+2;C>>=le,C-=le,y.have===0){D.msg="invalid bit length repeat",y.mode=30;break}Q=y.lens[y.have-1],P=3+(3&H),H>>>=2,C-=2}else if(ie===17){for(Z=le+3;C>>=le)),H>>>=3,C-=3}else{for(Z=le+7;C>>=le)),H>>>=7,C-=7}if(y.have+P>y.nlen+y.ndist){D.msg="invalid bit length repeat",y.mode=30;break}for(;P--;)y.lens[y.have++]=Q}}if(y.mode===30)break;if(y.lens[256]===0){D.msg="invalid code -- missing end-of-block",y.mode=30;break}if(y.lenbits=9,Ae={bits:y.lenbits},fe=c(A,y.lens,0,y.nlen,y.lencode,0,y.work,Ae),y.lenbits=Ae.bits,fe){D.msg="invalid literal/lengths set",y.mode=30;break}if(y.distbits=6,y.distcode=y.distdyn,Ae={bits:y.distbits},fe=c(u,y.lens,y.nlen,y.ndist,y.distcode,0,y.work,Ae),y.distbits=Ae.bits,fe){D.msg="invalid distances set",y.mode=30;break}if(y.mode=20,T===6)break e;case 20:y.mode=21;case 21:if(6<=z&&258<=j){D.next_out=O,D.avail_out=j,D.next_in=F,D.avail_in=z,y.hold=H,y.bits=C,l(D,ee),O=D.next_out,R=D.output,j=D.avail_out,F=D.next_in,E=D.input,z=D.avail_in,H=y.hold,C=y.bits,y.mode===12&&(y.back=-1);break}for(y.back=0;me=(q=y.lencode[H&(1<>>16&255,ie=65535&q,!((le=q>>>24)<=C);){if(z===0)break e;z--,H+=E[F++]<>ge)])>>>16&255,ie=65535&q,!(ge+(le=q>>>24)<=C);){if(z===0)break e;z--,H+=E[F++]<>>=ge,C-=ge,y.back+=ge}if(H>>>=le,C-=le,y.back+=le,y.length=ie,me===0){y.mode=26;break}if(32&me){y.back=-1,y.mode=12;break}if(64&me){D.msg="invalid literal/length code",y.mode=30;break}y.extra=15&me,y.mode=22;case 22:if(y.extra){for(Z=y.extra;C>>=y.extra,C-=y.extra,y.back+=y.extra}y.was=y.length,y.mode=23;case 23:for(;me=(q=y.distcode[H&(1<>>16&255,ie=65535&q,!((le=q>>>24)<=C);){if(z===0)break e;z--,H+=E[F++]<>ge)])>>>16&255,ie=65535&q,!(ge+(le=q>>>24)<=C);){if(z===0)break e;z--,H+=E[F++]<>>=ge,C-=ge,y.back+=ge}if(H>>>=le,C-=le,y.back+=le,64&me){D.msg="invalid distance code",y.mode=30;break}y.offset=ie,y.extra=15&me,y.mode=24;case 24:if(y.extra){for(Z=y.extra;C>>=y.extra,C-=y.extra,y.back+=y.extra}if(y.offset>y.dmax){D.msg="invalid distance too far back",y.mode=30;break}y.mode=25;case 25:if(j===0)break e;if(P=ee-j,y.offset>P){if((P=y.offset-P)>y.whave&&y.sane){D.msg="invalid distance too far back",y.mode=30;break}re=P>y.wnext?(P-=y.wnext,y.wsize-P):y.wnext-P,P>y.length&&(P=y.length),ue=y.window}else ue=R,re=O-y.offset,P=y.length;for(jB?(I=re[ue+g[T]],C[W+g[T]]):(I=96,0),v=1<>O)+(w-=v)]=M<<24|I<<16|S|0,w!==0;);for(v=1<>=1;if(v!==0?(H&=v-1,H+=v):H=0,T++,--ee[D]==0){if(D===E)break;D=u[f+g[T]]}if(R>>7)]}function W(q,he){q.pending_buf[q.pending++]=255&he,q.pending_buf[q.pending++]=he>>>8&255}function ee(q,he,X){q.bi_valid>p-X?(q.bi_buf|=he<>p-q.bi_valid,q.bi_valid+=X-p):(q.bi_buf|=he<>>=1,X<<=1,0<--he;);return X>>>1}function ue(q,he,X){var G,ne,Y=new Array(g+1),de=0;for(G=1;G<=g;G++)Y[G]=de=de+X[G-1]<<1;for(ne=0;ne<=he;ne++){var ae=q[2*ne+1];ae!==0&&(q[2*ne]=re(Y[ae]++,ae))}}function le(q){var he;for(he=0;he>1;1<=X;X--)ge(q,Y,X);for(ne=Ee;X=q.heap[1],q.heap[1]=q.heap[q.heap_len--],ge(q,Y,1),G=q.heap[1],q.heap[--q.heap_max]=X,q.heap[--q.heap_max]=G,Y[2*ne]=Y[2*X]+Y[2*G],q.depth[ne]=(q.depth[X]>=q.depth[G]?q.depth[X]:q.depth[G])+1,Y[2*X+1]=Y[2*G+1]=ne,q.heap[1]=ne++,ge(q,Y,1),2<=q.heap_len;);q.heap[--q.heap_max]=q.heap[1],function(U,N){var K,oe,pe,ve,Ce,Le,Re=N.dyn_tree,$e=N.max_code,ce=N.stat_desc.static_tree,Pe=N.stat_desc.has_stree,Me=N.stat_desc.extra_bits,Te=N.stat_desc.extra_base,Fe=N.stat_desc.max_length,De=0;for(ve=0;ve<=g;ve++)U.bl_count[ve]=0;for(Re[2*U.heap[U.heap_max]+1]=0,K=U.heap_max+1;K>=7;ne>>=1)if(1&V&&ae.dyn_ltree[2*Ee]!==0)return o;if(ae.dyn_ltree[18]!==0||ae.dyn_ltree[20]!==0||ae.dyn_ltree[26]!==0)return a;for(Ee=32;Ee>>3,(Y=q.static_len+3+7>>>3)<=ne&&(ne=Y)):ne=Y=X+5,X+4<=ne&&he!==-1?Z(q,he,X,G):q.strategy===4||Y===ne?(ee(q,2+(G?1:0),3),_e(q,L,D)):(ee(q,4+(G?1:0),3),function(ae,Ee,V,U){var N;for(ee(ae,Ee-257,5),ee(ae,V-1,5),ee(ae,U-4,4),N=0;N>>8&255,q.pending_buf[q.d_buf+2*q.last_lit+1]=255&he,q.pending_buf[q.l_buf+q.last_lit]=255&X,q.last_lit++,he===0?q.dyn_ltree[2*X]++:(q.matches++,he--,q.dyn_ltree[2*(y[X]+u+1)]++,q.dyn_dtree[2*C(he)]++),q.last_lit===q.lit_bufsize-1},i._tr_align=function(q){ee(q,2,3),P(q,w,L),function(he){he.bi_valid===16?(W(he,he.bi_buf),he.bi_buf=0,he.bi_valid=0):8<=he.bi_valid&&(he.pending_buf[he.pending++]=255&he.bi_buf,he.bi_buf>>=8,he.bi_valid-=8)}(q)}},{"../utils/common":41}],53:[function(t,r,i){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,r,i){(function(s){(function(o,a){if(!o.setImmediate){var l,c,A,u,f=1,h={},d=!1,m=o.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(o);g=g&&g.setTimeout?g:o,l={}.toString.call(o.process)==="[object process]"?function(_){process.nextTick(function(){v(_)})}:function(){if(o.postMessage&&!o.importScripts){var _=!0,x=o.onmessage;return o.onmessage=function(){_=!1},o.postMessage("","*"),o.onmessage=x,_}}()?(u="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",w,!1):o.attachEvent("onmessage",w),function(_){o.postMessage(u+_,"*")}):o.MessageChannel?((A=new MessageChannel).port1.onmessage=function(_){v(_.data)},function(_){A.port2.postMessage(_)}):m&&"onreadystatechange"in m.createElement("script")?(c=m.documentElement,function(_){var x=m.createElement("script");x.onreadystatechange=function(){v(_),x.onreadystatechange=null,c.removeChild(x),x=null},c.appendChild(x)}):function(_){setTimeout(v,0,_)},g.setImmediate=function(_){typeof _!="function"&&(_=new Function(""+_));for(var x=new Array(arguments.length-1),b=0;b"u"?s===void 0?this:s:self)}).call(this,typeof Na<"u"?Na:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(lV);var ive=lV.exports;const sve=oc(ive);class ep{constructor(){this.zipContainer={}}addData(e,t,r,i=""){i==""&&(i="_"),this.zipContainer[i]==null&&(this.zipContainer[i]=[]),this.zipContainer[i].push({data:e,name:t,extension:r})}saveZip(e,t=!0){const r=this.zipContainer,i=new sve;for(const s in r)if(s=="_")r[s].forEach((o,a)=>{i.file(o.name+"."+o.extension,o.data,{base64:!0})});else{const o=i.folder(s);r[s].forEach((a,l)=>{const c=a.extension!="txt";o.file(a.name+"."+a.extension,a.data,{base64:c})})}i.generateAsync({type:"blob"}).then(s=>{this._saveZipFile(s,e+".zip")}),t&&(this.zipContainer={})}_saveZipFile(e,t){const r=new Blob([e],{type:"application/zip"});if(typeof window.navigator.msSaveBlob<"u")window.navigator.msSaveBlob(r,t);else{const i=document.createElement("a");typeof i.download=="string"?(document.body.appendChild(i),i.download=t,i.href=URL.createObjectURL(r),i.click(),document.body.removeChild(i)):window.open(e,"_blank").document.write(""+t+"")}}}class ove{constructor(e){We(this,"screenshotManager");this.characterManager=e,this.screenshotManager=e.screenshotManager,this.blinkManager=e.blinkManager,this.animationManager=this.characterManager.animationManager,this.temptime=0}get vrms(){return Object.values(this.characterManager.avatar).map(e=>e.vrm)}async createLoraData(e,t=null,r=""){const i=e.manifest,s=e.name?"loraData/"+e.name:"loraData",o=await this._fetchManifest(i),{assetsLocation:a="",animationsDirectory:l="",backgroundGrayscale:c=1,backgroundDescription:A="",width:u=512,height:f=512,dataCollection:h}=o,d=a+l+"/";this.screenshotManager.setBackground([c,c,c]),this.blinkManager.enableScreenshot(),await this.screenshotManager.cameraFrameManager.calculateBoneOffsets(this.characterManager.characterModel,.2);let m=0;const g=this;if(Array.isArray(h)){const p=t??new ep;await(async()=>{if(Array.isArray(h))for(let w=0;w{var E;(E=y.springBoneManager)==null||E.reset()});const D=f2(B);g.screenshotManager.cameraFrameManager.setCameraFrameWithName(M,D);const T=g.screenshotManager.getImageData(u,f,!1);p.addData(T,S,"png",s),p.addData("anata "+I+" "+A,S,"txt",s)}})(),t==null&&(r==""&&(r="lora_zip"),p.saveZip(r))}this.blinkManager.disableScreenshot()}async _fetchManifest(e){return await(await fetch(e)).json()}}class ave{constructor(e){We(this,"screenshotManager");this.characterManager=e,this.screenshotManager=e.screenshotManager,this.blinkManager=e.blinkManager,this.animationManager=this.characterManager.animationManager}async createSpriteAtlas(e,t=null,r=""){const i=e.manifest,s=e.name?"spriteData/"+e.name:"spriteData",o=await this._fetchManifest(i),{assetsLocation:a="",animationsDirectory:l="",backgroundColor:c=[1,1,1,1],screenshotOffset:A,topFrameOffset:u=.1,bottomFrameOffset:f=.1,pixelStyleSize:h,atlasWidth:d=512,atlasHeight:m=512,spritesCollection:g}=o,p=a+l+"/";this.screenshotManager.cameraFrameManager.setBottomFrameOffset(f),this.screenshotManager.cameraFrameManager.setTopFrameOffset(u),this.screenshotManager.setBackground(c),this.blinkManager.enableScreenshot(),await this.screenshotManager.cameraFrameManager.calculateBoneOffsets(this.characterManager.characterModel,.2);let v=0;const w=this;if(Array.isArray(g)){const _=t??new ep;await(async()=>{if(Array.isArray(g))for(const b of g){const{animationName:B,animationPath:M,framesNumber:I,lookAtCamera:S,expression:L,cameraPosition:D,cameraFrame:T}=b;v++;const y=s+"/"+(B||v.toString().padStart(2,"0"));await w.animationManager.loadAnimation(p+M,!0,0);const E=f2(D);w.screenshotManager.cameraFrameManager.setCameraFrameWithName(T,E);const F=w.animationManager.getCurrentClipDuration()/I;for(let O=0;O{for(const b of m){const{traitGroup:B,cameraPosition:M="front",bottomBoneName:I,bottomBoneMaxVertex:S=!1,topBoneName:L,topBoneMaxVertex:D=!0,groupTopOffset:T,groupBotomOffset:y,cameraFrame:E,saveOnlyIDs:R}=b;if((!I||!L)&&(E||console.warn("missing bonename info or camera frame. Skipping")),!B){console.warn("missing trait group for thumbnail info. Skipping");continue}const F=()=>{const j=[];return ut(R).forEach(C=>{j.push({id:C})}),j},O=R==null?v.characterManager.getTraits(B):F();if(O==null){console.log("SKipping Thumbnail Generation for trait group "+B+", its not present in the character manifest.");continue}const z=f2(M);E?v.screenshotManager.cameraFrameManager.setCameraFrameWithName(E,z):v.screenshotManager.cameraFrameManager.frameShot(I,L,z,S,D);for(let j=0;j{const[e,t]=be.useState(null),[r,i]=be.useState(null),[s,o]=be.useState(null),[a,l]=be.useState(null),[c,A]=be.useState(null),[u,f]=be.useState(null),[h,d]=be.useState(null),[m,g]=be.useState(null),[p,v]=be.useState(null),[w,_]=be.useState(null),[x,b]=be.useState(null),[B,M]=be.useState(null),[I,S]=be.useState(!1);let L=!1,[D,T]=be.useState(!1);be.useEffect(()=>{if(L||D)return;T(!0),L=!0;const{scene:F,camera:O,controls:z,characterManager:j,sceneElements:H}=rve("editor-scene");_(O),v(F),t(j),f(H),d(j.animationManager),g(j.lookAtManager),l(j.overlayedTextureManager),b(z),i(new ove(j)),o(new ave(j)),A(new lve(j))},[]);const y=F=>{F==null&&(F=!I),S(F),p.traverse(O=>{O.isMesh&&O.setDebugMode&&O.setDebugMode(F)})};be.useEffect(()=>{if(B!=null&&B.defaultAnimations){const F=B.defaultAnimations.map(O=>O.location);h.storeDefaultAnimationPaths(F,"")}},[B]);const E=F=>{F?p.add(u):p.remove(u)},R=F=>{x&&(jM.to(x.target,{x:F.targetX??0,y:F.targetY??0,z:F.targetZ??0,duration:1}),jM.fromTo(x,{maxDistance:x.getDistance(),minDistance:x.getDistance(),minPolarAngle:x.getPolarAngle(),maxPolarAngle:x.getPolarAngle(),minAzimuthAngle:x.getAzimuthalAngle(),maxAzimuthAngle:x.getAzimuthalAngle()},{maxDistance:F.distance,minDistance:F.distance,minPolarAngle:Math.PI/2-.11,maxPolarAngle:Math.PI/2-.11,minAzimuthAngle:-.78,maxAzimuthAngle:-.78,duration:1}).then(()=>{x.minPolarAngle=0,x.maxPolarAngle=3.1415,x.minDistance=.5,x.maxDistance=10,x.minAzimuthAngle=1/0,x.maxAzimuthAngle=1/0}))};return k.jsx(sr.Provider,{value:{manifest:B,setManifest:M,scene:p,decalManager:a,characterManager:e,loraDataGenerator:r,spriteAtlasGenerator:s,thumbnailsGenerator:c,showEnvironmentModels:E,debugMode:I,toggleDebugMode:y,animationManager:h,lookAtManager:m,camera:w,moveCamera:R,controls:x,sceneElements:u},children:n.children})},Ave={NORMAL:"NORMAL",AR:"AR",AR_FRONT:"AR_FRONT",VR:"VR"},wt={LANDING:"LANDING",CREATE:"CREATE",CLAIM:"CLAIM",LOAD:"LOAD",APPEARANCE:"APPEARANCE",BATCHDOWNLOAD:"BATCHDOWNLOAD",SAVE:"SAVE",MINT:"MINT",OPTIMIZER:"OPTIMIZER",BATCHMANIFEST:"BATCHMANIFEST",WALLET:"WALLET"},us=J.createContext(),uve=n=>{const[e,t]=J.useState(Ave.NORMAL),[r,i]=J.useState(wt.LANDING),[s,o]=J.useState(!1),[a,l]=J.useState(!1);return k.jsx(us.Provider,{value:{viewMode:r,setViewMode:i,isLoading:s,setIsLoading:o,mouseIsOverUI:a,setMouseIsOverUI:l,currentCameraMode:e,setCurrentCameraMode:t},children:n.children})},fve="modulepreload",hve=function(n){return"/"+n},$O={},dve=function(e,t,r){if(!t||t.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(t.map(s=>{if(s=hve(s),s in $O)return;$O[s]=!0;const o=s.endsWith(".css"),a=o?'[rel="stylesheet"]':"";if(!!r)for(let A=i.length-1;A>=0;A--){const u=i[A];if(u.href===s&&(!o||u.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${s}"]${a}`))return;const c=document.createElement("link");if(c.rel=o?"stylesheet":fve,o||(c.as="script",c.crossOrigin=""),c.href=s,document.head.appendChild(c),o)return new Promise((A,u)=>{c.addEventListener("load",A),c.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${s}`)))})})).then(()=>e()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})};function ox(){return ox=Object.assign?Object.assign.bind():function(n){for(var e=1;e=0)continue;t[r]=n[r]}return t}function mve(n){be.useEffect(n,[])}var gve=["id","volume","playbackRate","soundEnabled","interrupt","onload"];function vve(n,e){var t=e===void 0?{}:e,r=t.volume,i=r===void 0?1:r,s=t.playbackRate,o=s===void 0?1:s,a=t.soundEnabled,l=a===void 0?!0:a,c=t.interrupt,A=c===void 0?!1:c,u=t.onload,f=pve(t,gve),h=J.useRef(null),d=J.useRef(!1),m=J.useState(null),g=m[0],p=m[1],v=J.useState(null),w=v[0],_=v[1],x=function(){typeof u=="function"&&u.call(this),d.current&&p(this.duration()*1e3),_(this)};mve(function(){return dve(()=>import("./howler-d099a844.js").then(S=>S.h),[]).then(function(S){if(!d.current){var L;h.current=(L=S.Howl)!==null&&L!==void 0?L:S.default.Howl,d.current=!0,new h.current(ox({src:Array.isArray(n)?n:[n],volume:i,rate:o,onload:x},f))}}),function(){d.current=!1}}),J.useEffect(function(){h.current&&w&&_(new h.current(ox({src:Array.isArray(n)?n:[n],volume:i,onload:x},f)))},[JSON.stringify(n)]),J.useEffect(function(){w&&(w.volume(i),w.rate(o))},[i,o]);var b=J.useCallback(function(S){typeof S>"u"&&(S={}),!(!w||!l&&!S.forceSoundEnabled)&&(A&&w.stop(),S.playbackRate&&w.rate(S.playbackRate),w.play(S.id))},[w,l,A]),B=J.useCallback(function(S){w&&w.stop(S)},[w]),M=J.useCallback(function(S){w&&w.pause(S)},[w]),I=[b,{sound:w,stop:B,pause:M,duration:g}];return I}const yve=[{name:"background/cc_bgm.wav",offset:0,duration:123458.58333333334},{name:"background/cc_bgm_balanced.wav",offset:123458.58333333334,duration:123458.60416666666},{name:"effect/character-load.wav",offset:246917.1875,duration:3030},{name:"effect/class-select.wav",offset:249947.1875,duration:2780},{name:"effect/switchingItem.wav",offset:252727.1875,duration:623.75},{name:"ui/back-next-button.wav",offset:253350.9375,duration:155.02083333333334},{name:"ui/class-mouse-over.wav",offset:253505.95833333334,duration:217.52083333333334},{name:"ui/class_click.wav",offset:253723.4791666667,duration:3123.75},{name:"ui/class_pass.wav",offset:256847.2291666667,duration:155},{name:"ui/option_click.wav",offset:257002.2291666667,duration:155.02083333333334},{name:"ui/randomize-button.wav",offset:257157.25000000003,duration:342.5208333333333},{name:"ui/section_click.wav",offset:257499.77083333337,duration:155}],wve="/assets/sounds-3322d50e.mp3",Co=be.createContext(),_ve=n=>{const e=i=>yve.find(s=>i.test(s.name)),[t]=vve(wve,{sprite:{switchItem:[e(/switchingItem/).offset,e(/switchingItem/).duration],classSelect:[e(/class-select/).offset,e(/class-select/).duration],characterLoad:[e(/character-load/).offset,e(/character-load/).duration],randomizeButton:[e(/randomize-button/).offset,e(/randomize-button/).duration],classMouseOver:[e(/class-mouse-over/).offset,e(/class-mouse-over/).duration],backNextButton:[e(/back-next-button/).offset,e(/back-next-button/).duration]}}),r=(i,s=0)=>{s===0?t({id:i}):setTimeout(()=>{t({id:i})},s)};return k.jsx(Co.Provider,{value:{playSound:r},children:n.children})};function Ns(n){"@babel/helpers - typeof";return Ns=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ns(n)}function To(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function xve(n,e){if(Ns(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(Ns(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function cV(n){var e=xve(n,"string");return Ns(e)=="symbol"?e:e+""}function ZO(n,e){for(var t=0;tn.length)&&(e=n.length);for(var t=0,r=Array(e);t1&&arguments[1]!==void 0?arguments[1]:{};To(this,n),this.init(e,t)}return Io(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=r.prefix||"i18next:",this.logger=t||Bve,this.options=r,this.debug=r.debug}},{key:"setDebug",value:function(t){this.debug=t}},{key:"log",value:function(){for(var t=arguments.length,r=new Array(t),i=0;i1?r-1:0),s=1;s-1?a.replace(/###/g,"."):a}function i(){return!n||typeof n=="string"}for(var s=typeof e!="string"?[].concat(e):e.split(".");s.length>1;){if(i())return{};var o=r(s.shift());!n[o]&&t&&(n[o]=new t),Object.prototype.hasOwnProperty.call(n,o)?n=n[o]:n={}}return i()?{}:{obj:n,k:r(s.shift())}}function n3(n,e,t){var r=g2(n,e,Object),i=r.obj,s=r.k;i[s]=t}function Cve(n,e,t,r){var i=g2(n,e,Object),s=i.obj,o=i.k;s[o]=s[o]||[],r&&(s[o]=s[o].concat(t)),r||s[o].push(t)}function ax(n,e){var t=g2(n,e),r=t.obj,i=t.k;if(r)return r[i]}function Tve(n,e,t){var r=ax(n,t);return r!==void 0?r:ax(e,t)}function hV(n,e,t){for(var r in e)r!=="__proto__"&&r!=="constructor"&&(r in n?typeof n[r]=="string"||n[r]instanceof String||typeof e[r]=="string"||e[r]instanceof String?t&&(n[r]=e[r]):hV(n[r],e[r],t):n[r]=e[r]);return n}function zf(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var Ive={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Rve(n){return typeof n=="string"?n.replace(/[&<>"'\/]/g,function(e){return Ive[e]}):n}var L1=typeof window<"u"&&window.navigator&&typeof window.navigator.userAgentData>"u"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,Uve=[" ",",","?","!",";"];function Fve(n,e,t){e=e||"",t=t||"";var r=Uve.filter(function(a){return e.indexOf(a)<0&&t.indexOf(a)<0});if(r.length===0)return!0;var i=new RegExp("(".concat(r.map(function(a){return a==="?"?"\\?":a}).join("|"),")")),s=!i.test(n);if(!s){var o=n.indexOf(t);o>0&&!i.test(n.substring(0,o))&&(s=!0)}return s}function lx(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(n){if(n[e])return n[e];for(var r=e.split(t),i=n,s=0;ss+o;)o++,a=r.slice(s,s+o).join(t),l=i[a];if(l===void 0)return;if(l===null)return null;if(e.endsWith(a)){if(typeof l=="string")return l;if(a&&typeof l[a]=="string")return l[a]}var c=r.slice(s+o).join(t);return c?lx(l,c,t):void 0}i=i[r[s]]}return i}}function r3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ny(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Dve=function(n){P1(t,n);var e=Pve(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return To(this,t),i=e.call(this),L1&&xA.call(hA(i)),i.data=r||{},i.options=s,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.options.ignoreJSONStructure===void 0&&(i.options.ignoreJSONStructure=!0),i}return Io(t,[{key:"addNamespaces",value:function(i){this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}},{key:"removeNamespaces",value:function(i){var s=this.options.ns.indexOf(i);s>-1&&this.options.ns.splice(s,1)}},{key:"getResource",value:function(i,s,o){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},l=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,c=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure,A=[i,s];o&&typeof o!="string"&&(A=A.concat(o)),o&&typeof o=="string"&&(A=A.concat(l?o.split(l):o)),i.indexOf(".")>-1&&(A=i.split("."));var u=ax(this.data,A);return u||!c||typeof o!="string"?u:lx(this.data&&this.data[i]&&this.data[i][s],o,l)}},{key:"addResource",value:function(i,s,o,a){var l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1},c=l.keySeparator!==void 0?l.keySeparator:this.options.keySeparator,A=[i,s];o&&(A=A.concat(c?o.split(c):o)),i.indexOf(".")>-1&&(A=i.split("."),a=s,s=A[1]),this.addNamespaces(s),n3(this.data,A,a),l.silent||this.emit("added",i,s,o,a)}},{key:"addResources",value:function(i,s,o){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(var l in o)(typeof o[l]=="string"||Object.prototype.toString.apply(o[l])==="[object Array]")&&this.addResource(i,s,l,o[l],{silent:!0});a.silent||this.emit("added",i,s,o)}},{key:"addResourceBundle",value:function(i,s,o,a,l){var c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},A=[i,s];i.indexOf(".")>-1&&(A=i.split("."),a=o,o=s,s=A[1]),this.addNamespaces(s);var u=ax(this.data,A)||{};a?hV(u,o,l):u=Ny(Ny({},u),o),n3(this.data,A,u),c.silent||this.emit("added",i,s,o)}},{key:"removeResourceBundle",value:function(i,s){this.hasResourceBundle(i,s)&&delete this.data[i][s],this.removeNamespaces(s),this.emit("removed",i,s)}},{key:"hasResourceBundle",value:function(i,s){return this.getResource(i,s)!==void 0}},{key:"getResourceBundle",value:function(i,s){return s||(s=this.options.defaultNS),this.options.compatibilityAPI==="v1"?Ny(Ny({},{}),this.getResource(i,s)):this.getResource(i,s)}},{key:"getDataByLanguage",value:function(i){return this.data[i]}},{key:"hasLanguageSomeTranslations",value:function(i){var s=this.getDataByLanguage(i),o=s&&Object.keys(s)||[];return!!o.find(function(a){return s[a]&&Object.keys(s[a]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),t}(xA),dV={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,r,i,s){var o=this;return e.forEach(function(a){o.processors[a]&&(t=o.processors[a].process(t,r,i,s))}),t}};function i3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function pi(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var s3={},o3=function(n){P1(t,n);var e=Nve(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return To(this,t),i=e.call(this),L1&&xA.call(hA(i)),Mve(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,hA(i)),i.options=s,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.logger=Ha.create("translator"),i}return Io(t,[{key:"changeLanguage",value:function(i){i&&(this.language=i)}},{key:"exists",value:function(i){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(i==null)return!1;var o=this.resolve(i,s);return o&&o.res!==void 0}},{key:"extractFromKey",value:function(i,s){var o=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");var a=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,l=s.ns||this.options.defaultNS||[],c=o&&i.indexOf(o)>-1,A=!this.options.userDefinedKeySeparator&&!s.keySeparator&&!this.options.userDefinedNsSeparator&&!s.nsSeparator&&!Fve(i,o,a);if(c&&!A){var u=i.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:i,namespaces:l};var f=i.split(o);(o!==a||o===a&&this.options.ns.indexOf(f[0])>-1)&&(l=f.shift()),i=f.join(a)}return typeof l=="string"&&(l=[l]),{key:i,namespaces:l}}},{key:"translate",value:function(i,s,o){var a=this;if(Ns(s)!=="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),Ns(s)==="object"&&(s=pi({},s)),s||(s={}),i==null)return"";Array.isArray(i)||(i=[String(i)]);var l=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,c=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,A=this.extractFromKey(i[i.length-1],s),u=A.key,f=A.namespaces,h=f[f.length-1],d=s.lng||this.language,m=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&d.toLowerCase()==="cimode"){if(m){var g=s.nsSeparator||this.options.nsSeparator;return l?{res:"".concat(h).concat(g).concat(u),usedKey:u,exactUsedKey:u,usedLng:d,usedNS:h}:"".concat(h).concat(g).concat(u)}return l?{res:u,usedKey:u,exactUsedKey:u,usedLng:d,usedNS:h}:u}var p=this.resolve(i,s),v=p&&p.res,w=p&&p.usedKey||u,_=p&&p.exactUsedKey||u,x=Object.prototype.toString.apply(v),b=["[object Number]","[object Function]","[object RegExp]"],B=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,M=!this.i18nFormat||this.i18nFormat.handleAsObject,I=typeof v!="string"&&typeof v!="boolean"&&typeof v!="number";if(M&&v&&I&&b.indexOf(x)<0&&!(typeof B=="string"&&x==="[object Array]")){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var S=this.options.returnedObjectHandler?this.options.returnedObjectHandler(w,v,pi(pi({},s),{},{ns:f})):"key '".concat(u," (").concat(this.language,")' returned an object instead of string.");return l?(p.res=S,p):S}if(c){var L=x==="[object Array]",D=L?[]:{},T=L?_:w;for(var y in v)if(Object.prototype.hasOwnProperty.call(v,y)){var E="".concat(T).concat(c).concat(y);D[y]=this.translate(E,pi(pi({},s),{joinArrays:!1,ns:f})),D[y]===E&&(D[y]=v[y])}v=D}}else if(M&&typeof B=="string"&&x==="[object Array]")v=v.join(B),v&&(v=this.extendTranslation(v,i,s,o));else{var R=!1,F=!1,O=s.count!==void 0&&typeof s.count!="string",z=t.hasDefaultValue(s),j=O?this.pluralResolver.getSuffix(d,s.count,s):"",H=s["defaultValue".concat(j)]||s.defaultValue;!this.isValidLookup(v)&&z&&(R=!0,v=H),this.isValidLookup(v)||(F=!0,v=u);var C=s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,W=C&&F?void 0:v,ee=z&&H!==v&&this.options.updateMissing;if(F||R||ee){if(this.logger.log(ee?"updateKey":"missingKey",d,h,u,ee?H:v),c){var P=this.resolve(u,pi(pi({},s),{},{keySeparator:!1}));P&&P.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var re=[],ue=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ue&&ue[0])for(var le=0;le1&&arguments[1]!==void 0?arguments[1]:{},a,l,c,A,u;return typeof i=="string"&&(i=[i]),i.forEach(function(f){if(!s.isValidLookup(a)){var h=s.extractFromKey(f,o),d=h.key;l=d;var m=h.namespaces;s.options.fallbackNS&&(m=m.concat(s.options.fallbackNS));var g=o.count!==void 0&&typeof o.count!="string",p=g&&!o.ordinal&&o.count===0&&s.pluralResolver.shouldUseIntlApi(),v=o.context!==void 0&&(typeof o.context=="string"||typeof o.context=="number")&&o.context!=="",w=o.lngs?o.lngs:s.languageUtils.toResolveHierarchy(o.lng||s.language,o.fallbackLng);m.forEach(function(_){s.isValidLookup(a)||(u=_,!s3["".concat(w[0],"-").concat(_)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(u)&&(s3["".concat(w[0],"-").concat(_)]=!0,s.logger.warn('key "'.concat(l,'" for languages "').concat(w.join(", "),`" won't get resolved as namespace "`).concat(u,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),w.forEach(function(x){if(!s.isValidLookup(a)){A=x;var b=[d];if(s.i18nFormat&&s.i18nFormat.addLookupKeys)s.i18nFormat.addLookupKeys(b,d,x,_,o);else{var B;g&&(B=s.pluralResolver.getSuffix(x,o.count,o));var M="".concat(s.options.pluralSeparator,"zero");if(g&&(b.push(d+B),p&&b.push(d+M)),v){var I="".concat(d).concat(s.options.contextSeparator).concat(o.context);b.push(I),g&&(b.push(I+B),p&&b.push(I+M))}}for(var S;S=b.pop();)s.isValidLookup(a)||(c=S,a=s.getResource(x,_,S,o))}}))})}}),{res:a,usedKey:l,exactUsedKey:c,usedLng:A,usedNS:u}}},{key:"isValidLookup",value:function(i){return i!==void 0&&!(!this.options.returnNull&&i===null)&&!(!this.options.returnEmptyString&&i==="")}},{key:"getResource",value:function(i,s,o){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(i,s,o,a):this.resourceStore.getResource(i,s,o,a)}}],[{key:"hasDefaultValue",value:function(i){var s="defaultValue";for(var o in i)if(Object.prototype.hasOwnProperty.call(i,o)&&s===o.substring(0,s.length)&&i[o]!==void 0)return!0;return!1}}]),t}(xA);function sS(n){return n.charAt(0).toUpperCase()+n.slice(1)}var a3=function(){function n(e){To(this,n),this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ha.create("languageUtils")}return Io(n,[{key:"getScriptPartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return null;var r=t.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}},{key:"getLanguagePartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return t;var r=t.split("-");return this.formatLanguageCode(r[0])}},{key:"formatLanguageCode",value:function(t){if(typeof t=="string"&&t.indexOf("-")>-1){var r=["hans","hant","latn","cyrl","cans","mong","arab"],i=t.split("-");return this.options.lowerCaseLng?i=i.map(function(s){return s.toLowerCase()}):i.length===2?(i[0]=i[0].toLowerCase(),i[1]=i[1].toUpperCase(),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=sS(i[1].toLowerCase()))):i.length===3&&(i[0]=i[0].toLowerCase(),i[1].length===2&&(i[1]=i[1].toUpperCase()),i[0]!=="sgn"&&i[2].length===2&&(i[2]=i[2].toUpperCase()),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=sS(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=sS(i[2].toLowerCase()))),i.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}},{key:"isSupportedCode",value:function(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}},{key:"getBestMatchFromCodes",value:function(t){var r=this;if(!t)return null;var i;return t.forEach(function(s){if(!i){var o=r.formatLanguageCode(s);(!r.options.supportedLngs||r.isSupportedCode(o))&&(i=o)}}),!i&&this.options.supportedLngs&&t.forEach(function(s){if(!i){var o=r.getLanguagePartFromCode(s);if(r.isSupportedCode(o))return i=o;i=r.options.supportedLngs.find(function(a){if(a===o)return a;if(!(a.indexOf("-")<0&&o.indexOf("-")<0)&&a.indexOf(o)===0)return a})}}),i||(i=this.getFallbackCodes(this.options.fallbackLng)[0]),i}},{key:"getFallbackCodes",value:function(t,r){if(!t)return[];if(typeof t=="function"&&(t=t(r)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!r)return t.default||[];var i=t[r];return i||(i=t[this.getScriptPartFromCode(r)]),i||(i=t[this.formatLanguageCode(r)]),i||(i=t[this.getLanguagePartFromCode(r)]),i||(i=t.default),i||[]}},{key:"toResolveHierarchy",value:function(t,r){var i=this,s=this.getFallbackCodes(r||this.options.fallbackLng||[],t),o=[],a=function(c){c&&(i.isSupportedCode(c)?o.push(c):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(c)))};return typeof t=="string"&&t.indexOf("-")>-1?(this.options.load!=="languageOnly"&&a(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&a(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&a(this.getLanguagePartFromCode(t))):typeof t=="string"&&a(this.formatLanguageCode(t)),s.forEach(function(l){o.indexOf(l)<0&&a(i.formatLanguageCode(l))}),o}}]),n}(),kve=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Hve={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}},Qve=["v1","v2","v3"],l3={zero:0,one:1,two:2,few:3,many:4,other:5};function zve(){var n={};return kve.forEach(function(e){e.lngs.forEach(function(t){n[t]={numbers:e.nr,plurals:Hve[e.fc]}})}),n}var Gve=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};To(this,n),this.languageUtils=e,this.options=t,this.logger=Ha.create("pluralResolver"),(!this.options.compatibilityJSON||this.options.compatibilityJSON==="v4")&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=zve()}return Io(n,[{key:"addRule",value:function(t,r){this.rules[t]=r}},{key:"getRule",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(t,{type:r.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}},{key:"needsPlural",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(t,r);return this.shouldUseIntlApi()?i&&i.resolvedOptions().pluralCategories.length>1:i&&i.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(t,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,i).map(function(s){return"".concat(r).concat(s)})}},{key:"getSuffixes",value:function(t){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=this.getRule(t,i);return s?this.shouldUseIntlApi()?s.resolvedOptions().pluralCategories.sort(function(o,a){return l3[o]-l3[a]}).map(function(o){return"".concat(r.options.prepend).concat(o)}):s.numbers.map(function(o){return r.getSuffix(t,o,i)}):[]}},{key:"getSuffix",value:function(t,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=this.getRule(t,i);return s?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(s.select(r)):this.getSuffixRetroCompatible(s,r):(this.logger.warn("no plural rule found for: ".concat(t)),"")}},{key:"getSuffixRetroCompatible",value:function(t,r){var i=this,s=t.noAbs?t.plurals(r):t.plurals(Math.abs(r)),o=t.numbers[s];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(o===2?o="plural":o===1&&(o=""));var a=function(){return i.options.prepend&&o.toString()?i.options.prepend+o.toString():o.toString()};return this.options.compatibilityJSON==="v1"?o===1?"":typeof o=="number"?"_plural_".concat(o.toString()):a():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?a():this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString()}},{key:"shouldUseIntlApi",value:function(){return!Qve.includes(this.options.compatibilityJSON)}}]),n}();function c3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ko(n){for(var e=1;e3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=Tve(n,e,t);return!s&&i&&typeof t=="string"&&(s=lx(n,t,r),s===void 0&&(s=lx(e,t,r))),s}var Vve=function(){function n(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};To(this,n),this.logger=Ha.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||function(t){return t},this.init(e)}return Io(n,[{key:"init",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});var r=t.interpolation;this.escape=r.escape!==void 0?r.escape:Rve,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?zf(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?zf(r.suffix):r.suffixEscaped||"}}",this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||",",this.unescapePrefix=r.unescapeSuffix?"":r.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":r.unescapeSuffix||"",this.nestingPrefix=r.nestingPrefix?zf(r.nestingPrefix):r.nestingPrefixEscaped||zf("$t("),this.nestingSuffix=r.nestingSuffix?zf(r.nestingSuffix):r.nestingSuffixEscaped||zf(")"),this.nestingOptionsSeparator=r.nestingOptionsSeparator?r.nestingOptionsSeparator:r.nestingOptionsSeparator||",",this.maxReplaces=r.maxReplaces?r.maxReplaces:1e3,this.alwaysFormat=r.alwaysFormat!==void 0?r.alwaysFormat:!1,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var t="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(t,"g");var r="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(r,"g");var i="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(i,"g")}},{key:"interpolate",value:function(t,r,i,s){var o=this,a,l,c,A=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(g){return g.replace(/\$/g,"$$$$")}var f=function(p){if(p.indexOf(o.formatSeparator)<0){var v=A3(r,A,p,o.options.keySeparator,o.options.ignoreJSONStructure);return o.alwaysFormat?o.format(v,void 0,i,ko(ko(ko({},s),r),{},{interpolationkey:p})):v}var w=p.split(o.formatSeparator),_=w.shift().trim(),x=w.join(o.formatSeparator).trim();return o.format(A3(r,A,_,o.options.keySeparator,o.options.ignoreJSONStructure),x,i,ko(ko(ko({},s),r),{},{interpolationkey:_}))};this.resetRegExp();var h=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,d=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,m=[{regex:this.regexpUnescape,safeValue:function(p){return u(p)}},{regex:this.regexp,safeValue:function(p){return o.escapeValue?u(o.escape(p)):u(p)}}];return m.forEach(function(g){for(c=0;a=g.regex.exec(t);){var p=a[1].trim();if(l=f(p),l===void 0)if(typeof h=="function"){var v=h(t,a,s);l=typeof v=="string"?v:""}else if(s&&Object.prototype.hasOwnProperty.call(s,p))l="";else if(d){l=a[0];continue}else o.logger.warn("missed to pass in variable ".concat(p," for interpolating ").concat(t)),l="";else typeof l!="string"&&!o.useRawValueToEscape&&(l=t3(l));var w=g.safeValue(l);if(t=t.replace(a[0],w),d?(g.regex.lastIndex+=l.length,g.regex.lastIndex-=a[0].length):g.regex.lastIndex=0,c++,c>=o.maxReplaces)break}}),t}},{key:"nest",value:function(t,r){var i=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o,a,l;function c(h,d){var m=this.nestingOptionsSeparator;if(h.indexOf(m)<0)return h;var g=h.split(new RegExp("".concat(m,"[ ]*{"))),p="{".concat(g[1]);h=g[0],p=this.interpolate(p,l);var v=p.match(/'/g),w=p.match(/"/g);(v&&v.length%2===0&&!w||w.length%2!==0)&&(p=p.replace(/'/g,'"'));try{l=JSON.parse(p),d&&(l=ko(ko({},d),l))}catch(_){return this.logger.warn("failed parsing options string in nesting for key ".concat(h),_),"".concat(h).concat(m).concat(p)}return delete l.defaultValue,h}for(;o=this.nestingRegexp.exec(t);){var A=[];l=ko({},s),l=l.replace&&typeof l.replace!="string"?l.replace:l,l.applyPostProcessor=!1,delete l.defaultValue;var u=!1;if(o[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(o[1])){var f=o[1].split(this.formatSeparator).map(function(h){return h.trim()});o[1]=f.shift(),A=f,u=!0}if(a=r(c.call(this,o[1].trim(),l),l),a&&o[0]===t&&typeof a!="string")return a;typeof a!="string"&&(a=t3(a)),a||(this.logger.warn("missed to resolve ".concat(o[1]," for nesting ").concat(t)),a=""),u&&(a=A.reduce(function(h,d){return i.format(h,d,s.lng,ko(ko({},s),{},{interpolationkey:o[1].trim()}))},a.trim())),t=t.replace(o[0],a),this.regexp.lastIndex=0}return t}}]),n}();function u3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function bl(n){for(var e=1;e-1){var r=n.split("(");e=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);if(e==="currency"&&i.indexOf(":")<0)t.currency||(t.currency=i.trim());else if(e==="relativetime"&&i.indexOf(":")<0)t.range||(t.range=i.trim());else{var s=i.split(";");s.forEach(function(o){if(o){var a=o.split(":"),l=Eve(a),c=l[0],A=l.slice(1),u=A.join(":").trim().replace(/^'+|'+$/g,"");t[c.trim()]||(t[c.trim()]=u),u==="false"&&(t[c.trim()]=!1),u==="true"&&(t[c.trim()]=!0),isNaN(u)||(t[c.trim()]=parseInt(u,10))}})}}return{formatName:e,formatOptions:t}}function Gf(n){var e={};return function(r,i,s){var o=i+JSON.stringify(s),a=e[o];return a||(a=n(i,s),e[o]=a),a(r)}}var Wve=function(){function n(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};To(this,n),this.logger=Ha.create("formatter"),this.options=e,this.formats={number:Gf(function(t,r){var i=new Intl.NumberFormat(t,bl({},r));return function(s){return i.format(s)}}),currency:Gf(function(t,r){var i=new Intl.NumberFormat(t,bl(bl({},r),{},{style:"currency"}));return function(s){return i.format(s)}}),datetime:Gf(function(t,r){var i=new Intl.DateTimeFormat(t,bl({},r));return function(s){return i.format(s)}}),relativetime:Gf(function(t,r){var i=new Intl.RelativeTimeFormat(t,bl({},r));return function(s){return i.format(s,r.range||"day")}}),list:Gf(function(t,r){var i=new Intl.ListFormat(t,bl({},r));return function(s){return i.format(s)}})},this.init(e)}return Io(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}},i=r.interpolation;this.formatSeparator=i.formatSeparator?i.formatSeparator:i.formatSeparator||","}},{key:"add",value:function(t,r){this.formats[t.toLowerCase().trim()]=r}},{key:"addCached",value:function(t,r){this.formats[t.toLowerCase().trim()]=Gf(r)}},{key:"format",value:function(t,r,i){var s=this,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},a=r.split(this.formatSeparator),l=a.reduce(function(c,A){var u=jve(A),f=u.formatName,h=u.formatOptions;if(s.formats[f]){var d=c;try{var m=o&&o.formatParams&&o.formatParams[o.interpolationkey]||{},g=m.locale||m.lng||o.locale||o.lng||i;d=s.formats[f](c,g,bl(bl(bl({},h),o),m))}catch(p){s.logger.warn(p)}return d}else s.logger.warn("there was no format function for ".concat(f));return c},t);return l}}]),n}();function f3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function h3(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Yve(n,e){n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)}var $ve=function(n){P1(t,n);var e=Kve(t);function t(r,i,s){var o,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return To(this,t),o=e.call(this),L1&&xA.call(hA(o)),o.backend=r,o.store=i,o.services=s,o.languageUtils=s.languageUtils,o.options=a,o.logger=Ha.create("backendConnector"),o.waitingReads=[],o.maxParallelReads=a.maxParallelReads||10,o.readingCalls=0,o.maxRetries=a.maxRetries>=0?a.maxRetries:5,o.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(s,a.backend,a),o}return Io(t,[{key:"queueLoad",value:function(i,s,o,a){var l=this,c={},A={},u={},f={};return i.forEach(function(h){var d=!0;s.forEach(function(m){var g="".concat(h,"|").concat(m);!o.reload&&l.store.hasResourceBundle(h,m)?l.state[g]=2:l.state[g]<0||(l.state[g]===1?A[g]===void 0&&(A[g]=!0):(l.state[g]=1,d=!1,A[g]===void 0&&(A[g]=!0),c[g]===void 0&&(c[g]=!0),f[m]===void 0&&(f[m]=!0)))}),d||(u[h]=!0)}),(Object.keys(c).length||Object.keys(A).length)&&this.queue.push({pending:A,pendingCount:Object.keys(A).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(c),pending:Object.keys(A),toLoadLanguages:Object.keys(u),toLoadNamespaces:Object.keys(f)}}},{key:"loaded",value:function(i,s,o){var a=i.split("|"),l=a[0],c=a[1];s&&this.emit("failedLoading",l,c,s),o&&this.store.addResourceBundle(l,c,o),this.state[i]=s?-1:2;var A={};this.queue.forEach(function(u){Cve(u.loaded,[l],c),Yve(u,i),s&&u.errors.push(s),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(function(f){A[f]||(A[f]={});var h=u.loaded[f];h.length&&h.forEach(function(d){A[f][d]===void 0&&(A[f][d]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",A),this.queue=this.queue.filter(function(u){return!u.done})}},{key:"read",value:function(i,s,o){var a=this,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,A=arguments.length>5?arguments[5]:void 0;if(!i.length)return A(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:i,ns:s,fcName:o,tried:l,wait:c,callback:A});return}this.readingCalls++;var u=function(m,g){if(a.readingCalls--,a.waitingReads.length>0){var p=a.waitingReads.shift();a.read(p.lng,p.ns,p.fcName,p.tried,p.wait,p.callback)}if(m&&g&&l2&&arguments[2]!==void 0?arguments[2]:{},l=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),l&&l();typeof i=="string"&&(i=this.languageUtils.toResolveHierarchy(i)),typeof s=="string"&&(s=[s]);var c=this.queueLoad(i,s,a,l);if(!c.toLoad.length)return c.pending.length||l(),null;c.toLoad.forEach(function(A){o.loadOne(A)})}},{key:"load",value:function(i,s,o){this.prepareLoading(i,s,{},o)}},{key:"reload",value:function(i,s,o){this.prepareLoading(i,s,{reload:!0},o)}},{key:"loadOne",value:function(i){var s=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",a=i.split("|"),l=a[0],c=a[1];this.read(l,c,"read",void 0,void 0,function(A,u){A&&s.logger.warn("".concat(o,"loading namespace ").concat(c," for language ").concat(l," failed"),A),!A&&u&&s.logger.log("".concat(o,"loaded namespace ").concat(c," for language ").concat(l),u),s.loaded(i,A,u)})}},{key:"saveMissing",value:function(i,s,o,a,l){var c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},A=arguments.length>6&&arguments[6]!==void 0?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(s)){this.logger.warn('did not save key "'.concat(o,'" as the namespace "').concat(s,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(o==null||o==="")){if(this.backend&&this.backend.create){var u=h3(h3({},c),{},{isUpdate:l}),f=this.backend.create.bind(this.backend);if(f.length<6)try{var h;f.length===5?h=f(i,s,o,a,u):h=f(i,s,o,a),h&&typeof h.then=="function"?h.then(function(d){return A(null,d)}).catch(A):A(null,h)}catch(d){A(d)}else f(i,s,o,a,A,u)}!i||!i[0]||this.store.addResource(i[0],s,o,a)}}}]),t}(xA);function d3(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if(Ns(e[1])==="object"&&(t=e[1]),typeof e[1]=="string"&&(t.defaultValue=e[1]),typeof e[2]=="string"&&(t.tDescription=e[2]),Ns(e[2])==="object"||Ns(e[3])==="object"){var r=e[3]||e[2];Object.keys(r).forEach(function(i){t[i]=r[i]})}return t},interpolation:{escapeValue:!0,format:function(e,t,r,i){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function p3(n){return typeof n.ns=="string"&&(n.ns=[n.ns]),typeof n.fallbackLng=="string"&&(n.fallbackLng=[n.fallbackLng]),typeof n.fallbackNS=="string"&&(n.fallbackNS=[n.fallbackNS]),n.supportedLngs&&n.supportedLngs.indexOf("cimode")<0&&(n.supportedLngs=n.supportedLngs.concat(["cimode"])),n}function m3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function wa(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Oy(){}function qve(n){var e=Object.getOwnPropertyNames(Object.getPrototypeOf(n));e.forEach(function(t){typeof n[t]=="function"&&(n[t]=n[t].bind(n))})}var cx=function(n){P1(t,n);var e=Zve(t);function t(){var r,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;if(To(this,t),r=e.call(this),L1&&xA.call(hA(r)),r.options=p3(i),r.services={},r.logger=Ha,r.modules={external:[]},qve(hA(r)),s&&!r.isInitialized&&!i.isClone){if(!r.options.initImmediate)return r.init(i,s),B0(r,hA(r));setTimeout(function(){r.init(i,s)},0)}return r}return Io(t,[{key:"init",value:function(){var i=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;typeof s=="function"&&(o=s,s={}),!s.defaultNS&&s.defaultNS!==!1&&s.ns&&(typeof s.ns=="string"?s.defaultNS=s.ns:s.ns.indexOf("translation")<0&&(s.defaultNS=s.ns[0]));var a=d3();this.options=wa(wa(wa({},a),this.options),p3(s)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=wa(wa({},a.interpolation),this.options.interpolation)),s.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=s.keySeparator),s.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=s.nsSeparator);function l(p){return p?typeof p=="function"?new p:p:null}if(!this.options.isClone){this.modules.logger?Ha.init(l(this.modules.logger),this.options):Ha.init(null,this.options);var c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=Wve);var A=new a3(this.options);this.store=new Dve(this.options.resources,this.options);var u=this.services;u.logger=Ha,u.resourceStore=this.store,u.languageUtils=A,u.pluralResolver=new Gve(A,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===a.interpolation.format)&&(u.formatter=l(c),u.formatter.init(u,this.options),this.options.interpolation.format=u.formatter.format.bind(u.formatter)),u.interpolator=new Vve(this.options),u.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},u.backendConnector=new $ve(l(this.modules.backend),u.resourceStore,u,this.options),u.backendConnector.on("*",function(p){for(var v=arguments.length,w=new Array(v>1?v-1:0),_=1;_1?v-1:0),_=1;_0&&f[0]!=="dev"&&(this.options.lng=f[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined");var h=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];h.forEach(function(p){i[p]=function(){var v;return(v=i.store)[p].apply(v,arguments)}});var d=["addResource","addResources","addResourceBundle","removeResourceBundle"];d.forEach(function(p){i[p]=function(){var v;return(v=i.store)[p].apply(v,arguments),i}});var m=sm(),g=function(){var v=function(_,x){i.isInitialized&&!i.initializedStoreOnce&&i.logger.warn("init: i18next is already initialized. You should call init just once!"),i.isInitialized=!0,i.options.isClone||i.logger.log("initialized",i.options),i.emit("initialized",i.options),m.resolve(x),o(_,x)};if(i.languages&&i.options.compatibilityAPI!=="v1"&&!i.isInitialized)return v(null,i.t.bind(i));i.changeLanguage(i.options.lng,v)};return this.options.resources||!this.options.initImmediate?g():setTimeout(g,0),m}},{key:"loadResources",value:function(i){var s=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Oy,a=o,l=typeof i=="string"?i:this.language;if(typeof i=="function"&&(a=i),!this.options.resources||this.options.partialBundledLanguages){if(l&&l.toLowerCase()==="cimode")return a();var c=[],A=function(h){if(h){var d=s.services.languageUtils.toResolveHierarchy(h);d.forEach(function(m){c.indexOf(m)<0&&c.push(m)})}};if(l)A(l);else{var u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.forEach(function(f){return A(f)})}this.options.preload&&this.options.preload.forEach(function(f){return A(f)}),this.services.backendConnector.load(c,this.options.ns,function(f){!f&&!s.resolvedLanguage&&s.language&&s.setResolvedLanguage(s.language),a(f)})}else a(null)}},{key:"reloadResources",value:function(i,s,o){var a=sm();return i||(i=this.languages),s||(s=this.options.ns),o||(o=Oy),this.services.backendConnector.reload(i,s,function(l){a.resolve(),o(l)}),a}},{key:"use",value:function(i){if(!i)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!i.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return i.type==="backend"&&(this.modules.backend=i),(i.type==="logger"||i.log&&i.warn&&i.error)&&(this.modules.logger=i),i.type==="languageDetector"&&(this.modules.languageDetector=i),i.type==="i18nFormat"&&(this.modules.i18nFormat=i),i.type==="postProcessor"&&dV.addPostProcessor(i),i.type==="formatter"&&(this.modules.formatter=i),i.type==="3rdParty"&&this.modules.external.push(i),this}},{key:"setResolvedLanguage",value:function(i){if(!(!i||!this.languages)&&!(["cimode","dev"].indexOf(i)>-1))for(var s=0;s-1)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}}},{key:"changeLanguage",value:function(i,s){var o=this;this.isLanguageChangingTo=i;var a=sm();this.emit("languageChanging",i);var l=function(f){o.language=f,o.languages=o.services.languageUtils.toResolveHierarchy(f),o.resolvedLanguage=void 0,o.setResolvedLanguage(f)},c=function(f,h){h?(l(h),o.translator.changeLanguage(h),o.isLanguageChangingTo=void 0,o.emit("languageChanged",h),o.logger.log("languageChanged",h)):o.isLanguageChangingTo=void 0,a.resolve(function(){return o.t.apply(o,arguments)}),s&&s(f,function(){return o.t.apply(o,arguments)})},A=function(f){!i&&!f&&o.services.languageDetector&&(f=[]);var h=typeof f=="string"?f:o.services.languageUtils.getBestMatchFromCodes(f);h&&(o.language||l(h),o.translator.language||o.translator.changeLanguage(h),o.services.languageDetector&&o.services.languageDetector.cacheUserLanguage&&o.services.languageDetector.cacheUserLanguage(h)),o.loadResources(h,function(d){c(d,h)})};return!i&&this.services.languageDetector&&!this.services.languageDetector.async?A(this.services.languageDetector.detect()):!i&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(A):this.services.languageDetector.detect(A):A(i),a}},{key:"getFixedT",value:function(i,s,o){var a=this,l=function c(A,u){var f;if(Ns(u)!=="object"){for(var h=arguments.length,d=new Array(h>2?h-2:0),m=2;m1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var a=o.lng||this.resolvedLanguage||this.languages[0],l=this.options?this.options.fallbackLng:!1,c=this.languages[this.languages.length-1];if(a.toLowerCase()==="cimode")return!0;var A=function(h,d){var m=s.services.backendConnector.state["".concat(h,"|").concat(d)];return m===-1||m===2};if(o.precheck){var u=o.precheck(this,A);if(u!==void 0)return u}return!!(this.hasResourceBundle(a,i)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||A(a,i)&&(!l||A(c,i)))}},{key:"loadNamespaces",value:function(i,s){var o=this,a=sm();return this.options.ns?(typeof i=="string"&&(i=[i]),i.forEach(function(l){o.options.ns.indexOf(l)<0&&o.options.ns.push(l)}),this.loadResources(function(l){a.resolve(),s&&s(l)}),a):(s&&s(),Promise.resolve())}},{key:"loadLanguages",value:function(i,s){var o=sm();typeof i=="string"&&(i=[i]);var a=this.options.preload||[],l=i.filter(function(c){return a.indexOf(c)<0});return l.length?(this.options.preload=a.concat(l),this.loadResources(function(c){o.resolve(),s&&s(c)}),o):(s&&s(),Promise.resolve())}},{key:"dir",value:function(i){if(i||(i=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!i)return"rtl";var s=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],o=this.services&&this.services.languageUtils||new a3(d3());return s.indexOf(o.getLanguagePartFromCode(i))>-1||i.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var i=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Oy,a=wa(wa(wa({},this.options),s),{isClone:!0}),l=new t(a);(s.debug!==void 0||s.prefix!==void 0)&&(l.logger=l.logger.clone(s));var c=["store","services","language"];return c.forEach(function(A){l[A]=i[A]}),l.services=wa({},this.services),l.services.utils={hasLoadedNamespace:l.hasLoadedNamespace.bind(l)},l.translator=new o3(l.services,l.options),l.translator.on("*",function(A){for(var u=arguments.length,f=new Array(u>1?u-1:0),h=1;h0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return new cx(n,e)});var Ti=cx.createInstance();Ti.createInstance=cx.createInstance;Ti.createInstance;Ti.dir;Ti.init;Ti.loadResources;Ti.reloadResources;Ti.use;Ti.changeLanguage;Ti.getFixedT;Ti.t;Ti.exists;Ti.setDefaultNamespace;Ti.hasLoadedNamespace;Ti.loadNamespaces;Ti.loadLanguages;function eye(){if(console&&console.warn){for(var n,e=arguments.length,t=new Array(e),r=0;r2&&arguments[2]!==void 0?arguments[2]:{},r=e.languages[0],i=e.options?e.options.fallbackLng:!1,s=e.languages[e.languages.length-1];if(r.toLowerCase()==="cimode")return!0;var o=function(l,c){var A=e.services.backendConnector.state["".concat(l,"|").concat(c)];return A===-1||A===2};return t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!o(e.isLanguageChangingTo,n)?!1:!!(e.hasResourceBundle(r,n)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||o(r,n)&&(!i||o(s,n)))}function nye(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e.languages||!e.languages.length)return CT("i18n.languages were undefined or empty",e.languages),!0;var r=e.options.ignoreJSONStructure!==void 0;return r?e.hasLoadedNamespace(n,{lng:t.lng,precheck:function(s,o){if(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!o(s.isLanguageChangingTo,n))return!1}}):tye(n,e,t)}var rye=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,iye={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},sye=function(e){return iye[e]},oye=function(e){return e.replace(rye,sye)};function w3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function _3(n){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};TT=_3(_3({},TT),n)}function lye(){return TT}var mV;function cye(n){mV=n}function Aye(){return mV}var uye={type:"3rdParty",init:function(e){aye(e.options.react),cye(e)}},fye=be.createContext(),hye=function(){function n(){To(this,n),this.usedNamespaces={}}return Io(n,[{key:"addUsedNamespaces",value:function(t){var r=this;t.forEach(function(i){r.usedNamespaces[i]||(r.usedNamespaces[i]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),n}();function dye(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(n)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(r=s.call(t)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(A){c=!0,i=A}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function pye(n,e){return AV(n)||dye(n,e)||uV(n,e)||fV()}function x3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function oS(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},t=e.i18n,r=be.useContext(fye)||{},i=r.i18n,s=r.defaultNS,o=t||i||Aye();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new hye),!o){CT("You will need to pass in an i18next instance by using initReactI18next");var a=function(I,S){return typeof S=="string"?S:S&&Ns(S)==="object"&&typeof S.defaultValue=="string"?S.defaultValue:Array.isArray(I)?I[I.length-1]:I},l=[a,{},!1];return l.t=a,l.i18n={},l.ready=!1,l}o.options.react&&o.options.react.wait!==void 0&&CT("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var c=oS(oS(oS({},lye()),o.options.react),e),A=c.useSuspense,u=c.keyPrefix,f=n||s||o.options&&o.options.defaultNS;f=typeof f=="string"?[f]:f||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(f);var h=(o.isInitialized||o.initializedStoreOnce)&&f.every(function(M){return nye(M,o,c)});function d(){return o.getFixedT(e.lng||null,c.nsMode==="fallback"?f:f[0],u)}var m=be.useState(d),g=pye(m,2),p=g[0],v=g[1],w=f.join();e.lng&&(w="".concat(e.lng).concat(w));var _=mye(w),x=be.useRef(!0);be.useEffect(function(){var M=c.bindI18n,I=c.bindI18nStore;x.current=!0,!h&&!A&&(e.lng?y3(o,e.lng,f,function(){x.current&&v(d)}):v3(o,f,function(){x.current&&v(d)})),h&&_&&_!==w&&x.current&&v(d);function S(){x.current&&v(d)}return M&&o&&o.on(M,S),I&&o&&o.store.on(I,S),function(){x.current=!1,M&&o&&M.split(" ").forEach(function(L){return o.off(L,S)}),I&&o&&I.split(" ").forEach(function(L){return o.store.off(L,S)})}},[o,w]);var b=be.useRef(!0);be.useEffect(function(){x.current&&!b.current&&v(d),b.current=!1},[o,u]);var B=[p,o,h];if(B.t=p,B.i18n=o,B.ready=h,h||!h&&!A)return B;throw new Promise(function(M){e.lng?y3(o,e.lng,f,function(){return M()}):v3(o,f,function(){return M()})})}var gV=[],vye=gV.forEach,yye=gV.slice;function wye(n){return vye.call(yye.call(arguments,1),function(e){if(e)for(var t in e)n[t]===void 0&&(n[t]=e[t])}),n}var b3=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,_ye=function(e,t,r){var i=r||{};i.path=i.path||"/";var s=encodeURIComponent(t),o="".concat(e,"=").concat(s);if(i.maxAge>0){var a=i.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");o+="; Max-Age=".concat(Math.floor(a))}if(i.domain){if(!b3.test(i.domain))throw new TypeError("option domain is invalid");o+="; Domain=".concat(i.domain)}if(i.path){if(!b3.test(i.path))throw new TypeError("option path is invalid");o+="; Path=".concat(i.path)}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(o+="; HttpOnly"),i.secure&&(o+="; Secure"),i.sameSite){var l=typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite;switch(l){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o},E3={create:function(e,t,r,i){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(s.expires=new Date,s.expires.setTime(s.expires.getTime()+r*60*1e3)),i&&(s.domain=i),document.cookie=_ye(e,encodeURIComponent(t),s)},read:function(e){for(var t="".concat(e,"="),r=document.cookie.split(";"),i=0;i-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var i=r.substring(1),s=i.split("&"),o=0;o0){var l=s[o].substring(0,a);l===e.lookupQuerystring&&(t=s[o].substring(a+1))}}}return t}},om=null,B3=function(){if(om!==null)return om;try{om=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{om=!1}return om},Eye={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&B3()){var r=window.localStorage.getItem(e.lookupLocalStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&B3()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},am=null,S3=function(){if(am!==null)return am;try{am=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{am=!1}return am},Bye={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&S3()){var r=window.sessionStorage.getItem(e.lookupSessionStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&S3()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},Sye={name:"navigator",lookup:function(e){var t=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?t:void 0}},Mye={name:"htmlTag",lookup:function(e){var t,r=e.htmlTag||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(t=r.getAttribute("lang")),t}},Cye={name:"path",lookup:function(e){var t;if(typeof window<"u"){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if(typeof e.lookupFromPathIndex=="number"){if(typeof r[e.lookupFromPathIndex]!="string")return;t=r[e.lookupFromPathIndex].replace("/","")}else t=r[0].replace("/","")}return t}},Tye={name:"subdomain",lookup:function(e){var t=typeof e.lookupFromSubdomainIndex=="number"?e.lookupFromSubdomainIndex+1:1,r=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[t]}};function Iye(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(e){return e}}}var vV=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};To(this,n),this.type="languageDetector",this.detectors={},this.init(e,t)}return Io(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t||{languageUtils:{}},this.options=wye(r,this.options||{},Iye()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(s){return s.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(xye),this.addDetector(bye),this.addDetector(Eye),this.addDetector(Bye),this.addDetector(Sye),this.addDetector(Mye),this.addDetector(Cye),this.addDetector(Tye)}},{key:"addDetector",value:function(t){return this.detectors[t.name]=t,this}},{key:"detect",value:function(t){var r=this;t||(t=this.options.order);var i=[];return t.forEach(function(s){if(r.detectors[s]){var o=r.detectors[s].lookup(r.options);o&&typeof o=="string"&&(o=[o]),o&&(i=i.concat(o))}}),i=i.map(function(s){return r.options.convertDetectedLanguage(s)}),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(t,r){var i=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||r.forEach(function(s){i.detectors[s]&&i.detectors[s].cacheUserLanguage(t,i.options)}))}}]),n}();vV.type="languageDetector";const Rye={translation:{pageTitles:{chooseClass:"Choose Character Class",chooseAppearance:"Choose Appearance",saveCharacter:"Save Your Character"},callToAction:{next:"Next",back:"Back",randomize:"Randomize",send:"Send"},editor:{title:"Appearance",head:"Head",body:"Body",eyes:"Eyes",outer:"Outer",chest:"Chest",legs:"Legs",feet:"Feet",accessories:"Accessories"},labels:{name:"Name",voice:"Voice",favoriteColor:"Favorite Color",preferredGreeting:"Preferred Greeting",question:"Question",yourName:"Your Name",conversation:"Conversation"},text:{unoptimized:"Unoptimized",apiUnderMaintnance:"Voice generation API is temporarily disabled for maintenance!"}}},Uye={translation:{pageTitles:{chooseClass:"Выбрать Класс Персонажа",chooseAppearance:"Выбрать Внешность",saveCharacter:"Сохранить Персонажа"},callToAction:{next:"Далее",back:"Назад",randomize:"Рандомизировать",send:"Отправить"},editor:{title:"Внешность",head:"Голова",body:"Тело",eyes:"Глаза",outer:"Внешний",chest:"Грудь",legs:"Ноги",feet:"Стопы",accessories:"Аксессуары"},labels:{name:"Имя",voice:"Голос",favoriteColor:"Любимый Цвет",preferredGreeting:"Предпочитаемое Приветствие",question:"Вопрос",yourName:"Ваше Имя",conversation:"Разговор"},text:{unoptimized:"Неоптимизи­рованный",apiUnderMaintnance:"API генерации голоса временно отключен на техническое обслуживание."}}},Fye={translation:{pageTitles:{chooseClass:"选择角色类型",chooseAppearance:"选择外观",saveCharacter:"保存角色"},callToAction:{next:"下一步",back:"返回",randomize:"随机",send:"发送"},editor:{title:"外观",head:"头部",body:"身体",eyes:"眼睛",outer:"外套",chest:"上身",legs:"腿部",feet:"脚部",accessories:"配件"},labels:{name:"名字",voice:"语音",favoriteColor:"颜色偏好",preferredGreeting:"首选问候语",question:"问题",yourName:"你的名字",conversation:"对话"},text:{unoptimized:"未优化",apiUnderMaintnance:"语音生成API暂时关闭进行维护!"}}},Pye={en:Rye,ru:Uye,zh:Fye};Ti.use(vV).use(uye).init({debug:!0,fallbackLng:"en",interpolation:{escapeValue:!1},resources:Pye});const Aa=be.createContext(),Lye=n=>{const{t:e}=gye();return k.jsx(Aa.Provider,{value:{t:e},children:n.children})},Dye=` +*/(function(n,e){(function(t){n.exports=t()})(function(){return function t(r,i,s){function o(c,A){if(!i[c]){if(!r[c]){var u=typeof Ny=="function"&&Ny;if(!A&&u)return u(c,!0);if(a)return a(c,!0);var f=new Error("Cannot find module '"+c+"'");throw f.code="MODULE_NOT_FOUND",f}var h=i[c]={exports:{}};r[c][0].call(h.exports,function(d){var m=r[c][1][d];return o(m||d)},h,h.exports,t,r,i,s)}return i[c].exports}for(var a=typeof Ny=="function"&&Ny,l=0;l>2,h=(3&c)<<4|A>>4,d=1>6:64,m=2>4,A=(15&f)<<4|(h=a.indexOf(l.charAt(m++)))>>2,u=(3&h)<<6|(d=a.indexOf(l.charAt(m++))),v[g++]=c,h!==64&&(v[g++]=A),d!==64&&(v[g++]=u);return v}},{"./support":30,"./utils":32}],2:[function(t,r,i){var s=t("./external"),o=t("./stream/DataWorker"),a=t("./stream/Crc32Probe"),l=t("./stream/DataLengthProbe");function c(A,u,f,h,d){this.compressedSize=A,this.uncompressedSize=u,this.crc32=f,this.compression=h,this.compressedContent=d}c.prototype={getContentWorker:function(){var A=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),u=this;return A.on("end",function(){if(this.streamInfo.data_length!==u.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),A},getCompressedWorker:function(){return new o(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},c.createWorkerFrom=function(A,u,f){return A.pipe(new a).pipe(new l("uncompressedSize")).pipe(u.compressWorker(f)).pipe(new l("compressedSize")).withStreamInfo("compression",u)},r.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,r,i){var s=t("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,r,i){var s=t("./utils"),o=function(){for(var a,l=[],c=0;c<256;c++){a=c;for(var A=0;A<8;A++)a=1&a?3988292384^a>>>1:a>>>1;l[c]=a}return l}();r.exports=function(a,l){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?function(c,A,u,f){var h=o,d=f+u;c^=-1;for(var m=f;m>>8^h[255&(c^A[m])];return-1^c}(0|l,a,a.length,0):function(c,A,u,f){var h=o,d=f+u;c^=-1;for(var m=f;m>>8^h[255&(c^A.charCodeAt(m))];return-1^c}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(t,r,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(t,r,i){var s=null;s=typeof Promise<"u"?Promise:t("lie"),r.exports={Promise:s}},{lie:37}],7:[function(t,r,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=t("pako"),a=t("./utils"),l=t("./stream/GenericWorker"),c=s?"uint8array":"array";function A(u,f){l.call(this,"FlateWorker/"+u),this._pako=null,this._pakoAction=u,this._pakoOptions=f,this.meta={}}i.magic="\b\0",a.inherits(A,l),A.prototype.processChunk=function(u){this.meta=u.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(c,u.data),!1)},A.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},A.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},A.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var u=this;this._pako.onData=function(f){u.push({data:f,meta:u.meta})}},i.compressWorker=function(u){return new A("Deflate",u)},i.uncompressWorker=function(){return new A("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,r,i){function s(h,d){var m,g="";for(m=0;m>>=8;return g}function o(h,d,m,g,p,v){var w,_,x=h.file,b=h.compression,B=v!==c.utf8encode,S=a.transformTo("string",v(x.name)),I=a.transformTo("string",c.utf8encode(x.name)),M=x.comment,L=a.transformTo("string",v(M)),D=a.transformTo("string",c.utf8encode(M)),T=I.length!==x.name.length,y=D.length!==M.length,E="",R="",F="",O=x.dir,z=x.date,j={crc32:0,compressedSize:0,uncompressedSize:0};d&&!m||(j.crc32=h.crc32,j.compressedSize=h.compressedSize,j.uncompressedSize=h.uncompressedSize);var Q=0;d&&(Q|=8),B||!T&&!y||(Q|=2048);var C=0,W=0;O&&(C|=16),p==="UNIX"?(W=798,C|=function(P,re){var ue=P;return P||(ue=re?16893:33204),(65535&ue)<<16}(x.unixPermissions,O)):(W=20,C|=function(P){return 63&(P||0)}(x.dosPermissions)),w=z.getUTCHours(),w<<=6,w|=z.getUTCMinutes(),w<<=5,w|=z.getUTCSeconds()/2,_=z.getUTCFullYear()-1980,_<<=4,_|=z.getUTCMonth()+1,_<<=5,_|=z.getUTCDate(),T&&(R=s(1,1)+s(A(S),4)+I,E+="up"+s(R.length,2)+R),y&&(F=s(1,1)+s(A(L),4)+D,E+="uc"+s(F.length,2)+F);var ee="";return ee+=` +\0`,ee+=s(Q,2),ee+=b.magic,ee+=s(w,2),ee+=s(_,2),ee+=s(j.crc32,4),ee+=s(j.compressedSize,4),ee+=s(j.uncompressedSize,4),ee+=s(S.length,2),ee+=s(E.length,2),{fileRecord:u.LOCAL_FILE_HEADER+ee+S+E,dirRecord:u.CENTRAL_FILE_HEADER+s(W,2)+ee+s(L.length,2)+"\0\0\0\0"+s(C,4)+s(g,4)+S+E+L}}var a=t("../utils"),l=t("../stream/GenericWorker"),c=t("../utf8"),A=t("../crc32"),u=t("../signature");function f(h,d,m,g){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=d,this.zipPlatform=m,this.encodeFileName=g,this.streamFiles=h,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(f,l),f.prototype.push=function(h){var d=h.meta.percent||0,m=this.entriesCount,g=this._sources.length;this.accumulate?this.contentBuffer.push(h):(this.bytesWritten+=h.data.length,l.prototype.push.call(this,{data:h.data,meta:{currentFile:this.currentFile,percent:m?(d+100*(m-g-1))/m:100}}))},f.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var d=this.streamFiles&&!h.file.dir;if(d){var m=o(h,d,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(h){this.accumulate=!1;var d=this.streamFiles&&!h.file.dir,m=o(h,d,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),d)this.push({data:function(g){return u.DATA_DESCRIPTOR+s(g.crc32,4)+s(g.compressedSize,4)+s(g.uncompressedSize,4)}(h),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var h=this.bytesWritten,d=0;d=this.index;l--)c=(c<<8)+this.byteAt(l);return this.index+=a,c},readString:function(a){return s.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=o},{"../utils":32}],19:[function(t,r,i){var s=t("./Uint8ArrayReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,r,i){var s=t("./DataReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},o.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},o.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=o},{"../utils":32,"./DataReader":18}],21:[function(t,r,i){var s=t("./ArrayReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(t,r,i){var s=t("../utils"),o=t("../support"),a=t("./ArrayReader"),l=t("./StringReader"),c=t("./NodeBufferReader"),A=t("./Uint8ArrayReader");r.exports=function(u){var f=s.getTypeOf(u);return s.checkSupport(f),f!=="string"||o.uint8array?f==="nodebuffer"?new c(u):o.uint8array?new A(s.transformTo("uint8array",u)):new a(s.transformTo("array",u)):new l(u)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,r,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,r,i){var s=t("./GenericWorker"),o=t("../utils");function a(l){s.call(this,"ConvertWorker to "+l),this.destType=l}o.inherits(a,s),a.prototype.processChunk=function(l){this.push({data:o.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(t,r,i){var s=t("./GenericWorker"),o=t("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(a,s),a.prototype.processChunk=function(l){this.streamInfo.crc32=o(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,r,i){var s=t("../utils"),o=t("./GenericWorker");function a(l){o.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}s.inherits(a,o),a.prototype.processChunk=function(l){if(l){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+l.data.length}o.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(t,r,i){var s=t("../utils"),o=t("./GenericWorker");function a(l){o.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(A){c.dataIsReady=!0,c.data=A,c.max=A&&A.length||0,c.type=s.getTypeOf(A),c.isPaused||c._tickAndRepeat()},function(A){c.error(A)})}s.inherits(a,o),a.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,c=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(t,r,i){function s(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,a){return this._listeners[o].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,a){if(this._listeners[o])for(var l=0;l "+o:o}},r.exports=s},{}],29:[function(t,r,i){var s=t("../utils"),o=t("./ConvertWorker"),a=t("./GenericWorker"),l=t("../base64"),c=t("../support"),A=t("../external"),u=null;if(c.nodestream)try{u=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(d,m){return new A.Promise(function(g,p){var v=[],w=d._internalType,_=d._outputType,x=d._mimeType;d.on("data",function(b,B){v.push(b),m&&m(B)}).on("error",function(b){v=[],p(b)}).on("end",function(){try{var b=function(B,S,I){switch(B){case"blob":return s.newBlob(s.transformTo("arraybuffer",S),I);case"base64":return l.encode(S);default:return s.transformTo(B,S)}}(_,function(B,S){var I,M=0,L=null,D=0;for(I=0;I"u")i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(s),i.blob=o.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!t("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(t,r,i){for(var s=t("./utils"),o=t("./support"),a=t("./nodejsUtils"),l=t("./stream/GenericWorker"),c=new Array(256),A=0;A<256;A++)c[A]=252<=A?6:248<=A?5:240<=A?4:224<=A?3:192<=A?2:1;c[254]=c[254]=1;function u(){l.call(this,"utf-8 decode"),this.leftOver=null}function f(){l.call(this,"utf-8 encode")}i.utf8encode=function(h){return o.nodebuffer?a.newBufferFrom(h,"utf-8"):function(d){var m,g,p,v,w,_=d.length,x=0;for(v=0;v<_;v++)(64512&(g=d.charCodeAt(v)))==55296&&v+1<_&&(64512&(p=d.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(p-56320),v++),x+=g<128?1:g<2048?2:g<65536?3:4;for(m=o.uint8array?new Uint8Array(x):new Array(x),v=w=0;w>>6:(g<65536?m[w++]=224|g>>>12:(m[w++]=240|g>>>18,m[w++]=128|g>>>12&63),m[w++]=128|g>>>6&63),m[w++]=128|63&g);return m}(h)},i.utf8decode=function(h){return o.nodebuffer?s.transformTo("nodebuffer",h).toString("utf-8"):function(d){var m,g,p,v,w=d.length,_=new Array(2*w);for(m=g=0;m>10&1023,_[g++]=56320|1023&p)}return _.length!==g&&(_.subarray?_=_.subarray(0,g):_.length=g),s.applyFromCharCode(_)}(h=s.transformTo(o.uint8array?"uint8array":"array",h))},s.inherits(u,l),u.prototype.processChunk=function(h){var d=s.transformTo(o.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var m=d;(d=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),d.set(m,this.leftOver.length)}else d=this.leftOver.concat(d);this.leftOver=null}var g=function(v,w){var _;for((w=w||v.length)>v.length&&(w=v.length),_=w-1;0<=_&&(192&v[_])==128;)_--;return _<0||_===0?w:_+c[v[_]]>w?_:w}(d),p=d;g!==d.length&&(o.uint8array?(p=d.subarray(0,g),this.leftOver=d.subarray(g,d.length)):(p=d.slice(0,g),this.leftOver=d.slice(g,d.length))),this.push({data:i.utf8decode(p),meta:h.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=u,s.inherits(f,l),f.prototype.processChunk=function(h){this.push({data:i.utf8encode(h.data),meta:h.meta})},i.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,r,i){var s=t("./support"),o=t("./base64"),a=t("./nodejsUtils"),l=t("./external");function c(m){return m}function A(m,g){for(var p=0;p>8;this.dir=!!(16&this.externalFileAttributes),h==0&&(this.dosPermissions=63&this.externalFileAttributes),h==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var h=s(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=h.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=h.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=h.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=h.readInt(4))}},readExtraFields:function(h){var d,m,g,p=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4>>6:(h<65536?f[g++]=224|h>>>12:(f[g++]=240|h>>>18,f[g++]=128|h>>>12&63),f[g++]=128|h>>>6&63),f[g++]=128|63&h);return f},i.buf2binstring=function(u){return A(u,u.length)},i.binstring2buf=function(u){for(var f=new s.Buf8(u.length),h=0,d=f.length;h>10&1023,v[d++]=56320|1023&m)}return A(v,d)},i.utf8border=function(u,f){var h;for((f=f||u.length)>u.length&&(f=u.length),h=f-1;0<=h&&(192&u[h])==128;)h--;return h<0||h===0?f:h+l[u[h]]>f?h:f}},{"./common":41}],43:[function(t,r,i){r.exports=function(s,o,a,l){for(var c=65535&s|0,A=s>>>16&65535|0,u=0;a!==0;){for(a-=u=2e3>>1:o>>>1;a[l]=o}return a}();r.exports=function(o,a,l,c){var A=s,u=c+l;o^=-1;for(var f=c;f>>8^A[255&(o^a[f])];return-1^o}},{}],46:[function(t,r,i){var s,o=t("../utils/common"),a=t("./trees"),l=t("./adler32"),c=t("./crc32"),A=t("./messages"),u=0,f=4,h=0,d=-2,m=-1,g=4,p=2,v=8,w=9,_=286,x=30,b=19,B=2*_+1,S=15,I=3,M=258,L=M+I+1,D=42,T=113,y=1,E=2,R=3,F=4;function O(H,fe){return H.msg=A[fe],fe}function z(H){return(H<<1)-(4H.avail_out&&(Ae=H.avail_out),Ae!==0&&(o.arraySet(H.output,fe.pending_buf,fe.pending_out,Ae,H.next_out),H.next_out+=Ae,fe.pending_out+=Ae,H.total_out+=Ae,H.avail_out-=Ae,fe.pending-=Ae,fe.pending===0&&(fe.pending_out=0))}function C(H,fe){a._tr_flush_block(H,0<=H.block_start?H.block_start:-1,H.strstart-H.block_start,fe),H.block_start=H.strstart,Q(H.strm)}function W(H,fe){H.pending_buf[H.pending++]=fe}function ee(H,fe){H.pending_buf[H.pending++]=fe>>>8&255,H.pending_buf[H.pending++]=255&fe}function P(H,fe){var Ae,J,q=H.max_chain_length,he=H.strstart,X=H.prev_length,G=H.nice_match,ne=H.strstart>H.w_size-L?H.strstart-(H.w_size-L):0,Y=H.window,de=H.w_mask,ae=H.prev,Ee=H.strstart+M,V=Y[he+X-1],U=Y[he+X];H.prev_length>=H.good_match&&(q>>=2),G>H.lookahead&&(G=H.lookahead);do if(Y[(Ae=fe)+X]===U&&Y[Ae+X-1]===V&&Y[Ae]===Y[he]&&Y[++Ae]===Y[he+1]){he+=2,Ae++;do;while(Y[++he]===Y[++Ae]&&Y[++he]===Y[++Ae]&&Y[++he]===Y[++Ae]&&Y[++he]===Y[++Ae]&&Y[++he]===Y[++Ae]&&Y[++he]===Y[++Ae]&&Y[++he]===Y[++Ae]&&Y[++he]===Y[++Ae]&&hene&&--q!=0);return X<=H.lookahead?X:H.lookahead}function re(H){var fe,Ae,J,q,he,X,G,ne,Y,de,ae=H.w_size;do{if(q=H.window_size-H.lookahead-H.strstart,H.strstart>=ae+(ae-L)){for(o.arraySet(H.window,H.window,ae,ae,0),H.match_start-=ae,H.strstart-=ae,H.block_start-=ae,fe=Ae=H.hash_size;J=H.head[--fe],H.head[fe]=ae<=J?J-ae:0,--Ae;);for(fe=Ae=ae;J=H.prev[--fe],H.prev[fe]=ae<=J?J-ae:0,--Ae;);q+=ae}if(H.strm.avail_in===0)break;if(X=H.strm,G=H.window,ne=H.strstart+H.lookahead,Y=q,de=void 0,de=X.avail_in,Y=I)for(he=H.strstart-H.insert,H.ins_h=H.window[he],H.ins_h=(H.ins_h<=I&&(H.ins_h=(H.ins_h<=I)if(J=a._tr_tally(H,H.strstart-H.match_start,H.match_length-I),H.lookahead-=H.match_length,H.match_length<=H.max_lazy_match&&H.lookahead>=I){for(H.match_length--;H.strstart++,H.ins_h=(H.ins_h<=I&&(H.ins_h=(H.ins_h<=I&&H.match_length<=H.prev_length){for(q=H.strstart+H.lookahead-I,J=a._tr_tally(H,H.strstart-1-H.prev_match,H.prev_length-I),H.lookahead-=H.prev_length-1,H.prev_length-=2;++H.strstart<=q&&(H.ins_h=(H.ins_h<H.pending_buf_size-5&&(Ae=H.pending_buf_size-5);;){if(H.lookahead<=1){if(re(H),H.lookahead===0&&fe===u)return y;if(H.lookahead===0)break}H.strstart+=H.lookahead,H.lookahead=0;var J=H.block_start+Ae;if((H.strstart===0||H.strstart>=J)&&(H.lookahead=H.strstart-J,H.strstart=J,C(H,!1),H.strm.avail_out===0)||H.strstart-H.block_start>=H.w_size-L&&(C(H,!1),H.strm.avail_out===0))return y}return H.insert=0,fe===f?(C(H,!0),H.strm.avail_out===0?R:F):(H.strstart>H.block_start&&(C(H,!1),H.strm.avail_out),y)}),new me(4,4,8,4,ue),new me(4,5,16,8,ue),new me(4,6,32,32,ue),new me(4,4,16,16,le),new me(8,16,32,32,le),new me(8,16,128,128,le),new me(8,32,128,256,le),new me(32,128,258,1024,le),new me(32,258,258,4096,le)],i.deflateInit=function(H,fe){return se(H,fe,v,15,8,0)},i.deflateInit2=se,i.deflateReset=_e,i.deflateResetKeep=ge,i.deflateSetHeader=function(H,fe){return H&&H.state?H.state.wrap!==2?d:(H.state.gzhead=fe,h):d},i.deflate=function(H,fe){var Ae,J,q,he;if(!H||!H.state||5>8&255),W(J,J.gzhead.time>>16&255),W(J,J.gzhead.time>>24&255),W(J,J.level===9?2:2<=J.strategy||J.level<2?4:0),W(J,255&J.gzhead.os),J.gzhead.extra&&J.gzhead.extra.length&&(W(J,255&J.gzhead.extra.length),W(J,J.gzhead.extra.length>>8&255)),J.gzhead.hcrc&&(H.adler=c(H.adler,J.pending_buf,J.pending,0)),J.gzindex=0,J.status=69):(W(J,0),W(J,0),W(J,0),W(J,0),W(J,0),W(J,J.level===9?2:2<=J.strategy||J.level<2?4:0),W(J,3),J.status=T);else{var X=v+(J.w_bits-8<<4)<<8;X|=(2<=J.strategy||J.level<2?0:J.level<6?1:J.level===6?2:3)<<6,J.strstart!==0&&(X|=32),X+=31-X%31,J.status=T,ee(J,X),J.strstart!==0&&(ee(J,H.adler>>>16),ee(J,65535&H.adler)),H.adler=1}if(J.status===69)if(J.gzhead.extra){for(q=J.pending;J.gzindex<(65535&J.gzhead.extra.length)&&(J.pending!==J.pending_buf_size||(J.gzhead.hcrc&&J.pending>q&&(H.adler=c(H.adler,J.pending_buf,J.pending-q,q)),Q(H),q=J.pending,J.pending!==J.pending_buf_size));)W(J,255&J.gzhead.extra[J.gzindex]),J.gzindex++;J.gzhead.hcrc&&J.pending>q&&(H.adler=c(H.adler,J.pending_buf,J.pending-q,q)),J.gzindex===J.gzhead.extra.length&&(J.gzindex=0,J.status=73)}else J.status=73;if(J.status===73)if(J.gzhead.name){q=J.pending;do{if(J.pending===J.pending_buf_size&&(J.gzhead.hcrc&&J.pending>q&&(H.adler=c(H.adler,J.pending_buf,J.pending-q,q)),Q(H),q=J.pending,J.pending===J.pending_buf_size)){he=1;break}he=J.gzindexq&&(H.adler=c(H.adler,J.pending_buf,J.pending-q,q)),he===0&&(J.gzindex=0,J.status=91)}else J.status=91;if(J.status===91)if(J.gzhead.comment){q=J.pending;do{if(J.pending===J.pending_buf_size&&(J.gzhead.hcrc&&J.pending>q&&(H.adler=c(H.adler,J.pending_buf,J.pending-q,q)),Q(H),q=J.pending,J.pending===J.pending_buf_size)){he=1;break}he=J.gzindexq&&(H.adler=c(H.adler,J.pending_buf,J.pending-q,q)),he===0&&(J.status=103)}else J.status=103;if(J.status===103&&(J.gzhead.hcrc?(J.pending+2>J.pending_buf_size&&Q(H),J.pending+2<=J.pending_buf_size&&(W(J,255&H.adler),W(J,H.adler>>8&255),H.adler=0,J.status=T)):J.status=T),J.pending!==0){if(Q(H),H.avail_out===0)return J.last_flush=-1,h}else if(H.avail_in===0&&z(fe)<=z(Ae)&&fe!==f)return O(H,-5);if(J.status===666&&H.avail_in!==0)return O(H,-5);if(H.avail_in!==0||J.lookahead!==0||fe!==u&&J.status!==666){var G=J.strategy===2?function(ne,Y){for(var de;;){if(ne.lookahead===0&&(re(ne),ne.lookahead===0)){if(Y===u)return y;break}if(ne.match_length=0,de=a._tr_tally(ne,0,ne.window[ne.strstart]),ne.lookahead--,ne.strstart++,de&&(C(ne,!1),ne.strm.avail_out===0))return y}return ne.insert=0,Y===f?(C(ne,!0),ne.strm.avail_out===0?R:F):ne.last_lit&&(C(ne,!1),ne.strm.avail_out===0)?y:E}(J,fe):J.strategy===3?function(ne,Y){for(var de,ae,Ee,V,U=ne.window;;){if(ne.lookahead<=M){if(re(ne),ne.lookahead<=M&&Y===u)return y;if(ne.lookahead===0)break}if(ne.match_length=0,ne.lookahead>=I&&0ne.lookahead&&(ne.match_length=ne.lookahead)}if(ne.match_length>=I?(de=a._tr_tally(ne,1,ne.match_length-I),ne.lookahead-=ne.match_length,ne.strstart+=ne.match_length,ne.match_length=0):(de=a._tr_tally(ne,0,ne.window[ne.strstart]),ne.lookahead--,ne.strstart++),de&&(C(ne,!1),ne.strm.avail_out===0))return y}return ne.insert=0,Y===f?(C(ne,!0),ne.strm.avail_out===0?R:F):ne.last_lit&&(C(ne,!1),ne.strm.avail_out===0)?y:E}(J,fe):s[J.level].func(J,fe);if(G!==R&&G!==F||(J.status=666),G===y||G===R)return H.avail_out===0&&(J.last_flush=-1),h;if(G===E&&(fe===1?a._tr_align(J):fe!==5&&(a._tr_stored_block(J,0,0,!1),fe===3&&(j(J.head),J.lookahead===0&&(J.strstart=0,J.block_start=0,J.insert=0))),Q(H),H.avail_out===0))return J.last_flush=-1,h}return fe!==f?h:J.wrap<=0?1:(J.wrap===2?(W(J,255&H.adler),W(J,H.adler>>8&255),W(J,H.adler>>16&255),W(J,H.adler>>24&255),W(J,255&H.total_in),W(J,H.total_in>>8&255),W(J,H.total_in>>16&255),W(J,H.total_in>>24&255)):(ee(J,H.adler>>>16),ee(J,65535&H.adler)),Q(H),0=Ae.w_size&&(he===0&&(j(Ae.head),Ae.strstart=0,Ae.block_start=0,Ae.insert=0),Y=new o.Buf8(Ae.w_size),o.arraySet(Y,fe,de-Ae.w_size,Ae.w_size,0),fe=Y,de=Ae.w_size),X=H.avail_in,G=H.next_in,ne=H.input,H.avail_in=de,H.next_in=0,H.input=fe,re(Ae);Ae.lookahead>=I;){for(J=Ae.strstart,q=Ae.lookahead-(I-1);Ae.ins_h=(Ae.ins_h<>>=I=S>>>24,w-=I,(I=S>>>16&255)===0)E[A++]=65535&S;else{if(!(16&I)){if(!(64&I)){S=_[(65535&S)+(v&(1<>>=I,w-=I),w<15&&(v+=y[l++]<>>=I=S>>>24,w-=I,!(16&(I=S>>>16&255))){if(!(64&I)){S=x[(65535&S)+(v&(1<>>=I,w-=I,(I=A-u)>3,v&=(1<<(w-=M<<3))-1,s.next_in=l,s.next_out=A,s.avail_in=l>>24&255)+(D>>>8&65280)+((65280&D)<<8)+((255&D)<<24)}function v(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(D){var T;return D&&D.state?(T=D.state,D.total_in=D.total_out=T.total=0,D.msg="",T.wrap&&(D.adler=1&T.wrap),T.mode=d,T.last=0,T.havedict=0,T.dmax=32768,T.head=null,T.hold=0,T.bits=0,T.lencode=T.lendyn=new s.Buf32(m),T.distcode=T.distdyn=new s.Buf32(g),T.sane=1,T.back=-1,f):h}function _(D){var T;return D&&D.state?((T=D.state).wsize=0,T.whave=0,T.wnext=0,w(D)):h}function x(D,T){var y,E;return D&&D.state?(E=D.state,T<0?(y=0,T=-T):(y=1+(T>>4),T<48&&(T&=15)),T&&(T<8||15=F.wsize?(s.arraySet(F.window,T,y-F.wsize,F.wsize,0),F.wnext=0,F.whave=F.wsize):(E<(R=F.wsize-F.wnext)&&(R=E),s.arraySet(F.window,T,y-E,R,F.wnext),(E-=R)?(s.arraySet(F.window,T,y-E,E,0),F.wnext=E,F.whave=F.wsize):(F.wnext+=R,F.wnext===F.wsize&&(F.wnext=0),F.whave>>8&255,y.check=a(y.check,he,2,0),C=Q=0,y.mode=2;break}if(y.flags=0,y.head&&(y.head.done=!1),!(1&y.wrap)||(((255&Q)<<8)+(Q>>8))%31){D.msg="incorrect header check",y.mode=30;break}if((15&Q)!=8){D.msg="unknown compression method",y.mode=30;break}if(C-=4,H=8+(15&(Q>>>=4)),y.wbits===0)y.wbits=H;else if(H>y.wbits){D.msg="invalid window size",y.mode=30;break}y.dmax=1<>8&1),512&y.flags&&(he[0]=255&Q,he[1]=Q>>>8&255,y.check=a(y.check,he,2,0)),C=Q=0,y.mode=3;case 3:for(;C<32;){if(z===0)break e;z--,Q+=E[F++]<>>8&255,he[2]=Q>>>16&255,he[3]=Q>>>24&255,y.check=a(y.check,he,4,0)),C=Q=0,y.mode=4;case 4:for(;C<16;){if(z===0)break e;z--,Q+=E[F++]<>8),512&y.flags&&(he[0]=255&Q,he[1]=Q>>>8&255,y.check=a(y.check,he,2,0)),C=Q=0,y.mode=5;case 5:if(1024&y.flags){for(;C<16;){if(z===0)break e;z--,Q+=E[F++]<>>8&255,y.check=a(y.check,he,2,0)),C=Q=0}else y.head&&(y.head.extra=null);y.mode=6;case 6:if(1024&y.flags&&(z<(P=y.length)&&(P=z),P&&(y.head&&(H=y.head.extra_len-y.length,y.head.extra||(y.head.extra=new Array(y.head.extra_len)),s.arraySet(y.head.extra,E,F,P,H)),512&y.flags&&(y.check=a(y.check,E,P,F)),z-=P,F+=P,y.length-=P),y.length))break e;y.length=0,y.mode=7;case 7:if(2048&y.flags){if(z===0)break e;for(P=0;H=E[F+P++],y.head&&H&&y.length<65536&&(y.head.name+=String.fromCharCode(H)),H&&P>9&1,y.head.done=!0),D.adler=y.check=0,y.mode=12;break;case 10:for(;C<32;){if(z===0)break e;z--,Q+=E[F++]<>>=7&C,C-=7&C,y.mode=27;break}for(;C<3;){if(z===0)break e;z--,Q+=E[F++]<>>=1)){case 0:y.mode=14;break;case 1:if(M(y),y.mode=20,T!==6)break;Q>>>=2,C-=2;break e;case 2:y.mode=17;break;case 3:D.msg="invalid block type",y.mode=30}Q>>>=2,C-=2;break;case 14:for(Q>>>=7&C,C-=7&C;C<32;){if(z===0)break e;z--,Q+=E[F++]<>>16^65535)){D.msg="invalid stored block lengths",y.mode=30;break}if(y.length=65535&Q,C=Q=0,y.mode=15,T===6)break e;case 15:y.mode=16;case 16:if(P=y.length){if(z>>=5,C-=5,y.ndist=1+(31&Q),Q>>>=5,C-=5,y.ncode=4+(15&Q),Q>>>=4,C-=4,286>>=3,C-=3}for(;y.have<19;)y.lens[X[y.have++]]=0;if(y.lencode=y.lendyn,y.lenbits=7,Ae={bits:y.lenbits},fe=c(0,y.lens,0,19,y.lencode,0,y.work,Ae),y.lenbits=Ae.bits,fe){D.msg="invalid code lengths set",y.mode=30;break}y.have=0,y.mode=19;case 19:for(;y.have>>16&255,ie=65535&q,!((le=q>>>24)<=C);){if(z===0)break e;z--,Q+=E[F++]<>>=le,C-=le,y.lens[y.have++]=ie;else{if(ie===16){for(J=le+2;C>>=le,C-=le,y.have===0){D.msg="invalid bit length repeat",y.mode=30;break}H=y.lens[y.have-1],P=3+(3&Q),Q>>>=2,C-=2}else if(ie===17){for(J=le+3;C>>=le)),Q>>>=3,C-=3}else{for(J=le+7;C>>=le)),Q>>>=7,C-=7}if(y.have+P>y.nlen+y.ndist){D.msg="invalid bit length repeat",y.mode=30;break}for(;P--;)y.lens[y.have++]=H}}if(y.mode===30)break;if(y.lens[256]===0){D.msg="invalid code -- missing end-of-block",y.mode=30;break}if(y.lenbits=9,Ae={bits:y.lenbits},fe=c(A,y.lens,0,y.nlen,y.lencode,0,y.work,Ae),y.lenbits=Ae.bits,fe){D.msg="invalid literal/lengths set",y.mode=30;break}if(y.distbits=6,y.distcode=y.distdyn,Ae={bits:y.distbits},fe=c(u,y.lens,y.nlen,y.ndist,y.distcode,0,y.work,Ae),y.distbits=Ae.bits,fe){D.msg="invalid distances set",y.mode=30;break}if(y.mode=20,T===6)break e;case 20:y.mode=21;case 21:if(6<=z&&258<=j){D.next_out=O,D.avail_out=j,D.next_in=F,D.avail_in=z,y.hold=Q,y.bits=C,l(D,ee),O=D.next_out,R=D.output,j=D.avail_out,F=D.next_in,E=D.input,z=D.avail_in,Q=y.hold,C=y.bits,y.mode===12&&(y.back=-1);break}for(y.back=0;me=(q=y.lencode[Q&(1<>>16&255,ie=65535&q,!((le=q>>>24)<=C);){if(z===0)break e;z--,Q+=E[F++]<>ge)])>>>16&255,ie=65535&q,!(ge+(le=q>>>24)<=C);){if(z===0)break e;z--,Q+=E[F++]<>>=ge,C-=ge,y.back+=ge}if(Q>>>=le,C-=le,y.back+=le,y.length=ie,me===0){y.mode=26;break}if(32&me){y.back=-1,y.mode=12;break}if(64&me){D.msg="invalid literal/length code",y.mode=30;break}y.extra=15&me,y.mode=22;case 22:if(y.extra){for(J=y.extra;C>>=y.extra,C-=y.extra,y.back+=y.extra}y.was=y.length,y.mode=23;case 23:for(;me=(q=y.distcode[Q&(1<>>16&255,ie=65535&q,!((le=q>>>24)<=C);){if(z===0)break e;z--,Q+=E[F++]<>ge)])>>>16&255,ie=65535&q,!(ge+(le=q>>>24)<=C);){if(z===0)break e;z--,Q+=E[F++]<>>=ge,C-=ge,y.back+=ge}if(Q>>>=le,C-=le,y.back+=le,64&me){D.msg="invalid distance code",y.mode=30;break}y.offset=ie,y.extra=15&me,y.mode=24;case 24:if(y.extra){for(J=y.extra;C>>=y.extra,C-=y.extra,y.back+=y.extra}if(y.offset>y.dmax){D.msg="invalid distance too far back",y.mode=30;break}y.mode=25;case 25:if(j===0)break e;if(P=ee-j,y.offset>P){if((P=y.offset-P)>y.whave&&y.sane){D.msg="invalid distance too far back",y.mode=30;break}re=P>y.wnext?(P-=y.wnext,y.wsize-P):y.wnext-P,P>y.length&&(P=y.length),ue=y.window}else ue=R,re=O-y.offset,P=y.length;for(jB?(I=re[ue+g[T]],C[W+g[T]]):(I=96,0),v=1<>O)+(w-=v)]=S<<24|I<<16|M|0,w!==0;);for(v=1<>=1;if(v!==0?(Q&=v-1,Q+=v):Q=0,T++,--ee[D]==0){if(D===E)break;D=u[f+g[T]]}if(R>>7)]}function W(q,he){q.pending_buf[q.pending++]=255&he,q.pending_buf[q.pending++]=he>>>8&255}function ee(q,he,X){q.bi_valid>p-X?(q.bi_buf|=he<>p-q.bi_valid,q.bi_valid+=X-p):(q.bi_buf|=he<>>=1,X<<=1,0<--he;);return X>>>1}function ue(q,he,X){var G,ne,Y=new Array(g+1),de=0;for(G=1;G<=g;G++)Y[G]=de=de+X[G-1]<<1;for(ne=0;ne<=he;ne++){var ae=q[2*ne+1];ae!==0&&(q[2*ne]=re(Y[ae]++,ae))}}function le(q){var he;for(he=0;he>1;1<=X;X--)ge(q,Y,X);for(ne=Ee;X=q.heap[1],q.heap[1]=q.heap[q.heap_len--],ge(q,Y,1),G=q.heap[1],q.heap[--q.heap_max]=X,q.heap[--q.heap_max]=G,Y[2*ne]=Y[2*X]+Y[2*G],q.depth[ne]=(q.depth[X]>=q.depth[G]?q.depth[X]:q.depth[G])+1,Y[2*X+1]=Y[2*G+1]=ne,q.heap[1]=ne++,ge(q,Y,1),2<=q.heap_len;);q.heap[--q.heap_max]=q.heap[1],function(U,N){var K,oe,pe,ve,Ce,Le,Re=N.dyn_tree,$e=N.max_code,ce=N.stat_desc.static_tree,Pe=N.stat_desc.has_stree,Se=N.stat_desc.extra_bits,Te=N.stat_desc.extra_base,Fe=N.stat_desc.max_length,De=0;for(ve=0;ve<=g;ve++)U.bl_count[ve]=0;for(Re[2*U.heap[U.heap_max]+1]=0,K=U.heap_max+1;K>=7;ne>>=1)if(1&V&&ae.dyn_ltree[2*Ee]!==0)return o;if(ae.dyn_ltree[18]!==0||ae.dyn_ltree[20]!==0||ae.dyn_ltree[26]!==0)return a;for(Ee=32;Ee>>3,(Y=q.static_len+3+7>>>3)<=ne&&(ne=Y)):ne=Y=X+5,X+4<=ne&&he!==-1?J(q,he,X,G):q.strategy===4||Y===ne?(ee(q,2+(G?1:0),3),_e(q,L,D)):(ee(q,4+(G?1:0),3),function(ae,Ee,V,U){var N;for(ee(ae,Ee-257,5),ee(ae,V-1,5),ee(ae,U-4,4),N=0;N>>8&255,q.pending_buf[q.d_buf+2*q.last_lit+1]=255&he,q.pending_buf[q.l_buf+q.last_lit]=255&X,q.last_lit++,he===0?q.dyn_ltree[2*X]++:(q.matches++,he--,q.dyn_ltree[2*(y[X]+u+1)]++,q.dyn_dtree[2*C(he)]++),q.last_lit===q.lit_bufsize-1},i._tr_align=function(q){ee(q,2,3),P(q,w,L),function(he){he.bi_valid===16?(W(he,he.bi_buf),he.bi_buf=0,he.bi_valid=0):8<=he.bi_valid&&(he.pending_buf[he.pending++]=255&he.bi_buf,he.bi_buf>>=8,he.bi_valid-=8)}(q)}},{"../utils/common":41}],53:[function(t,r,i){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,r,i){(function(s){(function(o,a){if(!o.setImmediate){var l,c,A,u,f=1,h={},d=!1,m=o.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(o);g=g&&g.setTimeout?g:o,l={}.toString.call(o.process)==="[object process]"?function(_){process.nextTick(function(){v(_)})}:function(){if(o.postMessage&&!o.importScripts){var _=!0,x=o.onmessage;return o.onmessage=function(){_=!1},o.postMessage("","*"),o.onmessage=x,_}}()?(u="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",w,!1):o.attachEvent("onmessage",w),function(_){o.postMessage(u+_,"*")}):o.MessageChannel?((A=new MessageChannel).port1.onmessage=function(_){v(_.data)},function(_){A.port2.postMessage(_)}):m&&"onreadystatechange"in m.createElement("script")?(c=m.documentElement,function(_){var x=m.createElement("script");x.onreadystatechange=function(){v(_),x.onreadystatechange=null,c.removeChild(x),x=null},c.appendChild(x)}):function(_){setTimeout(v,0,_)},g.setImmediate=function(_){typeof _!="function"&&(_=new Function(""+_));for(var x=new Array(arguments.length-1),b=0;b"u"?s===void 0?this:s:self)}).call(this,typeof ka<"u"?ka:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(cV);var rve=cV.exports;const ive=oc(rve);class ep{constructor(){this.zipContainer={}}addData(e,t,r,i=""){i==""&&(i="_"),this.zipContainer[i]==null&&(this.zipContainer[i]=[]),this.zipContainer[i].push({data:e,name:t,extension:r})}saveZip(e,t=!0){const r=this.zipContainer,i=new ive;for(const s in r)if(s=="_")r[s].forEach((o,a)=>{i.file(o.name+"."+o.extension,o.data,{base64:!0})});else{const o=i.folder(s);r[s].forEach((a,l)=>{const c=a.extension!="txt";o.file(a.name+"."+a.extension,a.data,{base64:c})})}i.generateAsync({type:"blob"}).then(s=>{this._saveZipFile(s,e+".zip")}),t&&(this.zipContainer={})}_saveZipFile(e,t){const r=new Blob([e],{type:"application/zip"});if(typeof window.navigator.msSaveBlob<"u")window.navigator.msSaveBlob(r,t);else{const i=document.createElement("a");typeof i.download=="string"?(document.body.appendChild(i),i.download=t,i.href=URL.createObjectURL(r),i.click(),document.body.removeChild(i)):window.open(e,"_blank").document.write(""+t+"")}}}class sve{constructor(e){Ne(this,"screenshotManager");this.characterManager=e,this.screenshotManager=e.screenshotManager,this.blinkManager=e.blinkManager,this.animationManager=this.characterManager.animationManager,this.temptime=0}get vrms(){return Object.values(this.characterManager.avatar).map(e=>e.vrm)}async createLoraData(e,t=null,r=""){const i=e.manifest,s=e.name?"loraData/"+e.name:"loraData",o=await this._fetchManifest(i),{assetsLocation:a="",animationsDirectory:l="",backgroundGrayscale:c=1,backgroundDescription:A="",width:u=512,height:f=512,dataCollection:h}=o,d=a+l+"/";this.screenshotManager.setBackground([c,c,c]),this.blinkManager.enableScreenshot(),await this.screenshotManager.cameraFrameManager.calculateBoneOffsets(this.characterManager.characterModel,.2);let m=0;const g=this;if(Array.isArray(h)){const p=t??new ep;await(async()=>{if(Array.isArray(h))for(let w=0;w{var E;(E=y.springBoneManager)==null||E.reset()});const D=h2(B);g.screenshotManager.cameraFrameManager.setCameraFrameWithName(S,D);const T=g.screenshotManager.getImageData(u,f,!1);p.addData(T,M,"png",s),p.addData("anata "+I+" "+A,M,"txt",s)}})(),t==null&&(r==""&&(r="lora_zip"),p.saveZip(r))}this.blinkManager.disableScreenshot()}async _fetchManifest(e){return await(await fetch(e)).json()}}class ove{constructor(e){Ne(this,"screenshotManager");this.characterManager=e,this.screenshotManager=e.screenshotManager,this.blinkManager=e.blinkManager,this.animationManager=this.characterManager.animationManager}async createSpriteAtlas(e,t=null,r=""){const i=e.manifest,s=e.name?"spriteData/"+e.name:"spriteData",o=await this._fetchManifest(i),{assetsLocation:a="",animationsDirectory:l="",backgroundColor:c=[1,1,1,1],screenshotOffset:A,topFrameOffset:u=.1,bottomFrameOffset:f=.1,pixelStyleSize:h,atlasWidth:d=512,atlasHeight:m=512,spritesCollection:g}=o,p=a+l+"/";this.screenshotManager.cameraFrameManager.setBottomFrameOffset(f),this.screenshotManager.cameraFrameManager.setTopFrameOffset(u),this.screenshotManager.setBackground(c),this.blinkManager.enableScreenshot(),await this.screenshotManager.cameraFrameManager.calculateBoneOffsets(this.characterManager.characterModel,.2);let v=0;const w=this;if(Array.isArray(g)){const _=t??new ep;await(async()=>{if(Array.isArray(g))for(const b of g){const{animationName:B,animationPath:S,framesNumber:I,lookAtCamera:M,expression:L,cameraPosition:D,cameraFrame:T}=b;v++;const y=s+"/"+(B||v.toString().padStart(2,"0"));await w.animationManager.loadAnimation(p+S,!0,0);const E=h2(D);w.screenshotManager.cameraFrameManager.setCameraFrameWithName(T,E);const F=w.animationManager.getCurrentClipDuration()/I;for(let O=0;O{for(const b of m){const{traitGroup:B,cameraPosition:S="front",bottomBoneName:I,bottomBoneMaxVertex:M=!1,topBoneName:L,topBoneMaxVertex:D=!0,groupTopOffset:T,groupBotomOffset:y,cameraFrame:E,saveOnlyIDs:R}=b;if((!I||!L)&&(E||console.warn("missing bonename info or camera frame. Skipping")),!B){console.warn("missing trait group for thumbnail info. Skipping");continue}const F=()=>{const j=[];return ut(R).forEach(C=>{j.push({id:C})}),j},O=R==null?v.characterManager.getTraits(B):F();if(O==null){console.log("SKipping Thumbnail Generation for trait group "+B+", its not present in the character manifest.");continue}const z=h2(S);E?v.screenshotManager.cameraFrameManager.setCameraFrameWithName(E,z):v.screenshotManager.cameraFrameManager.frameShot(I,L,z,M,D);for(let j=0;j{}}),lve=n=>{const[e,t]=be.useState(null),[r,i]=be.useState(null),[s,o]=be.useState(null),[a,l]=be.useState(null),[c,A]=be.useState(null),[u,f]=be.useState(null),[h,d]=be.useState(null),[m,g]=be.useState(null),[p,v]=be.useState(null),[w,_]=be.useState(null),[x,b]=be.useState(null),[B,S]=be.useState(null),[I,M]=be.useState(!1);let L=!1,[D,T]=be.useState(!1);be.useEffect(()=>{if(L||D)return;T(!0),L=!0;const{scene:F,camera:O,controls:z,characterManager:j,sceneElements:Q}=nve("editor-scene");_(O),v(F),t(j),f(Q),d(j.animationManager),g(j.lookAtManager),l(j.overlayedTextureManager),b(z),i(new sve(j)),o(new ove(j)),A(new ave(j))},[]);const y=F=>{F==null&&(F=!I),M(F),p.traverse(O=>{O.isMesh&&O.setDebugMode&&O.setDebugMode(F)})};be.useEffect(()=>{if(B!=null&&B.defaultAnimations){const F=B.defaultAnimations.map(O=>O.location);h.storeDefaultAnimationPaths(F,"")}},[B]);const E=F=>{F?p.add(u):p.remove(u)},R=F=>{x&&(KS.to(x.target,{x:F.targetX??0,y:F.targetY??0,z:F.targetZ??0,duration:1}),KS.fromTo(x,{maxDistance:x.getDistance(),minDistance:x.getDistance(),minPolarAngle:x.getPolarAngle(),maxPolarAngle:x.getPolarAngle(),minAzimuthAngle:x.getAzimuthalAngle(),maxAzimuthAngle:x.getAzimuthalAngle()},{maxDistance:F.distance,minDistance:F.distance,minPolarAngle:Math.PI/2-.11,maxPolarAngle:Math.PI/2-.11,minAzimuthAngle:-.78,maxAzimuthAngle:-.78,duration:1}).then(()=>{x.minPolarAngle=0,x.maxPolarAngle=3.1415,x.minDistance=.5,x.maxDistance=10,x.minAzimuthAngle=1/0,x.maxAzimuthAngle=1/0}))};return k.jsx($n.Provider,{value:{manifest:B,setManifest:S,scene:p,decalManager:a,characterManager:e,loraDataGenerator:r,spriteAtlasGenerator:s,thumbnailsGenerator:c,showEnvironmentModels:E,debugMode:I,toggleDebugMode:y,animationManager:h,lookAtManager:m,camera:w,moveCamera:R,controls:x,sceneElements:u},children:n.children})},cve={NORMAL:"NORMAL",AR:"AR",AR_FRONT:"AR_FRONT",VR:"VR"},wt={LANDING:"LANDING",CREATE:"CREATE",CLAIM:"CLAIM",LOAD:"LOAD",APPEARANCE:"APPEARANCE",BATCHDOWNLOAD:"BATCHDOWNLOAD",SAVE:"SAVE",MINT:"MINT",OPTIMIZER:"OPTIMIZER",BATCHMANIFEST:"BATCHMANIFEST",WALLET:"WALLET"},us=Z.createContext(),Ave=n=>{const[e,t]=Z.useState(cve.NORMAL),[r,i]=Z.useState(wt.LANDING),[s,o]=Z.useState(!1),[a,l]=Z.useState(!1);return k.jsx(us.Provider,{value:{viewMode:r,setViewMode:i,isLoading:s,setIsLoading:o,mouseIsOverUI:a,setMouseIsOverUI:l,currentCameraMode:e,setCurrentCameraMode:t},children:n.children})},uve="modulepreload",fve=function(n){return"/"+n},ZO={},hve=function(e,t,r){if(!t||t.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(t.map(s=>{if(s=fve(s),s in ZO)return;ZO[s]=!0;const o=s.endsWith(".css"),a=o?'[rel="stylesheet"]':"";if(!!r)for(let A=i.length-1;A>=0;A--){const u=i[A];if(u.href===s&&(!o||u.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${s}"]${a}`))return;const c=document.createElement("link");if(c.rel=o?"stylesheet":uve,o||(c.as="script",c.crossOrigin=""),c.href=s,document.head.appendChild(c),o)return new Promise((A,u)=>{c.addEventListener("load",A),c.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${s}`)))})})).then(()=>e()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})};function ax(){return ax=Object.assign?Object.assign.bind():function(n){for(var e=1;e=0)continue;t[r]=n[r]}return t}function pve(n){be.useEffect(n,[])}var mve=["id","volume","playbackRate","soundEnabled","interrupt","onload"];function gve(n,e){var t=e===void 0?{}:e,r=t.volume,i=r===void 0?1:r,s=t.playbackRate,o=s===void 0?1:s,a=t.soundEnabled,l=a===void 0?!0:a,c=t.interrupt,A=c===void 0?!1:c,u=t.onload,f=dve(t,mve),h=Z.useRef(null),d=Z.useRef(!1),m=Z.useState(null),g=m[0],p=m[1],v=Z.useState(null),w=v[0],_=v[1],x=function(){typeof u=="function"&&u.call(this),d.current&&p(this.duration()*1e3),_(this)};pve(function(){return hve(()=>import("./howler-2fc2b25b.js").then(M=>M.h),[]).then(function(M){if(!d.current){var L;h.current=(L=M.Howl)!==null&&L!==void 0?L:M.default.Howl,d.current=!0,new h.current(ax({src:Array.isArray(n)?n:[n],volume:i,rate:o,onload:x},f))}}),function(){d.current=!1}}),Z.useEffect(function(){h.current&&w&&_(new h.current(ax({src:Array.isArray(n)?n:[n],volume:i,onload:x},f)))},[JSON.stringify(n)]),Z.useEffect(function(){w&&(w.volume(i),w.rate(o))},[i,o]);var b=Z.useCallback(function(M){typeof M>"u"&&(M={}),!(!w||!l&&!M.forceSoundEnabled)&&(A&&w.stop(),M.playbackRate&&w.rate(M.playbackRate),w.play(M.id))},[w,l,A]),B=Z.useCallback(function(M){w&&w.stop(M)},[w]),S=Z.useCallback(function(M){w&&w.pause(M)},[w]),I=[b,{sound:w,stop:B,pause:S,duration:g}];return I}const vve=[{name:"background/cc_bgm.wav",offset:0,duration:123458.58333333334},{name:"background/cc_bgm_balanced.wav",offset:123458.58333333334,duration:123458.60416666666},{name:"effect/character-load.wav",offset:246917.1875,duration:3030},{name:"effect/class-select.wav",offset:249947.1875,duration:2780},{name:"effect/switchingItem.wav",offset:252727.1875,duration:623.75},{name:"ui/back-next-button.wav",offset:253350.9375,duration:155.02083333333334},{name:"ui/class-mouse-over.wav",offset:253505.95833333334,duration:217.52083333333334},{name:"ui/class_click.wav",offset:253723.4791666667,duration:3123.75},{name:"ui/class_pass.wav",offset:256847.2291666667,duration:155},{name:"ui/option_click.wav",offset:257002.2291666667,duration:155.02083333333334},{name:"ui/randomize-button.wav",offset:257157.25000000003,duration:342.5208333333333},{name:"ui/section_click.wav",offset:257499.77083333337,duration:155}],yve="/assets/sounds-3322d50e.mp3",Co=be.createContext(),wve=n=>{const e=i=>vve.find(s=>i.test(s.name)),[t]=gve(yve,{sprite:{switchItem:[e(/switchingItem/).offset,e(/switchingItem/).duration],classSelect:[e(/class-select/).offset,e(/class-select/).duration],characterLoad:[e(/character-load/).offset,e(/character-load/).duration],randomizeButton:[e(/randomize-button/).offset,e(/randomize-button/).duration],classMouseOver:[e(/class-mouse-over/).offset,e(/class-mouse-over/).duration],backNextButton:[e(/back-next-button/).offset,e(/back-next-button/).duration]}}),r=(i,s=0)=>{s===0?t({id:i}):setTimeout(()=>{t({id:i})},s)};return k.jsx(Co.Provider,{value:{playSound:r},children:n.children})};function Ns(n){"@babel/helpers - typeof";return Ns=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ns(n)}function To(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function _ve(n,e){if(Ns(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(Ns(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function AV(n){var e=_ve(n,"string");return Ns(e)=="symbol"?e:e+""}function JO(n,e){for(var t=0;tn.length)&&(e=n.length);for(var t=0,r=Array(e);t1&&arguments[1]!==void 0?arguments[1]:{};To(this,n),this.init(e,t)}return Io(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=r.prefix||"i18next:",this.logger=t||Eve,this.options=r,this.debug=r.debug}},{key:"setDebug",value:function(t){this.debug=t}},{key:"log",value:function(){for(var t=arguments.length,r=new Array(t),i=0;i1?r-1:0),s=1;s-1?a.replace(/###/g,"."):a}function i(){return!n||typeof n=="string"}for(var s=typeof e!="string"?[].concat(e):e.split(".");s.length>1;){if(i())return{};var o=r(s.shift());!n[o]&&t&&(n[o]=new t),Object.prototype.hasOwnProperty.call(n,o)?n=n[o]:n={}}return i()?{}:{obj:n,k:r(s.shift())}}function r3(n,e,t){var r=v2(n,e,Object),i=r.obj,s=r.k;i[s]=t}function Sve(n,e,t,r){var i=v2(n,e,Object),s=i.obj,o=i.k;s[o]=s[o]||[],r&&(s[o]=s[o].concat(t)),r||s[o].push(t)}function lx(n,e){var t=v2(n,e),r=t.obj,i=t.k;if(r)return r[i]}function Cve(n,e,t){var r=lx(n,t);return r!==void 0?r:lx(e,t)}function dV(n,e,t){for(var r in e)r!=="__proto__"&&r!=="constructor"&&(r in n?typeof n[r]=="string"||n[r]instanceof String||typeof e[r]=="string"||e[r]instanceof String?t&&(n[r]=e[r]):dV(n[r],e[r],t):n[r]=e[r]);return n}function Vf(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var Tve={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Ive(n){return typeof n=="string"?n.replace(/[&<>"'\/]/g,function(e){return Tve[e]}):n}var N1=typeof window<"u"&&window.navigator&&typeof window.navigator.userAgentData>"u"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,Rve=[" ",",","?","!",";"];function Uve(n,e,t){e=e||"",t=t||"";var r=Rve.filter(function(a){return e.indexOf(a)<0&&t.indexOf(a)<0});if(r.length===0)return!0;var i=new RegExp("(".concat(r.map(function(a){return a==="?"?"\\?":a}).join("|"),")")),s=!i.test(n);if(!s){var o=n.indexOf(t);o>0&&!i.test(n.substring(0,o))&&(s=!0)}return s}function cx(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(n){if(n[e])return n[e];for(var r=e.split(t),i=n,s=0;ss+o;)o++,a=r.slice(s,s+o).join(t),l=i[a];if(l===void 0)return;if(l===null)return null;if(e.endsWith(a)){if(typeof l=="string")return l;if(a&&typeof l[a]=="string")return l[a]}var c=r.slice(s+o).join(t);return c?cx(l,c,t):void 0}i=i[r[s]]}return i}}function i3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Oy(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Lve=function(n){D1(t,n);var e=Fve(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return To(this,t),i=e.call(this),N1&&bA.call(dA(i)),i.data=r||{},i.options=s,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.options.ignoreJSONStructure===void 0&&(i.options.ignoreJSONStructure=!0),i}return Io(t,[{key:"addNamespaces",value:function(i){this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}},{key:"removeNamespaces",value:function(i){var s=this.options.ns.indexOf(i);s>-1&&this.options.ns.splice(s,1)}},{key:"getResource",value:function(i,s,o){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},l=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,c=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure,A=[i,s];o&&typeof o!="string"&&(A=A.concat(o)),o&&typeof o=="string"&&(A=A.concat(l?o.split(l):o)),i.indexOf(".")>-1&&(A=i.split("."));var u=lx(this.data,A);return u||!c||typeof o!="string"?u:cx(this.data&&this.data[i]&&this.data[i][s],o,l)}},{key:"addResource",value:function(i,s,o,a){var l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1},c=l.keySeparator!==void 0?l.keySeparator:this.options.keySeparator,A=[i,s];o&&(A=A.concat(c?o.split(c):o)),i.indexOf(".")>-1&&(A=i.split("."),a=s,s=A[1]),this.addNamespaces(s),r3(this.data,A,a),l.silent||this.emit("added",i,s,o,a)}},{key:"addResources",value:function(i,s,o){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(var l in o)(typeof o[l]=="string"||Object.prototype.toString.apply(o[l])==="[object Array]")&&this.addResource(i,s,l,o[l],{silent:!0});a.silent||this.emit("added",i,s,o)}},{key:"addResourceBundle",value:function(i,s,o,a,l){var c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},A=[i,s];i.indexOf(".")>-1&&(A=i.split("."),a=o,o=s,s=A[1]),this.addNamespaces(s);var u=lx(this.data,A)||{};a?dV(u,o,l):u=Oy(Oy({},u),o),r3(this.data,A,u),c.silent||this.emit("added",i,s,o)}},{key:"removeResourceBundle",value:function(i,s){this.hasResourceBundle(i,s)&&delete this.data[i][s],this.removeNamespaces(s),this.emit("removed",i,s)}},{key:"hasResourceBundle",value:function(i,s){return this.getResource(i,s)!==void 0}},{key:"getResourceBundle",value:function(i,s){return s||(s=this.options.defaultNS),this.options.compatibilityAPI==="v1"?Oy(Oy({},{}),this.getResource(i,s)):this.getResource(i,s)}},{key:"getDataByLanguage",value:function(i){return this.data[i]}},{key:"hasLanguageSomeTranslations",value:function(i){var s=this.getDataByLanguage(i),o=s&&Object.keys(s)||[];return!!o.find(function(a){return s[a]&&Object.keys(s[a]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),t}(bA),pV={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,r,i,s){var o=this;return e.forEach(function(a){o.processors[a]&&(t=o.processors[a].process(t,r,i,s))}),t}};function s3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function pi(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var o3={},a3=function(n){D1(t,n);var e=Dve(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return To(this,t),i=e.call(this),N1&&bA.call(dA(i)),Mve(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,dA(i)),i.options=s,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.logger=za.create("translator"),i}return Io(t,[{key:"changeLanguage",value:function(i){i&&(this.language=i)}},{key:"exists",value:function(i){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(i==null)return!1;var o=this.resolve(i,s);return o&&o.res!==void 0}},{key:"extractFromKey",value:function(i,s){var o=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");var a=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,l=s.ns||this.options.defaultNS||[],c=o&&i.indexOf(o)>-1,A=!this.options.userDefinedKeySeparator&&!s.keySeparator&&!this.options.userDefinedNsSeparator&&!s.nsSeparator&&!Uve(i,o,a);if(c&&!A){var u=i.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:i,namespaces:l};var f=i.split(o);(o!==a||o===a&&this.options.ns.indexOf(f[0])>-1)&&(l=f.shift()),i=f.join(a)}return typeof l=="string"&&(l=[l]),{key:i,namespaces:l}}},{key:"translate",value:function(i,s,o){var a=this;if(Ns(s)!=="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),Ns(s)==="object"&&(s=pi({},s)),s||(s={}),i==null)return"";Array.isArray(i)||(i=[String(i)]);var l=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,c=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,A=this.extractFromKey(i[i.length-1],s),u=A.key,f=A.namespaces,h=f[f.length-1],d=s.lng||this.language,m=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&d.toLowerCase()==="cimode"){if(m){var g=s.nsSeparator||this.options.nsSeparator;return l?{res:"".concat(h).concat(g).concat(u),usedKey:u,exactUsedKey:u,usedLng:d,usedNS:h}:"".concat(h).concat(g).concat(u)}return l?{res:u,usedKey:u,exactUsedKey:u,usedLng:d,usedNS:h}:u}var p=this.resolve(i,s),v=p&&p.res,w=p&&p.usedKey||u,_=p&&p.exactUsedKey||u,x=Object.prototype.toString.apply(v),b=["[object Number]","[object Function]","[object RegExp]"],B=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,S=!this.i18nFormat||this.i18nFormat.handleAsObject,I=typeof v!="string"&&typeof v!="boolean"&&typeof v!="number";if(S&&v&&I&&b.indexOf(x)<0&&!(typeof B=="string"&&x==="[object Array]")){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var M=this.options.returnedObjectHandler?this.options.returnedObjectHandler(w,v,pi(pi({},s),{},{ns:f})):"key '".concat(u," (").concat(this.language,")' returned an object instead of string.");return l?(p.res=M,p):M}if(c){var L=x==="[object Array]",D=L?[]:{},T=L?_:w;for(var y in v)if(Object.prototype.hasOwnProperty.call(v,y)){var E="".concat(T).concat(c).concat(y);D[y]=this.translate(E,pi(pi({},s),{joinArrays:!1,ns:f})),D[y]===E&&(D[y]=v[y])}v=D}}else if(S&&typeof B=="string"&&x==="[object Array]")v=v.join(B),v&&(v=this.extendTranslation(v,i,s,o));else{var R=!1,F=!1,O=s.count!==void 0&&typeof s.count!="string",z=t.hasDefaultValue(s),j=O?this.pluralResolver.getSuffix(d,s.count,s):"",Q=s["defaultValue".concat(j)]||s.defaultValue;!this.isValidLookup(v)&&z&&(R=!0,v=Q),this.isValidLookup(v)||(F=!0,v=u);var C=s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,W=C&&F?void 0:v,ee=z&&Q!==v&&this.options.updateMissing;if(F||R||ee){if(this.logger.log(ee?"updateKey":"missingKey",d,h,u,ee?Q:v),c){var P=this.resolve(u,pi(pi({},s),{},{keySeparator:!1}));P&&P.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var re=[],ue=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ue&&ue[0])for(var le=0;le1&&arguments[1]!==void 0?arguments[1]:{},a,l,c,A,u;return typeof i=="string"&&(i=[i]),i.forEach(function(f){if(!s.isValidLookup(a)){var h=s.extractFromKey(f,o),d=h.key;l=d;var m=h.namespaces;s.options.fallbackNS&&(m=m.concat(s.options.fallbackNS));var g=o.count!==void 0&&typeof o.count!="string",p=g&&!o.ordinal&&o.count===0&&s.pluralResolver.shouldUseIntlApi(),v=o.context!==void 0&&(typeof o.context=="string"||typeof o.context=="number")&&o.context!=="",w=o.lngs?o.lngs:s.languageUtils.toResolveHierarchy(o.lng||s.language,o.fallbackLng);m.forEach(function(_){s.isValidLookup(a)||(u=_,!o3["".concat(w[0],"-").concat(_)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(u)&&(o3["".concat(w[0],"-").concat(_)]=!0,s.logger.warn('key "'.concat(l,'" for languages "').concat(w.join(", "),`" won't get resolved as namespace "`).concat(u,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),w.forEach(function(x){if(!s.isValidLookup(a)){A=x;var b=[d];if(s.i18nFormat&&s.i18nFormat.addLookupKeys)s.i18nFormat.addLookupKeys(b,d,x,_,o);else{var B;g&&(B=s.pluralResolver.getSuffix(x,o.count,o));var S="".concat(s.options.pluralSeparator,"zero");if(g&&(b.push(d+B),p&&b.push(d+S)),v){var I="".concat(d).concat(s.options.contextSeparator).concat(o.context);b.push(I),g&&(b.push(I+B),p&&b.push(I+S))}}for(var M;M=b.pop();)s.isValidLookup(a)||(c=M,a=s.getResource(x,_,M,o))}}))})}}),{res:a,usedKey:l,exactUsedKey:c,usedLng:A,usedNS:u}}},{key:"isValidLookup",value:function(i){return i!==void 0&&!(!this.options.returnNull&&i===null)&&!(!this.options.returnEmptyString&&i==="")}},{key:"getResource",value:function(i,s,o){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(i,s,o,a):this.resourceStore.getResource(i,s,o,a)}}],[{key:"hasDefaultValue",value:function(i){var s="defaultValue";for(var o in i)if(Object.prototype.hasOwnProperty.call(i,o)&&s===o.substring(0,s.length)&&i[o]!==void 0)return!0;return!1}}]),t}(bA);function aM(n){return n.charAt(0).toUpperCase()+n.slice(1)}var l3=function(){function n(e){To(this,n),this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=za.create("languageUtils")}return Io(n,[{key:"getScriptPartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return null;var r=t.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}},{key:"getLanguagePartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return t;var r=t.split("-");return this.formatLanguageCode(r[0])}},{key:"formatLanguageCode",value:function(t){if(typeof t=="string"&&t.indexOf("-")>-1){var r=["hans","hant","latn","cyrl","cans","mong","arab"],i=t.split("-");return this.options.lowerCaseLng?i=i.map(function(s){return s.toLowerCase()}):i.length===2?(i[0]=i[0].toLowerCase(),i[1]=i[1].toUpperCase(),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=aM(i[1].toLowerCase()))):i.length===3&&(i[0]=i[0].toLowerCase(),i[1].length===2&&(i[1]=i[1].toUpperCase()),i[0]!=="sgn"&&i[2].length===2&&(i[2]=i[2].toUpperCase()),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=aM(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=aM(i[2].toLowerCase()))),i.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}},{key:"isSupportedCode",value:function(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}},{key:"getBestMatchFromCodes",value:function(t){var r=this;if(!t)return null;var i;return t.forEach(function(s){if(!i){var o=r.formatLanguageCode(s);(!r.options.supportedLngs||r.isSupportedCode(o))&&(i=o)}}),!i&&this.options.supportedLngs&&t.forEach(function(s){if(!i){var o=r.getLanguagePartFromCode(s);if(r.isSupportedCode(o))return i=o;i=r.options.supportedLngs.find(function(a){if(a===o)return a;if(!(a.indexOf("-")<0&&o.indexOf("-")<0)&&a.indexOf(o)===0)return a})}}),i||(i=this.getFallbackCodes(this.options.fallbackLng)[0]),i}},{key:"getFallbackCodes",value:function(t,r){if(!t)return[];if(typeof t=="function"&&(t=t(r)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!r)return t.default||[];var i=t[r];return i||(i=t[this.getScriptPartFromCode(r)]),i||(i=t[this.formatLanguageCode(r)]),i||(i=t[this.getLanguagePartFromCode(r)]),i||(i=t.default),i||[]}},{key:"toResolveHierarchy",value:function(t,r){var i=this,s=this.getFallbackCodes(r||this.options.fallbackLng||[],t),o=[],a=function(c){c&&(i.isSupportedCode(c)?o.push(c):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(c)))};return typeof t=="string"&&t.indexOf("-")>-1?(this.options.load!=="languageOnly"&&a(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&a(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&a(this.getLanguagePartFromCode(t))):typeof t=="string"&&a(this.formatLanguageCode(t)),s.forEach(function(l){o.indexOf(l)<0&&a(i.formatLanguageCode(l))}),o}}]),n}(),Ove=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],kve={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}},Qve=["v1","v2","v3"],c3={zero:0,one:1,two:2,few:3,many:4,other:5};function Hve(){var n={};return Ove.forEach(function(e){e.lngs.forEach(function(t){n[t]={numbers:e.nr,plurals:kve[e.fc]}})}),n}var zve=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};To(this,n),this.languageUtils=e,this.options=t,this.logger=za.create("pluralResolver"),(!this.options.compatibilityJSON||this.options.compatibilityJSON==="v4")&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=Hve()}return Io(n,[{key:"addRule",value:function(t,r){this.rules[t]=r}},{key:"getRule",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(t,{type:r.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}},{key:"needsPlural",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(t,r);return this.shouldUseIntlApi()?i&&i.resolvedOptions().pluralCategories.length>1:i&&i.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(t,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,i).map(function(s){return"".concat(r).concat(s)})}},{key:"getSuffixes",value:function(t){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=this.getRule(t,i);return s?this.shouldUseIntlApi()?s.resolvedOptions().pluralCategories.sort(function(o,a){return c3[o]-c3[a]}).map(function(o){return"".concat(r.options.prepend).concat(o)}):s.numbers.map(function(o){return r.getSuffix(t,o,i)}):[]}},{key:"getSuffix",value:function(t,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=this.getRule(t,i);return s?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(s.select(r)):this.getSuffixRetroCompatible(s,r):(this.logger.warn("no plural rule found for: ".concat(t)),"")}},{key:"getSuffixRetroCompatible",value:function(t,r){var i=this,s=t.noAbs?t.plurals(r):t.plurals(Math.abs(r)),o=t.numbers[s];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(o===2?o="plural":o===1&&(o=""));var a=function(){return i.options.prepend&&o.toString()?i.options.prepend+o.toString():o.toString()};return this.options.compatibilityJSON==="v1"?o===1?"":typeof o=="number"?"_plural_".concat(o.toString()):a():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?a():this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString()}},{key:"shouldUseIntlApi",value:function(){return!Qve.includes(this.options.compatibilityJSON)}}]),n}();function A3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ko(n){for(var e=1;e3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=Cve(n,e,t);return!s&&i&&typeof t=="string"&&(s=cx(n,t,r),s===void 0&&(s=cx(e,t,r))),s}var Gve=function(){function n(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};To(this,n),this.logger=za.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||function(t){return t},this.init(e)}return Io(n,[{key:"init",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});var r=t.interpolation;this.escape=r.escape!==void 0?r.escape:Ive,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?Vf(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?Vf(r.suffix):r.suffixEscaped||"}}",this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||",",this.unescapePrefix=r.unescapeSuffix?"":r.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":r.unescapeSuffix||"",this.nestingPrefix=r.nestingPrefix?Vf(r.nestingPrefix):r.nestingPrefixEscaped||Vf("$t("),this.nestingSuffix=r.nestingSuffix?Vf(r.nestingSuffix):r.nestingSuffixEscaped||Vf(")"),this.nestingOptionsSeparator=r.nestingOptionsSeparator?r.nestingOptionsSeparator:r.nestingOptionsSeparator||",",this.maxReplaces=r.maxReplaces?r.maxReplaces:1e3,this.alwaysFormat=r.alwaysFormat!==void 0?r.alwaysFormat:!1,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var t="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(t,"g");var r="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(r,"g");var i="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(i,"g")}},{key:"interpolate",value:function(t,r,i,s){var o=this,a,l,c,A=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(g){return g.replace(/\$/g,"$$$$")}var f=function(p){if(p.indexOf(o.formatSeparator)<0){var v=u3(r,A,p,o.options.keySeparator,o.options.ignoreJSONStructure);return o.alwaysFormat?o.format(v,void 0,i,ko(ko(ko({},s),r),{},{interpolationkey:p})):v}var w=p.split(o.formatSeparator),_=w.shift().trim(),x=w.join(o.formatSeparator).trim();return o.format(u3(r,A,_,o.options.keySeparator,o.options.ignoreJSONStructure),x,i,ko(ko(ko({},s),r),{},{interpolationkey:_}))};this.resetRegExp();var h=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,d=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,m=[{regex:this.regexpUnescape,safeValue:function(p){return u(p)}},{regex:this.regexp,safeValue:function(p){return o.escapeValue?u(o.escape(p)):u(p)}}];return m.forEach(function(g){for(c=0;a=g.regex.exec(t);){var p=a[1].trim();if(l=f(p),l===void 0)if(typeof h=="function"){var v=h(t,a,s);l=typeof v=="string"?v:""}else if(s&&Object.prototype.hasOwnProperty.call(s,p))l="";else if(d){l=a[0];continue}else o.logger.warn("missed to pass in variable ".concat(p," for interpolating ").concat(t)),l="";else typeof l!="string"&&!o.useRawValueToEscape&&(l=n3(l));var w=g.safeValue(l);if(t=t.replace(a[0],w),d?(g.regex.lastIndex+=l.length,g.regex.lastIndex-=a[0].length):g.regex.lastIndex=0,c++,c>=o.maxReplaces)break}}),t}},{key:"nest",value:function(t,r){var i=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o,a,l;function c(h,d){var m=this.nestingOptionsSeparator;if(h.indexOf(m)<0)return h;var g=h.split(new RegExp("".concat(m,"[ ]*{"))),p="{".concat(g[1]);h=g[0],p=this.interpolate(p,l);var v=p.match(/'/g),w=p.match(/"/g);(v&&v.length%2===0&&!w||w.length%2!==0)&&(p=p.replace(/'/g,'"'));try{l=JSON.parse(p),d&&(l=ko(ko({},d),l))}catch(_){return this.logger.warn("failed parsing options string in nesting for key ".concat(h),_),"".concat(h).concat(m).concat(p)}return delete l.defaultValue,h}for(;o=this.nestingRegexp.exec(t);){var A=[];l=ko({},s),l=l.replace&&typeof l.replace!="string"?l.replace:l,l.applyPostProcessor=!1,delete l.defaultValue;var u=!1;if(o[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(o[1])){var f=o[1].split(this.formatSeparator).map(function(h){return h.trim()});o[1]=f.shift(),A=f,u=!0}if(a=r(c.call(this,o[1].trim(),l),l),a&&o[0]===t&&typeof a!="string")return a;typeof a!="string"&&(a=n3(a)),a||(this.logger.warn("missed to resolve ".concat(o[1]," for nesting ").concat(t)),a=""),u&&(a=A.reduce(function(h,d){return i.format(h,d,s.lng,ko(ko({},s),{},{interpolationkey:o[1].trim()}))},a.trim())),t=t.replace(o[0],a),this.regexp.lastIndex=0}return t}}]),n}();function f3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function bl(n){for(var e=1;e-1){var r=n.split("(");e=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);if(e==="currency"&&i.indexOf(":")<0)t.currency||(t.currency=i.trim());else if(e==="relativetime"&&i.indexOf(":")<0)t.range||(t.range=i.trim());else{var s=i.split(";");s.forEach(function(o){if(o){var a=o.split(":"),l=bve(a),c=l[0],A=l.slice(1),u=A.join(":").trim().replace(/^'+|'+$/g,"");t[c.trim()]||(t[c.trim()]=u),u==="false"&&(t[c.trim()]=!1),u==="true"&&(t[c.trim()]=!0),isNaN(u)||(t[c.trim()]=parseInt(u,10))}})}}return{formatName:e,formatOptions:t}}function jf(n){var e={};return function(r,i,s){var o=i+JSON.stringify(s),a=e[o];return a||(a=n(i,s),e[o]=a),a(r)}}var jve=function(){function n(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};To(this,n),this.logger=za.create("formatter"),this.options=e,this.formats={number:jf(function(t,r){var i=new Intl.NumberFormat(t,bl({},r));return function(s){return i.format(s)}}),currency:jf(function(t,r){var i=new Intl.NumberFormat(t,bl(bl({},r),{},{style:"currency"}));return function(s){return i.format(s)}}),datetime:jf(function(t,r){var i=new Intl.DateTimeFormat(t,bl({},r));return function(s){return i.format(s)}}),relativetime:jf(function(t,r){var i=new Intl.RelativeTimeFormat(t,bl({},r));return function(s){return i.format(s,r.range||"day")}}),list:jf(function(t,r){var i=new Intl.ListFormat(t,bl({},r));return function(s){return i.format(s)}})},this.init(e)}return Io(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}},i=r.interpolation;this.formatSeparator=i.formatSeparator?i.formatSeparator:i.formatSeparator||","}},{key:"add",value:function(t,r){this.formats[t.toLowerCase().trim()]=r}},{key:"addCached",value:function(t,r){this.formats[t.toLowerCase().trim()]=jf(r)}},{key:"format",value:function(t,r,i){var s=this,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},a=r.split(this.formatSeparator),l=a.reduce(function(c,A){var u=Vve(A),f=u.formatName,h=u.formatOptions;if(s.formats[f]){var d=c;try{var m=o&&o.formatParams&&o.formatParams[o.interpolationkey]||{},g=m.locale||m.lng||o.locale||o.lng||i;d=s.formats[f](c,g,bl(bl(bl({},h),o),m))}catch(p){s.logger.warn(p)}return d}else s.logger.warn("there was no format function for ".concat(f));return c},t);return l}}]),n}();function h3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function d3(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Xve(n,e){n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)}var Yve=function(n){D1(t,n);var e=Wve(t);function t(r,i,s){var o,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return To(this,t),o=e.call(this),N1&&bA.call(dA(o)),o.backend=r,o.store=i,o.services=s,o.languageUtils=s.languageUtils,o.options=a,o.logger=za.create("backendConnector"),o.waitingReads=[],o.maxParallelReads=a.maxParallelReads||10,o.readingCalls=0,o.maxRetries=a.maxRetries>=0?a.maxRetries:5,o.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(s,a.backend,a),o}return Io(t,[{key:"queueLoad",value:function(i,s,o,a){var l=this,c={},A={},u={},f={};return i.forEach(function(h){var d=!0;s.forEach(function(m){var g="".concat(h,"|").concat(m);!o.reload&&l.store.hasResourceBundle(h,m)?l.state[g]=2:l.state[g]<0||(l.state[g]===1?A[g]===void 0&&(A[g]=!0):(l.state[g]=1,d=!1,A[g]===void 0&&(A[g]=!0),c[g]===void 0&&(c[g]=!0),f[m]===void 0&&(f[m]=!0)))}),d||(u[h]=!0)}),(Object.keys(c).length||Object.keys(A).length)&&this.queue.push({pending:A,pendingCount:Object.keys(A).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(c),pending:Object.keys(A),toLoadLanguages:Object.keys(u),toLoadNamespaces:Object.keys(f)}}},{key:"loaded",value:function(i,s,o){var a=i.split("|"),l=a[0],c=a[1];s&&this.emit("failedLoading",l,c,s),o&&this.store.addResourceBundle(l,c,o),this.state[i]=s?-1:2;var A={};this.queue.forEach(function(u){Sve(u.loaded,[l],c),Xve(u,i),s&&u.errors.push(s),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(function(f){A[f]||(A[f]={});var h=u.loaded[f];h.length&&h.forEach(function(d){A[f][d]===void 0&&(A[f][d]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",A),this.queue=this.queue.filter(function(u){return!u.done})}},{key:"read",value:function(i,s,o){var a=this,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,A=arguments.length>5?arguments[5]:void 0;if(!i.length)return A(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:i,ns:s,fcName:o,tried:l,wait:c,callback:A});return}this.readingCalls++;var u=function(m,g){if(a.readingCalls--,a.waitingReads.length>0){var p=a.waitingReads.shift();a.read(p.lng,p.ns,p.fcName,p.tried,p.wait,p.callback)}if(m&&g&&l2&&arguments[2]!==void 0?arguments[2]:{},l=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),l&&l();typeof i=="string"&&(i=this.languageUtils.toResolveHierarchy(i)),typeof s=="string"&&(s=[s]);var c=this.queueLoad(i,s,a,l);if(!c.toLoad.length)return c.pending.length||l(),null;c.toLoad.forEach(function(A){o.loadOne(A)})}},{key:"load",value:function(i,s,o){this.prepareLoading(i,s,{},o)}},{key:"reload",value:function(i,s,o){this.prepareLoading(i,s,{reload:!0},o)}},{key:"loadOne",value:function(i){var s=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",a=i.split("|"),l=a[0],c=a[1];this.read(l,c,"read",void 0,void 0,function(A,u){A&&s.logger.warn("".concat(o,"loading namespace ").concat(c," for language ").concat(l," failed"),A),!A&&u&&s.logger.log("".concat(o,"loaded namespace ").concat(c," for language ").concat(l),u),s.loaded(i,A,u)})}},{key:"saveMissing",value:function(i,s,o,a,l){var c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},A=arguments.length>6&&arguments[6]!==void 0?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(s)){this.logger.warn('did not save key "'.concat(o,'" as the namespace "').concat(s,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(o==null||o==="")){if(this.backend&&this.backend.create){var u=d3(d3({},c),{},{isUpdate:l}),f=this.backend.create.bind(this.backend);if(f.length<6)try{var h;f.length===5?h=f(i,s,o,a,u):h=f(i,s,o,a),h&&typeof h.then=="function"?h.then(function(d){return A(null,d)}).catch(A):A(null,h)}catch(d){A(d)}else f(i,s,o,a,A,u)}!i||!i[0]||this.store.addResource(i[0],s,o,a)}}}]),t}(bA);function p3(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if(Ns(e[1])==="object"&&(t=e[1]),typeof e[1]=="string"&&(t.defaultValue=e[1]),typeof e[2]=="string"&&(t.tDescription=e[2]),Ns(e[2])==="object"||Ns(e[3])==="object"){var r=e[3]||e[2];Object.keys(r).forEach(function(i){t[i]=r[i]})}return t},interpolation:{escapeValue:!0,format:function(e,t,r,i){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function m3(n){return typeof n.ns=="string"&&(n.ns=[n.ns]),typeof n.fallbackLng=="string"&&(n.fallbackLng=[n.fallbackLng]),typeof n.fallbackNS=="string"&&(n.fallbackNS=[n.fallbackNS]),n.supportedLngs&&n.supportedLngs.indexOf("cimode")<0&&(n.supportedLngs=n.supportedLngs.concat(["cimode"])),n}function g3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function xa(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ky(){}function Jve(n){var e=Object.getOwnPropertyNames(Object.getPrototypeOf(n));e.forEach(function(t){typeof n[t]=="function"&&(n[t]=n[t].bind(n))})}var Ax=function(n){D1(t,n);var e=$ve(t);function t(){var r,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;if(To(this,t),r=e.call(this),N1&&bA.call(dA(r)),r.options=m3(i),r.services={},r.logger=za,r.modules={external:[]},Jve(dA(r)),s&&!r.isInitialized&&!i.isClone){if(!r.options.initImmediate)return r.init(i,s),M0(r,dA(r));setTimeout(function(){r.init(i,s)},0)}return r}return Io(t,[{key:"init",value:function(){var i=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;typeof s=="function"&&(o=s,s={}),!s.defaultNS&&s.defaultNS!==!1&&s.ns&&(typeof s.ns=="string"?s.defaultNS=s.ns:s.ns.indexOf("translation")<0&&(s.defaultNS=s.ns[0]));var a=p3();this.options=xa(xa(xa({},a),this.options),m3(s)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=xa(xa({},a.interpolation),this.options.interpolation)),s.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=s.keySeparator),s.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=s.nsSeparator);function l(p){return p?typeof p=="function"?new p:p:null}if(!this.options.isClone){this.modules.logger?za.init(l(this.modules.logger),this.options):za.init(null,this.options);var c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=jve);var A=new l3(this.options);this.store=new Lve(this.options.resources,this.options);var u=this.services;u.logger=za,u.resourceStore=this.store,u.languageUtils=A,u.pluralResolver=new zve(A,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===a.interpolation.format)&&(u.formatter=l(c),u.formatter.init(u,this.options),this.options.interpolation.format=u.formatter.format.bind(u.formatter)),u.interpolator=new Gve(this.options),u.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},u.backendConnector=new Yve(l(this.modules.backend),u.resourceStore,u,this.options),u.backendConnector.on("*",function(p){for(var v=arguments.length,w=new Array(v>1?v-1:0),_=1;_1?v-1:0),_=1;_0&&f[0]!=="dev"&&(this.options.lng=f[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined");var h=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];h.forEach(function(p){i[p]=function(){var v;return(v=i.store)[p].apply(v,arguments)}});var d=["addResource","addResources","addResourceBundle","removeResourceBundle"];d.forEach(function(p){i[p]=function(){var v;return(v=i.store)[p].apply(v,arguments),i}});var m=om(),g=function(){var v=function(_,x){i.isInitialized&&!i.initializedStoreOnce&&i.logger.warn("init: i18next is already initialized. You should call init just once!"),i.isInitialized=!0,i.options.isClone||i.logger.log("initialized",i.options),i.emit("initialized",i.options),m.resolve(x),o(_,x)};if(i.languages&&i.options.compatibilityAPI!=="v1"&&!i.isInitialized)return v(null,i.t.bind(i));i.changeLanguage(i.options.lng,v)};return this.options.resources||!this.options.initImmediate?g():setTimeout(g,0),m}},{key:"loadResources",value:function(i){var s=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ky,a=o,l=typeof i=="string"?i:this.language;if(typeof i=="function"&&(a=i),!this.options.resources||this.options.partialBundledLanguages){if(l&&l.toLowerCase()==="cimode")return a();var c=[],A=function(h){if(h){var d=s.services.languageUtils.toResolveHierarchy(h);d.forEach(function(m){c.indexOf(m)<0&&c.push(m)})}};if(l)A(l);else{var u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.forEach(function(f){return A(f)})}this.options.preload&&this.options.preload.forEach(function(f){return A(f)}),this.services.backendConnector.load(c,this.options.ns,function(f){!f&&!s.resolvedLanguage&&s.language&&s.setResolvedLanguage(s.language),a(f)})}else a(null)}},{key:"reloadResources",value:function(i,s,o){var a=om();return i||(i=this.languages),s||(s=this.options.ns),o||(o=ky),this.services.backendConnector.reload(i,s,function(l){a.resolve(),o(l)}),a}},{key:"use",value:function(i){if(!i)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!i.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return i.type==="backend"&&(this.modules.backend=i),(i.type==="logger"||i.log&&i.warn&&i.error)&&(this.modules.logger=i),i.type==="languageDetector"&&(this.modules.languageDetector=i),i.type==="i18nFormat"&&(this.modules.i18nFormat=i),i.type==="postProcessor"&&pV.addPostProcessor(i),i.type==="formatter"&&(this.modules.formatter=i),i.type==="3rdParty"&&this.modules.external.push(i),this}},{key:"setResolvedLanguage",value:function(i){if(!(!i||!this.languages)&&!(["cimode","dev"].indexOf(i)>-1))for(var s=0;s-1)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}}},{key:"changeLanguage",value:function(i,s){var o=this;this.isLanguageChangingTo=i;var a=om();this.emit("languageChanging",i);var l=function(f){o.language=f,o.languages=o.services.languageUtils.toResolveHierarchy(f),o.resolvedLanguage=void 0,o.setResolvedLanguage(f)},c=function(f,h){h?(l(h),o.translator.changeLanguage(h),o.isLanguageChangingTo=void 0,o.emit("languageChanged",h),o.logger.log("languageChanged",h)):o.isLanguageChangingTo=void 0,a.resolve(function(){return o.t.apply(o,arguments)}),s&&s(f,function(){return o.t.apply(o,arguments)})},A=function(f){!i&&!f&&o.services.languageDetector&&(f=[]);var h=typeof f=="string"?f:o.services.languageUtils.getBestMatchFromCodes(f);h&&(o.language||l(h),o.translator.language||o.translator.changeLanguage(h),o.services.languageDetector&&o.services.languageDetector.cacheUserLanguage&&o.services.languageDetector.cacheUserLanguage(h)),o.loadResources(h,function(d){c(d,h)})};return!i&&this.services.languageDetector&&!this.services.languageDetector.async?A(this.services.languageDetector.detect()):!i&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(A):this.services.languageDetector.detect(A):A(i),a}},{key:"getFixedT",value:function(i,s,o){var a=this,l=function c(A,u){var f;if(Ns(u)!=="object"){for(var h=arguments.length,d=new Array(h>2?h-2:0),m=2;m1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var a=o.lng||this.resolvedLanguage||this.languages[0],l=this.options?this.options.fallbackLng:!1,c=this.languages[this.languages.length-1];if(a.toLowerCase()==="cimode")return!0;var A=function(h,d){var m=s.services.backendConnector.state["".concat(h,"|").concat(d)];return m===-1||m===2};if(o.precheck){var u=o.precheck(this,A);if(u!==void 0)return u}return!!(this.hasResourceBundle(a,i)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||A(a,i)&&(!l||A(c,i)))}},{key:"loadNamespaces",value:function(i,s){var o=this,a=om();return this.options.ns?(typeof i=="string"&&(i=[i]),i.forEach(function(l){o.options.ns.indexOf(l)<0&&o.options.ns.push(l)}),this.loadResources(function(l){a.resolve(),s&&s(l)}),a):(s&&s(),Promise.resolve())}},{key:"loadLanguages",value:function(i,s){var o=om();typeof i=="string"&&(i=[i]);var a=this.options.preload||[],l=i.filter(function(c){return a.indexOf(c)<0});return l.length?(this.options.preload=a.concat(l),this.loadResources(function(c){o.resolve(),s&&s(c)}),o):(s&&s(),Promise.resolve())}},{key:"dir",value:function(i){if(i||(i=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!i)return"rtl";var s=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],o=this.services&&this.services.languageUtils||new l3(p3());return s.indexOf(o.getLanguagePartFromCode(i))>-1||i.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var i=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ky,a=xa(xa(xa({},this.options),s),{isClone:!0}),l=new t(a);(s.debug!==void 0||s.prefix!==void 0)&&(l.logger=l.logger.clone(s));var c=["store","services","language"];return c.forEach(function(A){l[A]=i[A]}),l.services=xa({},this.services),l.services.utils={hasLoadedNamespace:l.hasLoadedNamespace.bind(l)},l.translator=new a3(l.services,l.options),l.translator.on("*",function(A){for(var u=arguments.length,f=new Array(u>1?u-1:0),h=1;h0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return new Ax(n,e)});var Ti=Ax.createInstance();Ti.createInstance=Ax.createInstance;Ti.createInstance;Ti.dir;Ti.init;Ti.loadResources;Ti.reloadResources;Ti.use;Ti.changeLanguage;Ti.getFixedT;Ti.t;Ti.exists;Ti.setDefaultNamespace;Ti.hasLoadedNamespace;Ti.loadNamespaces;Ti.loadLanguages;function qve(){if(console&&console.warn){for(var n,e=arguments.length,t=new Array(e),r=0;r2&&arguments[2]!==void 0?arguments[2]:{},r=e.languages[0],i=e.options?e.options.fallbackLng:!1,s=e.languages[e.languages.length-1];if(r.toLowerCase()==="cimode")return!0;var o=function(l,c){var A=e.services.backendConnector.state["".concat(l,"|").concat(c)];return A===-1||A===2};return t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!o(e.isLanguageChangingTo,n)?!1:!!(e.hasResourceBundle(r,n)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||o(r,n)&&(!i||o(s,n)))}function tye(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e.languages||!e.languages.length)return IT("i18n.languages were undefined or empty",e.languages),!0;var r=e.options.ignoreJSONStructure!==void 0;return r?e.hasLoadedNamespace(n,{lng:t.lng,precheck:function(s,o){if(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!o(s.isLanguageChangingTo,n))return!1}}):eye(n,e,t)}var nye=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,rye={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},iye=function(e){return rye[e]},sye=function(e){return e.replace(nye,iye)};function _3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function x3(n){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};RT=x3(x3({},RT),n)}function aye(){return RT}var gV;function lye(n){gV=n}function cye(){return gV}var Aye={type:"3rdParty",init:function(e){oye(e.options.react),lye(e)}},uye=be.createContext(),fye=function(){function n(){To(this,n),this.usedNamespaces={}}return Io(n,[{key:"addUsedNamespaces",value:function(t){var r=this;t.forEach(function(i){r.usedNamespaces[i]||(r.usedNamespaces[i]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),n}();function hye(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(n)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(r=s.call(t)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(A){c=!0,i=A}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function dye(n,e){return uV(n)||hye(n,e)||fV(n,e)||hV()}function b3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function lM(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},t=e.i18n,r=be.useContext(uye)||{},i=r.i18n,s=r.defaultNS,o=t||i||cye();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new fye),!o){IT("You will need to pass in an i18next instance by using initReactI18next");var a=function(I,M){return typeof M=="string"?M:M&&Ns(M)==="object"&&typeof M.defaultValue=="string"?M.defaultValue:Array.isArray(I)?I[I.length-1]:I},l=[a,{},!1];return l.t=a,l.i18n={},l.ready=!1,l}o.options.react&&o.options.react.wait!==void 0&&IT("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var c=lM(lM(lM({},aye()),o.options.react),e),A=c.useSuspense,u=c.keyPrefix,f=n||s||o.options&&o.options.defaultNS;f=typeof f=="string"?[f]:f||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(f);var h=(o.isInitialized||o.initializedStoreOnce)&&f.every(function(S){return tye(S,o,c)});function d(){return o.getFixedT(e.lng||null,c.nsMode==="fallback"?f:f[0],u)}var m=be.useState(d),g=dye(m,2),p=g[0],v=g[1],w=f.join();e.lng&&(w="".concat(e.lng).concat(w));var _=pye(w),x=be.useRef(!0);be.useEffect(function(){var S=c.bindI18n,I=c.bindI18nStore;x.current=!0,!h&&!A&&(e.lng?w3(o,e.lng,f,function(){x.current&&v(d)}):y3(o,f,function(){x.current&&v(d)})),h&&_&&_!==w&&x.current&&v(d);function M(){x.current&&v(d)}return S&&o&&o.on(S,M),I&&o&&o.store.on(I,M),function(){x.current=!1,S&&o&&S.split(" ").forEach(function(L){return o.off(L,M)}),I&&o&&I.split(" ").forEach(function(L){return o.store.off(L,M)})}},[o,w]);var b=be.useRef(!0);be.useEffect(function(){x.current&&!b.current&&v(d),b.current=!1},[o,u]);var B=[p,o,h];if(B.t=p,B.i18n=o,B.ready=h,h||!h&&!A)return B;throw new Promise(function(S){e.lng?w3(o,e.lng,f,function(){return S()}):y3(o,f,function(){return S()})})}var vV=[],gye=vV.forEach,vye=vV.slice;function yye(n){return gye.call(vye.call(arguments,1),function(e){if(e)for(var t in e)n[t]===void 0&&(n[t]=e[t])}),n}var E3=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,wye=function(e,t,r){var i=r||{};i.path=i.path||"/";var s=encodeURIComponent(t),o="".concat(e,"=").concat(s);if(i.maxAge>0){var a=i.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");o+="; Max-Age=".concat(Math.floor(a))}if(i.domain){if(!E3.test(i.domain))throw new TypeError("option domain is invalid");o+="; Domain=".concat(i.domain)}if(i.path){if(!E3.test(i.path))throw new TypeError("option path is invalid");o+="; Path=".concat(i.path)}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(o+="; HttpOnly"),i.secure&&(o+="; Secure"),i.sameSite){var l=typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite;switch(l){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o},B3={create:function(e,t,r,i){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(s.expires=new Date,s.expires.setTime(s.expires.getTime()+r*60*1e3)),i&&(s.domain=i),document.cookie=wye(e,encodeURIComponent(t),s)},read:function(e){for(var t="".concat(e,"="),r=document.cookie.split(";"),i=0;i-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var i=r.substring(1),s=i.split("&"),o=0;o0){var l=s[o].substring(0,a);l===e.lookupQuerystring&&(t=s[o].substring(a+1))}}}return t}},am=null,M3=function(){if(am!==null)return am;try{am=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{am=!1}return am},bye={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&M3()){var r=window.localStorage.getItem(e.lookupLocalStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&M3()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},lm=null,S3=function(){if(lm!==null)return lm;try{lm=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{lm=!1}return lm},Eye={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&S3()){var r=window.sessionStorage.getItem(e.lookupSessionStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&S3()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},Bye={name:"navigator",lookup:function(e){var t=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?t:void 0}},Mye={name:"htmlTag",lookup:function(e){var t,r=e.htmlTag||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(t=r.getAttribute("lang")),t}},Sye={name:"path",lookup:function(e){var t;if(typeof window<"u"){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if(typeof e.lookupFromPathIndex=="number"){if(typeof r[e.lookupFromPathIndex]!="string")return;t=r[e.lookupFromPathIndex].replace("/","")}else t=r[0].replace("/","")}return t}},Cye={name:"subdomain",lookup:function(e){var t=typeof e.lookupFromSubdomainIndex=="number"?e.lookupFromSubdomainIndex+1:1,r=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[t]}};function Tye(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(e){return e}}}var yV=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};To(this,n),this.type="languageDetector",this.detectors={},this.init(e,t)}return Io(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t||{languageUtils:{}},this.options=yye(r,this.options||{},Tye()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(s){return s.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(_ye),this.addDetector(xye),this.addDetector(bye),this.addDetector(Eye),this.addDetector(Bye),this.addDetector(Mye),this.addDetector(Sye),this.addDetector(Cye)}},{key:"addDetector",value:function(t){return this.detectors[t.name]=t,this}},{key:"detect",value:function(t){var r=this;t||(t=this.options.order);var i=[];return t.forEach(function(s){if(r.detectors[s]){var o=r.detectors[s].lookup(r.options);o&&typeof o=="string"&&(o=[o]),o&&(i=i.concat(o))}}),i=i.map(function(s){return r.options.convertDetectedLanguage(s)}),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(t,r){var i=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||r.forEach(function(s){i.detectors[s]&&i.detectors[s].cacheUserLanguage(t,i.options)}))}}]),n}();yV.type="languageDetector";const Iye={translation:{pageTitles:{chooseClass:"Choose Character Class",chooseAppearance:"Choose Appearance",saveCharacter:"Save Your Character"},callToAction:{next:"Next",back:"Back",randomize:"Randomize",send:"Send"},editor:{title:"Appearance",head:"Head",body:"Body",eyes:"Eyes",outer:"Outer",chest:"Chest",legs:"Legs",feet:"Feet",accessories:"Accessories"},labels:{name:"Name",voice:"Voice",favoriteColor:"Favorite Color",preferredGreeting:"Preferred Greeting",question:"Question",yourName:"Your Name",conversation:"Conversation"},text:{unoptimized:"Unoptimized",apiUnderMaintnance:"Voice generation API is temporarily disabled for maintenance!"}}},Rye={translation:{pageTitles:{chooseClass:"Выбрать Класс Персонажа",chooseAppearance:"Выбрать Внешность",saveCharacter:"Сохранить Персонажа"},callToAction:{next:"Далее",back:"Назад",randomize:"Рандомизировать",send:"Отправить"},editor:{title:"Внешность",head:"Голова",body:"Тело",eyes:"Глаза",outer:"Внешний",chest:"Грудь",legs:"Ноги",feet:"Стопы",accessories:"Аксессуары"},labels:{name:"Имя",voice:"Голос",favoriteColor:"Любимый Цвет",preferredGreeting:"Предпочитаемое Приветствие",question:"Вопрос",yourName:"Ваше Имя",conversation:"Разговор"},text:{unoptimized:"Неоптимизи­рованный",apiUnderMaintnance:"API генерации голоса временно отключен на техническое обслуживание."}}},Uye={translation:{pageTitles:{chooseClass:"选择角色类型",chooseAppearance:"选择外观",saveCharacter:"保存角色"},callToAction:{next:"下一步",back:"返回",randomize:"随机",send:"发送"},editor:{title:"外观",head:"头部",body:"身体",eyes:"眼睛",outer:"外套",chest:"上身",legs:"腿部",feet:"脚部",accessories:"配件"},labels:{name:"名字",voice:"语音",favoriteColor:"颜色偏好",preferredGreeting:"首选问候语",question:"问题",yourName:"你的名字",conversation:"对话"},text:{unoptimized:"未优化",apiUnderMaintnance:"语音生成API暂时关闭进行维护!"}}},Fye={en:Iye,ru:Rye,zh:Uye};Ti.use(yV).use(Aye).init({debug:!0,fallbackLng:"en",interpolation:{escapeValue:!1},resources:Fye});const fa=be.createContext(),Pye=n=>{const{t:e}=mye();return k.jsx(fa.Provider,{value:{t:e},children:n.children})},Lye=` uniform vec3 cameraDir; uniform vec3 eye; @@ -5056,7 +5056,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho vWorldPosition = (modelMatrix * vec4( pos, 1.0 )).xyz; gl_Position = projectionMatrix * modelViewMatrix * vec4( pos, 1.0 ); } -`,Nye=` +`,Dye=` uniform float switchItemDuration; uniform float switchItemTime; uniform vec3 cameraDir; @@ -5094,7 +5094,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho gl_FragColor.a *= (switchItemDuration - switchItemTime); gl_FragColor *= aura; } -`,Oye=` +`,Nye=` uniform vec4 cameraBillboardQuaternion; attribute vec2 scales; @@ -5125,7 +5125,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho vec4 projectionPosition = projectionMatrix * viewPosition; gl_Position = projectionPosition; } -`,kye=` +`,Oye=` varying vec2 vUv; varying float vOpacity; varying vec3 vWorldPosition; @@ -5148,7 +5148,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } gl_FragColor.a *= vOpacity; } -`,Hye=` +`,kye=` attribute vec2 scales; attribute float opacity; attribute vec3 positions; @@ -5197,7 +5197,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho gl_FragColor.a = smoothstep(0.3, 0.8, gl_FragColor.a); gl_FragColor.a *= vOpacity; } -`,zye=` +`,Hye=` uniform vec4 cameraBillboardQuaternion; varying vec2 vUv; @@ -5218,7 +5218,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho vec4 projectionPosition = projectionMatrix * viewPosition; gl_Position = projectionPosition; } -`,Gye=` +`,zye=` varying vec2 vUv; varying vec3 vWorldPosition; @@ -5228,7 +5228,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho gl_FragColor.a = col; gl_FragColor.a *= clamp(vWorldPosition.y * 10., 0.0, 1.0); } -`,Vye=` +`,Gye=` varying vec3 vWorldPosition; varying vec3 vSurfaceNormal; @@ -5241,7 +5241,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho vWorldPosition = (modelMatrix * vec4( pos, 1.0 )).xyz; gl_Position = projectionMatrix * modelViewMatrix * vec4( pos, 1.0 ); } -`,jye=` +`,Vye=` uniform vec3 cameraDir; uniform vec3 eye; @@ -5263,7 +5263,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho gl_FragColor *= pow(1. - vUv.y, 3.0); gl_FragColor *= opacity; } -`,v2=(n,e,t)=>{const r=new Jt;["position","normal","uv"].forEach(o=>{r.setAttribute(o,n.attributes[o])}),r.setIndex(n.index);const i=new Float32Array(t*3),s=new Gg(i,3);r.setAttribute("positions",s);for(const o of e){const{name:a,itemSize:l}=o,c=new Float32Array(t*l);r.setAttribute(a,new Gg(c,l))}return r},Wye=n=>{const r=new d1(.45,.45,5,50,50,!0),i=new mr({uniforms:{auraTexture:{value:null}},vertexShader:Dye,fragmentShader:Nye,transparent:!0,blending:Pu});i.uniforms.cameraDir=n.cameraDir,i.uniforms.eye=n.eye,i.uniforms.switchItemTime=n.switchItemTime,i.uniforms.switchItemDuration=n.switchItemDuration;const s=new dn(r,i);return s.frustumCulled=!1,s.position.y=5*.46,s},Kye=()=>{const e=[];e.push({name:"opacity",itemSize:1}),e.push({name:"scales",itemSize:2});const t=.3,r=new cc(t,t),i=v2(r,e,20),s=new mr({uniforms:{cameraBillboardQuaternion:{value:new nt}},vertexShader:Oye,fragmentShader:kye,depthWrite:!1,blending:Pu}),o=new h1(i,s,20);return o.info={particleCount:20,velocity:[20]},o},Xye=n=>{const t=[];t.push({name:"opacity",itemSize:1}),t.push({name:"scales",itemSize:2});const r=.43,i=new zR(r,32,32),s=v2(i,t,10),o=new mr({uniforms:{radius:{value:r}},vertexShader:Hye,fragmentShader:Qye,depthWrite:!1,blending:Pu});o.uniforms.cameraDir=n.cameraDir,o.uniforms.eye=n.eye,o.uniforms.fadeInAvatarTime=n.fadeInAvatarTime;const a=new h1(s,o,10);return a.info={particleCount:10,velocity:[10],currentIndex:0},a},Yye=n=>{const t=new cc(1,1),r=new mr({uniforms:{cameraBillboardQuaternion:{value:new nt}},vertexShader:zye,fragmentShader:Gye,depthWrite:!1,blending:Pu});return new dn(t,r)},$ye=n=>{const t=[],s=new d1(.645,.43,2.5,50,50,!0),o=v2(s,t,2),a=new mr({uniforms:{opacity:{value:0}},vertexShader:Vye,fragmentShader:jye,transparent:!0,blending:Pu});a.uniforms.cameraDir=n.cameraDir,a.uniforms.eye=n.eye;const l=new h1(o,a,2);return l.fadeIn=!1,l.frustumCulled=!1,l.position.y=2.5*.46,l},M3=100,Zye=0,Ax=1.5,Jye=.1,Ow=0,C3=1,T3=.05,IT=0,qye=1,ewe=.015,Ki={normal:0,switchItem:1,fadeOutAvatar:2,loadingAvatar:3,fadeInAvatar:4},twe=new FA,yV=twe.load("./textures/beam2.png");yV.wrapS=zs;class nwe{constructor(e,t,r){this.scene=e,this.camera=t,this.globalUniforms=r,this.eye=new $,this.cameraDir=new $,this.beamMesh=null,this.initBeam(),this.pixelMesh=null,this.initPixel(),this.ringMesh=null,this.initRing(),this.teleportMesh=null,this.initTeleport(),this.spotLight=null,this.initSpotLight()}emitBeam(){this.beamMesh.visible=!0}emitPixel(){this.stopUpdatePixelMesh=!1;const e=this.pixelMesh.geometry.getAttribute("scales"),t=this.pixelMesh.geometry.getAttribute("positions"),r=this.pixelMesh.geometry.getAttribute("opacity"),i=this.pixelMesh.info.particleCount,s=.25;for(let o=0;ol+e||i.getX(a)<=0)&&(r.setXYZ(o,0,l,0),t.setXY(o,1,.06),i.setX(o,1),this.ringMesh.info.velocity[o]=.1,this.ringMesh.info.currentIndex++,this.ringMesh.info.currentIndex>=s&&(this.ringMesh.info.currentIndex=0)),t.needsUpdate=!0,r.needsUpdate=!0,i.needsUpdate=!0}emitTeleport(){this.teleportMesh.visible=!0}emitSpotLight(){this.spotLight.visible=!0,this.spotLight.fadeIn=!0}removeSpotLight(){this.spotLight.fadeIn=!1}update(){this.beamMesh.visible&&this.beamMesh.update(),!this.stopUpdatePixelMesh&&this.pixelMesh.update(),this.ringMesh.visible&&this.ringMesh.update(),this.teleportMesh.visible&&this.teleportMesh.update(),this.spotLight.visible&&this.spotLight.update()}initBeam(){this.beamMesh=Wye(this.globalUniforms),this.beamMesh.material.uniforms.auraTexture.value=yV,this.beamMesh.update=()=>this.updateBeam(),this.scene.add(this.beamMesh)}initPixel(){this.pixelMesh=Kye(),this.pixelMesh.update=()=>this.updatePixel(),this.scene.add(this.pixelMesh)}initRing(){this.ringMesh=Xye(this.globalUniforms),this.ringMesh.update=()=>this.updateRing(),this.scene.add(this.ringMesh)}initTeleport(){this.teleportMesh=Yye(this.globalUniforms),this.teleportMesh.update=()=>this.updateTeleport(),this.teleportMesh.visible=!1,this.scene.add(this.teleportMesh)}initSpotLight(){this.spotLight=$ye(this.globalUniforms),this.spotLight.update=()=>this.updateSpotLight(),this.spotLight.visible=!1,this.scene.add(this.spotLight)}updateBeam(){this.beamMesh&&this.globalUniforms.transitionEffectType.value!==Ki.switchItem&&(this.beamMesh.visible=!1)}updatePixel(){if(this.pixelMesh){let e=0;const t=this.pixelMesh.geometry.getAttribute("positions"),r=this.pixelMesh.geometry.getAttribute("opacity"),i=this.pixelMesh.info.particleCount;for(let s=0;s.01?(t.setY(s,t.getY(s)+this.pixelMesh.info.velocity[s]),r.setX(s,r.getX(s)/1.3)):(r.setX(s,0),e++);e>=i&&(this.stopUpdatePixelMesh=!0),t.needsUpdate=!0,r.needsUpdate=!0,this.pixelMesh.material.uniforms.cameraBillboardQuaternion.value.copy(this.camera.quaternion)}}updateRing(){if(this.ringMesh){const e=this.ringMesh.geometry.getAttribute("positions"),t=this.ringMesh.geometry.getAttribute("opacity"),r=this.ringMesh.info.particleCount;for(let i=0;i.01?(e.setY(i,e.getY(i)+this.ringMesh.info.velocity[i]),t.setX(i,t.getX(i)/1.27)):t.setX(i,0);e.needsUpdate=!0,t.needsUpdate=!0,this.globalUniforms.transitionEffectType.value!==Ki.fadeInAvatar&&(this.ringMesh.visible=!1)}}updateTeleport(){if(this.teleportMesh){if(this.globalUniforms.transitionEffectType.value===Ki.fadeOutAvatar){const e=this.globalUniforms.fadeOutAvatarTime.value,t=.2;if(e0?(this.teleportMesh.scale.x=this.teleportMesh.scale.x-.2,this.teleportMesh.scale.z=this.teleportMesh.scale.z-.2):this.teleportMesh.visible=!1}else this.teleportMesh.visible=!1;this.teleportMesh.material.uniforms.cameraBillboardQuaternion.value.copy(this.camera.quaternion)}}updateSpotLight(){this.spotLight&&(this.spotLight.fadeIn?this.spotLight.material.uniforms.opacity.value<1&&(this.spotLight.material.uniforms.opacity.value=1):this.spotLight.material.uniforms.opacity.value>0?this.spotLight.material.uniforms.opacity.value-=.025:(this.spotLight.material.uniforms.opacity.value=0,this.spotLight.visible=!1))}}const wV=new FA,RT=wV.load("./textures/pixel9.png");RT.wrapS=RT.wrapT=zs;const UT=wV.load("./textures/noise3.jpg");UT.wrapS=UT.wrapT=zs;const Ht={switchItemDuration:{value:Ax},switchItemTime:{value:Ax},eye:{value:new $},cameraDir:{value:new $},fadeOutAvatarTime:{value:Ow},fadeInAvatarTime:{value:IT},transitionEffectType:{value:Ki.normal}},I3={pixelTexture:{value:RT},noiseTexture:{value:UT}};class rwe extends EventTarget{constructor(){super();We(this,"setTransitionEffect",t=>{this.transitionEffectType=t});We(this,"getTransitionEffect",t=>this.transitionEffectType===t);this.cameraDir=new $,this.frameRate=1e3/30,this.initParticle=!1,this.transitionEffectType=null,this.transitionTime=M3,this.update()}setCustomShader(t){t.vertexShader&&(t.vertexShader=t.vertexShader.replace("varying vec3 vViewPosition;",` +`,y2=(n,e,t)=>{const r=new Jt;["position","normal","uv"].forEach(o=>{r.setAttribute(o,n.attributes[o])}),r.setIndex(n.index);const i=new Float32Array(t*3),s=new Vg(i,3);r.setAttribute("positions",s);for(const o of e){const{name:a,itemSize:l}=o,c=new Float32Array(t*l);r.setAttribute(a,new Vg(c,l))}return r},jye=n=>{const r=new p1(.45,.45,5,50,50,!0),i=new mr({uniforms:{auraTexture:{value:null}},vertexShader:Lye,fragmentShader:Dye,transparent:!0,blending:Du});i.uniforms.cameraDir=n.cameraDir,i.uniforms.eye=n.eye,i.uniforms.switchItemTime=n.switchItemTime,i.uniforms.switchItemDuration=n.switchItemDuration;const s=new dn(r,i);return s.frustumCulled=!1,s.position.y=5*.46,s},Wye=()=>{const e=[];e.push({name:"opacity",itemSize:1}),e.push({name:"scales",itemSize:2});const t=.3,r=new cc(t,t),i=y2(r,e,20),s=new mr({uniforms:{cameraBillboardQuaternion:{value:new nt}},vertexShader:Nye,fragmentShader:Oye,depthWrite:!1,blending:Du}),o=new d1(i,s,20);return o.info={particleCount:20,velocity:[20]},o},Kye=n=>{const t=[];t.push({name:"opacity",itemSize:1}),t.push({name:"scales",itemSize:2});const r=.43,i=new VR(r,32,32),s=y2(i,t,10),o=new mr({uniforms:{radius:{value:r}},vertexShader:kye,fragmentShader:Qye,depthWrite:!1,blending:Du});o.uniforms.cameraDir=n.cameraDir,o.uniforms.eye=n.eye,o.uniforms.fadeInAvatarTime=n.fadeInAvatarTime;const a=new d1(s,o,10);return a.info={particleCount:10,velocity:[10],currentIndex:0},a},Xye=n=>{const t=new cc(1,1),r=new mr({uniforms:{cameraBillboardQuaternion:{value:new nt}},vertexShader:Hye,fragmentShader:zye,depthWrite:!1,blending:Du});return new dn(t,r)},Yye=n=>{const t=[],s=new p1(.645,.43,2.5,50,50,!0),o=y2(s,t,2),a=new mr({uniforms:{opacity:{value:0}},vertexShader:Gye,fragmentShader:Vye,transparent:!0,blending:Du});a.uniforms.cameraDir=n.cameraDir,a.uniforms.eye=n.eye;const l=new d1(o,a,2);return l.fadeIn=!1,l.frustumCulled=!1,l.position.y=2.5*.46,l},C3=100,$ye=0,ux=1.5,Zye=.1,kw=0,T3=1,I3=.05,UT=0,Jye=1,qye=.015,Ki={normal:0,switchItem:1,fadeOutAvatar:2,loadingAvatar:3,fadeInAvatar:4},ewe=new PA,wV=ewe.load("./textures/beam2.png");wV.wrapS=zs;class twe{constructor(e,t,r){this.scene=e,this.camera=t,this.globalUniforms=r,this.eye=new $,this.cameraDir=new $,this.beamMesh=null,this.initBeam(),this.pixelMesh=null,this.initPixel(),this.ringMesh=null,this.initRing(),this.teleportMesh=null,this.initTeleport(),this.spotLight=null,this.initSpotLight()}emitBeam(){this.beamMesh.visible=!0}emitPixel(){this.stopUpdatePixelMesh=!1;const e=this.pixelMesh.geometry.getAttribute("scales"),t=this.pixelMesh.geometry.getAttribute("positions"),r=this.pixelMesh.geometry.getAttribute("opacity"),i=this.pixelMesh.info.particleCount,s=.25;for(let o=0;ol+e||i.getX(a)<=0)&&(r.setXYZ(o,0,l,0),t.setXY(o,1,.06),i.setX(o,1),this.ringMesh.info.velocity[o]=.1,this.ringMesh.info.currentIndex++,this.ringMesh.info.currentIndex>=s&&(this.ringMesh.info.currentIndex=0)),t.needsUpdate=!0,r.needsUpdate=!0,i.needsUpdate=!0}emitTeleport(){this.teleportMesh.visible=!0}emitSpotLight(){this.spotLight.visible=!0,this.spotLight.fadeIn=!0}removeSpotLight(){this.spotLight.fadeIn=!1}update(){this.beamMesh.visible&&this.beamMesh.update(),!this.stopUpdatePixelMesh&&this.pixelMesh.update(),this.ringMesh.visible&&this.ringMesh.update(),this.teleportMesh.visible&&this.teleportMesh.update(),this.spotLight.visible&&this.spotLight.update()}initBeam(){this.beamMesh=jye(this.globalUniforms),this.beamMesh.material.uniforms.auraTexture.value=wV,this.beamMesh.update=()=>this.updateBeam(),this.scene.add(this.beamMesh)}initPixel(){this.pixelMesh=Wye(),this.pixelMesh.update=()=>this.updatePixel(),this.scene.add(this.pixelMesh)}initRing(){this.ringMesh=Kye(this.globalUniforms),this.ringMesh.update=()=>this.updateRing(),this.scene.add(this.ringMesh)}initTeleport(){this.teleportMesh=Xye(this.globalUniforms),this.teleportMesh.update=()=>this.updateTeleport(),this.teleportMesh.visible=!1,this.scene.add(this.teleportMesh)}initSpotLight(){this.spotLight=Yye(this.globalUniforms),this.spotLight.update=()=>this.updateSpotLight(),this.spotLight.visible=!1,this.scene.add(this.spotLight)}updateBeam(){this.beamMesh&&this.globalUniforms.transitionEffectType.value!==Ki.switchItem&&(this.beamMesh.visible=!1)}updatePixel(){if(this.pixelMesh){let e=0;const t=this.pixelMesh.geometry.getAttribute("positions"),r=this.pixelMesh.geometry.getAttribute("opacity"),i=this.pixelMesh.info.particleCount;for(let s=0;s.01?(t.setY(s,t.getY(s)+this.pixelMesh.info.velocity[s]),r.setX(s,r.getX(s)/1.3)):(r.setX(s,0),e++);e>=i&&(this.stopUpdatePixelMesh=!0),t.needsUpdate=!0,r.needsUpdate=!0,this.pixelMesh.material.uniforms.cameraBillboardQuaternion.value.copy(this.camera.quaternion)}}updateRing(){if(this.ringMesh){const e=this.ringMesh.geometry.getAttribute("positions"),t=this.ringMesh.geometry.getAttribute("opacity"),r=this.ringMesh.info.particleCount;for(let i=0;i.01?(e.setY(i,e.getY(i)+this.ringMesh.info.velocity[i]),t.setX(i,t.getX(i)/1.27)):t.setX(i,0);e.needsUpdate=!0,t.needsUpdate=!0,this.globalUniforms.transitionEffectType.value!==Ki.fadeInAvatar&&(this.ringMesh.visible=!1)}}updateTeleport(){if(this.teleportMesh){if(this.globalUniforms.transitionEffectType.value===Ki.fadeOutAvatar){const e=this.globalUniforms.fadeOutAvatarTime.value,t=.2;if(e0?(this.teleportMesh.scale.x=this.teleportMesh.scale.x-.2,this.teleportMesh.scale.z=this.teleportMesh.scale.z-.2):this.teleportMesh.visible=!1}else this.teleportMesh.visible=!1;this.teleportMesh.material.uniforms.cameraBillboardQuaternion.value.copy(this.camera.quaternion)}}updateSpotLight(){this.spotLight&&(this.spotLight.fadeIn?this.spotLight.material.uniforms.opacity.value<1&&(this.spotLight.material.uniforms.opacity.value=1):this.spotLight.material.uniforms.opacity.value>0?this.spotLight.material.uniforms.opacity.value-=.025:(this.spotLight.material.uniforms.opacity.value=0,this.spotLight.visible=!1))}}const _V=new PA,FT=_V.load("./textures/pixel9.png");FT.wrapS=FT.wrapT=zs;const PT=_V.load("./textures/noise3.jpg");PT.wrapS=PT.wrapT=zs;const Qt={switchItemDuration:{value:ux},switchItemTime:{value:ux},eye:{value:new $},cameraDir:{value:new $},fadeOutAvatarTime:{value:kw},fadeInAvatarTime:{value:UT},transitionEffectType:{value:Ki.normal}},R3={pixelTexture:{value:FT},noiseTexture:{value:PT}};class nwe extends EventTarget{constructor(){super();Ne(this,"setTransitionEffect",t=>{this.transitionEffectType=t});Ne(this,"getTransitionEffect",t=>this.transitionEffectType===t);this.cameraDir=new $,this.frameRate=1e3/30,this.initParticle=!1,this.transitionEffectType=null,this.transitionTime=C3,this.update()}setCustomShader(t){t.vertexShader&&(t.vertexShader=t.vertexShader.replace("varying vec3 vViewPosition;",` varying vec3 vViewPosition; varying vec3 vWorldPosition; varying vec3 vSurfaceNormal; @@ -5420,13 +5420,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } gl_FragColor = vec4( col, diffuseColor.a ); - `),t.uniforms.pixelTexture=I3.pixelTexture,t.uniforms.noiseTexture=I3.noiseTexture,t.uniforms.cameraDir=Ht.cameraDir,t.uniforms.eye=Ht.eye,t.uniforms.switchItemTime=Ht.switchItemTime,t.uniforms.switchItemDuration=Ht.switchItemDuration,t.uniforms.transitionEffectType=Ht.transitionEffectType,t.uniforms.fadeInAvatarTime=Ht.fadeInAvatarTime)}playFadeOutEffect(){Ht.transitionEffectType.value=Ki.fadeOutAvatar,this.particleEffect.emitSpotLight(),this.particleEffect.emitPixel(),this.particleEffect.emitTeleport(),this.transitionTime=this.frameRate*((C3-Ow)/T3),this.initialFadeOutTimer()}playFadeInEffect(){Ht.transitionEffectType.value=Ki.fadeInAvatar,this.initialFadeInTimer()}playSwitchItemEffect(){Ht.switchItemTime.value=Zye,Ht.transitionEffectType.value=Ki.switchItem,this.transitionTime=M3}setParticle(t,r){this.particleEffect=new nwe(t,r,Ht)}initialFadeOutTimer(){Ht.fadeOutAvatarTime.value=Ow}initialFadeInTimer(){Ht.fadeInAvatarTime.value=IT}update(){setInterval(()=>{this.scene&&this.camera&&!this.initParticle&&(this.setParticle(this.scene,this.camera),this.initParticle=!0),this.initParticle&&this.particleEffect.update(),Ht.transitionEffectType.value===Ki.switchItem?Ht.switchItemTime.valueC3&&(Ht.fadeOutAvatarTime.value=Ow,Ht.transitionEffectType.value=Ki.loadingAvatar)):Ht.transitionEffectType.value===Ki.loadingAvatar||Ht.transitionEffectType.value===Ki.fadeInAvatar&&(Ht.fadeInAvatarTime.value>.1&&Ht.fadeInAvatarTime.value<.5&&(this.particleEffect.emitRing(.5*(1-Ht.fadeInAvatarTime.value)),this.particleEffect.emitRespawnPixel()),Ht.fadeInAvatarTime.value>=.5&&this.particleEffect.removeSpotLight(),Ht.fadeInAvatarTime.value+=ewe,Ht.fadeInAvatarTime.value>qye&&(Ht.fadeInAvatarTime.value=IT,Ht.transitionEffectType.value=Ki.normal,this.setTransitionEffect("normal"),this.dispatchEvent(new Event("fadeinavatarend")))),this.camera&&(this.cameraDir.set(0,0,-1),this.cameraDir.applyQuaternion(this.camera.quaternion),this.cameraDir.normalize(),Ht.cameraDir.value.copy(this.cameraDir),Ht.eye.value.copy(this.camera.position))},this.frameRate)}}const iwe="_container_1fjfz_1",swe="_messageWindow_1fjfz_11",owe="_messageTitle_1fjfz_25",awe="_buttonContainer_1fjfz_36",ky={container:iwe,messageWindow:swe,messageTitle:owe,buttonContainer:awe};var _V={exports:{}};/*! + `),t.uniforms.pixelTexture=R3.pixelTexture,t.uniforms.noiseTexture=R3.noiseTexture,t.uniforms.cameraDir=Qt.cameraDir,t.uniforms.eye=Qt.eye,t.uniforms.switchItemTime=Qt.switchItemTime,t.uniforms.switchItemDuration=Qt.switchItemDuration,t.uniforms.transitionEffectType=Qt.transitionEffectType,t.uniforms.fadeInAvatarTime=Qt.fadeInAvatarTime)}playFadeOutEffect(){Qt.transitionEffectType.value=Ki.fadeOutAvatar,this.particleEffect.emitSpotLight(),this.particleEffect.emitPixel(),this.particleEffect.emitTeleport(),this.transitionTime=this.frameRate*((T3-kw)/I3),this.initialFadeOutTimer()}playFadeInEffect(){Qt.transitionEffectType.value=Ki.fadeInAvatar,this.initialFadeInTimer()}playSwitchItemEffect(){Qt.switchItemTime.value=$ye,Qt.transitionEffectType.value=Ki.switchItem,this.transitionTime=C3}setParticle(t,r){this.particleEffect=new twe(t,r,Qt)}initialFadeOutTimer(){Qt.fadeOutAvatarTime.value=kw}initialFadeInTimer(){Qt.fadeInAvatarTime.value=UT}update(){setInterval(()=>{this.scene&&this.camera&&!this.initParticle&&(this.setParticle(this.scene,this.camera),this.initParticle=!0),this.initParticle&&this.particleEffect.update(),Qt.transitionEffectType.value===Ki.switchItem?Qt.switchItemTime.valueT3&&(Qt.fadeOutAvatarTime.value=kw,Qt.transitionEffectType.value=Ki.loadingAvatar)):Qt.transitionEffectType.value===Ki.loadingAvatar||Qt.transitionEffectType.value===Ki.fadeInAvatar&&(Qt.fadeInAvatarTime.value>.1&&Qt.fadeInAvatarTime.value<.5&&(this.particleEffect.emitRing(.5*(1-Qt.fadeInAvatarTime.value)),this.particleEffect.emitRespawnPixel()),Qt.fadeInAvatarTime.value>=.5&&this.particleEffect.removeSpotLight(),Qt.fadeInAvatarTime.value+=qye,Qt.fadeInAvatarTime.value>Jye&&(Qt.fadeInAvatarTime.value=UT,Qt.transitionEffectType.value=Ki.normal,this.setTransitionEffect("normal"),this.dispatchEvent(new Event("fadeinavatarend")))),this.camera&&(this.cameraDir.set(0,0,-1),this.cameraDir.applyQuaternion(this.camera.quaternion),this.cameraDir.normalize(),Qt.cameraDir.value.copy(this.cameraDir),Qt.eye.value.copy(this.camera.position))},this.frameRate)}}const rwe="_container_1fjfz_1",iwe="_messageWindow_1fjfz_11",swe="_messageTitle_1fjfz_25",owe="_buttonContainer_1fjfz_36",Qy={container:rwe,messageWindow:iwe,messageTitle:swe,buttonContainer:owe};var xV={exports:{}};/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames -*/(function(n){(function(){var e={}.hasOwnProperty;function t(){for(var s="",o=0;ot.name===n);return await fetch(e.file).then(t=>t.text()).then(t=>new DOMParser().parseFromString(t,"image/svg+xml").firstElementChild)}function Bn(n){const{size:e,icon:t,className:r,onClick:i,theme:s,type:o,text:a,onMouseEnter:l,active:c,onSubmit:A,minWidth:u,disabled:f}=n,h=be.useRef(null);return be.useEffect(()=>{t&&wwe(t).then(d=>{h.current&&(h.current.innerHTML="",d&&(d.classList.add($n.icon),h.current.append(d)))})},[t]),o&&o==="login"?k.jsxs("div",{className:Ad(r,$n.iconButtonWrap,s&&s==="dark"?$n.dark:$n.light,c&&$n.active),style:{height:e},onClick:i,onMouseEnter:l,children:[k.jsxs("svg",{width:"71",height:"67",viewBox:"0 0 71 67",className:$n.buttonBackground,xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M2 2H68.8452L64.1437 65H2V2Z",className:$n.buttonBackgroundColor,fill:"#D9D9D9",stroke:"#050B0E",strokeWidth:"4"}),k.jsx("path",{d:"M9 9H62L58.2676 58H9V9Z",fill:"#050B0E",className:$n.innerBackgroundColor})]}),k.jsx("span",{ref:h,className:$n.iconWrap})]}):o&&o==="icon"?k.jsxs("div",{className:Ad(r,$n.iconButtonWrap,s&&s==="dark"?$n.dark:$n.light,c&&$n.active),style:{height:e},onClick:i,onMouseEnter:l,children:[k.jsxs("svg",{className:$n.buttonBackground,width:"69",height:"63",viewBox:"0 0 69 63",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M5 2H2.85562L3.00485 4.13918L6.7903 58.4048L6.9201 60.2656H8.78545H62.6772H64.6178L64.6763 58.3259L66.3135 4.06031L66.3756 2H64.3144H5Z",fill:"#efefef",className:$n.buttonBackgroundColor,stroke:"black",strokeWidth:"4"}),k.jsx("path",{d:"M8.77795 7.28503H61.7957L59.8437 54.7911H11.367L8.77795 7.28503Z",fill:"black",className:$n.innerBackgroundColor})]}),k.jsx("span",{ref:h,className:$n.iconWrap})]}):k.jsx("button",{className:Ad(r,$n.buttonWrap,s&&s==="dark"?$n.dark:$n.light),onClick:i,onMouseEnter:l,onSubmit:A,type:o,disabled:f,style:{minWidth:u?u+"px":""},children:k.jsxs("div",{className:$n.innerWrap,style:{fontSize:e},children:[t&&k.jsx("span",{ref:h,className:$n.buttonIconWrap,style:{height:e,width:e,opacity:f?"0.4":"1"}}),a&&a]})})}function _we(n){const{cancelOption:e=!0,confirmDialogText:t,confirmDialogWindow:r,setConfirmDialogWindow:i,confirmDialogCallback:s}=n;return r?k.jsx("div",{className:ky.container,children:k.jsxs("div",{className:ky.messageWindow,children:[k.jsx("div",{className:ky.messageTitle,children:t}),k.jsxs("div",{className:ky.buttonContainer,children:[e&&k.jsx(Bn,{size:16,theme:"light",text:"Cancel",onClick:()=>{s[0](!1),i(!1)}}),k.jsx(Bn,{size:16,theme:"light",text:"Continue",onClick:()=>{s[0](!0),i(!1)}})]})]})}):k.jsx("div",{})}const xwe="_backgroundImg_1yy0g_1",bwe="_darkBackground_1yy0g_16",Ewe="_logo_1yy0g_29",Hy={backgroundImg:xwe,darkBackground:bwe,logo:Ewe};function Bwe(){const{debugMode:n}=J.useContext(sr);return k.jsxs("div",{className:n?Hy.darkBackground:Hy.backgroundImg,children:[k.jsx("div",{className:Hy.backgroundBlur}),k.jsx("div",{className:Hy.Background})]})}const Swe="_buttonContainer_1x1gj_1",Mwe="_buttonLeft_1x1gj_10",Cwe="_buttonRight_1x1gj_14",Twe="_buttonCenter_1x1gj_18",Iwe="_sideMenu_1x1gj_33",Rwe="_scrollContainer_1x1gj_44",Uwe="_scrollContainerOptions_1x1gj_52",Fwe="_bottomLine_1x1gj_60",Pwe="_editorButton_1x1gj_94",Lwe="_editorText_1x1gj_102",Dwe="_selectorContainerPos_1x1gj_112",Nwe="_selectorButton_1x1gj_137",Owe="_selectorColorPickerUI_1x1gj_146",kwe="_selectorColorPickerButton_1x1gj_152",Hwe="_selectorPickerTabs_1x1gj_162",Qwe="_selectorColorPickerImg_1x1gj_170",zwe="_uploadContainer_1x1gj_176",Gwe="_uploadButton_1x1gj_189",Vwe="_relativeBox_1x1gj_209",jwe="_blendshapeGroup_1x1gj_213",jt={buttonContainer:Swe,buttonLeft:Mwe,buttonRight:Cwe,buttonCenter:Twe,sideMenu:Iwe,scrollContainer:Rwe,scrollContainerOptions:Uwe,bottomLine:Fwe,"editor-container":"_editor-container_1x1gj_87",editorButton:Pwe,editorText:Lwe,selectorContainerPos:Dwe,"selector-container":"_selector-container_1x1gj_123","selector-container-column":"_selector-container-column_1x1gj_129",selectorButton:Nwe,selectorColorPickerUI:Owe,selectorColorPickerButton:kwe,selectorPickerTabs:Hwe,selectorColorPickerImg:Qwe,uploadContainer:zwe,uploadButton:Gwe,relativeBox:Vwe,blendshapeGroup:jwe},Wwe="_dropArea_1a0z4_1",Kwe={dropArea:Wwe};function S0({onFilesDrop:n}){const[e,t]=be.useState(!1),[r,i]=J.useState(null);be.useEffect(()=>{const o=l=>{l.preventDefault(),t(!1);const c=l.dataTransfer.files;n&&i(c)},a=l=>{l.preventDefault(),t(!0)};return window.addEventListener("drop",o),window.addEventListener("dragover",a),()=>{window.removeEventListener("drop",o),window.removeEventListener("dragover",a)}},[]),be.useEffect(()=>{r&&n(r)},[r]);const s=()=>{t(!1)};return k.jsx("div",{onDragLeave:s,className:Kwe.dropArea,style:{display:e?"flex":"none"}})}const Xwe="_mainTitleWrap_4fb0s_1",Ywe="_mainTitle_4fb0s_1",$we="_topLine_4fb0s_18",aS={mainTitleWrap:Xwe,mainTitle:Ywe,topLine:$we};function il({title:n,width:e,left:t,right:r}){const i={width:e?`${e}px`:null,left:t?`${t}px`:null,right:r?`${r}px`:null};return n&&k.jsxs("div",{className:aS.mainTitleWrap,style:i,children:[k.jsx("div",{className:aS.topLine}),k.jsx("div",{className:aS.mainTitle,children:n})]})}const Zwe="_ContainerPositionTop_v15ql_2",Jwe="_ContainerPosition_v15ql_2",qwe="_Container_v15ql_2",e_e="_topLine_v15ql_68",t_e="_traitInfoTitle_v15ql_96",n_e="_flexSelect_v15ql_105",r_e="_flexButtons_v15ql_114",i_e="_flexButtonsTop_v15ql_122",s_e="_optionButtons_v15ql_131",o_e="_optionButtonsSmall_v15ql_143",vr={ContainerPositionTop:Zwe,ContainerPosition:Jwe,Container:qwe,"arrow-button":"_arrow-button_v15ql_39","left-button":"_left-button_v15ql_55","right-button":"_right-button_v15ql_62",topLine:e_e,traitInfoTitle:t_e,flexSelect:n_e,flexButtons:r_e,flexButtonsTop:i_e,optionButtons:s_e,optionButtonsSmall:o_e},a_e="/assets/randomize-green-4388c12b.png",l_e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyNDo0My0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjNiOTBlZjU3LTIwOWItYzQ0Zi05OWNjLTkwYjYxM2Q0MWJiOCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo2NWQ3ZjJiYi1jMWI3LWI3NDMtYWJiMy0xZjNlYzYzMWIxNDQiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo2NWQ3ZjJiYi1jMWI3LWI3NDMtYWJiMy0xZjNlYzYzMWIxNDQiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjY1ZDdmMmJiLWMxYjctYjc0My1hYmIzLTFmM2VjNjMxYjE0NCIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyNDo0My0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDozYjkwZWY1Ny0yMDliLWM0NGYtOTljYy05MGI2MTNkNDFiYjgiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6bbHqfAAAFoklEQVR42u2duWtWQRTFo5hGRNAETKFiIQqCSxGto4iCqSLon6BoQJJCEcEFLASbD7QRRcTKNbihoLgUWhj/AItUCi7gVmjikubzPphAiOYts9659xQHAnl5M2/u73vnzHwvbzra7XaHNg1cPrKadJs0bnSHtEbjWGgr/HxSi9SeRWeLYwCAzOIPmk97u0ITpAMAQE7h+0ivaxR+psZIWwBAvoVfSXpsUfiZelZkBgAgx+dtJTIfaPV5W4nLB9p93lZi8oEEn39iWcRPpK2kzaSPlud4mns+0Ojzk6QTpM5p5+skHSP90ZYPtPn8DVJ3ybkXk65oygdafH6UtKlBW72klxrygfT5/BfSLoe2B0xWELt+oMbnHfoxj3RUaj6Q6vNdAfq0SGI+UOvzDn0UlQ/U+7z2fACfV54P4PPK8wF8Xnk+gM8rzwfweeX5AD6vPB/A55XnA/i88nwAn1eeD+DzyvMBfF55PoDPK88H8Hnl+aBup/aQflp26HrZc3hQaT64Zjnmv0h7nQEwT8u24PNJQdjokA9aVXfdqsaH4fNsQNhJ+mxRj2EXAO41bGw/ihUchH0Na3LXBYC7DRs7T1qOQgUr/lLSuZgA3LL0nkukhSiat8IvIF2wrMWtFABMJdHDpLkoolPxD5mxbOcGwJTekfpRzMaF305662H8kwMwpRekDShuZeHXkp57HHc2ACAfhPP5JAB8MB3+jXyQzOeLJfaLpPcpAPhmjlnmcMtSnQ8cfb6w1BXmPF9TAFB8N9Az7dhtpDfIB8F9vvjQ7Jh2rp6K72mCArDkP39z0GHaIjofOPr8lG3OmXHOJawAmHah57F+4G0+P+sHgyUAHm91/fD5cmtkDYDmfODT57MHQFM+COHzYgCQng9C+bwoACTmg9A+LxIACfkgls+LBiDHfBDb51UAkEs+SOHzagDgnA9S+rw6ADjlAw4+rxaAlPmAk8+rByB2PuDm8wAgUj7g6vMAIHA+4O7zACDc7fqk+a/lbJel1QPgIR9k/cUUAAj7SDX7r6YBgP98wM7nAUCa9YOo83kAwC8f5PIACgDwnA+yegQNADQfsGdlb9rK8HoAQMMBK3vryT0AIB+ARyXX9AgAyAfgYck1PQQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlALQAwCSX0+y18V/L/a3BQDJr2cx6UcKAMZz3BRaIADdphZJNo16ldsG0ZIAoP721thY2gmAulvH3iB1AYCot/0rMbaObbJ59KR53UonAAjW907ScTPWUfYOHpK2fXyuADhsHz/kAkBBXMvy5QqjHPNBbgBQnzbW8PnZ1Kq6I9ftxJ6KuWaZrnOaLeQCQDHFJl1zeLPJ3jrtNOnQfIe7AZt8wB0A6sM80lHSH8uxPlPUqm57Nh1cSXps2bnk+YAzANT+AOmT5dg+Ja1q2qZLZ/tIry07m2z9gCMAjj4/Rtpi27aPzg9WrERVrR90awXAzOevWo7dBOmAax98XUg2+YADAGZ2dSyWzwcHIKd8kBoAM5+P6vPRAMghH6QCIKXPRweAcz6IDQAHn08GAMd8EAsATj6fFABu+SAGANx8ngUAXPJBSAC4+jwrADzlg5u2+SAEANx9niUAqfKBTwBy8Xm2AHjKB19Ju2MDkJPPswcgZj5wBSBHn88GgBj5wBaAnH0+OwBC5oOmAEjw+SwBCJUPmrwuXorPZw2Ax3yw3pxnpOS4EXPMOkk+LwKAGflgwrI4p0kPSn5/n3RKms+LAsBDPggh1j4vDgBP+cCHsvB5sQB4ygfifV48AJ7WD8T6vBoAAueDbH1eFQAB8kH2Pq8SAA/5QIzPqwbAIh+I83kAUD8fiPR5APAvCKtJt80dYdz8vEbjWPwFnWtJD/nY2zYAAAAASUVORK5CYII=",c_e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyNDo1MS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmM2NDY5Y2JiLWFkMzUtYmQ0Ny04M2Q1LWU0NGQ0MTI2YmYwNiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoyMjUyMzZlNS1mYTFiLWUzNDUtOGQzNi0xOWJkMmE0YmYzNTEiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDoyMjUyMzZlNS1mYTFiLWUzNDUtOGQzNi0xOWJkMmE0YmYzNTEiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjIyNTIzNmU1LWZhMWItZTM0NS04ZDM2LTE5YmQyYTRiZjM1MSIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyNDo1MS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpjNjQ2OWNiYi1hZDM1LWJkNDctODNkNS1lNDRkNDEyNmJmMDYiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6qPgTwAAAEeUlEQVR42u2dX4tNURiH58KfwR1K0USSj6BoIpdydcY0TUMmIy58BPdK/uTCLReaG7kwooQoH4FQyneQMNw53t2cqdOJPfusvfZa77ve5+JX1DlnOns9PM+cqT0T/X5/wtt6D64ekj2W/ZKtDv582OO18Hbwk7I7sv5/dle2DQDKPPzLsp81h7++6n+EKwBQzsGfkH1ucPCj+yI7CQB2D/6A7GXAwY/utewgAJTj+dAV2QdePR+64vrAu+dDV0wf4HnnfYDnnfcBnnfeB3jeeR/geed9gOed9wGed94HeN55H+B5532A5533AZ533gd43nkf4HnnfYDnnfcBnnfeB3jeeR/geed9gOed9wGed94HeN55H+B5530wzsHvkr3hQqvfW9nuLgDYKXvGBVa/F50AMATCHtkKF1rdqn+ce1NG4BHZOy589n2QHc35beBZ2VcOIvm+yRa1fBC0SXZN9oeDSbLrss0aPwqmDxR6PggA+ULnZRfpA9uel+ddkJ0LAWB56AOG/fSBLc/L86ZkrwavsxwCwOgPd6q/T9IHuj0vz9kquzl6djEAqPZDdok+0Ol5ed6S7Ps/XjMaAOurfgh0nD5Q4/lp2aea144OwPDHjvRBXs8/b/A1OgOAPtDj+awA0Af5PZ8dAPogr+fVAEAf5PG8OgDog7SeVwuA1z5I7XnVAHjqg1yeNwFAyX2Q2/OmACitDzR43iQA1vtAk+fNAmCxDzR63jwAFvpAs+eLAUBrH2j3fHEAaOkDK54vEoCcfWDN80UDkLIPrHreBQBd94Flz7sCIEYfPCnM8+4AiNEHZ2RzhXjeLQCt+6AQz7sHoFUfFOB5AIjRB4Y9DwAx+8Cg5wEgVh8Y9TwANNjt6rOADT4nuFHg+waAoc3WvOfZQt8zAAxtruY9zwFA+QDM1LznGQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANsA3AeAYnYvBIBTsvcAYH4fZaeDf328PHmxt3bzRACwteqWNkvBvz5+5MJs6a3dRBEAbOxWdVOrJmc77j1z9smeAoDaVbe1mRrnTENvnnSst3YzZQDQsepGVtMhZ9n29mkW+6AkABp5vjMAjPZBKQA09nynABjsA+sAjO35JAAY6gOrAAR7PikABvrAGgCtPZ8FAMV9YAmAKJ7PBoDSPrAAQFTPZwdAWR9oBqATz6sBQEkfaASgU8+rAyBzH2gDoHPPqwQgYx9oASCZ51UDkKEPcgOQ3PMmAEjYB7kAyOZ5UwAk6IMcAGT1vDkAOu6DlACo8LxZADrqgxQAqPK8eQAi90GXAKj0fDEAROqDrgBQ6/miAIjQB7EBUO/5IgFo0QexADDj+aIBCOiDtgCY87wLAMbogzYAmPS8GwAa9kEIAKY97w6ADfpgHACK8LxbAEb6YHVwqPM1j5sfPOZ3SZ53D8DgcLfLHsoWah6zIHsk2+HluvwF92zupxEV3NQAAAAASUVORK5CYII=",A_e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyMjo0Mi0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmY3YWFkYzZiLWM2ZmEtNjE0OC05YWZkLTgxN2Q1OWRkZTI0MiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo3NjUxYWZkMi1lOWE3LTk3NGYtYWVhZC03YjFjMjg0NmFhM2YiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo3NjUxYWZkMi1lOWE3LTk3NGYtYWVhZC03YjFjMjg0NmFhM2YiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjc2NTFhZmQyLWU5YTctOTc0Zi1hZWFkLTdiMWMyODQ2YWEzZiIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyMjo0Mi0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpmN2FhZGM2Yi1jNmZhLTYxNDgtOWFmZC04MTdkNTlkZGUyNDIiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6TWt7cAAAFm0lEQVR42u2dT2xURQCHSTXpQTH0oIJpgfZKi1ETiSK1MV7FbORQNcG0Hmg3oQVjjKARrhDBBDEYMSEYS6kWkxoVAheDiBc9kHBBuaGgMSo1KgTF+pt0JLq6dOe93X3z5zt8SbPdvtmZ37fvvc7Mm5k3MzMzD9KFRkAAGgEBAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABPKO0f3OrWCxWiTViROwQ+8QBcchywL62w77HvLdPdJpjIEAYYd8sHhDPiD3iuLggfhczGblqj/GJ2Cs2il5xCwL4EfoK8bw4LH7MEbQrF8UR8aK4T7QgQPNC77On6jNNDHwuzopXzGdDgMaEvlRsEqc8Cr0ap+2ZoRMB8gdvrulviT8CCP7/7h/GxIMI4B78Q+KjAEOvhrlHeRgB5g7e3FB9GFHwlZi6rUSA/wZ/m3g94uAreVMsRIDZ8J8S3yUU/t98L55OVgDby3Y4weArMf0JXUkJoAo/Ln4i/GtMiyeTEEAV3U3gVXktWgFUuXbxKSHPyWeiIyoBVKG7xXnCrRnTVvdEIYAqsjrniFwjGteciabEuGXKvnbes57ER4MWQBVY60FD/ioOiiHRfb3xfTt/oNu+1/zNLx58/rVBCqAPPlxww52x4/e356jDrfYYXxZcl+GgBCg4/Gk7KaSljvVpsSJcLLBe5SAEMB+04L72JQ08qy0ueKyi7LUABYe/pYn/0r4UiwSxhD9UQIfWuhgkiOGav67A8YzgJeC0n7/+W0KWIOTwj3o0keVoqBKEGv5vYoFHAiwQl0KUIMTwDSM5wuoQg3Ya90HLTvtaR47jjhbcJuWmCOBB+OcyBrTcPgJ25TrHvmKFuDNjGedCkyC08DN9+20vnms5GwM8CzhLEFr45jo73zGUbTnK2+5Y1nxxOSQJQgrf8G4B38gRxzInPWmrcl0E8Ch8w4BDEF11LLfLodwBj9qrnEsAz8I3LHMI4r06ljvpUO4yz9qsnEkA/WG/ZxX5VtxQYwh3NKD8RTWWfaOHzzn0OwmgP2izU5J8qsQJh2/hYMGXnxMePqja5iLAdg8nSk45BPBqA8rf5VD+lIftt81FgC88rMC4QwDvNKD8CYfyxz1sv88RAAG4BHAJSOMmcICbwBw3gRH8G7ioAeUvTObfwEg6giYL6gjqjqIjiK7gzF3Bg6VYuoIjGAwaYTAoruHgywwHFzAc7JkEoxkmamwQfzIhJI4pYd9knK7VU+OUMNOJszxjGV9HPSXMIwlGc0zebLf9BDsrJoWa19pzHHdDEpNCPZHgUrWOjYKmhbclNS3cEwmOeSTAseQeDPFEgq08GsbDoUMFhj+U/MOhnpwJhgmfBSK2ctpniRizx8DSBga/hCVi/JfgZ/FsrUPHjotETbNIVDjLxH1lVwtjmTgWitw8YYXsqWGhyB773gkWiqyPBI/M0f/ebC7YZWHf/0dXsPn5pP2dL5/TLK+7OpbFou8ygzgsAl37gJdpM5aLT5OTeQalQtgwYhchV2V3KlvG9LNlzL8waxA/kdqmUWY7WDaNmm2DtDaNYtu4a9vGDbJxZJobR75RYuPIqlvHfhBx8GYc4X62jk1v82hTFzaPzrh9/H7PNp2qFbPl/duil+3j6zMMu0mcCiD40+IF0RlC2wYhQIUMveJluymUL6GftWsP94XWnsEJUCHDveI5e439oYmBm06sI/abvqKeG1QhQHYZbhIr7fj9HvFxaXYjyDz3D1ftMY6LvfbYq1yfT0SA4qRotcvDm5vJNfZpYXP52CfGxCHLmH3N/G69eMyczkuzW9y3xtxGUQsACAAIAAgACAAIAAgACAAIAAgACAAIAAiAADQCAgACAAIAAgACAAIAAgACAAIAAgACAAIAAkCc/AWkhfX2hx9ZaQAAAABJRU5ErkJggg==",u_e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAATr2AAE69gE6sVc6AAAE7mlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyMjo0OS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MTQtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MTQtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjhhZWE1MDNlLTM3NGItYmM0NC1iOGNjLTU0OWU2MDUyYzYxMyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo4YWVhNTAzZS0zNzRiLWJjNDQtYjhjYy01NDllNjA1MmM2MTMiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo4YWVhNTAzZS0zNzRiLWJjNDQtYjhjYy01NDllNjA1MmM2MTMiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjhhZWE1MDNlLTM3NGItYmM0NC1iOGNjLTU0OWU2MDUyYzYxMyIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyMjo0OS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDwvcmRmOlNlcT4gPC94bXBNTTpIaXN0b3J5PiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PslPja4AAAbiSURBVHja7Z17iFVFHMc1K80ybc3SP9K21YrubtLDiIJqK5WMpbYt1MpSKiKkba0gtU0rCCpoyxRXSKrNiJIwCmtD0u2JEWFuSC/t2sueghDU2svbd2D+uFzce89rzvxm5vvHB2TX5Zw758PMufN7zJBSqTSEhAsHgQJwECgAoQCEAhAKQCgAoQCEAhAKQCgAoQCEAhAKQCgAoQDVaO1ZOgWsB7+CAbALLAPDOdCeC4CH3AJKg/AlGM/B9lQAPNxG8HcVARS7wQQOuJ8CPFvj4VMCXwXAAx0BfowoACXwUIA68EcMASiBh0vApzEFoASeCdCZQABK4JEAw0A/JQh7H2A8KFKCsHcCxUugX1qnghlgLrgBzNP/bgXTwTRwAjiEAsQf4AkpJChmJYF+0M1gIegGm8Dn4M+I9/If+B68B3rAneBiMIoCCJwJ8DejwZVgBfgQ7E94/Vqor7ybwVJwOgWwKAH+z3HgJrDR4AOvxU7wIDiFAuQoAX7XZumBV0MtF20UID8JnhMoQUlvjXeAw5kQYl6CVUIlUOwD7WBo8BlBhiVYK1gCxU/giuBTwgxL8IJwCRTvg/qgcwINS/CKAxIolgSdFGpYgjcdkeATMDHYrGDDErzriASK+cGmhZuSAD8/DHzskARrg60LMCjBkQkTVWwuCccGWRhiUIIx4DOHJNgLCkFWBhmUYJzer3dFAhWFnOXjRtAosA6cb0ECFaL+xiEJFAt8E6BXf7Cfq22GGJRgIvjBMQlu9yUWsOUgW6M2JGgAvzgmQYfr0cA3quyPm5KgWEWCaXpLVhWtXqVp11k/6uffCpRgoav5AC9GCJvWS0svw99NVhs0OtHkgBAJ5rmWEbQiRqSs3saOYcTPcTzoAv8KkGCGKzmBnQnCpbkvBwlE2GRZAJXQ2ig9K3hOipi52Jmg7D7aLUvwXdbp81k+/DPAPykTJ1yQYKbld4MPJFYGHZPi4bgowaWWZ4I10gTYmHEKlQsS3GxZgtukFIfeayiPzgUJnrYswVm2G0Q0G06mFC2BCuHq7W1bAmxPW8OYNsBjOtJmUoKvwaQMJOiwPAussiVAXoUZJiVQJWW/gR3gSdXrMME4jIzZJ8kEl+UqgC7EzDu33pQElSxPMB6PWRZANeU8KhcBdJKFDeNNxg4q6Yk5JhcJ2CpemZcA6yxX2YibCVQdoIBlQHGhUQHUWiOk+PLEnCRoTJD0YpM+0wJIybS9xmCnknK6YozNGiFjM8eIAAJ2vsqjYlEaSGQxE2yLMT4PCBmfreBkEwK8JuQDfhTjnpsySNUeGfFaiwVlEd1hQoBXhXy4vpjf0femvF6TYzOAMQGkLAHbY763bEt5vWLEJadb0BIwxeeXQJXZOyLGPT+ewTVrSqDi9EIEmO3718DI07K+50JG16xVlfywgHHpzWMj6CkBH/SWmPe8PCcJHrU4JurUltPyEODoDDdakvJ8gvvuyejaRaES3JVnMMj2UvA7GJvgvu/zdCbYYiMc/IRlCRYlvO8GHfrdoY+42+/4TPBXkqk/q4wgm504dsf5NlDlM0zS4VQTM8Ej0nMD0w5ewWKf3kSxews9i0xK8LKEpND5lpeCMx2QwMRyoFLaxkhJC++yKIBay48IcCY4T1pl0GaLErzuSAu7rGaCzJpHZCnAOD0AtiTYEIgEqyUXhxYSHCSZaahYlal5LME7LpSHTxewSdTioQS7TPQSNNUgYoGAeMFbWdTTm+xPEEMCVbvQ4FqLmEVCIodv62PhRjs6E6iS+7NdbRJ1j6AsmQEtw0r1Fg2uBVdrHtJNoqYKlKDZ9TZxSxxqy2atIHWQfYLLfWkUeTcliC3BTN+OjLmVEkSSQEUqr/f1yJgWQb33vGhS4eKRMY36aw0lECCBrfbwdQ6d6uG1BLbPCeimBHYlkHBYxNyU/QUpgScnhmylBPlLIOoUS71Dd4ASBCpAWW1/LyUIVICyQbxE+IFPXkgg/nx7DMSNQvrveCmBeAEqRJA4I+wD57oqgTMCVHTqlvaO0GcrnyA4ASpeFhdn0AAiKTt1HF8dRHWozaSSIAWoGNyTdM/eDQbjDOq0jvX61JCmFPsdoiTwQoCDNG08R7e0Wa1zA7/SGUFRBnqP3pRSp57dD9rAqWBohjOX1TOQvBagysCP1V3DLgCz9IOdDa4DrarSRjWgBMNcPSuZArglpAgJ+DDclaA/i9mKD8JtCTopQNgS9FOAsCVQdZh1FCBcCfakbZPDgXdbgme4BIQrgWoMWaAA/kqgTiz/oooALdwH8F+C4WCZDjwN6L6GL4HJ3AkkFIBQAEIBCAUgFIBQAEIBCAUgFIBQAEIBCAUgFIBQAEIByGD8DzQJyO8fOgE8AAAAAElFTkSuQmCC",f_e="/assets/play-de4238c5.png",h_e="/assets/reverse-e35421b8.png",d_e="/assets/pause-b6381fd4.png",p_e="/assets/fast-forward-0d3ffae5.png",m_e="/assets/fast-backward-1f713448.png";function D1({loadedAnimationName:n,randomize:e}){const{characterManager:t,toggleDebugMode:r,debugMode:i,lookAtManager:s,animationManager:o}=be.useContext(sr),[a,l]=be.useState(s.userActivated),[c,A]=J.useState((o==null?void 0:o.getCurrentAnimationName())||"");be.useEffect(()=>{n==null&&(n="T-Pose"),n!=""&&A(n)},[n]);const u=()=>{r()},f=p=>{p?o.play():o.pause(),o.setSpeed(1)},h=p=>{o.play(),o.setSpeed(p)},d=()=>{s.setActive(!a),o.enableMouseLook(!a),l(!a)},m=async()=>{console.log("play next"),await o.loadNextAnimation(),A(o.getCurrentAnimationName())},g=async()=>{console.log("play prev"),await o.loadPreviousAnimation(),A(o.getCurrentAnimationName())};return k.jsxs("div",{className:vr.Container,children:[k.jsx("div",{className:vr.ContainerPositionTop,children:k.jsxs("div",{className:vr.flexButtonsTop,children:[k.jsx("div",{className:`${vr.optionButtonsSmall}`,onClick:()=>{h(-2)},children:k.jsx("img",{src:m_e})}),k.jsx("div",{className:`${vr.optionButtonsSmall}`,onClick:()=>{h(-1)},children:k.jsx("img",{src:h_e})}),k.jsx("div",{className:`${vr.optionButtonsSmall}`,onClick:()=>{f(!1)},children:k.jsx("img",{src:d_e})}),k.jsx("div",{className:`${vr.optionButtonsSmall}`,onClick:()=>{f(!0)},children:k.jsx("img",{src:f_e})}),k.jsx("div",{className:`${vr.optionButtonsSmall}`,onClick:()=>{h(2)},children:k.jsx("img",{src:p_e})})]})}),k.jsxs("div",{className:vr.ContainerPosition,children:[k.jsx("div",{className:vr.topLine}),k.jsxs("div",{className:vr.flexSelect,children:[k.jsx("div",{className:`${vr["arrow-button"]} ${vr["left-button"]}`,onClick:g}),k.jsx("div",{className:vr.traitInfoTitle,style:{marginBottom:"10px"},children:c}),k.jsx("div",{className:`${vr["arrow-button"]} ${vr["right-button"]}`,onClick:m})]}),k.jsxs("div",{className:vr.flexButtons,children:[e&&k.jsx("div",{className:`${vr.optionButtons}`,onClick:e,children:k.jsx("img",{src:a_e})}),k.jsx("div",{className:`${vr.optionButtons}`,onClick:d,children:k.jsx("img",{src:a?u_e:A_e})}),k.jsx("div",{className:`${vr.optionButtons}`,onClick:u,children:k.jsx("img",{src:i?c_e:l_e})})]})]})]})}const g_e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABAAQMAAACQp+OdAAAAAXNSR0IB2cksfwAAAAlwSFlzAAACxQAAAsUBidZ/7wAAAAZQTFRFAAAAr8rpn4DGigAAAAJ0Uk5TAP9bkSK1AAABRUlEQVR4nEWSMU6GQBSE5wEJGAvotIPOY/AbC8/hLfwr2Nh4HU+gHOEv7aSTTgrjkgDrvLeaP0DyhX07zM4gALpeAN65x1wp1B/YMoWu1wVeO8eGg+gIOCQov9D3SyGcHW73LRO0r4k+gu5YcFkEYWyQrk5kd9QJg6Sr6OceJP9JCO2L5N8ZoT5JORWEcpJyrAj5LPXQENLlDK07EGQ7Qye92Y7QvhEczK2BupXAb9It3yY2EoEnCwYB2BTSFVgUdNP8D6Osme0e9A1zgVMwmT8IiQL1GAKBeowlAoMKom7Ghn4UmGEE19Pz02rxGoQEPNfdasm37t5TBjz7TSzFgHkynytPGcJUesqAGV56LYupXnjKgDkXnjJq8fmRMlwNn9eUIdAoZQi0ThlogyoD61T70ZZVxnpXGfsTjkWE+lRFyN+1ll9u0JghRPMM5gAAAABJRU5ErkJggg==",v_e="_tokenBoxWrap_q4pvo_1",y_e="_mask_q4pvo_7",w_e="_timer_q4pvo_31",__e="_level_q4pvo_42",x_e="_mythic_q4pvo_55",b_e="_epic_q4pvo_60",E_e="_rare_q4pvo_65",B_e="_uncommon_q4pvo_70",S_e="_common_q4pvo_75",M_e="_none_q4pvo_80",C_e="_value_q4pvo_85",T_e="_frame_q4pvo_95",I_e="_emptyIcon_q4pvo_111",R_e="_badge_q4pvo_123",U_e="_frameActive_q4pvo_131",Rc={tokenBoxWrap:v_e,mask:y_e,timer:w_e,level:__e,mythic:x_e,epic:b_e,rare:E_e,uncommon:B_e,common:S_e,none:M_e,value:C_e,frame:T_e,emptyIcon:I_e,badge:R_e,frameActive:U_e,default:"_default_q4pvo_159"},F_e="/assets/magic-box-cd45f027.png",Qa=n=>{const{size:e,active:t,onClick:r,level:i,icon:s,rarity:o,style:a}=n,[l,c]=J.useState(!1),A=()=>{c(!0)};return k.jsxs("div",{className:Rc.tokenBoxWrap,style:{width:e,height:e},onClick:r,children:[t&&k.jsx("div",{className:Ad(Rc.frame,Rc.frameActive)}),k.jsx("div",{className:Ad(Rc.frame,o&&Rc[o])}),k.jsx("img",{src:l?F_e:s,className:Rc.emptyIcon,style:a,onError:A}),i&&k.jsxs("div",{className:Ad(Rc.level,o&&Rc[o]),children:["Lv.",i]})]})},P_e="_InformationContainerPos_72ckd_2",L_e="_scrollContainer_72ckd_15",D_e="_traitInfoTitle_72ckd_27",N_e="_traitInfoText_72ckd_35",O_e="_flexSelect_72ckd_62",k_e="_checked_72ckd_119",H_e="_checkmark_72ckd_123",Q_e="_checkboxHolder_72ckd_136",_a={InformationContainerPos:P_e,scrollContainer:L_e,traitInfoTitle:D_e,traitInfoText:N_e,"input-box":"_input-box_72ckd_43",flexSelect:O_e,"arrow-button":"_arrow-button_72ckd_70","left-button":"_left-button_72ckd_86","right-button":"_right-button_72ckd_93","anim-button":"_anim-button_72ckd_100","custom-checkbox":"_custom-checkbox_72ckd_105","checkbox-container":"_checkbox-container_72ckd_110",checked:k_e,checkmark:H_e,checkboxHolder:Q_e};function y2({jsonSelectionArray:n,byManifest:e=!1}){const{isLoading:t,setIsLoading:r}=J.useContext(us),{characterManager:i}=be.useContext(sr),[s,o]=be.useState(0),[a,l]=J.useState({}),[c,A]=J.useState([]),u=m=>{i.setManifest(m),i.loadInitialTraits().then(()=>{r(!1)})};be.useEffect(()=>{t==!1&&(l(i.getAvatarSelection()),A(Object.keys(i.getAvatarSelection())))},[t]);const f=m=>{i.loadTraitsFromNFTObject(m).then(()=>{r(!1)})},h=async()=>{if(!t)if(r(!0),s>=n.length-1)e?u(n[0]):f(n[0]),o(0);else{const m=s+1;e?u(n[m]):f(n[m]),o(m)}},d=async()=>{if(!t)if(r(!0),s<=0)e?u(n[n.length-1]):f(n[n.length-1]),o(n.length-1);else{const m=s-1;e?u(n[m]):f(n[m]),o(m)}};return(n==null?void 0:n.length)>0?k.jsxs("div",{className:_a.InformationContainerPos,children:[k.jsx(il,{title:"Trait Selection",width:180,right:20}),k.jsxs("div",{className:_a.scrollContainer,children:[k.jsxs("div",{className:_a.flexSelect,children:[(n==null?void 0:n.length)>1?k.jsx("div",{className:`${_a["arrow-button"]} ${_a["left-button"]}`,onClick:d}):k.jsx(k.Fragment,{}),(n[s].name||n[s].manifestName)&&k.jsx("div",{style:{textAlign:"center",flex:1},children:k.jsx("div",{className:_a.traitInfoTitle,children:e?n[s].manifestName:n[s].name})}),(n==null?void 0:n.length)>1?k.jsx("div",{className:`${_a["arrow-button"]} ${_a["right-button"]}`,onClick:h}):k.jsx(k.Fragment,{})]}),(n[s].thumb||n[s].thumbnail)&&k.jsx("img",{src:n[s].thumb||n[s].thumbnail,alt:"Selection Thumbnail",style:{width:"280px",height:"460px",display:"block",margin:"20px auto 20px"}}),n[s].attributes&&n[s].attributes.map(m=>k.jsx("div",{children:k.jsx("div",{className:_a.traitInfoText,children:`${m.trait_type} : ${m.value}`})},`json:${m.trait_type}_${m.value}`)),e&&c.map(m=>k.jsx("div",{children:k.jsx("div",{className:_a.traitInfoText,children:`${m} : ${a[m].id}`})},`val:${m}`))]})]}):k.jsx(k.Fragment,{})}const ux="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYCAYAAABxlTA0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAXASURBVHgB7ZzNchNHEMd7ZiWf5WtSCSIfVa5cLN+MTRXrEFPcWJwHwNxys/0Etm+5YZ4Ac0pOIG4EU2WlCgffIm4+pIhS8ADKEQlt07OSKKGdlVdSz64K9++kmhlpR3+Pe3qmuwUgCIIgCIIgCIIgCIIgCIIgCIIgXHAUzCDLflDWRfCVgkVA5aOCkgqhRLMt9cdQW0MhNEBhHRFehW2ondaqDZgxZkZg3w9KrTm9RdJtknBlmAwjeLXTgvuzInbuAi//FPieUrv00gdW1GGnHe7nLXRuAkdmoKDvKYUBOCVfoT3IgSvrP295Gn4nG1sB91S0p4Kvvl34/83rszpkTOYrePXGxj1A3E41GKGGCl/Rq7oXQpM2tma/q0PC0R+orFAt0rfwU32eUgcnzx7tQIZkJrDZxNpFdUwvR6/arqgP59pQrdWqTUj52a0iBCT2nRRi14ttXEv72dOSicCpxCVhFeD+i+fVGkzB8s2g7HVgj77anRHDMhO5ABkwUlzjz4Z4d1ph+5w+jTazzZX1oEYmYTfB5av05rQEjtHgmMjmJoiLqKrFFi5xiTtEPTqcJFPpzc0pTk0EraJNBeqBrU9hZA72wAH03ArZ4+PBk18Socadl39UD8ARzgTuHnfVMT2gPNw3K+L2aHbauOTKT3ZmIrwi7NrENWYhR3Ftm1pJz2lnpsKJwGb10jrdjHXQhhYWQid+6Hnimv8a8hwum0siS19wlY7s4AAnApvVC9aH4U5vl2cljbjmv8a4ZZo8FtsY7N6HsMNug83q9YrqX8ujDk+OHt0FZtKKO9i2un7buGj+8Fha4fPcvjH7CtYeWI/BHS/cB2YmEbffbhvfKkC6I/wY8JsIrW7F2uiUxm0aJhXX0PO7a7H3qJGnv4lgFdiYB6vnQHcLwMg04n6cE1jnVF75ceMSMMIqsAnz2NrNxQ0wwSHu6DmFa8AIr4kILUdiMg9cGweXuIbenGqxDo/3jppVYKXpbnaI3n3u1HCK+3FuYXxuZIevASOsApNdK8faMO7Yj4sLcSM0xCMcmPqInfIRjNDFTnm4jWJSU4VpnIlr5hbaj87AiPPrymlwKa6hrS6wwK7FzQpegTG+Ijp6/BXxuYhr4N3kFMYEVu/HEzhLcZU90tIARrg3ubhNG8OvzHrlWuN1OMMCk1/553Abib6Y5r15mAWXfnsfXhusrS6Zb8L2o96Wh7i9OfmWrqncymFYBQ49y9GTaGkIkt6T14ZmElVs7UnfYVJYBTZXknSaawy3K89+DZint6BsiSkUTuK+VuX3gxFs14D+cMwrT3G7McO4eUDEJ8AMu8Bz7+HA1j4Y88rbz02KGZJ5YM+PcJIXkRTzIuHWQjqe5inuletBoLV6HO9xEzN0clROinnRKn6Qp7hRxEUraw6Ei5ihwYnAJuZlEkwsXeU8j79RRj3YkgHVoYt0guiZ4IgowQQhVSQjC3FXbmzsWssVyHNwtXoNzkoI3v5z1vz6m4V3FCK4OWpcZuIi7tn6yK3cefnMSXZnhNMajTevz04vXV6YJ5GXrQPM6mnDztvGGUvMbhhzWvviux9+U4C/gPXxeP/kqPorOCSTDHfyKv6G5Ox2czjZ/+uoegiMmPIwbTZVSKy5q58cPXaegJ1JhrtJ1x+R5V42OcSr6xvXOMqtUtbdRSUEkAGzVwRDoXSTFDJREUz3+OufM/zzK4IZ5Or14AC12ko5vGZqkcMQ/sOBWy5FURK6yy31apkrtFNV0iRcG5v74qi6DRmSS6WnKS0YUaDigiZdNOyfPHdXKpBELpWepuLyy+8XnmiEefobp454TII58IQFvE2u2FPIgfyLwdPVtY0PU93dtMzMzxkYoXUHtsl03JrUdJCdbmjEhwW60ctqEzuP2fxBjq7YPph6ZFSLaGqSP/VnmyQm3cqZ+uUoDlif1R/kEARBEARBEARBEARBEARBEARBEC48HwDC3eeu0ZVWOQAAAABJRU5ErkJggg==",R3=({active:n,src:e,select:t})=>k.jsx("div",{className:`${jt.selectorButton}`,onClick:t,children:k.jsx(Qa,{size:56,icon:e||"",rarity:n?"mythic":"none"})}),z_e=({selectedTraitGroup:n,onBack:e})=>{const{decalManager:t,characterManager:r}=J.useContext(sr),[i,s]=J.useState([]),o=n.getAllDecals();return J.useEffect(()=>{const a=Array.from(t.applied.keys());s(a.map(l=>l))},[]),k.jsxs("div",{className:jt["selector-container-column"],children:[k.jsx(Bn,{theme:"dark",text:"Back",size:14,className:jt.buttonLeft,onClick:e}),k.jsxs("div",{className:jt["selector-container"],children:[k.jsx(R3,{src:ux,active:!1,select:()=>{t.removeAllOverlayedTextures(),s([])}},"empty"),o.map(a=>{const l=iV(r.manifestData.getTraitsDirectory(),a.thumbnail);return k.jsx(R3,{src:l,active:i.includes(a.id),select:()=>{i.includes(a.id)?t.removeOverlayTexture(a.id).then(()=>{s(i.filter(c=>c!==a.id))}):t.loadOverlayTexture(n,a.id).then(()=>{s(i.concat([a.id]))})}},a.id)})]})]})},G_e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYCAYAAABxlTA0AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFyWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0wMlQxMTo0OTozNy0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMDJUMTE6NTI6MjMtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMDJUMTE6NTI6MjMtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjBmNjkzZGRkLWI4ZWYtZTU0Ni05YWQ2LTRjNzJkOTg4MTJhNCIgeG1wTU06RG9jdW1lbnRJRD0iYWRvYmU6ZG9jaWQ6cGhvdG9zaG9wOjBiNWViMTliLTkxMmEtMmI0NS1iOTZlLTliNDUxOGUzZDU4NyIgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjg4ODliZDlkLTAxZjItMTQ0Ni04NDE4LWYyYzNjNjQ1ODNlOCI+IDx4bXBNTTpIaXN0b3J5PiA8cmRmOlNlcT4gPHJkZjpsaSBzdEV2dDphY3Rpb249ImNyZWF0ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6ODg4OWJkOWQtMDFmMi0xNDQ2LTg0MTgtZjJjM2M2NDU4M2U4IiBzdEV2dDp3aGVuPSIyMDI0LTAxLTAyVDExOjQ5OjM3LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiLz4gPHJkZjpsaSBzdEV2dDphY3Rpb249InNhdmVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjBmNjkzZGRkLWI4ZWYtZTU0Ni05YWQ2LTRjNzJkOTg4MTJhNCIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0wMlQxMTo1MjoyMy0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiBzdEV2dDpjaGFuZ2VkPSIvIi8+IDwvcmRmOlNlcT4gPC94bXBNTTpIaXN0b3J5PiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv0y+4AAAASPSURBVHja7ZxrSBVBFMctyqIgC0ujJ5UFaQpZRC/7YoUVQYUUkZQYQoVfJBF62PtBlhlJoJWSUQRSEYUFUVRiSEWRiokVgZqRWUEv7W3/oQkul53Ze+/OXWfyfPh98e6cPfNjnZ2ZPbshnZ2dIUTwIAkkmAQTJJgEk2CCBJNgEkyQYBKsgFnzlsaCanARZICFIJwEqxN8CXR68R08479lgxVgDAkOTPATC8EiXoLbYB9YDeJJsFzucPDLD8FWvABlIBcsAeNBKAn+K3i+Q7ki3oNycAys4eP8gO4oeH2QBFvxFVSAYj6uR3cHwWdcFGzFG1AF8sBakOBkeNFR8AMbAY/BedDqovQPoA6UgghjBbMxkXfGqpMfwUyv4w90wRV+1GTBCyQdmy5oc8hlwQdMFrxF0KlzkjbDwA8XBSebLPikv1cNfusBml0UHGWy4BpBp0olbYaAjgBlselZHBgNloNGm+PbQF8jBfsgKlrQbnuActMtYoWCBkmb68ZO09hNzEbIUzDCq82GAOXekuSRJGl3xGTBmT6IYXsU10Ahn5cGOo5ukeQxCLQL2q0zWXCBizeq7TZD1XdBu1iTBVe4KPieJI9kQZtPYKCRgpF4P/DW5QVDnkUeUVyk1fH3jd2L4Pu1KqSxMfohH6cbfbmS+eqRTdX22ixYck0WnKZAbguY5BV3o8IrPsVkwWUKBMQIYmcpEjzdZMF3eCfaA4C1OxGkld4/WgPdE9ZBLttLGMwJD4AI0F8SvycfPpwIvkuFJ2LBQyXzWl8pck0wmwuCcWCUZrCcwizy3aZg/E13RTBONMXjpL81g+W0wyvf/YpucHPdEpzbxQ8k7djlkesmRTHbnZRt+Ss4T3PBOz1y3aooZq1rj+1xsoMGCd6sKOYFEhxcwRm6Cf4JvmksuIUXlrz2MeZknQTv5k95e4HZvCM6CU73c5O/w2ldskrBqTbL4K4WnCbIL0MS75GrtWkSwZWSNgkaCK63Wao3CeKd0kVwgaRNmGQT2y3BZ236VS6Il6OL4OOSNpEK9gKcCq6y6VetIF6iLoKbRdt5vNhZhzE4UZDfYkm8kboIZpy2OH4C+KyJYFZsPdUrvzmSWM9dL8D2YZpWw4tBlrEyTz4n1mmaxvK5DvLBTY9NIitKdBT8P63k1pPg4ApOMllwBX+9agZYKamqdCI4x0Ec9vg+0lTBhYLYVxQLznYQp65L3jJSILhN9G4a/j5RseAefBW5gy00/PwvuWSq4GKb+PWqBAviR/Ay2UxeTV8pqObJMlVwiU38hmAKlizl4/iCqIjXIS8yeYgIE8SOUTlEGPkyuKKb3FlB7FskWN00jX1sIxVM4/uxTaqnad1dcNAXGiSYBGsjuJoXvJTy95VJsEJWeZ2/N7hBghWXQXnl0Ae8IsHOGSfJ4zAJdv59HVlR9SYS7JxESR4XSbBzLgtyiKebnDqugrEe248pkveISbAD3oEvtNCglRwJ1l1wvuaC95gueJ/mgnNMFxzFH6m84V841YVW/nZ9DH0/mD4xTpBgEkyQYBJMggkSTIJJMEGCteYPxO/zzCRZDV4AAAAASUVORK5CYII=",V_e="/assets/color-palette-71a7a2d4.png";var lo={},M0={},j_e=typeof Na=="object"&&Na&&Na.Object===Object&&Na,bV=j_e,W_e=bV,K_e=typeof self=="object"&&self&&self.Object===Object&&self,X_e=W_e||K_e||Function("return this")(),ul=X_e,Y_e=ul,$_e=Y_e.Symbol,C0=$_e,U3=C0,EV=Object.prototype,Z_e=EV.hasOwnProperty,J_e=EV.toString,lm=U3?U3.toStringTag:void 0;function q_e(n){var e=Z_e.call(n,lm),t=n[lm];try{n[lm]=void 0;var r=!0}catch{}var i=J_e.call(n);return r&&(e?n[lm]=t:delete n[lm]),i}var exe=q_e,txe=Object.prototype,nxe=txe.toString;function rxe(n){return nxe.call(n)}var ixe=rxe,F3=C0,sxe=exe,oxe=ixe,axe="[object Null]",lxe="[object Undefined]",P3=F3?F3.toStringTag:void 0;function cxe(n){return n==null?n===void 0?lxe:axe:P3&&P3 in Object(n)?sxe(n):oxe(n)}var Yu=cxe,Axe=Array.isArray,ua=Axe;function uxe(n){return n!=null&&typeof n=="object"}var uc=uxe,fxe=Yu,hxe=ua,dxe=uc,pxe="[object String]";function mxe(n){return typeof n=="string"||!hxe(n)&&dxe(n)&&fxe(n)==pxe}var gxe=mxe;function vxe(n){return function(e,t,r){for(var i=-1,s=Object(e),o=r(e),a=o.length;a--;){var l=o[n?a:++i];if(t(s[l],l,s)===!1)break}return e}}var yxe=vxe,wxe=yxe,_xe=wxe(),xxe=_xe;function bxe(n,e){for(var t=-1,r=Array(n);++t-1&&n%1==0&&n-1&&n%1==0&&n<=kxe}var _2=Hxe,Qxe=Yu,zxe=_2,Gxe=uc,Vxe="[object Arguments]",jxe="[object Array]",Wxe="[object Boolean]",Kxe="[object Date]",Xxe="[object Error]",Yxe="[object Function]",$xe="[object Map]",Zxe="[object Number]",Jxe="[object Object]",qxe="[object RegExp]",e1e="[object Set]",t1e="[object String]",n1e="[object WeakMap]",r1e="[object ArrayBuffer]",i1e="[object DataView]",s1e="[object Float32Array]",o1e="[object Float64Array]",a1e="[object Int8Array]",l1e="[object Int16Array]",c1e="[object Int32Array]",A1e="[object Uint8Array]",u1e="[object Uint8ClampedArray]",f1e="[object Uint16Array]",h1e="[object Uint32Array]",Cn={};Cn[s1e]=Cn[o1e]=Cn[a1e]=Cn[l1e]=Cn[c1e]=Cn[A1e]=Cn[u1e]=Cn[f1e]=Cn[h1e]=!0;Cn[Vxe]=Cn[jxe]=Cn[r1e]=Cn[Wxe]=Cn[i1e]=Cn[Kxe]=Cn[Xxe]=Cn[Yxe]=Cn[$xe]=Cn[Zxe]=Cn[Jxe]=Cn[qxe]=Cn[e1e]=Cn[t1e]=Cn[n1e]=!1;function d1e(n){return Gxe(n)&&zxe(n.length)&&!!Cn[Qxe(n)]}var p1e=d1e;function m1e(n){return function(e){return n(e)}}var x2=m1e,hx={exports:{}};hx.exports;(function(n,e){var t=bV,r=e&&!e.nodeType&&e,i=r&&!0&&n&&!n.nodeType&&n,s=i&&i.exports===r,o=s&&t.process,a=function(){try{var l=i&&i.require&&i.require("util").types;return l||o&&o.binding&&o.binding("util")}catch{}}();n.exports=a})(hx,hx.exports);var b2=hx.exports,g1e=p1e,v1e=x2,D3=b2,N3=D3&&D3.isTypedArray,y1e=N3?v1e(N3):g1e,CV=y1e,w1e=Exe,_1e=SV,x1e=ua,b1e=w2,E1e=MV,B1e=CV,S1e=Object.prototype,M1e=S1e.hasOwnProperty;function C1e(n,e){var t=x1e(n),r=!t&&_1e(n),i=!t&&!r&&b1e(n),s=!t&&!r&&!i&&B1e(n),o=t||r||i||s,a=o?w1e(n.length,String):[],l=a.length;for(var c in n)(e||M1e.call(n,c))&&!(o&&(c=="length"||i&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||E1e(c,l)))&&a.push(c);return a}var TV=C1e,T1e=Object.prototype;function I1e(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||T1e;return n===t}var E2=I1e;function R1e(n,e){return function(t){return n(e(t))}}var IV=R1e,U1e=IV,F1e=U1e(Object.keys,Object),P1e=F1e,L1e=E2,D1e=P1e,N1e=Object.prototype,O1e=N1e.hasOwnProperty;function k1e(n){if(!L1e(n))return D1e(n);var e=[];for(var t in Object(n))O1e.call(n,t)&&t!="constructor"&&e.push(t);return e}var H1e=k1e;function Q1e(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var tp=Q1e,z1e=Yu,G1e=tp,V1e="[object AsyncFunction]",j1e="[object Function]",W1e="[object GeneratorFunction]",K1e="[object Proxy]";function X1e(n){if(!G1e(n))return!1;var e=z1e(n);return e==j1e||e==W1e||e==V1e||e==K1e}var RV=X1e,Y1e=RV,$1e=_2;function Z1e(n){return n!=null&&$1e(n.length)&&!Y1e(n)}var N1=Z1e,J1e=TV,q1e=H1e,ebe=N1;function tbe(n){return ebe(n)?J1e(n):q1e(n)}var T0=tbe,nbe=xxe,rbe=T0;function ibe(n,e){return n&&nbe(n,e,rbe)}var UV=ibe;function sbe(n){return n}var FV=sbe,obe=FV;function abe(n){return typeof n=="function"?n:obe}var lbe=abe,cbe=UV,Abe=lbe;function ube(n,e){return n&&cbe(n,Abe(e))}var B2=ube,fbe=IV,hbe=fbe(Object.getPrototypeOf,Object),S2=hbe,dbe=Yu,pbe=S2,mbe=uc,gbe="[object Object]",vbe=Function.prototype,ybe=Object.prototype,PV=vbe.toString,wbe=ybe.hasOwnProperty,_be=PV.call(Object);function xbe(n){if(!mbe(n)||dbe(n)!=gbe)return!1;var e=pbe(n);if(e===null)return!0;var t=wbe.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&PV.call(t)==_be}var bbe=xbe;function Ebe(n,e){for(var t=-1,r=n==null?0:n.length,i=Array(r);++t-1}var Hbe=kbe,Qbe=O1;function zbe(n,e){var t=this.__data__,r=Qbe(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}var Gbe=zbe,Vbe=Sbe,jbe=Pbe,Wbe=Nbe,Kbe=Hbe,Xbe=Gbe;function np(n){var e=-1,t=n==null?0:n.length;for(this.clear();++ea))return!1;var c=s.get(n),A=s.get(e);if(c&&A)return c==e&&A==n;var u=-1,f=!0,h=t&oSe?new nSe:void 0;for(s.set(n,e),s.set(e,n);++u0&&arguments[0]!==void 0?arguments[0]:[],t=[];return(0,$Te.default)(e,function(r){Array.isArray(r)?n(r).map(function(i){return t.push(i)}):(0,XTe.default)(r)?(0,WTe.default)(r,function(i,s){i===!0&&t.push(s),t.push(s+"-"+i)}):(0,VTe.default)(r)&&t.push(r)}),t};M0.default=ZTe;var I0={};function JTe(n,e){for(var t=-1,r=n==null?0:n.length;++t1&&arguments[1]!==void 0?arguments[1]:[],r=e.default&&(0,vUe.default)(e.default)||{};return t.map(function(i){var s=e[i];return s&&(0,mUe.default)(s,function(o,a){r[a]||(r[a]={}),r[a]=yUe({},r[a],s[a])}),i}),r};I0.default=wUe;var R0={};Object.defineProperty(R0,"__esModule",{value:!0});R0.autoprefix=void 0;var _Ue=B2,gk=bUe(_Ue),xUe=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){IUe(i,r);function i(){var s,o,a,l;TUe(this,i);for(var c=arguments.length,A=Array(c),u=0;u1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){DUe(i,r);function i(){var s,o,a,l;LUe(this,i);for(var c=arguments.length,A=Array(c),u=0;u1&&arguments[1]!==void 0?arguments[1]:!0;r[o]=a};return e===0&&i("first-child"),e===t-1&&i("last-child"),(e===0||e%2===0)&&i("even"),Math.abs(e%2)===1&&i("odd"),i("nth-child",e),r};N2.default=OUe;Object.defineProperty(lo,"__esModule",{value:!0});lo.ReactCSS=lo.loop=lo.handleActive=O2=lo.handleHover=lo.hover=void 0;var kUe=M0,HUe=ap(kUe),QUe=I0,zUe=ap(QUe),GUe=R0,VUe=ap(GUe),jUe=U0,sj=ap(jUe),WUe=F0,KUe=ap(WUe),XUe=N2,YUe=ap(XUe);function ap(n){return n&&n.__esModule?n:{default:n}}lo.hover=sj.default;var O2=lo.handleHover=sj.default;lo.handleActive=KUe.default;lo.loop=YUe.default;var $Ue=lo.ReactCSS=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;ia?f=1:f=Math.round(u*100/a)/100,t.a!==f)return{h:t.h,s:t.s,l:t.l,a:f,source:"rgb"}}else{var h=void 0;if(A<0?h=0:A>o?h=1:h=Math.round(A*100/o)/100,i!==h)return{h:t.h,s:t.s,l:t.l,a:h,source:"rgb"}}return null},hS={},JUe=function(e,t,r,i){if(typeof document>"u"&&!i)return null;var s=i?new i:document.createElement("canvas");s.width=r*2,s.height=r*2;var o=s.getContext("2d");return o?(o.fillStyle=e,o.fillRect(0,0,s.width,s.height),o.fillStyle=t,o.fillRect(0,0,r,r),o.translate(r,r),o.fillRect(0,0,r,r),s.toDataURL()):null},qUe=function(e,t,r,i){var s=e+"-"+t+"-"+r+(i?"-server":"");if(hS[s])return hS[s];var o=JUe(e,t,r,i);return hS[s]=o,o},wk=Object.assign||function(n){for(var e=1;et.name===n);return await fetch(e.file).then(t=>t.text()).then(t=>new DOMParser().parseFromString(t,"image/svg+xml").firstElementChild)}function Bn(n){const{size:e,icon:t,className:r,onClick:i,theme:s,type:o,text:a,onMouseEnter:l,active:c,onSubmit:A,minWidth:u,disabled:f}=n,h=be.useRef(null);return be.useEffect(()=>{t&&ywe(t).then(d=>{h.current&&(h.current.innerHTML="",d&&(d.classList.add(Zn.icon),h.current.append(d)))})},[t]),o&&o==="login"?k.jsxs("div",{className:ud(r,Zn.iconButtonWrap,s&&s==="dark"?Zn.dark:Zn.light,c&&Zn.active),style:{height:e},onClick:i,onMouseEnter:l,children:[k.jsxs("svg",{width:"71",height:"67",viewBox:"0 0 71 67",className:Zn.buttonBackground,xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M2 2H68.8452L64.1437 65H2V2Z",className:Zn.buttonBackgroundColor,fill:"#D9D9D9",stroke:"#050B0E",strokeWidth:"4"}),k.jsx("path",{d:"M9 9H62L58.2676 58H9V9Z",fill:"#050B0E",className:Zn.innerBackgroundColor})]}),k.jsx("span",{ref:h,className:Zn.iconWrap})]}):o&&o==="icon"?k.jsxs("div",{className:ud(r,Zn.iconButtonWrap,s&&s==="dark"?Zn.dark:Zn.light,c&&Zn.active),style:{height:e},onClick:i,onMouseEnter:l,children:[k.jsxs("svg",{className:Zn.buttonBackground,width:"69",height:"63",viewBox:"0 0 69 63",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M5 2H2.85562L3.00485 4.13918L6.7903 58.4048L6.9201 60.2656H8.78545H62.6772H64.6178L64.6763 58.3259L66.3135 4.06031L66.3756 2H64.3144H5Z",fill:"#efefef",className:Zn.buttonBackgroundColor,stroke:"black",strokeWidth:"4"}),k.jsx("path",{d:"M8.77795 7.28503H61.7957L59.8437 54.7911H11.367L8.77795 7.28503Z",fill:"black",className:Zn.innerBackgroundColor})]}),k.jsx("span",{ref:h,className:Zn.iconWrap})]}):k.jsx("button",{className:ud(r,Zn.buttonWrap,s&&s==="dark"?Zn.dark:Zn.light),onClick:i,onMouseEnter:l,onSubmit:A,type:o,disabled:f,style:{minWidth:u?u+"px":""},children:k.jsxs("div",{className:Zn.innerWrap,style:{fontSize:e},children:[t&&k.jsx("span",{ref:h,className:Zn.buttonIconWrap,style:{height:e,width:e,opacity:f?"0.4":"1"}}),a&&a]})})}function wwe(n){const{cancelOption:e=!0,confirmDialogText:t,confirmDialogWindow:r,setConfirmDialogWindow:i,confirmDialogCallback:s}=n;return r?k.jsx("div",{className:Qy.container,children:k.jsxs("div",{className:Qy.messageWindow,children:[k.jsx("div",{className:Qy.messageTitle,children:t}),k.jsxs("div",{className:Qy.buttonContainer,children:[e&&k.jsx(Bn,{size:16,theme:"light",text:"Cancel",onClick:()=>{s[0](!1),i(!1)}}),k.jsx(Bn,{size:16,theme:"light",text:"Continue",onClick:()=>{s[0](!0),i(!1)}})]})]})}):k.jsx("div",{})}const _we="_backgroundImg_1yy0g_1",xwe="_darkBackground_1yy0g_16",bwe="_logo_1yy0g_29",Hy={backgroundImg:_we,darkBackground:xwe,logo:bwe};function Ewe(){const{debugMode:n}=Z.useContext($n);return k.jsxs("div",{className:n?Hy.darkBackground:Hy.backgroundImg,children:[k.jsx("div",{className:Hy.backgroundBlur}),k.jsx("div",{className:Hy.Background})]})}const Bwe="_buttonContainer_1x1gj_1",Mwe="_buttonLeft_1x1gj_10",Swe="_buttonRight_1x1gj_14",Cwe="_buttonCenter_1x1gj_18",Twe="_sideMenu_1x1gj_33",Iwe="_scrollContainer_1x1gj_44",Rwe="_scrollContainerOptions_1x1gj_52",Uwe="_bottomLine_1x1gj_60",Fwe="_editorButton_1x1gj_94",Pwe="_editorText_1x1gj_102",Lwe="_selectorContainerPos_1x1gj_112",Dwe="_selectorButton_1x1gj_137",Nwe="_selectorColorPickerUI_1x1gj_146",Owe="_selectorColorPickerButton_1x1gj_152",kwe="_selectorPickerTabs_1x1gj_162",Qwe="_selectorColorPickerImg_1x1gj_170",Hwe="_uploadContainer_1x1gj_176",zwe="_uploadButton_1x1gj_189",Gwe="_relativeBox_1x1gj_209",Vwe="_blendshapeGroup_1x1gj_213",jt={buttonContainer:Bwe,buttonLeft:Mwe,buttonRight:Swe,buttonCenter:Cwe,sideMenu:Twe,scrollContainer:Iwe,scrollContainerOptions:Rwe,bottomLine:Uwe,"editor-container":"_editor-container_1x1gj_87",editorButton:Fwe,editorText:Pwe,selectorContainerPos:Lwe,"selector-container":"_selector-container_1x1gj_123","selector-container-column":"_selector-container-column_1x1gj_129",selectorButton:Dwe,selectorColorPickerUI:Nwe,selectorColorPickerButton:Owe,selectorPickerTabs:kwe,selectorColorPickerImg:Qwe,uploadContainer:Hwe,uploadButton:zwe,relativeBox:Gwe,blendshapeGroup:Vwe},jwe="_dropArea_1a0z4_1",Wwe={dropArea:jwe};function S0({onFilesDrop:n}){const[e,t]=be.useState(!1),[r,i]=Z.useState(null);be.useEffect(()=>{const o=l=>{l.preventDefault(),t(!1);const c=l.dataTransfer.files;n&&i(c)},a=l=>{l.preventDefault(),t(!0)};return window.addEventListener("drop",o),window.addEventListener("dragover",a),()=>{window.removeEventListener("drop",o),window.removeEventListener("dragover",a)}},[]),be.useEffect(()=>{r&&n(r)},[r]);const s=()=>{t(!1)};return k.jsx("div",{onDragLeave:s,className:Wwe.dropArea,style:{display:e?"flex":"none"}})}const Kwe="_mainTitleWrap_4fb0s_1",Xwe="_mainTitle_4fb0s_1",Ywe="_topLine_4fb0s_18",cM={mainTitleWrap:Kwe,mainTitle:Xwe,topLine:Ywe};function Aa({title:n,width:e,left:t,right:r}){const i={width:e?`${e}px`:null,left:t?`${t}px`:null,right:r?`${r}px`:null};return n&&k.jsxs("div",{className:cM.mainTitleWrap,style:i,children:[k.jsx("div",{className:cM.topLine}),k.jsx("div",{className:cM.mainTitle,children:n})]})}const $we="_ContainerPositionTop_v15ql_2",Zwe="_ContainerPosition_v15ql_2",Jwe="_Container_v15ql_2",qwe="_topLine_v15ql_68",e_e="_traitInfoTitle_v15ql_96",t_e="_flexSelect_v15ql_105",n_e="_flexButtons_v15ql_114",r_e="_flexButtonsTop_v15ql_122",i_e="_optionButtons_v15ql_131",s_e="_optionButtonsSmall_v15ql_143",vr={ContainerPositionTop:$we,ContainerPosition:Zwe,Container:Jwe,"arrow-button":"_arrow-button_v15ql_39","left-button":"_left-button_v15ql_55","right-button":"_right-button_v15ql_62",topLine:qwe,traitInfoTitle:e_e,flexSelect:t_e,flexButtons:n_e,flexButtonsTop:r_e,optionButtons:i_e,optionButtonsSmall:s_e},o_e="/assets/randomize-green-4388c12b.png",a_e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyNDo0My0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjNiOTBlZjU3LTIwOWItYzQ0Zi05OWNjLTkwYjYxM2Q0MWJiOCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo2NWQ3ZjJiYi1jMWI3LWI3NDMtYWJiMy0xZjNlYzYzMWIxNDQiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo2NWQ3ZjJiYi1jMWI3LWI3NDMtYWJiMy0xZjNlYzYzMWIxNDQiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjY1ZDdmMmJiLWMxYjctYjc0My1hYmIzLTFmM2VjNjMxYjE0NCIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyNDo0My0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDozYjkwZWY1Ny0yMDliLWM0NGYtOTljYy05MGI2MTNkNDFiYjgiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6bbHqfAAAFoklEQVR42u2duWtWQRTFo5hGRNAETKFiIQqCSxGto4iCqSLon6BoQJJCEcEFLASbD7QRRcTKNbihoLgUWhj/AItUCi7gVmjikubzPphAiOYts9659xQHAnl5M2/u73vnzHwvbzra7XaHNg1cPrKadJs0bnSHtEbjWGgr/HxSi9SeRWeLYwCAzOIPmk97u0ITpAMAQE7h+0ivaxR+psZIWwBAvoVfSXpsUfiZelZkBgAgx+dtJTIfaPV5W4nLB9p93lZi8oEEn39iWcRPpK2kzaSPlud4mns+0Ojzk6QTpM5p5+skHSP90ZYPtPn8DVJ3ybkXk65oygdafH6UtKlBW72klxrygfT5/BfSLoe2B0xWELt+oMbnHfoxj3RUaj6Q6vNdAfq0SGI+UOvzDn0UlQ/U+7z2fACfV54P4PPK8wF8Xnk+gM8rzwfweeX5AD6vPB/A55XnA/i88nwAn1eeD+DzyvMBfF55PoDPK88H8Hnl+aBup/aQflp26HrZc3hQaT64Zjnmv0h7nQEwT8u24PNJQdjokA9aVXfdqsaH4fNsQNhJ+mxRj2EXAO41bGw/ihUchH0Na3LXBYC7DRs7T1qOQgUr/lLSuZgA3LL0nkukhSiat8IvIF2wrMWtFABMJdHDpLkoolPxD5mxbOcGwJTekfpRzMaF305662H8kwMwpRekDShuZeHXkp57HHc2ACAfhPP5JAB8MB3+jXyQzOeLJfaLpPcpAPhmjlnmcMtSnQ8cfb6w1BXmPF9TAFB8N9Az7dhtpDfIB8F9vvjQ7Jh2rp6K72mCArDkP39z0GHaIjofOPr8lG3OmXHOJawAmHah57F+4G0+P+sHgyUAHm91/fD5cmtkDYDmfODT57MHQFM+COHzYgCQng9C+bwoACTmg9A+LxIACfkgls+LBiDHfBDb51UAkEs+SOHzagDgnA9S+rw6ADjlAw4+rxaAlPmAk8+rByB2PuDm8wAgUj7g6vMAIHA+4O7zACDc7fqk+a/lbJel1QPgIR9k/cUUAAj7SDX7r6YBgP98wM7nAUCa9YOo83kAwC8f5PIACgDwnA+yegQNADQfsGdlb9rK8HoAQMMBK3vryT0AIB+ARyXX9AgAyAfgYck1PQQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlALQAwCSX0+y18V/L/a3BQDJr2cx6UcKAMZz3BRaIADdphZJNo16ldsG0ZIAoP721thY2gmAulvH3iB1AYCot/0rMbaObbJ59KR53UonAAjW907ScTPWUfYOHpK2fXyuADhsHz/kAkBBXMvy5QqjHPNBbgBQnzbW8PnZ1Kq6I9ftxJ6KuWaZrnOaLeQCQDHFJl1zeLPJ3jrtNOnQfIe7AZt8wB0A6sM80lHSH8uxPlPUqm57Nh1cSXps2bnk+YAzANT+AOmT5dg+Ja1q2qZLZ/tIry07m2z9gCMAjj4/Rtpi27aPzg9WrERVrR90awXAzOevWo7dBOmAax98XUg2+YADAGZ2dSyWzwcHIKd8kBoAM5+P6vPRAMghH6QCIKXPRweAcz6IDQAHn08GAMd8EAsATj6fFABu+SAGANx8ngUAXPJBSAC4+jwrADzlg5u2+SAEANx9niUAqfKBTwBy8Xm2AHjKB19Ju2MDkJPPswcgZj5wBSBHn88GgBj5wBaAnH0+OwBC5oOmAEjw+SwBCJUPmrwuXorPZw2Ax3yw3pxnpOS4EXPMOkk+LwKAGflgwrI4p0kPSn5/n3RKms+LAsBDPggh1j4vDgBP+cCHsvB5sQB4ygfifV48AJ7WD8T6vBoAAueDbH1eFQAB8kH2Pq8SAA/5QIzPqwbAIh+I83kAUD8fiPR5APAvCKtJt80dYdz8vEbjWPwFnWtJD/nY2zYAAAAASUVORK5CYII=",l_e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyNDo1MS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmM2NDY5Y2JiLWFkMzUtYmQ0Ny04M2Q1LWU0NGQ0MTI2YmYwNiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoyMjUyMzZlNS1mYTFiLWUzNDUtOGQzNi0xOWJkMmE0YmYzNTEiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDoyMjUyMzZlNS1mYTFiLWUzNDUtOGQzNi0xOWJkMmE0YmYzNTEiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjIyNTIzNmU1LWZhMWItZTM0NS04ZDM2LTE5YmQyYTRiZjM1MSIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyNDo1MS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpjNjQ2OWNiYi1hZDM1LWJkNDctODNkNS1lNDRkNDEyNmJmMDYiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6qPgTwAAAEeUlEQVR42u2dX4tNURiH58KfwR1K0USSj6BoIpdydcY0TUMmIy58BPdK/uTCLReaG7kwooQoH4FQyneQMNw53t2cqdOJPfusvfZa77ve5+JX1DlnOns9PM+cqT0T/X5/wtt6D64ekj2W/ZKtDv582OO18Hbwk7I7sv5/dle2DQDKPPzLsp81h7++6n+EKwBQzsGfkH1ucPCj+yI7CQB2D/6A7GXAwY/utewgAJTj+dAV2QdePR+64vrAu+dDV0wf4HnnfYDnnfcBnnfeB3jeeR/geed9gOed9wGed94HeN55H+B5532A5533AZ533gd43nkf4HnnfYDnnfcBnnfeB3jeeR/geed9gOed9wGed94HeN55H+B5530wzsHvkr3hQqvfW9nuLgDYKXvGBVa/F50AMATCHtkKF1rdqn+ce1NG4BHZOy589n2QHc35beBZ2VcOIvm+yRa1fBC0SXZN9oeDSbLrss0aPwqmDxR6PggA+ULnZRfpA9uel+ddkJ0LAWB56AOG/fSBLc/L86ZkrwavsxwCwOgPd6q/T9IHuj0vz9kquzl6djEAqPZDdok+0Ol5ed6S7Ps/XjMaAOurfgh0nD5Q4/lp2aea144OwPDHjvRBXs8/b/A1OgOAPtDj+awA0Af5PZ8dAPogr+fVAEAf5PG8OgDog7SeVwuA1z5I7XnVAHjqg1yeNwFAyX2Q2/OmACitDzR43iQA1vtAk+fNAmCxDzR63jwAFvpAs+eLAUBrH2j3fHEAaOkDK54vEoCcfWDN80UDkLIPrHreBQBd94Flz7sCIEYfPCnM8+4AiNEHZ2RzhXjeLQCt+6AQz7sHoFUfFOB5AIjRB4Y9DwAx+8Cg5wEgVh8Y9TwANNjt6rOADT4nuFHg+waAoc3WvOfZQt8zAAxtruY9zwFA+QDM1LznGQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANsA3AeAYnYvBIBTsvcAYH4fZaeDf328PHmxt3bzRACwteqWNkvBvz5+5MJs6a3dRBEAbOxWdVOrJmc77j1z9smeAoDaVbe1mRrnTENvnnSst3YzZQDQsepGVtMhZ9n29mkW+6AkABp5vjMAjPZBKQA09nynABjsA+sAjO35JAAY6gOrAAR7PikABvrAGgCtPZ8FAMV9YAmAKJ7PBoDSPrAAQFTPZwdAWR9oBqATz6sBQEkfaASgU8+rAyBzH2gDoHPPqwQgYx9oASCZ51UDkKEPcgOQ3PMmAEjYB7kAyOZ5UwAk6IMcAGT1vDkAOu6DlACo8LxZADrqgxQAqPK8eQAi90GXAKj0fDEAROqDrgBQ6/miAIjQB7EBUO/5IgFo0QexADDj+aIBCOiDtgCY87wLAMbogzYAmPS8GwAa9kEIAKY97w6ADfpgHACK8LxbAEb6YHVwqPM1j5sfPOZ3SZ53D8DgcLfLHsoWah6zIHsk2+HluvwF92zupxEV3NQAAAAASUVORK5CYII=",c_e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyMjo0Mi0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmY3YWFkYzZiLWM2ZmEtNjE0OC05YWZkLTgxN2Q1OWRkZTI0MiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo3NjUxYWZkMi1lOWE3LTk3NGYtYWVhZC03YjFjMjg0NmFhM2YiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo3NjUxYWZkMi1lOWE3LTk3NGYtYWVhZC03YjFjMjg0NmFhM2YiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjc2NTFhZmQyLWU5YTctOTc0Zi1hZWFkLTdiMWMyODQ2YWEzZiIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyMjo0Mi0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpmN2FhZGM2Yi1jNmZhLTYxNDgtOWFmZC04MTdkNTlkZGUyNDIiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6TWt7cAAAFm0lEQVR42u2dT2xURQCHSTXpQTH0oIJpgfZKi1ETiSK1MV7FbORQNcG0Hmg3oQVjjKARrhDBBDEYMSEYS6kWkxoVAheDiBc9kHBBuaGgMSo1KgTF+pt0JLq6dOe93X3z5zt8SbPdvtmZ37fvvc7Mm5k3MzMzD9KFRkAAGgEBAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABPKO0f3OrWCxWiTViROwQ+8QBcchywL62w77HvLdPdJpjIEAYYd8sHhDPiD3iuLggfhczGblqj/GJ2Cs2il5xCwL4EfoK8bw4LH7MEbQrF8UR8aK4T7QgQPNC77On6jNNDHwuzopXzGdDgMaEvlRsEqc8Cr0ap+2ZoRMB8gdvrulviT8CCP7/7h/GxIMI4B78Q+KjAEOvhrlHeRgB5g7e3FB9GFHwlZi6rUSA/wZ/m3g94uAreVMsRIDZ8J8S3yUU/t98L55OVgDby3Y4weArMf0JXUkJoAo/Ln4i/GtMiyeTEEAV3U3gVXktWgFUuXbxKSHPyWeiIyoBVKG7xXnCrRnTVvdEIYAqsjrniFwjGteciabEuGXKvnbes57ER4MWQBVY60FD/ioOiiHRfb3xfTt/oNu+1/zNLx58/rVBCqAPPlxww52x4/e356jDrfYYXxZcl+GgBCg4/Gk7KaSljvVpsSJcLLBe5SAEMB+04L72JQ08qy0ueKyi7LUABYe/pYn/0r4UiwSxhD9UQIfWuhgkiOGav67A8YzgJeC0n7/+W0KWIOTwj3o0keVoqBKEGv5vYoFHAiwQl0KUIMTwDSM5wuoQg3Ya90HLTvtaR47jjhbcJuWmCOBB+OcyBrTcPgJ25TrHvmKFuDNjGedCkyC08DN9+20vnms5GwM8CzhLEFr45jo73zGUbTnK2+5Y1nxxOSQJQgrf8G4B38gRxzInPWmrcl0E8Ch8w4BDEF11LLfLodwBj9qrnEsAz8I3LHMI4r06ljvpUO4yz9qsnEkA/WG/ZxX5VtxQYwh3NKD8RTWWfaOHzzn0OwmgP2izU5J8qsQJh2/hYMGXnxMePqja5iLAdg8nSk45BPBqA8rf5VD+lIftt81FgC88rMC4QwDvNKD8CYfyxz1sv88RAAG4BHAJSOMmcICbwBw3gRH8G7ioAeUvTObfwEg6giYL6gjqjqIjiK7gzF3Bg6VYuoIjGAwaYTAoruHgywwHFzAc7JkEoxkmamwQfzIhJI4pYd9knK7VU+OUMNOJszxjGV9HPSXMIwlGc0zebLf9BDsrJoWa19pzHHdDEpNCPZHgUrWOjYKmhbclNS3cEwmOeSTAseQeDPFEgq08GsbDoUMFhj+U/MOhnpwJhgmfBSK2ctpniRizx8DSBga/hCVi/JfgZ/FsrUPHjotETbNIVDjLxH1lVwtjmTgWitw8YYXsqWGhyB773gkWiqyPBI/M0f/ebC7YZWHf/0dXsPn5pP2dL5/TLK+7OpbFou8ygzgsAl37gJdpM5aLT5OTeQalQtgwYhchV2V3KlvG9LNlzL8waxA/kdqmUWY7WDaNmm2DtDaNYtu4a9vGDbJxZJobR75RYuPIqlvHfhBx8GYc4X62jk1v82hTFzaPzrh9/H7PNp2qFbPl/duil+3j6zMMu0mcCiD40+IF0RlC2wYhQIUMveJluymUL6GftWsP94XWnsEJUCHDveI5e439oYmBm06sI/abvqKeG1QhQHYZbhIr7fj9HvFxaXYjyDz3D1ftMY6LvfbYq1yfT0SA4qRotcvDm5vJNfZpYXP52CfGxCHLmH3N/G69eMyczkuzW9y3xtxGUQsACAAIAAgACAAIAAgACAAIAAgACAAIAAiAADQCAgACAAIAAgACAAIAAgACAAIAAgACAAIAAkCc/AWkhfX2hx9ZaQAAAABJRU5ErkJggg==",A_e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAATr2AAE69gE6sVc6AAAE7mlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyMjo0OS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MTQtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MTQtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjhhZWE1MDNlLTM3NGItYmM0NC1iOGNjLTU0OWU2MDUyYzYxMyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo4YWVhNTAzZS0zNzRiLWJjNDQtYjhjYy01NDllNjA1MmM2MTMiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo4YWVhNTAzZS0zNzRiLWJjNDQtYjhjYy01NDllNjA1MmM2MTMiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjhhZWE1MDNlLTM3NGItYmM0NC1iOGNjLTU0OWU2MDUyYzYxMyIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyMjo0OS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDwvcmRmOlNlcT4gPC94bXBNTTpIaXN0b3J5PiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PslPja4AAAbiSURBVHja7Z17iFVFHMc1K80ybc3SP9K21YrubtLDiIJqK5WMpbYt1MpSKiKkba0gtU0rCCpoyxRXSKrNiJIwCmtD0u2JEWFuSC/t2sueghDU2svbd2D+uFzce89rzvxm5vvHB2TX5Zw758PMufN7zJBSqTSEhAsHgQJwECgAoQCEAhAKQCgAoQCEAhAKQCgAoQCEAhAKQCgAoQDVaO1ZOgWsB7+CAbALLAPDOdCeC4CH3AJKg/AlGM/B9lQAPNxG8HcVARS7wQQOuJ8CPFvj4VMCXwXAAx0BfowoACXwUIA68EcMASiBh0vApzEFoASeCdCZQABK4JEAw0A/JQh7H2A8KFKCsHcCxUugX1qnghlgLrgBzNP/bgXTwTRwAjiEAsQf4AkpJChmJYF+0M1gIegGm8Dn4M+I9/If+B68B3rAneBiMIoCCJwJ8DejwZVgBfgQ7E94/Vqor7ybwVJwOgWwKAH+z3HgJrDR4AOvxU7wIDiFAuQoAX7XZumBV0MtF20UID8JnhMoQUlvjXeAw5kQYl6CVUIlUOwD7WBo8BlBhiVYK1gCxU/giuBTwgxL8IJwCRTvg/qgcwINS/CKAxIolgSdFGpYgjcdkeATMDHYrGDDErzriASK+cGmhZuSAD8/DHzskARrg60LMCjBkQkTVWwuCccGWRhiUIIx4DOHJNgLCkFWBhmUYJzer3dFAhWFnOXjRtAosA6cb0ECFaL+xiEJFAt8E6BXf7Cfq22GGJRgIvjBMQlu9yUWsOUgW6M2JGgAvzgmQYfr0cA3quyPm5KgWEWCaXpLVhWtXqVp11k/6uffCpRgoav5AC9GCJvWS0svw99NVhs0OtHkgBAJ5rmWEbQiRqSs3saOYcTPcTzoAv8KkGCGKzmBnQnCpbkvBwlE2GRZAJXQ2ig9K3hOipi52Jmg7D7aLUvwXdbp81k+/DPAPykTJ1yQYKbld4MPJFYGHZPi4bgowaWWZ4I10gTYmHEKlQsS3GxZgtukFIfeayiPzgUJnrYswVm2G0Q0G06mFC2BCuHq7W1bAmxPW8OYNsBjOtJmUoKvwaQMJOiwPAussiVAXoUZJiVQJWW/gR3gSdXrMME4jIzZJ8kEl+UqgC7EzDu33pQElSxPMB6PWRZANeU8KhcBdJKFDeNNxg4q6Yk5JhcJ2CpemZcA6yxX2YibCVQdoIBlQHGhUQHUWiOk+PLEnCRoTJD0YpM+0wJIybS9xmCnknK6YozNGiFjM8eIAAJ2vsqjYlEaSGQxE2yLMT4PCBmfreBkEwK8JuQDfhTjnpsySNUeGfFaiwVlEd1hQoBXhXy4vpjf0femvF6TYzOAMQGkLAHbY763bEt5vWLEJadb0BIwxeeXQJXZOyLGPT+ewTVrSqDi9EIEmO3718DI07K+50JG16xVlfywgHHpzWMj6CkBH/SWmPe8PCcJHrU4JurUltPyEODoDDdakvJ8gvvuyejaRaES3JVnMMj2UvA7GJvgvu/zdCbYYiMc/IRlCRYlvO8GHfrdoY+42+/4TPBXkqk/q4wgm504dsf5NlDlM0zS4VQTM8Ej0nMD0w5ewWKf3kSxews9i0xK8LKEpND5lpeCMx2QwMRyoFLaxkhJC++yKIBay48IcCY4T1pl0GaLErzuSAu7rGaCzJpHZCnAOD0AtiTYEIgEqyUXhxYSHCSZaahYlal5LME7LpSHTxewSdTioQS7TPQSNNUgYoGAeMFbWdTTm+xPEEMCVbvQ4FqLmEVCIodv62PhRjs6E6iS+7NdbRJ1j6AsmQEtw0r1Fg2uBVdrHtJNoqYKlKDZ9TZxSxxqy2atIHWQfYLLfWkUeTcliC3BTN+OjLmVEkSSQEUqr/f1yJgWQb33vGhS4eKRMY36aw0lECCBrfbwdQ6d6uG1BLbPCeimBHYlkHBYxNyU/QUpgScnhmylBPlLIOoUS71Dd4ASBCpAWW1/LyUIVICyQbxE+IFPXkgg/nx7DMSNQvrveCmBeAEqRJA4I+wD57oqgTMCVHTqlvaO0GcrnyA4ASpeFhdn0AAiKTt1HF8dRHWozaSSIAWoGNyTdM/eDQbjDOq0jvX61JCmFPsdoiTwQoCDNG08R7e0Wa1zA7/SGUFRBnqP3pRSp57dD9rAqWBohjOX1TOQvBagysCP1V3DLgCz9IOdDa4DrarSRjWgBMNcPSuZArglpAgJ+DDclaA/i9mKD8JtCTopQNgS9FOAsCVQdZh1FCBcCfakbZPDgXdbgme4BIQrgWoMWaAA/kqgTiz/oooALdwH8F+C4WCZDjwN6L6GL4HJ3AkkFIBQAEIBCAUgFIBQAEIBCAUgFIBQAEIBCAUgFIBQAEIByGD8DzQJyO8fOgE8AAAAAElFTkSuQmCC",u_e="/assets/play-de4238c5.png",f_e="/assets/reverse-e35421b8.png",h_e="/assets/pause-b6381fd4.png",d_e="/assets/fast-forward-0d3ffae5.png",p_e="/assets/fast-backward-1f713448.png";function O1({loadedAnimationName:n,randomize:e}){const{characterManager:t,toggleDebugMode:r,debugMode:i,lookAtManager:s,animationManager:o}=be.useContext($n),[a,l]=be.useState(s.userActivated),[c,A]=Z.useState((o==null?void 0:o.getCurrentAnimationName())||"");be.useEffect(()=>{n==null&&(n="T-Pose"),n!=""&&A(n)},[n]);const u=()=>{r()},f=p=>{p?o.play():o.pause(),o.setSpeed(1)},h=p=>{o.play(),o.setSpeed(p)},d=()=>{s.setActive(!a),o.enableMouseLook(!a),l(!a)},m=async()=>{console.log("play next"),await o.loadNextAnimation(),A(o.getCurrentAnimationName())},g=async()=>{console.log("play prev"),await o.loadPreviousAnimation(),A(o.getCurrentAnimationName())};return k.jsxs("div",{className:vr.Container,children:[k.jsx("div",{className:vr.ContainerPositionTop,children:k.jsxs("div",{className:vr.flexButtonsTop,children:[k.jsx("div",{className:`${vr.optionButtonsSmall}`,onClick:()=>{h(-2)},children:k.jsx("img",{src:p_e})}),k.jsx("div",{className:`${vr.optionButtonsSmall}`,onClick:()=>{h(-1)},children:k.jsx("img",{src:f_e})}),k.jsx("div",{className:`${vr.optionButtonsSmall}`,onClick:()=>{f(!1)},children:k.jsx("img",{src:h_e})}),k.jsx("div",{className:`${vr.optionButtonsSmall}`,onClick:()=>{f(!0)},children:k.jsx("img",{src:u_e})}),k.jsx("div",{className:`${vr.optionButtonsSmall}`,onClick:()=>{h(2)},children:k.jsx("img",{src:d_e})})]})}),k.jsxs("div",{className:vr.ContainerPosition,children:[k.jsx("div",{className:vr.topLine}),k.jsxs("div",{className:vr.flexSelect,children:[k.jsx("div",{className:`${vr["arrow-button"]} ${vr["left-button"]}`,onClick:g}),k.jsx("div",{className:vr.traitInfoTitle,style:{marginBottom:"10px"},children:c}),k.jsx("div",{className:`${vr["arrow-button"]} ${vr["right-button"]}`,onClick:m})]}),k.jsxs("div",{className:vr.flexButtons,children:[e&&k.jsx("div",{className:`${vr.optionButtons}`,onClick:e,children:k.jsx("img",{src:o_e})}),k.jsx("div",{className:`${vr.optionButtons}`,onClick:d,children:k.jsx("img",{src:a?A_e:c_e})}),k.jsx("div",{className:`${vr.optionButtons}`,onClick:u,children:k.jsx("img",{src:i?l_e:a_e})})]})]})]})}const m_e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABAAQMAAACQp+OdAAAAAXNSR0IB2cksfwAAAAlwSFlzAAACxQAAAsUBidZ/7wAAAAZQTFRFAAAAr8rpn4DGigAAAAJ0Uk5TAP9bkSK1AAABRUlEQVR4nEWSMU6GQBSE5wEJGAvotIPOY/AbC8/hLfwr2Nh4HU+gHOEv7aSTTgrjkgDrvLeaP0DyhX07zM4gALpeAN65x1wp1B/YMoWu1wVeO8eGg+gIOCQov9D3SyGcHW73LRO0r4k+gu5YcFkEYWyQrk5kd9QJg6Sr6OceJP9JCO2L5N8ZoT5JORWEcpJyrAj5LPXQENLlDK07EGQ7Qye92Y7QvhEczK2BupXAb9It3yY2EoEnCwYB2BTSFVgUdNP8D6Osme0e9A1zgVMwmT8IiQL1GAKBeowlAoMKom7Ghn4UmGEE19Pz02rxGoQEPNfdasm37t5TBjz7TSzFgHkynytPGcJUesqAGV56LYupXnjKgDkXnjJq8fmRMlwNn9eUIdAoZQi0ThlogyoD61T70ZZVxnpXGfsTjkWE+lRFyN+1ll9u0JghRPMM5gAAAABJRU5ErkJggg==",g_e="_tokenBoxWrap_q4pvo_1",v_e="_mask_q4pvo_7",y_e="_timer_q4pvo_31",w_e="_level_q4pvo_42",__e="_mythic_q4pvo_55",x_e="_epic_q4pvo_60",b_e="_rare_q4pvo_65",E_e="_uncommon_q4pvo_70",B_e="_common_q4pvo_75",M_e="_none_q4pvo_80",S_e="_value_q4pvo_85",C_e="_frame_q4pvo_95",T_e="_emptyIcon_q4pvo_111",I_e="_badge_q4pvo_123",R_e="_frameActive_q4pvo_131",Rc={tokenBoxWrap:g_e,mask:v_e,timer:y_e,level:w_e,mythic:__e,epic:x_e,rare:b_e,uncommon:E_e,common:B_e,none:M_e,value:S_e,frame:C_e,emptyIcon:T_e,badge:I_e,frameActive:R_e,default:"_default_q4pvo_159"},U_e="/assets/magic-box-cd45f027.png",Jo=n=>{const{size:e,active:t,onClick:r,level:i,icon:s,rarity:o,style:a}=n,[l,c]=Z.useState(!1),A=()=>{c(!0)};return k.jsxs("div",{className:Rc.tokenBoxWrap,style:{width:e,height:e},onClick:r,children:[t&&k.jsx("div",{className:ud(Rc.frame,Rc.frameActive)}),k.jsx("div",{className:ud(Rc.frame,o&&Rc[o])}),k.jsx("img",{src:l?U_e:s,className:Rc.emptyIcon,style:a,onError:A}),i&&k.jsxs("div",{className:ud(Rc.level,o&&Rc[o]),children:["Lv.",i]})]})},F_e="_InformationContainerPos_72ckd_2",P_e="_scrollContainer_72ckd_15",L_e="_traitInfoTitle_72ckd_27",D_e="_traitInfoText_72ckd_35",N_e="_flexSelect_72ckd_62",O_e="_checked_72ckd_119",k_e="_checkmark_72ckd_123",Q_e="_checkboxHolder_72ckd_136",ba={InformationContainerPos:F_e,scrollContainer:P_e,traitInfoTitle:L_e,traitInfoText:D_e,"input-box":"_input-box_72ckd_43",flexSelect:N_e,"arrow-button":"_arrow-button_72ckd_70","left-button":"_left-button_72ckd_86","right-button":"_right-button_72ckd_93","anim-button":"_anim-button_72ckd_100","custom-checkbox":"_custom-checkbox_72ckd_105","checkbox-container":"_checkbox-container_72ckd_110",checked:O_e,checkmark:k_e,checkboxHolder:Q_e};function w2({jsonSelectionArray:n,byManifest:e=!1}){const{isLoading:t,setIsLoading:r}=Z.useContext(us),{characterManager:i}=be.useContext($n),[s,o]=be.useState(0),[a,l]=Z.useState({}),[c,A]=Z.useState([]),u=m=>{i.setManifest(m),i.loadInitialTraits().then(()=>{r(!1)})};be.useEffect(()=>{t==!1&&(l(i.getAvatarSelection()),A(Object.keys(i.getAvatarSelection())))},[t]);const f=m=>{i.loadTraitsFromNFTObject(m).then(()=>{r(!1)})},h=async()=>{if(!t)if(r(!0),s>=n.length-1)e?u(n[0]):f(n[0]),o(0);else{const m=s+1;e?u(n[m]):f(n[m]),o(m)}},d=async()=>{if(!t)if(r(!0),s<=0)e?u(n[n.length-1]):f(n[n.length-1]),o(n.length-1);else{const m=s-1;e?u(n[m]):f(n[m]),o(m)}};return(n==null?void 0:n.length)>0?k.jsxs("div",{className:ba.InformationContainerPos,children:[k.jsx(Aa,{title:"Trait Selection",width:180,right:20}),k.jsxs("div",{className:ba.scrollContainer,children:[k.jsxs("div",{className:ba.flexSelect,children:[(n==null?void 0:n.length)>1?k.jsx("div",{className:`${ba["arrow-button"]} ${ba["left-button"]}`,onClick:d}):k.jsx(k.Fragment,{}),(n[s].name||n[s].manifestName)&&k.jsx("div",{style:{textAlign:"center",flex:1},children:k.jsx("div",{className:ba.traitInfoTitle,children:e?n[s].manifestName:n[s].name})}),(n==null?void 0:n.length)>1?k.jsx("div",{className:`${ba["arrow-button"]} ${ba["right-button"]}`,onClick:h}):k.jsx(k.Fragment,{})]}),(n[s].thumb||n[s].thumbnail)&&k.jsx("img",{src:n[s].thumb||n[s].thumbnail,alt:"Selection Thumbnail",style:{width:"280px",height:"460px",display:"block",margin:"20px auto 20px"}}),n[s].attributes&&n[s].attributes.map(m=>k.jsx("div",{children:k.jsx("div",{className:ba.traitInfoText,children:`${m.trait_type} : ${m.value}`})},`json:${m.trait_type}_${m.value}`)),e&&c.map(m=>k.jsx("div",{children:k.jsx("div",{className:ba.traitInfoText,children:`${m} : ${a[m].id}`})},`val:${m}`))]})]}):k.jsx(k.Fragment,{})}const fx="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYCAYAAABxlTA0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAXASURBVHgB7ZzNchNHEMd7ZiWf5WtSCSIfVa5cLN+MTRXrEFPcWJwHwNxys/0Etm+5YZ4Ac0pOIG4EU2WlCgffIm4+pIhS8ADKEQlt07OSKKGdlVdSz64K9++kmhlpR3+Pe3qmuwUgCIIgCIIgCIIgCIIgCIIgCIIgXHAUzCDLflDWRfCVgkVA5aOCkgqhRLMt9cdQW0MhNEBhHRFehW2ondaqDZgxZkZg3w9KrTm9RdJtknBlmAwjeLXTgvuzInbuAi//FPieUrv00gdW1GGnHe7nLXRuAkdmoKDvKYUBOCVfoT3IgSvrP295Gn4nG1sB91S0p4Kvvl34/83rszpkTOYrePXGxj1A3E41GKGGCl/Rq7oXQpM2tma/q0PC0R+orFAt0rfwU32eUgcnzx7tQIZkJrDZxNpFdUwvR6/arqgP59pQrdWqTUj52a0iBCT2nRRi14ttXEv72dOSicCpxCVhFeD+i+fVGkzB8s2g7HVgj77anRHDMhO5ABkwUlzjz4Z4d1ph+5w+jTazzZX1oEYmYTfB5av05rQEjtHgmMjmJoiLqKrFFi5xiTtEPTqcJFPpzc0pTk0EraJNBeqBrU9hZA72wAH03ArZ4+PBk18Socadl39UD8ARzgTuHnfVMT2gPNw3K+L2aHbauOTKT3ZmIrwi7NrENWYhR3Ftm1pJz2lnpsKJwGb10jrdjHXQhhYWQid+6Hnimv8a8hwum0siS19wlY7s4AAnApvVC9aH4U5vl2cljbjmv8a4ZZo8FtsY7N6HsMNug83q9YrqX8ujDk+OHt0FZtKKO9i2un7buGj+8Fha4fPcvjH7CtYeWI/BHS/cB2YmEbffbhvfKkC6I/wY8JsIrW7F2uiUxm0aJhXX0PO7a7H3qJGnv4lgFdiYB6vnQHcLwMg04n6cE1jnVF75ceMSMMIqsAnz2NrNxQ0wwSHu6DmFa8AIr4kILUdiMg9cGweXuIbenGqxDo/3jppVYKXpbnaI3n3u1HCK+3FuYXxuZIevASOsApNdK8faMO7Yj4sLcSM0xCMcmPqInfIRjNDFTnm4jWJSU4VpnIlr5hbaj87AiPPrymlwKa6hrS6wwK7FzQpegTG+Ijp6/BXxuYhr4N3kFMYEVu/HEzhLcZU90tIARrg3ubhNG8OvzHrlWuN1OMMCk1/553Abib6Y5r15mAWXfnsfXhusrS6Zb8L2o96Wh7i9OfmWrqncymFYBQ49y9GTaGkIkt6T14ZmElVs7UnfYVJYBTZXknSaawy3K89+DZint6BsiSkUTuK+VuX3gxFs14D+cMwrT3G7McO4eUDEJ8AMu8Bz7+HA1j4Y88rbz02KGZJ5YM+PcJIXkRTzIuHWQjqe5inuletBoLV6HO9xEzN0clROinnRKn6Qp7hRxEUraw6Ei5ihwYnAJuZlEkwsXeU8j79RRj3YkgHVoYt0guiZ4IgowQQhVSQjC3FXbmzsWssVyHNwtXoNzkoI3v5z1vz6m4V3FCK4OWpcZuIi7tn6yK3cefnMSXZnhNMajTevz04vXV6YJ5GXrQPM6mnDztvGGUvMbhhzWvviux9+U4C/gPXxeP/kqPorOCSTDHfyKv6G5Ox2czjZ/+uoegiMmPIwbTZVSKy5q58cPXaegJ1JhrtJ1x+R5V42OcSr6xvXOMqtUtbdRSUEkAGzVwRDoXSTFDJREUz3+OufM/zzK4IZ5Or14AC12ko5vGZqkcMQ/sOBWy5FURK6yy31apkrtFNV0iRcG5v74qi6DRmSS6WnKS0YUaDigiZdNOyfPHdXKpBELpWepuLyy+8XnmiEefobp454TII58IQFvE2u2FPIgfyLwdPVtY0PU93dtMzMzxkYoXUHtsl03JrUdJCdbmjEhwW60ctqEzuP2fxBjq7YPph6ZFSLaGqSP/VnmyQm3cqZ+uUoDlif1R/kEARBEARBEARBEARBEARBEARBEC48HwDC3eeu0ZVWOQAAAABJRU5ErkJggg==",U3=({active:n,src:e,select:t})=>k.jsx("div",{className:`${jt.selectorButton}`,onClick:t,children:k.jsx(Jo,{size:56,icon:e||"",rarity:n?"mythic":"none"})}),H_e=({selectedTraitGroup:n,onBack:e})=>{const{decalManager:t,characterManager:r}=Z.useContext($n),[i,s]=Z.useState([]),o=n.getAllDecals();return Z.useEffect(()=>{const a=Array.from(t.applied.keys());s(a.map(l=>l))},[]),k.jsxs("div",{className:jt["selector-container-column"],children:[k.jsx(Bn,{theme:"dark",text:"Back",size:14,className:jt.buttonLeft,onClick:e}),k.jsxs("div",{className:jt["selector-container"],children:[k.jsx(U3,{src:fx,active:!1,select:()=>{t.removeAllOverlayedTextures(),s([])}},"empty"),o.map(a=>{const l=sV(r.manifestData.getTraitsDirectory(),a.thumbnail);return k.jsx(U3,{src:l,active:i.includes(a.id),select:()=>{i.includes(a.id)?t.removeOverlayTexture(a.id).then(()=>{s(i.filter(c=>c!==a.id))}):t.loadOverlayTexture(n,a.id).then(()=>{s(i.concat([a.id]))})}},a.id)})]})]})},z_e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYCAYAAABxlTA0AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFyWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0wMlQxMTo0OTozNy0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMDJUMTE6NTI6MjMtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMDJUMTE6NTI6MjMtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjBmNjkzZGRkLWI4ZWYtZTU0Ni05YWQ2LTRjNzJkOTg4MTJhNCIgeG1wTU06RG9jdW1lbnRJRD0iYWRvYmU6ZG9jaWQ6cGhvdG9zaG9wOjBiNWViMTliLTkxMmEtMmI0NS1iOTZlLTliNDUxOGUzZDU4NyIgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjg4ODliZDlkLTAxZjItMTQ0Ni04NDE4LWYyYzNjNjQ1ODNlOCI+IDx4bXBNTTpIaXN0b3J5PiA8cmRmOlNlcT4gPHJkZjpsaSBzdEV2dDphY3Rpb249ImNyZWF0ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6ODg4OWJkOWQtMDFmMi0xNDQ2LTg0MTgtZjJjM2M2NDU4M2U4IiBzdEV2dDp3aGVuPSIyMDI0LTAxLTAyVDExOjQ5OjM3LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiLz4gPHJkZjpsaSBzdEV2dDphY3Rpb249InNhdmVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjBmNjkzZGRkLWI4ZWYtZTU0Ni05YWQ2LTRjNzJkOTg4MTJhNCIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0wMlQxMTo1MjoyMy0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiBzdEV2dDpjaGFuZ2VkPSIvIi8+IDwvcmRmOlNlcT4gPC94bXBNTTpIaXN0b3J5PiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv0y+4AAAASPSURBVHja7ZxrSBVBFMctyqIgC0ujJ5UFaQpZRC/7YoUVQYUUkZQYQoVfJBF62PtBlhlJoJWSUQRSEYUFUVRiSEWRiokVgZqRWUEv7W3/oQkul53Ze+/OXWfyfPh98e6cPfNjnZ2ZPbshnZ2dIUTwIAkkmAQTJJgEk2CCBJNgEkyQYBKsgFnzlsaCanARZICFIJwEqxN8CXR68R08479lgxVgDAkOTPATC8EiXoLbYB9YDeJJsFzucPDLD8FWvABlIBcsAeNBKAn+K3i+Q7ki3oNycAys4eP8gO4oeH2QBFvxFVSAYj6uR3cHwWdcFGzFG1AF8sBakOBkeNFR8AMbAY/BedDqovQPoA6UgghjBbMxkXfGqpMfwUyv4w90wRV+1GTBCyQdmy5oc8hlwQdMFrxF0KlzkjbDwA8XBSebLPikv1cNfusBml0UHGWy4BpBp0olbYaAjgBlselZHBgNloNGm+PbQF8jBfsgKlrQbnuActMtYoWCBkmb68ZO09hNzEbIUzDCq82GAOXekuSRJGl3xGTBmT6IYXsU10Ahn5cGOo5ukeQxCLQL2q0zWXCBizeq7TZD1XdBu1iTBVe4KPieJI9kQZtPYKCRgpF4P/DW5QVDnkUeUVyk1fH3jd2L4Pu1KqSxMfohH6cbfbmS+eqRTdX22ixYck0WnKZAbguY5BV3o8IrPsVkwWUKBMQIYmcpEjzdZMF3eCfaA4C1OxGkld4/WgPdE9ZBLttLGMwJD4AI0F8SvycfPpwIvkuFJ2LBQyXzWl8pck0wmwuCcWCUZrCcwizy3aZg/E13RTBONMXjpL81g+W0wyvf/YpucHPdEpzbxQ8k7djlkesmRTHbnZRt+Ss4T3PBOz1y3aooZq1rj+1xsoMGCd6sKOYFEhxcwRm6Cf4JvmksuIUXlrz2MeZknQTv5k95e4HZvCM6CU73c5O/w2ldskrBqTbL4K4WnCbIL0MS75GrtWkSwZWSNgkaCK63Wao3CeKd0kVwgaRNmGQT2y3BZ236VS6Il6OL4OOSNpEK9gKcCq6y6VetIF6iLoKbRdt5vNhZhzE4UZDfYkm8kboIZpy2OH4C+KyJYFZsPdUrvzmSWM9dL8D2YZpWw4tBlrEyTz4n1mmaxvK5DvLBTY9NIitKdBT8P63k1pPg4ApOMllwBX+9agZYKamqdCI4x0Ec9vg+0lTBhYLYVxQLznYQp65L3jJSILhN9G4a/j5RseAefBW5gy00/PwvuWSq4GKb+PWqBAviR/Ay2UxeTV8pqObJMlVwiU38hmAKlizl4/iCqIjXIS8yeYgIE8SOUTlEGPkyuKKb3FlB7FskWN00jX1sIxVM4/uxTaqnad1dcNAXGiSYBGsjuJoXvJTy95VJsEJWeZ2/N7hBghWXQXnl0Ae8IsHOGSfJ4zAJdv59HVlR9SYS7JxESR4XSbBzLgtyiKebnDqugrEe248pkveISbAD3oEvtNCglRwJ1l1wvuaC95gueJ/mgnNMFxzFH6m84V841YVW/nZ9DH0/mD4xTpBgEkyQYBJMggkSTIJJMEGCteYPxO/zzCRZDV4AAAAASUVORK5CYII=",G_e="/assets/color-palette-71a7a2d4.png";var lo={},C0={},V_e=typeof ka=="object"&&ka&&ka.Object===Object&&ka,EV=V_e,j_e=EV,W_e=typeof self=="object"&&self&&self.Object===Object&&self,K_e=j_e||W_e||Function("return this")(),ul=K_e,X_e=ul,Y_e=X_e.Symbol,T0=Y_e,F3=T0,BV=Object.prototype,$_e=BV.hasOwnProperty,Z_e=BV.toString,cm=F3?F3.toStringTag:void 0;function J_e(n){var e=$_e.call(n,cm),t=n[cm];try{n[cm]=void 0;var r=!0}catch{}var i=Z_e.call(n);return r&&(e?n[cm]=t:delete n[cm]),i}var q_e=J_e,exe=Object.prototype,txe=exe.toString;function nxe(n){return txe.call(n)}var rxe=nxe,P3=T0,ixe=q_e,sxe=rxe,oxe="[object Null]",axe="[object Undefined]",L3=P3?P3.toStringTag:void 0;function lxe(n){return n==null?n===void 0?axe:oxe:L3&&L3 in Object(n)?ixe(n):sxe(n)}var Zu=lxe,cxe=Array.isArray,ha=cxe;function Axe(n){return n!=null&&typeof n=="object"}var uc=Axe,uxe=Zu,fxe=ha,hxe=uc,dxe="[object String]";function pxe(n){return typeof n=="string"||!fxe(n)&&hxe(n)&&uxe(n)==dxe}var mxe=pxe;function gxe(n){return function(e,t,r){for(var i=-1,s=Object(e),o=r(e),a=o.length;a--;){var l=o[n?a:++i];if(t(s[l],l,s)===!1)break}return e}}var vxe=gxe,yxe=vxe,wxe=yxe(),_xe=wxe;function xxe(n,e){for(var t=-1,r=Array(n);++t-1&&n%1==0&&n-1&&n%1==0&&n<=Oxe}var x2=kxe,Qxe=Zu,Hxe=x2,zxe=uc,Gxe="[object Arguments]",Vxe="[object Array]",jxe="[object Boolean]",Wxe="[object Date]",Kxe="[object Error]",Xxe="[object Function]",Yxe="[object Map]",$xe="[object Number]",Zxe="[object Object]",Jxe="[object RegExp]",qxe="[object Set]",e1e="[object String]",t1e="[object WeakMap]",n1e="[object ArrayBuffer]",r1e="[object DataView]",i1e="[object Float32Array]",s1e="[object Float64Array]",o1e="[object Int8Array]",a1e="[object Int16Array]",l1e="[object Int32Array]",c1e="[object Uint8Array]",A1e="[object Uint8ClampedArray]",u1e="[object Uint16Array]",f1e="[object Uint32Array]",Cn={};Cn[i1e]=Cn[s1e]=Cn[o1e]=Cn[a1e]=Cn[l1e]=Cn[c1e]=Cn[A1e]=Cn[u1e]=Cn[f1e]=!0;Cn[Gxe]=Cn[Vxe]=Cn[n1e]=Cn[jxe]=Cn[r1e]=Cn[Wxe]=Cn[Kxe]=Cn[Xxe]=Cn[Yxe]=Cn[$xe]=Cn[Zxe]=Cn[Jxe]=Cn[qxe]=Cn[e1e]=Cn[t1e]=!1;function h1e(n){return zxe(n)&&Hxe(n.length)&&!!Cn[Qxe(n)]}var d1e=h1e;function p1e(n){return function(e){return n(e)}}var b2=p1e,dx={exports:{}};dx.exports;(function(n,e){var t=EV,r=e&&!e.nodeType&&e,i=r&&!0&&n&&!n.nodeType&&n,s=i&&i.exports===r,o=s&&t.process,a=function(){try{var l=i&&i.require&&i.require("util").types;return l||o&&o.binding&&o.binding("util")}catch{}}();n.exports=a})(dx,dx.exports);var E2=dx.exports,m1e=d1e,g1e=b2,N3=E2,O3=N3&&N3.isTypedArray,v1e=O3?g1e(O3):m1e,TV=v1e,y1e=bxe,w1e=SV,_1e=ha,x1e=_2,b1e=CV,E1e=TV,B1e=Object.prototype,M1e=B1e.hasOwnProperty;function S1e(n,e){var t=_1e(n),r=!t&&w1e(n),i=!t&&!r&&x1e(n),s=!t&&!r&&!i&&E1e(n),o=t||r||i||s,a=o?y1e(n.length,String):[],l=a.length;for(var c in n)(e||M1e.call(n,c))&&!(o&&(c=="length"||i&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||b1e(c,l)))&&a.push(c);return a}var IV=S1e,C1e=Object.prototype;function T1e(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||C1e;return n===t}var B2=T1e;function I1e(n,e){return function(t){return n(e(t))}}var RV=I1e,R1e=RV,U1e=R1e(Object.keys,Object),F1e=U1e,P1e=B2,L1e=F1e,D1e=Object.prototype,N1e=D1e.hasOwnProperty;function O1e(n){if(!P1e(n))return L1e(n);var e=[];for(var t in Object(n))N1e.call(n,t)&&t!="constructor"&&e.push(t);return e}var k1e=O1e;function Q1e(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var tp=Q1e,H1e=Zu,z1e=tp,G1e="[object AsyncFunction]",V1e="[object Function]",j1e="[object GeneratorFunction]",W1e="[object Proxy]";function K1e(n){if(!z1e(n))return!1;var e=H1e(n);return e==V1e||e==j1e||e==G1e||e==W1e}var UV=K1e,X1e=UV,Y1e=x2;function $1e(n){return n!=null&&Y1e(n.length)&&!X1e(n)}var k1=$1e,Z1e=IV,J1e=k1e,q1e=k1;function ebe(n){return q1e(n)?Z1e(n):J1e(n)}var I0=ebe,tbe=_xe,nbe=I0;function rbe(n,e){return n&&tbe(n,e,nbe)}var FV=rbe;function ibe(n){return n}var PV=ibe,sbe=PV;function obe(n){return typeof n=="function"?n:sbe}var abe=obe,lbe=FV,cbe=abe;function Abe(n,e){return n&&lbe(n,cbe(e))}var M2=Abe,ube=RV,fbe=ube(Object.getPrototypeOf,Object),S2=fbe,hbe=Zu,dbe=S2,pbe=uc,mbe="[object Object]",gbe=Function.prototype,vbe=Object.prototype,LV=gbe.toString,ybe=vbe.hasOwnProperty,wbe=LV.call(Object);function _be(n){if(!pbe(n)||hbe(n)!=mbe)return!1;var e=dbe(n);if(e===null)return!0;var t=ybe.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&LV.call(t)==wbe}var xbe=_be;function bbe(n,e){for(var t=-1,r=n==null?0:n.length,i=Array(r);++t-1}var kbe=Obe,Qbe=Q1;function Hbe(n,e){var t=this.__data__,r=Qbe(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}var zbe=Hbe,Gbe=Bbe,Vbe=Fbe,jbe=Dbe,Wbe=kbe,Kbe=zbe;function np(n){var e=-1,t=n==null?0:n.length;for(this.clear();++ea))return!1;var c=s.get(n),A=s.get(e);if(c&&A)return c==e&&A==n;var u=-1,f=!0,h=t&sMe?new tMe:void 0;for(s.set(n,e),s.set(e,n);++u0&&arguments[0]!==void 0?arguments[0]:[],t=[];return(0,YTe.default)(e,function(r){Array.isArray(r)?n(r).map(function(i){return t.push(i)}):(0,KTe.default)(r)?(0,jTe.default)(r,function(i,s){i===!0&&t.push(s),t.push(s+"-"+i)}):(0,GTe.default)(r)&&t.push(r)}),t};C0.default=$Te;var R0={};function ZTe(n,e){for(var t=-1,r=n==null?0:n.length;++t1&&arguments[1]!==void 0?arguments[1]:[],r=e.default&&(0,gUe.default)(e.default)||{};return t.map(function(i){var s=e[i];return s&&(0,pUe.default)(s,function(o,a){r[a]||(r[a]={}),r[a]=vUe({},r[a],s[a])}),i}),r};R0.default=yUe;var U0={};Object.defineProperty(U0,"__esModule",{value:!0});U0.autoprefix=void 0;var wUe=M2,vk=xUe(wUe),_Ue=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){TUe(i,r);function i(){var s,o,a,l;CUe(this,i);for(var c=arguments.length,A=Array(c),u=0;u1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){LUe(i,r);function i(){var s,o,a,l;PUe(this,i);for(var c=arguments.length,A=Array(c),u=0;u1&&arguments[1]!==void 0?arguments[1]:!0;r[o]=a};return e===0&&i("first-child"),e===t-1&&i("last-child"),(e===0||e%2===0)&&i("even"),Math.abs(e%2)===1&&i("odd"),i("nth-child",e),r};O2.default=NUe;Object.defineProperty(lo,"__esModule",{value:!0});lo.ReactCSS=lo.loop=lo.handleActive=k2=lo.handleHover=lo.hover=void 0;var OUe=C0,kUe=ap(OUe),QUe=R0,HUe=ap(QUe),zUe=U0,GUe=ap(zUe),VUe=F0,oj=ap(VUe),jUe=P0,WUe=ap(jUe),KUe=O2,XUe=ap(KUe);function ap(n){return n&&n.__esModule?n:{default:n}}lo.hover=oj.default;var k2=lo.handleHover=oj.default;lo.handleActive=WUe.default;lo.loop=XUe.default;var YUe=lo.ReactCSS=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;ia?f=1:f=Math.round(u*100/a)/100,t.a!==f)return{h:t.h,s:t.s,l:t.l,a:f,source:"rgb"}}else{var h=void 0;if(A<0?h=0:A>o?h=1:h=Math.round(A*100/o)/100,i!==h)return{h:t.h,s:t.s,l:t.l,a:h,source:"rgb"}}return null},pM={},ZUe=function(e,t,r,i){if(typeof document>"u"&&!i)return null;var s=i?new i:document.createElement("canvas");s.width=r*2,s.height=r*2;var o=s.getContext("2d");return o?(o.fillStyle=e,o.fillRect(0,0,s.width,s.height),o.fillStyle=t,o.fillRect(0,0,r,r),o.translate(r,r),o.fillRect(0,0,r,r),s.toDataURL()):null},JUe=function(e,t,r,i){var s=e+"-"+t+"-"+r+(i?"-server":"");if(pM[s])return pM[s];var o=ZUe(e,t,r,i);return pM[s]=o,o},_k=Object.assign||function(n){for(var e=1;e-1},hFe=function(e){return Number(String(e).replace(/%/g,""))},dFe=1,Qt=function(n){lFe(e,n);function e(t){oFe(this,e);var r=aFe(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return r.handleBlur=function(){r.state.blurValue&&r.setState({value:r.state.blurValue,blurValue:null})},r.handleChange=function(i){r.setUpdatedValue(i.target.value,i)},r.handleKeyDown=function(i){var s=hFe(i.target.value);if(!isNaN(s)&&fFe(i.keyCode)){var o=r.getArrowOffset(),a=i.keyCode===oj?s+o:s-o;r.setUpdatedValue(a,i)}},r.handleDrag=function(i){if(r.props.dragLabel){var s=Math.round(r.props.value+i.movementX);s>=0&&s<=r.props.dragMax&&r.props.onChange&&r.props.onChange(r.getValueObjectWithLabel(s),i)}},r.handleMouseDown=function(i){r.props.dragLabel&&(i.preventDefault(),r.handleDrag(i),window.addEventListener("mousemove",r.handleDrag),window.addEventListener("mouseup",r.handleMouseUp))},r.handleMouseUp=function(){r.unbindEventListeners()},r.unbindEventListeners=function(){window.removeEventListener("mousemove",r.handleDrag),window.removeEventListener("mouseup",r.handleMouseUp)},r.state={value:String(t.value).toUpperCase(),blurValue:String(t.value).toUpperCase()},r.inputId="rc-editable-input-"+dFe++,r}return iFe(e,[{key:"componentDidUpdate",value:function(r,i){this.props.value!==this.state.value&&(r.value!==this.props.value||i.value!==this.state.value)&&(this.input===document.activeElement?this.setState({blurValue:String(this.props.value).toUpperCase()}):this.setState({value:String(this.props.value).toUpperCase(),blurValue:!this.state.blurValue&&String(this.props.value).toUpperCase()}))}},{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"getValueObjectWithLabel",value:function(r){return sFe({},this.props.label,r)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||cFe}},{key:"setUpdatedValue",value:function(r,i){var s=this.props.label?this.getValueObjectWithLabel(r):r;this.props.onChange&&this.props.onChange(s,i),this.setState({value:r})}},{key:"render",value:function(){var r=this,i=vt({default:{wrap:{position:"relative"}},"user-override":{wrap:this.props.style&&this.props.style.wrap?this.props.style.wrap:{},input:this.props.style&&this.props.style.input?this.props.style.input:{},label:this.props.style&&this.props.style.label?this.props.style.label:{}},"dragLabel-true":{label:{cursor:"ew-resize"}}},{"user-override":!0},this.props);return J.createElement("div",{style:i.wrap},J.createElement("input",{id:this.inputId,style:i.input,ref:function(o){return r.input=o},value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,onBlur:this.handleBlur,placeholder:this.props.placeholder,spellCheck:"false"}),this.props.label&&!this.props.hideLabel?J.createElement("label",{htmlFor:this.inputId,style:i.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),e}(be.PureComponent||be.Component),pFe=function(e,t,r,i){var s=i.clientWidth,o=i.clientHeight,a=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,l=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,c=a-(i.getBoundingClientRect().left+window.pageXOffset),A=l-(i.getBoundingClientRect().top+window.pageYOffset);if(t==="vertical"){var u=void 0;if(A<0)u=359;else if(A>o)u=0;else{var f=-(A*100/o)+100;u=360*f/100}if(r.h!==u)return{h:u,s:r.s,l:r.l,a:r.a,source:"hsl"}}else{var h=void 0;if(c<0)h=0;else if(c>s)h=359;else{var d=c*100/s;h=360*d/100}if(r.h!==h)return{h,s:r.s,l:r.l,a:r.a,source:"hsl"}}return null},mFe=function(){function n(e,t){for(var r=0;r-1},fFe=function(e){return Number(String(e).replace(/%/g,""))},hFe=1,Ht=function(n){aFe(e,n);function e(t){sFe(this,e);var r=oFe(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return r.handleBlur=function(){r.state.blurValue&&r.setState({value:r.state.blurValue,blurValue:null})},r.handleChange=function(i){r.setUpdatedValue(i.target.value,i)},r.handleKeyDown=function(i){var s=fFe(i.target.value);if(!isNaN(s)&&uFe(i.keyCode)){var o=r.getArrowOffset(),a=i.keyCode===aj?s+o:s-o;r.setUpdatedValue(a,i)}},r.handleDrag=function(i){if(r.props.dragLabel){var s=Math.round(r.props.value+i.movementX);s>=0&&s<=r.props.dragMax&&r.props.onChange&&r.props.onChange(r.getValueObjectWithLabel(s),i)}},r.handleMouseDown=function(i){r.props.dragLabel&&(i.preventDefault(),r.handleDrag(i),window.addEventListener("mousemove",r.handleDrag),window.addEventListener("mouseup",r.handleMouseUp))},r.handleMouseUp=function(){r.unbindEventListeners()},r.unbindEventListeners=function(){window.removeEventListener("mousemove",r.handleDrag),window.removeEventListener("mouseup",r.handleMouseUp)},r.state={value:String(t.value).toUpperCase(),blurValue:String(t.value).toUpperCase()},r.inputId="rc-editable-input-"+hFe++,r}return rFe(e,[{key:"componentDidUpdate",value:function(r,i){this.props.value!==this.state.value&&(r.value!==this.props.value||i.value!==this.state.value)&&(this.input===document.activeElement?this.setState({blurValue:String(this.props.value).toUpperCase()}):this.setState({value:String(this.props.value).toUpperCase(),blurValue:!this.state.blurValue&&String(this.props.value).toUpperCase()}))}},{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"getValueObjectWithLabel",value:function(r){return iFe({},this.props.label,r)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||lFe}},{key:"setUpdatedValue",value:function(r,i){var s=this.props.label?this.getValueObjectWithLabel(r):r;this.props.onChange&&this.props.onChange(s,i),this.setState({value:r})}},{key:"render",value:function(){var r=this,i=vt({default:{wrap:{position:"relative"}},"user-override":{wrap:this.props.style&&this.props.style.wrap?this.props.style.wrap:{},input:this.props.style&&this.props.style.input?this.props.style.input:{},label:this.props.style&&this.props.style.label?this.props.style.label:{}},"dragLabel-true":{label:{cursor:"ew-resize"}}},{"user-override":!0},this.props);return Z.createElement("div",{style:i.wrap},Z.createElement("input",{id:this.inputId,style:i.input,ref:function(o){return r.input=o},value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,onBlur:this.handleBlur,placeholder:this.props.placeholder,spellCheck:"false"}),this.props.label&&!this.props.hideLabel?Z.createElement("label",{htmlFor:this.inputId,style:i.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),e}(be.PureComponent||be.Component),dFe=function(e,t,r,i){var s=i.clientWidth,o=i.clientHeight,a=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,l=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,c=a-(i.getBoundingClientRect().left+window.pageXOffset),A=l-(i.getBoundingClientRect().top+window.pageYOffset);if(t==="vertical"){var u=void 0;if(A<0)u=359;else if(A>o)u=0;else{var f=-(A*100/o)+100;u=360*f/100}if(r.h!==u)return{h:u,s:r.s,l:r.l,a:r.a,source:"hsl"}}else{var h=void 0;if(c<0)h=0;else if(c>s)h=359;else{var d=c*100/s;h=360*d/100}if(r.h!==h)return{h,s:r.s,l:r.l,a:r.a,source:"hsl"}}return null},pFe=function(){function n(e,t){for(var r=0;r-1}function IFe(n,e){var t=this.__data__,r=W1(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}function fc(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e-1&&n%1==0&&n<=$Pe}function Ap(n){return n!=null&&G2(n.length)&&!H2(n)}function ZPe(n){return EA(n)&&Ap(n)}function JPe(){return!1}var gj=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ik=gj&&typeof module=="object"&&module&&!module.nodeType&&module,qPe=Ik&&Ik.exports===gj,Rk=qPe?fa.Buffer:void 0,eLe=Rk?Rk.isBuffer:void 0,tLe=eLe||JPe;const yx=tLe;var nLe="[object Object]",rLe=Function.prototype,iLe=Object.prototype,vj=rLe.toString,sLe=iLe.hasOwnProperty,oLe=vj.call(Object);function aLe(n){if(!EA(n)||Zu(n)!=nLe)return!1;var e=pj(n);if(e===null)return!0;var t=sLe.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&vj.call(t)==oLe}var lLe="[object Arguments]",cLe="[object Array]",ALe="[object Boolean]",uLe="[object Date]",fLe="[object Error]",hLe="[object Function]",dLe="[object Map]",pLe="[object Number]",mLe="[object Object]",gLe="[object RegExp]",vLe="[object Set]",yLe="[object String]",wLe="[object WeakMap]",_Le="[object ArrayBuffer]",xLe="[object DataView]",bLe="[object Float32Array]",ELe="[object Float64Array]",BLe="[object Int8Array]",SLe="[object Int16Array]",MLe="[object Int32Array]",CLe="[object Uint8Array]",TLe="[object Uint8ClampedArray]",ILe="[object Uint16Array]",RLe="[object Uint32Array]",Tn={};Tn[bLe]=Tn[ELe]=Tn[BLe]=Tn[SLe]=Tn[MLe]=Tn[CLe]=Tn[TLe]=Tn[ILe]=Tn[RLe]=!0;Tn[lLe]=Tn[cLe]=Tn[_Le]=Tn[ALe]=Tn[xLe]=Tn[uLe]=Tn[fLe]=Tn[hLe]=Tn[dLe]=Tn[pLe]=Tn[mLe]=Tn[gLe]=Tn[vLe]=Tn[yLe]=Tn[wLe]=!1;function ULe(n){return EA(n)&&G2(n.length)&&!!Tn[Zu(n)]}function FLe(n){return function(e){return n(e)}}var yj=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ag=yj&&typeof module=="object"&&module&&!module.nodeType&&module,PLe=ag&&ag.exports===yj,pS=PLe&&Aj.process,LLe=function(){try{var n=ag&&ag.require&&ag.require("util").types;return n||pS&&pS.binding&&pS.binding("util")}catch{}}();const Uk=LLe;var Fk=Uk&&Uk.isTypedArray,DLe=Fk?FLe(Fk):ULe;const V2=DLe;function kT(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}var NLe=Object.prototype,OLe=NLe.hasOwnProperty;function kLe(n,e,t){var r=n[e];(!(OLe.call(n,e)&&P0(r,t))||t===void 0&&!(e in n))&&Q2(n,e,t)}function HLe(n,e,t,r){var i=!t;t||(t={});for(var s=-1,o=e.length;++s-1&&n%1==0&&n0){if(++e>=rDe)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}var aDe=oDe(nDe);const lDe=aDe;function cDe(n,e){return lDe(qLe(n,e,X1),n+"")}function ADe(n,e,t){if(!Eo(t))return!1;var r=typeof e;return(r=="number"?Ap(t)&&j2(e,t.length):r=="string"&&e in t)?P0(t[e],n):!1}function uDe(n){return cDe(function(e,t){var r=-1,i=t.length,s=i>1?t[i-1]:void 0,o=i>2?t[2]:void 0;for(s=n.length>3&&typeof s=="function"?(i--,s):void 0,o&&ADe(t[0],t[1],o)&&(s=i<3?void 0:s,i=1),e=Object(e);++r=e||B<0||u&&M>=s}function p(){var b=mS();if(g(b))return v(b);a=setTimeout(p,m(b))}function v(b){return a=void 0,f&&r?h(b):(r=i=void 0,o)}function w(){a!==void 0&&clearTimeout(a),c=0,r=l=i=a=void 0}function _(){return a===void 0?o:v(mS())}function x(){var b=mS(),B=g(b);if(r=arguments,i=this,l=b,B){if(a===void 0)return d(l);if(u)return clearTimeout(a),a=setTimeout(p,e),h(l)}return a===void 0&&(a=setTimeout(p,e)),o}return x.cancel=w,x.flush=_,x}var SDe="Expected a function";function MDe(n,e,t){var r=!0,i=!0;if(typeof n!="function")throw new TypeError(SDe);return Eo(t)&&(r="leading"in t?!!t.leading:r,i="trailing"in t?!!t.trailing:i),bj(n,e,{leading:r,maxWait:e,trailing:i})}var CDe=function(e,t,r){var i=r.getBoundingClientRect(),s=i.width,o=i.height,a=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,l=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,c=a-(r.getBoundingClientRect().left+window.pageXOffset),A=l-(r.getBoundingClientRect().top+window.pageYOffset);c<0?c=0:c>s&&(c=s),A<0?A=0:A>o&&(A=o);var u=c/s,f=1-A/o;return{h:t.h,s:u,v:f,a:t.a,source:"hsv"}},TDe=function(){function n(e,t){for(var r=0;r-1}function TFe(n,e){var t=this.__data__,r=X1(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}function fc(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e-1&&n%1==0&&n<=YPe}function Ap(n){return n!=null&&V2(n.length)&&!H2(n)}function $Pe(n){return BA(n)&&Ap(n)}function ZPe(){return!1}var vj=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Rk=vj&&typeof module=="object"&&module&&!module.nodeType&&module,JPe=Rk&&Rk.exports===vj,Uk=JPe?da.Buffer:void 0,qPe=Uk?Uk.isBuffer:void 0,eLe=qPe||ZPe;const wx=eLe;var tLe="[object Object]",nLe=Function.prototype,rLe=Object.prototype,yj=nLe.toString,iLe=rLe.hasOwnProperty,sLe=yj.call(Object);function oLe(n){if(!BA(n)||qu(n)!=tLe)return!1;var e=mj(n);if(e===null)return!0;var t=iLe.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&yj.call(t)==sLe}var aLe="[object Arguments]",lLe="[object Array]",cLe="[object Boolean]",ALe="[object Date]",uLe="[object Error]",fLe="[object Function]",hLe="[object Map]",dLe="[object Number]",pLe="[object Object]",mLe="[object RegExp]",gLe="[object Set]",vLe="[object String]",yLe="[object WeakMap]",wLe="[object ArrayBuffer]",_Le="[object DataView]",xLe="[object Float32Array]",bLe="[object Float64Array]",ELe="[object Int8Array]",BLe="[object Int16Array]",MLe="[object Int32Array]",SLe="[object Uint8Array]",CLe="[object Uint8ClampedArray]",TLe="[object Uint16Array]",ILe="[object Uint32Array]",Tn={};Tn[xLe]=Tn[bLe]=Tn[ELe]=Tn[BLe]=Tn[MLe]=Tn[SLe]=Tn[CLe]=Tn[TLe]=Tn[ILe]=!0;Tn[aLe]=Tn[lLe]=Tn[wLe]=Tn[cLe]=Tn[_Le]=Tn[ALe]=Tn[uLe]=Tn[fLe]=Tn[hLe]=Tn[dLe]=Tn[pLe]=Tn[mLe]=Tn[gLe]=Tn[vLe]=Tn[yLe]=!1;function RLe(n){return BA(n)&&V2(n.length)&&!!Tn[qu(n)]}function ULe(n){return function(e){return n(e)}}var wj=typeof exports=="object"&&exports&&!exports.nodeType&&exports,lg=wj&&typeof module=="object"&&module&&!module.nodeType&&module,FLe=lg&&lg.exports===wj,gM=FLe&&uj.process,PLe=function(){try{var n=lg&&lg.require&&lg.require("util").types;return n||gM&&gM.binding&&gM.binding("util")}catch{}}();const Fk=PLe;var Pk=Fk&&Fk.isTypedArray,LLe=Pk?ULe(Pk):RLe;const j2=LLe;function HT(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}var DLe=Object.prototype,NLe=DLe.hasOwnProperty;function OLe(n,e,t){var r=n[e];(!(NLe.call(n,e)&&L0(r,t))||t===void 0&&!(e in n))&&z2(n,e,t)}function kLe(n,e,t,r){var i=!t;t||(t={});for(var s=-1,o=e.length;++s-1&&n%1==0&&n0){if(++e>=nDe)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}var oDe=sDe(tDe);const aDe=oDe;function lDe(n,e){return aDe(JLe(n,e,$1),n+"")}function cDe(n,e,t){if(!Eo(t))return!1;var r=typeof e;return(r=="number"?Ap(t)&&W2(e,t.length):r=="string"&&e in t)?L0(t[e],n):!1}function ADe(n){return lDe(function(e,t){var r=-1,i=t.length,s=i>1?t[i-1]:void 0,o=i>2?t[2]:void 0;for(s=n.length>3&&typeof s=="function"?(i--,s):void 0,o&&cDe(t[0],t[1],o)&&(s=i<3?void 0:s,i=1),e=Object(e);++r=e||B<0||u&&S>=s}function p(){var b=vM();if(g(b))return v(b);a=setTimeout(p,m(b))}function v(b){return a=void 0,f&&r?h(b):(r=i=void 0,o)}function w(){a!==void 0&&clearTimeout(a),c=0,r=l=i=a=void 0}function _(){return a===void 0?o:v(vM())}function x(){var b=vM(),B=g(b);if(r=arguments,i=this,l=b,B){if(a===void 0)return d(l);if(u)return clearTimeout(a),a=setTimeout(p,e),h(l)}return a===void 0&&(a=setTimeout(p,e)),o}return x.cancel=w,x.flush=_,x}var BDe="Expected a function";function MDe(n,e,t){var r=!0,i=!0;if(typeof n!="function")throw new TypeError(BDe);return Eo(t)&&(r="leading"in t?!!t.leading:r,i="trailing"in t?!!t.trailing:i),Ej(n,e,{leading:r,maxWait:e,trailing:i})}var SDe=function(e,t,r){var i=r.getBoundingClientRect(),s=i.width,o=i.height,a=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,l=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,c=a-(r.getBoundingClientRect().left+window.pageXOffset),A=l-(r.getBoundingClientRect().top+window.pageYOffset);c<0?c=0:c>s&&(c=s),A<0?A=0:A>o&&(A=o);var u=c/s,f=1-A/o;return{h:t.h,s:u,v:f,a:t.a,source:"hsv"}},CDe=function(){function n(e,t){for(var r=0;r=0,s=!t&&i&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(r=this.toRgbString()),e==="prgb"&&(r=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(r=this.toHexString()),e==="hex3"&&(r=this.toHexString(!0)),e==="hex4"&&(r=this.toHex8String(!0)),e==="hex8"&&(r=this.toHex8String()),e==="name"&&(r=this.toName()),e==="hsl"&&(r=this.toHslString()),e==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return ot(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(eNe,arguments)},brighten:function(){return this._applyModification(tNe,arguments)},darken:function(){return this._applyModification(nNe,arguments)},desaturate:function(){return this._applyModification(ZDe,arguments)},saturate:function(){return this._applyModification(JDe,arguments)},greyscale:function(){return this._applyModification(qDe,arguments)},spin:function(){return this._applyModification(rNe,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(oNe,arguments)},complement:function(){return this._applyCombination(iNe,arguments)},monochromatic:function(){return this._applyCombination(aNe,arguments)},splitcomplement:function(){return this._applyCombination(sNe,arguments)},triad:function(){return this._applyCombination(Qk,[3])},tetrad:function(){return this._applyCombination(Qk,[4])}};ot.fromRatio=function(n,e){if(wx(n)=="object"){var t={};for(var r in n)n.hasOwnProperty(r)&&(r==="a"?t[r]=n[r]:t[r]=Lm(n[r]));n=t}return ot(n,e)};function WDe(n){var e={r:0,g:0,b:0},t=1,r=null,i=null,s=null,o=!1,a=!1;return typeof n=="string"&&(n=fNe(n)),wx(n)=="object"&&(El(n.r)&&El(n.g)&&El(n.b)?(e=KDe(n.r,n.g,n.b),o=!0,a=String(n.r).substr(-1)==="%"?"prgb":"rgb"):El(n.h)&&El(n.s)&&El(n.v)?(r=Lm(n.s),i=Lm(n.v),e=YDe(n.h,r,i),o=!0,a="hsv"):El(n.h)&&El(n.s)&&El(n.l)&&(r=Lm(n.s),s=Lm(n.l),e=XDe(n.h,r,s),o=!0,a="hsl"),n.hasOwnProperty("a")&&(t=n.a)),t=Bj(t),{ok:o,format:n.format||a,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function KDe(n,e,t){return{r:Dn(n,255)*255,g:Dn(e,255)*255,b:Dn(t,255)*255}}function Nk(n,e,t){n=Dn(n,255),e=Dn(e,255),t=Dn(t,255);var r=Math.max(n,e,t),i=Math.min(n,e,t),s,o,a=(r+i)/2;if(r==i)s=o=0;else{var l=r-i;switch(o=a>.5?l/(2-r-i):l/(r+i),r){case n:s=(e-t)/l+(e1&&(u-=1),u<1/6?c+(A-c)*6*u:u<1/2?A:u<2/3?c+(A-c)*(2/3-u)*6:c}if(e===0)r=i=s=t;else{var a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;r=o(l,a,n+1/3),i=o(l,a,n),s=o(l,a,n-1/3)}return{r:r*255,g:i*255,b:s*255}}function Ok(n,e,t){n=Dn(n,255),e=Dn(e,255),t=Dn(t,255);var r=Math.max(n,e,t),i=Math.min(n,e,t),s,o,a=r,l=r-i;if(o=r===0?0:l/r,r==i)s=0;else{switch(r){case n:s=(e-t)/l+(e>1)+720)%360;--e;)r.h=(r.h+i)%360,s.push(ot(r));return s}function aNe(n,e){e=e||6;for(var t=ot(n).toHsv(),r=t.h,i=t.s,s=t.v,o=[],a=1/e;e--;)o.push(ot({h:r,s:i,v:s})),s=(s+a)%1;return o}ot.mix=function(n,e,t){t=t===0?0:t||50;var r=ot(n).toRgb(),i=ot(e).toRgb(),s=t/100,o={r:(i.r-r.r)*s+r.r,g:(i.g-r.g)*s+r.g,b:(i.b-r.b)*s+r.b,a:(i.a-r.a)*s+r.a};return ot(o)};ot.readability=function(n,e){var t=ot(n),r=ot(e);return(Math.max(t.getLuminance(),r.getLuminance())+.05)/(Math.min(t.getLuminance(),r.getLuminance())+.05)};ot.isReadable=function(n,e,t){var r=ot.readability(n,e),i,s;switch(s=!1,i=hNe(t),i.level+i.size){case"AAsmall":case"AAAlarge":s=r>=4.5;break;case"AAlarge":s=r>=3;break;case"AAAsmall":s=r>=7;break}return s};ot.mostReadable=function(n,e,t){var r=null,i=0,s,o,a,l;t=t||{},o=t.includeFallbackColors,a=t.level,l=t.size;for(var c=0;ci&&(i=s,r=ot(e[c]));return ot.isReadable(n,r,{level:a,size:l})||!o?r:(t.includeFallbackColors=!1,ot.mostReadable(n,["#fff","#000"],t))};var HT=ot.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},lNe=ot.hexNames=cNe(HT);function cNe(n){var e={};for(var t in n)n.hasOwnProperty(t)&&(e[n[t]]=t);return e}function Bj(n){return n=parseFloat(n),(isNaN(n)||n<0||n>1)&&(n=1),n}function Dn(n,e){ANe(n)&&(n="100%");var t=uNe(n);return n=Math.min(e,Math.max(0,parseFloat(n))),t&&(n=parseInt(n*e,10)/100),Math.abs(n-e)<1e-6?1:n%e/parseFloat(e)}function Z1(n){return Math.min(1,Math.max(0,n))}function ys(n){return parseInt(n,16)}function ANe(n){return typeof n=="string"&&n.indexOf(".")!=-1&&parseFloat(n)===1}function uNe(n){return typeof n=="string"&&n.indexOf("%")!=-1}function ea(n){return n.length==1?"0"+n:""+n}function Lm(n){return n<=1&&(n=n*100+"%"),n}function Sj(n){return Math.round(parseFloat(n)*255).toString(16)}function zk(n){return ys(n)/255}var Go=function(){var n="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+n+")",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",i="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function El(n){return!!Go.CSS_UNIT.exec(n)}function fNe(n){n=n.replace(VDe,"").replace(jDe,"").toLowerCase();var e=!1;if(HT[n])n=HT[n],e=!0;else if(n=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=Go.rgb.exec(n))?{r:t[1],g:t[2],b:t[3]}:(t=Go.rgba.exec(n))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=Go.hsl.exec(n))?{h:t[1],s:t[2],l:t[3]}:(t=Go.hsla.exec(n))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=Go.hsv.exec(n))?{h:t[1],s:t[2],v:t[3]}:(t=Go.hsva.exec(n))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=Go.hex8.exec(n))?{r:ys(t[1]),g:ys(t[2]),b:ys(t[3]),a:zk(t[4]),format:e?"name":"hex8"}:(t=Go.hex6.exec(n))?{r:ys(t[1]),g:ys(t[2]),b:ys(t[3]),format:e?"name":"hex"}:(t=Go.hex4.exec(n))?{r:ys(t[1]+""+t[1]),g:ys(t[2]+""+t[2]),b:ys(t[3]+""+t[3]),a:zk(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=Go.hex3.exec(n))?{r:ys(t[1]+""+t[1]),g:ys(t[2]+""+t[2]),b:ys(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function hNe(n){var e,t;return n=n||{level:"AA",size:"small"},e=(n.level||"AA").toUpperCase(),t=(n.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}var Gk=function(e){var t=["r","g","b","a","h","s","l","v"],r=0,i=0;return GDe(t,function(s){if(e[s]&&(r+=1,isNaN(e[s])||(i+=1),s==="s"||s==="l")){var o=/^\d+%$/;o.test(e[s])&&(i+=1)}}),r===i?e:!1},Dm=function(e,t){var r=e.hex?ot(e.hex):ot(e),i=r.toHsl(),s=r.toHsv(),o=r.toRgb(),a=r.toHex();i.s===0&&(i.h=t||0,s.h=t||0);var l=a==="000000"&&o.a===0;return{hsl:i,hex:l?"transparent":"#"+a,rgb:o,hsv:s,oldHue:e.h||t||i.h,source:e.source}},PA=function(e){if(e==="transparent")return!0;var t=String(e).charAt(0)==="#"?1:0;return e.length!==4+t&&e.length<7+t&&ot(e).isValid()},K2=function(e){if(!e)return"#fff";var t=Dm(e);if(t.hex==="transparent")return"rgba(0,0,0,0.4)";var r=(t.rgb.r*299+t.rgb.g*587+t.rgb.b*114)/1e3;return r>=128?"#000":"#fff"},gS=function(e,t){var r=e.replace("°","");return ot(t+" ("+r+")")._ok},Am=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){_Ne(i,r);function i(){var s,o,a,l;wNe(this,i);for(var c=arguments.length,A=Array(c),u=0;ua))return!1;var c=s.get(n),A=s.get(e);if(c&&A)return c==e&&A==n;var u=-1,f=!0,h=t&FNe?new _x:void 0;for(s.set(n,e),s.set(e,n);++u=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var Gy=24,t3e=Dj.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?Gy:r,s=n.height,o=s===void 0?Gy:s,a=n.style,l=a===void 0?{}:a,c=e3e(n,["fill","width","height","style"]);return l4.default.createElement("svg",a4({viewBox:"0 0 "+Gy+" "+Gy,style:a4({fill:t,width:i,height:o},l)},c),l4.default.createElement("path",{d:"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"}))},n3e=function(){function n(e,t){for(var r=0;r1&&(i.a=1),r.props.onChange({h:r.props.hsl.h,s:r.props.hsl.s,l:r.props.hsl.l,a:Math.round(i.a*100)/100,source:"rgb"},s)):(i.h||i.s||i.l)&&(typeof i.s=="string"&&i.s.includes("%")&&(i.s=i.s.replace("%","")),typeof i.l=="string"&&i.l.includes("%")&&(i.l=i.l.replace("%","")),i.s==1?i.s=.01:i.l==1&&(i.l=.01),r.props.onChange({h:i.h||r.props.hsl.h,s:Number(o4(i.s)?r.props.hsl.s:i.s),l:Number(o4(i.l)?r.props.hsl.l:i.l),source:"hsl"},s))},r.showHighlight=function(i){i.currentTarget.style.background="#eee"},r.hideHighlight=function(i){i.currentTarget.style.background="transparent"},t.hsl.a!==1&&t.view==="hex"?r.state={view:"rgb"}:r.state={view:t.view},r}return n3e(e,[{key:"render",value:function(){var r=this,i=vt({default:{wrap:{paddingTop:"16px",display:"flex"},fields:{flex:"1",display:"flex",marginLeft:"-6px"},field:{paddingLeft:"6px",width:"100%"},alpha:{paddingLeft:"6px",width:"100%"},toggle:{width:"32px",textAlign:"right",position:"relative"},icon:{marginRight:"-4px",marginTop:"12px",cursor:"pointer",position:"relative"},iconHighlight:{position:"absolute",width:"24px",height:"28px",background:"#eee",borderRadius:"4px",top:"10px",left:"12px",display:"none"},input:{fontSize:"11px",color:"#333",width:"100%",borderRadius:"2px",border:"none",boxShadow:"inset 0 0 0 1px #dadada",height:"21px",textAlign:"center"},label:{textTransform:"uppercase",fontSize:"11px",lineHeight:"11px",color:"#969696",textAlign:"center",display:"block",marginTop:"12px"},svg:{fill:"#333",width:"24px",height:"24px",border:"1px transparent solid",borderRadius:"5px"}},disableAlpha:{alpha:{display:"none"}}},this.props,this.state),s=void 0;return this.state.view==="hex"?s=J.createElement("div",{style:i.fields,className:"flexbox-fix"},J.createElement("div",{style:i.field},J.createElement(Qt,{style:{input:i.input,label:i.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?s=J.createElement("div",{style:i.fields,className:"flexbox-fix"},J.createElement("div",{style:i.field},J.createElement(Qt,{style:{input:i.input,label:i.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),J.createElement("div",{style:i.field},J.createElement(Qt,{style:{input:i.input,label:i.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),J.createElement("div",{style:i.field},J.createElement(Qt,{style:{input:i.input,label:i.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),J.createElement("div",{style:i.alpha},J.createElement(Qt,{style:{input:i.input,label:i.label},label:"a",value:this.props.rgb.a,arrowOffset:.01,onChange:this.handleChange}))):this.state.view==="hsl"&&(s=J.createElement("div",{style:i.fields,className:"flexbox-fix"},J.createElement("div",{style:i.field},J.createElement(Qt,{style:{input:i.input,label:i.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),J.createElement("div",{style:i.field},J.createElement(Qt,{style:{input:i.input,label:i.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),J.createElement("div",{style:i.field},J.createElement(Qt,{style:{input:i.input,label:i.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),J.createElement("div",{style:i.alpha},J.createElement(Qt,{style:{input:i.input,label:i.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),J.createElement("div",{style:i.wrap,className:"flexbox-fix"},s,J.createElement("div",{style:i.toggle},J.createElement("div",{style:i.icon,onClick:this.toggleViews,ref:function(a){return r.icon=a}},J.createElement(t3e,{style:i.svg,onMouseOver:this.showHighlight,onMouseEnter:this.showHighlight,onMouseOut:this.hideHighlight}))))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.hsl.a!==1&&i.view==="hex"?{view:"rgb"}:null}}]),e}(J.Component);Nj.defaultProps={view:"hex"};var c4=function(){var e=vt({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",transform:"translate(-6px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}});return J.createElement("div",{style:e.picker})},o3e=function(){var e=vt({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return J.createElement("div",{style:e.picker})},q2=function(e){var t=e.width,r=e.onChange,i=e.disableAlpha,s=e.rgb,o=e.hsl,a=e.hsv,l=e.hex,c=e.renderers,A=e.styles,u=A===void 0?{}:A,f=e.className,h=f===void 0?"":f,d=e.defaultView,m=vt(fs({default:{picker:{width:t,background:"#fff",borderRadius:"2px",boxShadow:"0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3)",boxSizing:"initial",fontFamily:"Menlo"},saturation:{width:"100%",paddingBottom:"55%",position:"relative",borderRadius:"2px 2px 0 0",overflow:"hidden"},Saturation:{radius:"2px 2px 0 0"},body:{padding:"16px 16px 12px"},controls:{display:"flex"},color:{width:"32px"},swatch:{marginTop:"6px",width:"16px",height:"16px",borderRadius:"8px",position:"relative",overflow:"hidden"},active:{absolute:"0px 0px 0px 0px",borderRadius:"8px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.1)",background:"rgba("+s.r+", "+s.g+", "+s.b+", "+s.a+")",zIndex:"2"},toggles:{flex:"1"},hue:{height:"10px",position:"relative",marginBottom:"8px"},Hue:{radius:"2px"},alpha:{height:"10px",position:"relative"},Alpha:{radius:"2px"}},disableAlpha:{color:{width:"22px"},alpha:{display:"none"},hue:{marginBottom:"0px"},swatch:{width:"10px",height:"10px",marginTop:"0px"}}},u),{disableAlpha:i});return J.createElement("div",{style:m.picker,className:"chrome-picker "+h},J.createElement("div",{style:m.saturation},J.createElement($1,{style:m.Saturation,hsl:o,hsv:a,pointer:o3e,onChange:r})),J.createElement("div",{style:m.body},J.createElement("div",{style:m.controls,className:"flexbox-fix"},J.createElement("div",{style:m.color},J.createElement("div",{style:m.swatch},J.createElement("div",{style:m.active}),J.createElement(lp,{renderers:c}))),J.createElement("div",{style:m.toggles},J.createElement("div",{style:m.hue},J.createElement(cp,{style:m.Hue,hsl:o,pointer:c4,onChange:r})),J.createElement("div",{style:m.alpha},J.createElement(k2,{style:m.Alpha,rgb:s,hsl:o,pointer:c4,renderers:c,onChange:r})))),J.createElement(Nj,{rgb:s,hsl:o,hex:l,view:d,onChange:r,disableAlpha:i})))};q2.propTypes={width:Ge.oneOfType([Ge.string,Ge.number]),disableAlpha:Ge.bool,styles:Ge.object,defaultView:Ge.oneOf(["hex","rgb","hsl"])};q2.defaultProps={width:225,disableAlpha:!1,styles:{}};const a3e=hs(q2);var l3e=function(e){var t=e.color,r=e.onClick,i=r===void 0?function(){}:r,s=e.onSwatchHover,o=e.active,a=vt({default:{color:{background:t,width:"15px",height:"15px",float:"left",marginRight:"5px",marginBottom:"5px",position:"relative",cursor:"pointer"},dot:{absolute:"5px 5px 5px 5px",background:K2(t),borderRadius:"50%",opacity:"0"}},active:{dot:{opacity:"1"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},dot:{background:"#000"}},transparent:{dot:{background:"#000"}}},{active:o,"color-#FFFFFF":t==="#FFFFFF",transparent:t==="transparent"});return J.createElement(ef,{style:a.color,color:t,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},J.createElement("div",{style:a.dot}))},c3e=function(e){var t=e.hex,r=e.rgb,i=e.onChange,s=vt({default:{fields:{display:"flex",paddingBottom:"6px",paddingRight:"5px",position:"relative"},active:{position:"absolute",top:"6px",left:"5px",height:"9px",width:"9px",background:t},HEXwrap:{flex:"6",position:"relative"},HEXinput:{width:"80%",padding:"0px",paddingLeft:"20%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},HEXlabel:{display:"none"},RGBwrap:{flex:"3",position:"relative"},RGBinput:{width:"70%",padding:"0px",paddingLeft:"30%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},RGBlabel:{position:"absolute",top:"3px",left:"0px",lineHeight:"16px",textTransform:"uppercase",fontSize:"12px",color:"#999"}}}),o=function(l,c){l.r||l.g||l.b?i({r:l.r||r.r,g:l.g||r.g,b:l.b||r.b,source:"rgb"},c):i({hex:l.hex,source:"hex"},c)};return J.createElement("div",{style:s.fields,className:"flexbox-fix"},J.createElement("div",{style:s.active}),J.createElement(Qt,{style:{wrap:s.HEXwrap,input:s.HEXinput,label:s.HEXlabel},label:"hex",value:t,onChange:o}),J.createElement(Qt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"r",value:r.r,onChange:o}),J.createElement(Qt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"g",value:r.g,onChange:o}),J.createElement(Qt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"b",value:r.b,onChange:o}))},eU=function(e){var t=e.onChange,r=e.onSwatchHover,i=e.colors,s=e.hex,o=e.rgb,a=e.styles,l=a===void 0?{}:a,c=e.className,A=c===void 0?"":c,u=vt(fs({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},l)),f=function(d,m){d.hex?PA(d.hex)&&t({hex:d.hex,source:"hex"},m):t(d,m)};return J.createElement(L0,{style:u.Compact,styles:l},J.createElement("div",{style:u.compact,className:"compact-picker "+A},J.createElement("div",null,tf(i,function(h){return J.createElement(l3e,{key:h,color:h,active:h.toLowerCase()===s,onClick:f,onSwatchHover:r})}),J.createElement("div",{style:u.clear})),J.createElement(c3e,{hex:s,rgb:o,onChange:f})))};eU.propTypes={colors:Ge.arrayOf(Ge.string),styles:Ge.object};eU.defaultProps={colors:["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#cccccc","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"],styles:{}};hs(eU);var A3e=function(e){var t=e.hover,r=e.color,i=e.onClick,s=e.onSwatchHover,o={position:"relative",zIndex:"2",outline:"2px solid #fff",boxShadow:"0 0 5px 2px rgba(0,0,0,0.25)"},a=vt({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:o}},{hover:t});return J.createElement("div",{style:a.swatch},J.createElement(ef,{color:r,onClick:i,onHover:s,focusStyle:o}))};const u3e=O2(A3e);var tU=function(e){var t=e.width,r=e.colors,i=e.onChange,s=e.onSwatchHover,o=e.triangle,a=e.styles,l=a===void 0?{}:a,c=e.className,A=c===void 0?"":c,u=vt(fs({default:{card:{width:t,background:"#fff",border:"1px solid rgba(0,0,0,0.2)",boxShadow:"0 3px 12px rgba(0,0,0,0.15)",borderRadius:"4px",position:"relative",padding:"5px",display:"flex",flexWrap:"wrap"},triangle:{position:"absolute",border:"7px solid transparent",borderBottomColor:"#fff"},triangleShadow:{position:"absolute",border:"8px solid transparent",borderBottomColor:"rgba(0,0,0,0.15)"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-14px",left:"10px"},triangleShadow:{top:"-16px",left:"9px"}},"top-right-triangle":{triangle:{top:"-14px",right:"10px"},triangleShadow:{top:"-16px",right:"9px"}},"bottom-left-triangle":{triangle:{top:"35px",left:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",left:"9px",transform:"rotate(180deg)"}},"bottom-right-triangle":{triangle:{top:"35px",right:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",right:"9px",transform:"rotate(180deg)"}}},l),{"hide-triangle":o==="hide","top-left-triangle":o==="top-left","top-right-triangle":o==="top-right","bottom-left-triangle":o==="bottom-left","bottom-right-triangle":o==="bottom-right"}),f=function(d,m){return i({hex:d,source:"hex"},m)};return J.createElement("div",{style:u.card,className:"github-picker "+A},J.createElement("div",{style:u.triangleShadow}),J.createElement("div",{style:u.triangle}),tf(r,function(h){return J.createElement(u3e,{color:h,key:h,onClick:f,onSwatchHover:s})}))};tU.propTypes={width:Ge.oneOfType([Ge.string,Ge.number]),colors:Ge.arrayOf(Ge.string),triangle:Ge.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:Ge.object};tU.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};hs(tU);var f3e=function(e){var t=e.direction,r=vt({default:{picker:{width:"18px",height:"18px",borderRadius:"50%",transform:"translate(-9px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}},vertical:{picker:{transform:"translate(-3px, -9px)"}}},{vertical:t==="vertical"});return J.createElement("div",{style:r.picker})},h3e=Object.assign||function(n){for(var e=1;e.5});return J.createElement("div",{style:r.picker})},g3e=function(){var e=vt({default:{triangle:{width:0,height:0,borderStyle:"solid",borderWidth:"4px 0 4px 6px",borderColor:"transparent transparent transparent #fff",position:"absolute",top:"1px",left:"1px"},triangleBorder:{width:0,height:0,borderStyle:"solid",borderWidth:"5px 0 5px 8px",borderColor:"transparent transparent transparent #555"},left:{Extend:"triangleBorder",transform:"translate(-13px, -4px)"},leftInside:{Extend:"triangle",transform:"translate(-8px, -5px)"},right:{Extend:"triangleBorder",transform:"translate(20px, -14px) rotate(180deg)"},rightInside:{Extend:"triangle",transform:"translate(-8px, -5px)"}}});return J.createElement("div",{style:e.pointer},J.createElement("div",{style:e.left},J.createElement("div",{style:e.leftInside})),J.createElement("div",{style:e.right},J.createElement("div",{style:e.rightInside})))},A4=function(e){var t=e.onClick,r=e.label,i=e.children,s=e.active,o=vt({default:{button:{backgroundImage:"linear-gradient(-180deg, #FFFFFF 0%, #E6E6E6 100%)",border:"1px solid #878787",borderRadius:"2px",height:"20px",boxShadow:"0 1px 0 0 #EAEAEA",fontSize:"14px",color:"#000",lineHeight:"20px",textAlign:"center",marginBottom:"10px",cursor:"pointer"}},active:{button:{boxShadow:"0 0 0 1px #878787"}}},{active:s});return J.createElement("div",{style:o.button,onClick:t},r||i)},v3e=function(e){var t=e.rgb,r=e.currentColor,i=vt({default:{swatches:{border:"1px solid #B3B3B3",borderBottom:"1px solid #F0F0F0",marginBottom:"2px",marginTop:"1px"},new:{height:"34px",background:"rgb("+t.r+","+t.g+", "+t.b+")",boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 1px 0 #000"},current:{height:"34px",background:r,boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 -1px 0 #000"},label:{fontSize:"14px",color:"#000",textAlign:"center"}}});return J.createElement("div",null,J.createElement("div",{style:i.label},"new"),J.createElement("div",{style:i.swatches},J.createElement("div",{style:i.new}),J.createElement("div",{style:i.current})),J.createElement("div",{style:i.label},"current"))},y3e=function(){function n(e,t){for(var r=0;r100&&(A.a=100),A.a/=100,t({h:i.h,s:i.s,l:i.l,a:A.a,source:"rgb"},u))};return J.createElement("div",{style:a.fields,className:"flexbox-fix"},J.createElement("div",{style:a.double},J.createElement(Qt,{style:{input:a.input,label:a.label},label:"hex",value:s.replace("#",""),onChange:l})),J.createElement("div",{style:a.single},J.createElement(Qt,{style:{input:a.input,label:a.label},label:"r",value:r.r,onChange:l,dragLabel:"true",dragMax:"255"})),J.createElement("div",{style:a.single},J.createElement(Qt,{style:{input:a.input,label:a.label},label:"g",value:r.g,onChange:l,dragLabel:"true",dragMax:"255"})),J.createElement("div",{style:a.single},J.createElement(Qt,{style:{input:a.input,label:a.label},label:"b",value:r.b,onChange:l,dragLabel:"true",dragMax:"255"})),J.createElement("div",{style:a.alpha},J.createElement(Qt,{style:{input:a.input,label:a.label},label:"a",value:Math.round(r.a*100),onChange:l,dragLabel:"true",dragMax:"100"})))},E3e=Object.assign||function(n){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var Vy=24,R3e=kj.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?Vy:r,s=n.height,o=s===void 0?Vy:s,a=n.style,l=a===void 0?{}:a,c=I3e(n,["fill","width","height","style"]);return f4.default.createElement("svg",u4({viewBox:"0 0 "+Vy+" "+Vy,style:u4({fill:t,width:i,height:o},l)},c),f4.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},U3e=function(e){var t=e.color,r=e.onClick,i=r===void 0?function(){}:r,s=e.onSwatchHover,o=e.first,a=e.last,l=e.active,c=vt({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:t,marginBottom:"1px"},check:{color:K2(t),marginLeft:"8px",display:"none"}},first:{color:{overflow:"hidden",borderRadius:"2px 2px 0 0"}},last:{color:{overflow:"hidden",borderRadius:"0 0 2px 2px"}},active:{check:{display:"block"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},check:{color:"#333"}},transparent:{check:{color:"#333"}}},{first:o,last:a,active:l,"color-#FFFFFF":t==="#FFFFFF",transparent:t==="transparent"});return J.createElement(ef,{color:t,style:c.color,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},J.createElement("div",{style:c.check},J.createElement(R3e,null)))},F3e=function(e){var t=e.onClick,r=e.onSwatchHover,i=e.group,s=e.active,o=vt({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return J.createElement("div",{style:o.group},tf(i,function(a,l){return J.createElement(U3e,{key:a,color:a,active:a.toLowerCase()===s,first:l===0,last:l===i.length-1,onClick:t,onSwatchHover:r})}))},oU=function(e){var t=e.width,r=e.height,i=e.onChange,s=e.onSwatchHover,o=e.colors,a=e.hex,l=e.styles,c=l===void 0?{}:l,A=e.className,u=A===void 0?"":A,f=vt(fs({default:{picker:{width:t,height:r},overflow:{height:r,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},c)),h=function(m,g){return i({hex:m,source:"hex"},g)};return J.createElement("div",{style:f.picker,className:"swatches-picker "+u},J.createElement(L0,null,J.createElement("div",{style:f.overflow},J.createElement("div",{style:f.body},tf(o,function(d){return J.createElement(F3e,{key:d.toString(),group:d,active:a,onClick:h,onSwatchHover:s})}),J.createElement("div",{style:f.clear})))))};oU.propTypes={width:Ge.oneOfType([Ge.string,Ge.number]),height:Ge.oneOfType([Ge.string,Ge.number]),colors:Ge.arrayOf(Ge.arrayOf(Ge.string)),styles:Ge.object};oU.defaultProps={width:320,height:240,colors:[[$f[900],$f[700],$f[500],$f[300],$f[100]],[Zf[900],Zf[700],Zf[500],Zf[300],Zf[100]],[Jf[900],Jf[700],Jf[500],Jf[300],Jf[100]],[qf[900],qf[700],qf[500],qf[300],qf[100]],[eh[900],eh[700],eh[500],eh[300],eh[100]],[th[900],th[700],th[500],th[300],th[100]],[nh[900],nh[700],nh[500],nh[300],nh[100]],[rh[900],rh[700],rh[500],rh[300],rh[100]],[ih[900],ih[700],ih[500],ih[300],ih[100]],["#194D33",Nm[700],Nm[500],Nm[300],Nm[100]],[sh[900],sh[700],sh[500],sh[300],sh[100]],[oh[900],oh[700],oh[500],oh[300],oh[100]],[ah[900],ah[700],ah[500],ah[300],ah[100]],[lh[900],lh[700],lh[500],lh[300],lh[100]],[ch[900],ch[700],ch[500],ch[300],ch[100]],[Ah[900],Ah[700],Ah[500],Ah[300],Ah[100]],[uh[900],uh[700],uh[500],uh[300],uh[100]],[fh[900],fh[700],fh[500],fh[300],fh[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};hs(oU);var aU=function(e){var t=e.onChange,r=e.onSwatchHover,i=e.hex,s=e.colors,o=e.width,a=e.triangle,l=e.styles,c=l===void 0?{}:l,A=e.className,u=A===void 0?"":A,f=vt(fs({default:{card:{width:o,background:"#fff",border:"0 solid rgba(0,0,0,0.25)",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",borderRadius:"4px",position:"relative"},body:{padding:"15px 9px 9px 15px"},label:{fontSize:"18px",color:"#fff"},triangle:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent #fff transparent",position:"absolute"},triangleShadow:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent rgba(0,0,0,.1) transparent",position:"absolute"},hash:{background:"#F0F0F0",height:"30px",width:"30px",borderRadius:"4px 0 0 4px",float:"left",color:"#98A1A4",display:"flex",alignItems:"center",justifyContent:"center"},input:{width:"100px",fontSize:"14px",color:"#666",border:"0px",outline:"none",height:"28px",boxShadow:"inset 0 0 0 1px #F0F0F0",boxSizing:"content-box",borderRadius:"0 4px 4px 0",float:"left",paddingLeft:"8px"},swatch:{width:"30px",height:"30px",float:"left",borderRadius:"4px",margin:"0 6px 6px 0"},clear:{clear:"both"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-10px",left:"12px"},triangleShadow:{top:"-11px",left:"12px"}},"top-right-triangle":{triangle:{top:"-10px",right:"12px"},triangleShadow:{top:"-11px",right:"12px"}}},c),{"hide-triangle":a==="hide","top-left-triangle":a==="top-left","top-right-triangle":a==="top-right"}),h=function(m,g){PA(m)&&t({hex:m,source:"hex"},g)};return J.createElement("div",{style:f.card,className:"twitter-picker "+u},J.createElement("div",{style:f.triangleShadow}),J.createElement("div",{style:f.triangle}),J.createElement("div",{style:f.body},tf(s,function(d,m){return J.createElement(ef,{key:m,color:d,hex:d,style:f.swatch,onClick:h,onHover:r,focusStyle:{boxShadow:"0 0 4px "+d}})}),J.createElement("div",{style:f.hash},"#"),J.createElement(Qt,{label:null,style:{input:f.input},value:i.replace("#",""),onChange:h}),J.createElement("div",{style:f.clear})))};aU.propTypes={width:Ge.oneOfType([Ge.string,Ge.number]),triangle:Ge.oneOf(["hide","top-left","top-right"]),colors:Ge.arrayOf(Ge.string),styles:Ge.object};aU.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};hs(aU);var lU=function(e){var t=vt({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",border:"2px #fff solid",transform:"translate(-12px, -13px)",background:"hsl("+Math.round(e.hsl.h)+", "+Math.round(e.hsl.s*100)+"%, "+Math.round(e.hsl.l*100)+"%)"}}});return J.createElement("div",{style:t.picker})};lU.propTypes={hsl:Ge.shape({h:Ge.number,s:Ge.number,l:Ge.number,a:Ge.number})};lU.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var cU=function(e){var t=vt({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",transform:"translate(-10px, -7px)",background:"hsl("+Math.round(e.hsl.h)+", 100%, 50%)",border:"2px white solid"}}});return J.createElement("div",{style:t.picker})};cU.propTypes={hsl:Ge.shape({h:Ge.number,s:Ge.number,l:Ge.number,a:Ge.number})};cU.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var P3e=function(e){var t=e.onChange,r=e.rgb,i=e.hsl,s=e.hex,o=e.hsv,a=function(h,d){if(h.hex)PA(h.hex)&&t({hex:h.hex,source:"hex"},d);else if(h.rgb){var m=h.rgb.split(",");gS(h.rgb,"rgb")&&t({r:m[0],g:m[1],b:m[2],a:1,source:"rgb"},d)}else if(h.hsv){var g=h.hsv.split(",");gS(h.hsv,"hsv")&&(g[2]=g[2].replace("%",""),g[1]=g[1].replace("%",""),g[0]=g[0].replace("°",""),g[1]==1?g[1]=.01:g[2]==1&&(g[2]=.01),t({h:Number(g[0]),s:Number(g[1]),v:Number(g[2]),source:"hsv"},d))}else if(h.hsl){var p=h.hsl.split(",");gS(h.hsl,"hsl")&&(p[2]=p[2].replace("%",""),p[1]=p[1].replace("%",""),p[0]=p[0].replace("°",""),u[1]==1?u[1]=.01:u[2]==1&&(u[2]=.01),t({h:Number(p[0]),s:Number(p[1]),v:Number(p[2]),source:"hsl"},d))}},l=vt({default:{wrap:{display:"flex",height:"100px",marginTop:"4px"},fields:{width:"100%"},column:{paddingTop:"10px",display:"flex",justifyContent:"space-between"},double:{padding:"0px 4.4px",boxSizing:"border-box"},input:{width:"100%",height:"38px",boxSizing:"border-box",padding:"4px 10% 3px",textAlign:"center",border:"1px solid #dadce0",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",fontFamily:"Roboto,Arial,sans-serif"},input2:{height:"38px",width:"100%",border:"1px solid #dadce0",boxSizing:"border-box",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",paddingLeft:"10px",fontFamily:"Roboto,Arial,sans-serif"},label:{textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"35px",top:"-6px",left:"0",right:"0",marginLeft:"auto",marginRight:"auto",fontFamily:"Roboto,Arial,sans-serif"},label2:{left:"10px",textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"32px",top:"-6px",fontFamily:"Roboto,Arial,sans-serif"},single:{flexGrow:"1",margin:"0px 4.4px"}}}),c=r.r+", "+r.g+", "+r.b,A=Math.round(i.h)+"°, "+Math.round(i.s*100)+"%, "+Math.round(i.l*100)+"%",u=Math.round(o.h)+"°, "+Math.round(o.s*100)+"%, "+Math.round(o.v*100)+"%";return J.createElement("div",{style:l.wrap,className:"flexbox-fix"},J.createElement("div",{style:l.fields},J.createElement("div",{style:l.double},J.createElement(Qt,{style:{input:l.input,label:l.label},label:"hex",value:s,onChange:a})),J.createElement("div",{style:l.column},J.createElement("div",{style:l.single},J.createElement(Qt,{style:{input:l.input2,label:l.label2},label:"rgb",value:c,onChange:a})),J.createElement("div",{style:l.single},J.createElement(Qt,{style:{input:l.input2,label:l.label2},label:"hsv",value:u,onChange:a})),J.createElement("div",{style:l.single},J.createElement(Qt,{style:{input:l.input2,label:l.label2},label:"hsl",value:A,onChange:a})))))},AU=function(e){var t=e.width,r=e.onChange,i=e.rgb,s=e.hsl,o=e.hsv,a=e.hex,l=e.header,c=e.styles,A=c===void 0?{}:c,u=e.className,f=u===void 0?"":u,h=vt(fs({default:{picker:{width:t,background:"#fff",border:"1px solid #dfe1e5",boxSizing:"initial",display:"flex",flexWrap:"wrap",borderRadius:"8px 8px 0px 0px"},head:{height:"57px",width:"100%",paddingTop:"16px",paddingBottom:"16px",paddingLeft:"16px",fontSize:"20px",boxSizing:"border-box",fontFamily:"Roboto-Regular,HelveticaNeue,Arial,sans-serif"},saturation:{width:"70%",padding:"0px",position:"relative",overflow:"hidden"},swatch:{width:"30%",height:"228px",padding:"0px",background:"rgba("+i.r+", "+i.g+", "+i.b+", 1)",position:"relative",overflow:"hidden"},body:{margin:"auto",width:"95%"},controls:{display:"flex",boxSizing:"border-box",height:"52px",paddingTop:"22px"},color:{width:"32px"},hue:{height:"8px",position:"relative",margin:"0px 16px 0px 16px",width:"100%"},Hue:{radius:"2px"}}},A));return J.createElement("div",{style:h.picker,className:"google-picker "+f},J.createElement("div",{style:h.head},l),J.createElement("div",{style:h.swatch}),J.createElement("div",{style:h.saturation},J.createElement($1,{hsl:s,hsv:o,pointer:lU,onChange:r})),J.createElement("div",{style:h.body},J.createElement("div",{style:h.controls,className:"flexbox-fix"},J.createElement("div",{style:h.hue},J.createElement(cp,{style:h.Hue,hsl:s,radius:"4px",pointer:cU,onChange:r}))),J.createElement(P3e,{rgb:i,hsl:s,hex:a,hsv:o,onChange:r})))};AU.propTypes={width:Ge.oneOfType([Ge.string,Ge.number]),styles:Ge.object,header:Ge.string};AU.defaultProps={width:652,styles:{},header:"Color picker"};hs(AU);const L3e="_InformationContainerPos_1yd4c_2",D3e="_scrollContainer_1yd4c_15",yS={InformationContainerPos:L3e,scrollContainer:D3e,"options-container":"_options-container_1yd4c_24"},N3e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAABE5AAAROQEb2ZNGAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxODowNS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6NDctMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6NDctMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmU1ZTg4ZDczLWQ3YmItNjg0NS1iNDkxLWYxZTU0YmRhZDE1MiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDphYTA0ZDdmOC1lYzY0LWU4NGQtYjI0My1kOGY0YTI1ZTdmM2YiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDphYTA0ZDdmOC1lYzY0LWU4NGQtYjI0My1kOGY0YTI1ZTdmM2YiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmFhMDRkN2Y4LWVjNjQtZTg0ZC1iMjQzLWQ4ZjRhMjVlN2YzZiIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxODowNS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDozNzgwNzA3Yy0zNDg5LTAzNDctYmEwNy1kOTFhY2ZkYmUwODYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6MjQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6ZTVlODhkNzMtZDdiYi02ODQ1LWI0OTEtZjFlNTRiZGFkMTUyIiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjQ3LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+okruHwAAA6NJREFUeNrt279LG2EYwHG1CCqKPwKOJQU3cXYqXZ0KofgPuBWcUmsgoouCFArS0UXaWUpTFxHcUnE4cO6fULoUbWnTFk2ftz4p19BoLve+d33vvsN3KWre97lPUvPm7Gs2m32U3xgCABgCAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABABnlV5VR6QH0mOpIq229VSacPj4E/oY7Y9b0TWZtY0AwO7Qp6WH0q70XrqSmh1qSLMO1zKrj9Hp8a90jbu65mkAxBv4svRR+nHD0MOZr5t3uJ75iGsxa18GQPRBl6Sgy0GHu5QWHa5rUR8j6rrMXkoAuH3Ag9KLHgYcbsfh+nZirs3sbRAA/x5uQXrb4zMs3AdpyMH6hvRnx1nbpe6xAIC/hzssHcUcbrjnUr/F9fXrz7S1PrPXYQBcD3dKemdxuKZP0pzFNc7pz7S5RrPnqVwDkAGMSTXLg211auNtmL4NPXW0RrP3sVwC0EOVwNFgW9XjPMv01anueI2By8Or/xKAbHhSeuN4sK3OpPvSQIT1Dej3nCW0RjOLyVwA0Jf9IKHBhk8IX0vFLtZX1K9tJLzGII3/DtJ4q1dLeLDhvkjH0jNpSXqkLem/HevXpLW+WtJvEZP+IKee4nB9qZ7kB0pJPvOPuLiRzgkKmQCgz/xDLmrkDpN4JUjikOeEi9lzJ64Pi1wDOOAixu7AZwBVLmDsqr7/DrAhfeVCRs7MbCMr7wLWuKCRW8vaOYC5cfIbF/bWzIwqWT0J3LRww0eWM7PZzPpnAeUUztl9yMyknJdPA7el71z0P5lZbOftfgDzSvCTi/97BuW83hG0lfNfDM3et/J+T+BKjgGscFfwNYL1DodF+yl/Pm/j/oP9Doc869wVfPNh0Z50Vzr3GMC57mEvjUMeH/8yqKJvh15Ko9I96cJjABe6h1HdUyPJQx4fAdyRFtruz/MdQDG0nwWzRwB0DyJTAPjjUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAhgDMSJ89BmDWPgOA3gGMS0+kVU8zax8HAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIACQlX4BjeT0VuSSEBUAAAAASUVORK5CYII=",O3e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoyMTozMy0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MTgtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MTgtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjA4MDc2OWJhLTIwNzQtMjU0Zi1iNjM5LWJiZjEyMTFlMjljNSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpjMTM0ZDhjYS01ZTFlLWMzNGMtOWZjNC0zZWU4MjRkNWE1YWMiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpjMTM0ZDhjYS01ZTFlLWMzNGMtOWZjNC0zZWU4MjRkNWE1YWMiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmMxMzRkOGNhLTVlMWUtYzM0Yy05ZmM0LTNlZTgyNGQ1YTVhYyIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoyMTozMy0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo4NzUzMzYxZC05NmIzLTgwNDctYTA0ZC0wODcxYmNiNzY4MDAiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6Mjk6NTctMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MDgwNzY5YmEtMjA3NC0yNTRmLWI2MzktYmJmMTIxMWUyOWM1IiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjE4LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Yrc/VQAAAzxJREFUeNrt3b9LFnEcwHE3IW1oiUCF/gCXcgibmhyaDEqnWhoCaRXqUQhByKVVXAqsMbQyGgIHA6GhSdpNc7E/IBehp8/h94ErRLzoOc671/Ce7/O572t4/PHc9bTb7R41NzcBADcBAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAiAinVrudUfPY92o+0ut5uu1Q9AtQCsRe2SWgMAAAAAAAAAAEo/7KHoWnQl12i0USKAjXTN/AzZTEMAdB/AQvQjfRrvtBMdlAjgIF0zP0M20wIA3QewVOJBF20JAAAAAACAbgJYrDCARQD+30EPRjei66nsU/fVaLXCAFbTjKO5ubMdBgEoDuBR9Cv6+VeHFQZweMy82Q6PACgOYLbCB120WQCKA5ipEYAZAAAAoCCAxzUC8BiAk3+3fzeajCZSN6OXNQLwMu3U2W8y7TwEwNENaTe0CQCWW7cbDOA2AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACcWQB3GgzgDgDLrbHoa/Ql1+foe40O+nvaKb9jtvMYAMutc9Hl9C3hTgPR0xoBeJp2yu+Y7XzO8wE8IAIAAAAAAABPCQPgTwD3ok/Req6P0V6FD3ovzZifOdvhHgD/9hKI7JPzpVwXoxcVBvAizZifeaDKL5fwsGgPiwYAAAAAAACAswJgKnqf3tzV6W20X+JB76dr5mfIZpoCoPsAeqPz6aeETheiDyUC+JCumZ8hm6kXAO8NBAAAAAAAoFQAfdG7EgFk1+oDoLuHOhI9jB6covvRVokAttI1TzNbtsMIAMUBPKnRXwOfAOD/AQAAAAAAACj04si6APDiyBMOejh6Fs3naqX/pqkLgPW0U37HbOdhAI7eoNXUbwZNAuC7gQAAAAAADQYw3mAA440BkD7svYlWotepV9FmgwFspnvQuR8r6R5N1hHAfIMPumjzdQQw52BP3RwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADA2QQwHe1E36JtHdu3dI+mfTVMAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAAV7DcOsgfgT8DmTAAAAABJRU5ErkJggg==",k3e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxOTozNC0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzM6MTEtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzM6MTEtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjJkMTY5MDdlLWQyY2EtZDA0Mi05MWRjLTliZTMyYzYyYjlmOSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDowMzZkNWExYy1jOTYwLTAxNDktODlkMC00NzQ0NDMwM2QyNWQiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowMzZkNWExYy1jOTYwLTAxNDktODlkMC00NzQ0NDMwM2QyNWQiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjAzNmQ1YTFjLWM5NjAtMDE0OS04OWQwLTQ3NDQ0MzAzZDI1ZCIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxOTozNC0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo2N2JiZmQ0OC0yMGMzLTI0NDktODQyNS1kNWJmOTBlNzMwYjYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6MTQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MmQxNjkwN2UtZDJjYS1kMDQyLTkxZGMtOWJlMzJjNjJiOWY5IiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMzOjExLTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Q6I0lAAAAs1JREFUeNrt3TtrFFEYgOFE2HjFXgv9AyIYsbATMaAWQtqAYBPQ0ibCgoSA/yGbwsJ/o6Ag3gMWEkurTeGlcfwGzoIs7LKT3TXOOU/xFlnYkNnvIRNOZs4sVFW1oHLzIQDgQwBAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAiAiVt91l2OXkRVi3oTXQVg+uHfjX60bPiDfkUPADj48C+2ePh/dx2AgwF4ncHw695HHQCaA6gy6hYAZQPYAqBsANsAlA1gBwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAogDE14tRt359RL3ocbQSLQGQH4Aj0bsJ31tfF3EDgPwAvGzw/t/ROgDlAhhcY7gMQLkABpeXnQSgXAB1mwCUDeAjAGUD6ANQNoB9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOCQ6wFQNoAnQ8fWiXYBKAfAnaFjOxXtATAewIdMhv85Ojp0bGfqq3sBGA/gcrodKrt9guO11Sm+XxkA0gd1P90Y2dbhb4w4rm8ATI5gpYVbx+8On/eHHoJRAdAMwVJ9j3zaNKE3ZmOFw6z+uTaj29HxEcdxLvoKQIHVd/XW9/XN4LcLAC0c/vno04xOLwC0bPj3oi8z/PsCgIYDWExLr/+iTlrkORutTbHYA8AMAXTTuvu8e5XO8XtTLPIAMAcATzNbVgagIYAdAAAAAAAAAAAAAADKA7CdGYA+AM0AbGUG4C0AzQDczAzABgDNAHTSHrs5DL9ebTwGQHME1zIY/vfoQjG7hc8BwXr0s8XDXyvqeQFzQnClhZeXPY8uFffEkDkiOB09ShDq/9rt/4f10/n+YXSiyGcGqfCnhgkAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAAaBp+gMB5Yr6zMTlPAAAAABJRU5ErkJggg==",H3e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxOTo1Ny0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MjYtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MjYtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmFmYmE3YzFhLWI0MTMtMGQ0MS05YmRkLTE2ZGY2MTllOTgyMSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo5MTFjMjQ0NC01M2M4LWI1NDgtYmYwZi03M2VhOGZlOTVmM2UiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo5MTFjMjQ0NC01M2M4LWI1NDgtYmYwZi03M2VhOGZlOTVmM2UiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjkxMWMyNDQ0LTUzYzgtYjU0OC1iZjBmLTczZWE4ZmU5NWYzZSIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxOTo1Ny0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpmNjZhMzQ1Ni02ODczLWQ5NDYtOTRkMy1mZTYwZjQ5NzliNjYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6NDQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6YWZiYTdjMWEtYjQxMy0wZDQxLTliZGQtMTZkZjYxOWU5ODIxIiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjI2LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+F7DBkwAABCVJREFUeNrt3TtMFEEYwHHuAiYkNjRg74mJpSYUkCiGAhKxsLKXggQ6yi2wQUh8RMCGRJulEgotjgLwVaCVDYYeHzQaKU5FCRo4vwnfRdQgHvu4mZ1/8W/Iec7c/u7gdmd368rlch35Gy8CAHgRAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAJLpUhjkpW5pQfoolaRPjlXSsZs59Jg5AeDgDZ+T2qRFaUcqZyQzl0c6txwA9n/X9+m7ppzR1nWOeQD8DaBD+pzhjV/JzLEDAL9v/JPSmgcbv5KZaysAfv3ev+PRxq80acPfAzYAKEgrHgIwcy4AIAwGpS8eAjBzHgBAGEx7uPErhQAIg6LHAIoACIM5jwHMAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIuA3pjbYBgOwDMOvyNqUZ6azUuGcMjfqz+/qYHQBkC8BXaUI6/p/rE8b13wAgAwB+SOel+irGVC91St8B4DYAs8K4J8LYehJepQyAhAEMVfPO3+eTYAgAbgJYinGMSwBwC8A36VyMY+zU5wSAIwCWpeYYx9gsvQKAOwAe7P2eH8MYzX6ChwBwB8DtOE+60PMWxwHgDoCRBMY5AgB3AIzHeQaufgJMAIC/AQDg8beAZQC4A2Argf0AWwBwa0/gc+lIDONr0OdiT6CjxwJyEcaW41iA2wDeS70RxnZBnwMADq8HMOfhXzzEuHpTuG4BAFJaEWQO5IxKp/61f0C/75vHXEvo4A8Aarwm8J00K13WpV9HtYL+bFYfw5pAT5aFb2osC+e8AABkFcBOxADgGIBt6YU0pUfwhqWrh2xYn2NKn3MbAHYDeCId0713ed2RE0d5fc4W6TEA7APwVuqPsgK4ypXC/XpKGQAsAPBB6qrBuLti2EsIgIgAzFk/fTUce5+OAQA1AjCTxsf+Ab8OZgBQGwDmtiynLRj/mQj3OQBABAAv41z1E2H8LToWAKQMwOy3b7Bg/A06FgCkDOCmRbe7uQWA9AGMWgRgFADpAxizCMAYAAAAAAAAgL8BAJAagOsWAbgBgPQBPJWaLBh/k/QMAOkDMIsz7lkw/rsRFooAIIbDweY27avS65Rb1f+bw8EsCgUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcCCAoscAigAIg2mPAYQACIPBFC7GZGNmzgMA2L0+z4qHAMycCwDYPf9+0kMAk3He08BZAIqgVVrzaOObuZ6w4bW3AoAiaI9wkqVLmTm22/K62wTA/Cq4kvCNGmvdul5TIA+A/RG0SQspXqwxrYtULurccja95lYB+OOSrd3SvH4ilPR6AC5V0rHP6y1o8za+1lYCIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAFXRT5xealqlzx1wAAAAAElFTkSuQmCC",Q3e="_InformationContainerPos_1m76y_2",z3e="_scrollContainer_1m76y_15",G3e="_centerAlign_1m76y_25",V3e="_traitInfoTitle_1m76y_28",j3e="_dropdownFlex_1m76y_38",W3e="_checkboxFlex_1m76y_44",K3e="_simpleFlex_1m76y_49",X3e="_traitInfoText_1m76y_55",Y3e="_dropdownBase_1m76y_64",$3e="_dropdownControl_1m76y_74",Z3e="_dropdownControlSmall_1m76y_80",J3e="_flexSelect_1m76y_106",q3e="_checked_1m76y_163",eke="_checkmark_1m76y_167",tke="_checkboxHolder_1m76y_180",nke="_actionButton_1m76y_189",rke="_tabHolder_1m76y_209",ike="_tabButton_1m76y_215",ske="_tabButtonSelected_1m76y_235",Ke={InformationContainerPos:Q3e,scrollContainer:z3e,centerAlign:G3e,traitInfoTitle:V3e,dropdownFlex:j3e,checkboxFlex:W3e,simpleFlex:K3e,traitInfoText:X3e,dropdownBase:Y3e,dropdownControl:$3e,dropdownControlSmall:Z3e,"input-box":"_input-box_1m76y_87",flexSelect:J3e,"arrow-button":"_arrow-button_1m76y_114","left-button":"_left-button_1m76y_130","right-button":"_right-button_1m76y_137","anim-button":"_anim-button_1m76y_144","custom-checkbox":"_custom-checkbox_1m76y_149","checkbox-container":"_checkbox-container_1m76y_154",checked:q3e,checkmark:eke,checkboxHolder:tke,actionButton:nke,tabHolder:rke,tabButton:ike,tabButtonSelected:ske},oke="_slider_1y6nx_1",ake="_infoContainer_1y6nx_13",jy={"slider-container":"_slider-container_1y6nx_1",slider:oke,infoContainer:ake,"input-box":"_input-box_1y6nx_18"};function Gh({title:n,value:e,min:t,max:r,onChange:i,step:s,stepBox:o}){return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:jy.infoContainer,children:[n,o&&k.jsx("input",{type:"number",min:"0",max:"100",value:e,onChange:i,className:jy["input-box"],step:o})]}),k.jsx("div",{className:jy["slider-container"],children:k.jsx("input",{type:"range",min:t,max:r,value:e,onChange:i,className:jy.slider,step:s})})]})}function lke({selectedTrait:n,selectedVRM:e}){const{animationManager:t,characterManager:r}=be.useContext(sr),[i,s]=be.useState(0),[o,a]=be.useState(0),[l,c]=be.useState(0);be.useEffect(()=>{var d,m,g;e!=null&&(c((d=e.data)==null?void 0:d.cullingLayer),s(((m=e.data)==null?void 0:m.cullingDistance[0])||0),a(((g=e.data)==null?void 0:g.cullingDistance[1])||0))},[e]);const A=d=>{s(d.target.value),e!=null&&e.data&&(e.data.cullingDistance[0]=d.target.value)},u=d=>{a(d.target.value),e!=null&&e.data&&(e.data.cullingDistance[1]=d.target.value)},f=d=>{e!=null&&e.data&&(c(d.target.value),e.data.cullingLayer=d.target.value)},h=()=>{r.updateCullHiddenMeshes()};return k.jsx("div",{children:k.jsxs("div",{className:Ke.InformationContainerPos,children:[k.jsx(il,{title:"Trait Information",width:180,right:20}),k.jsx("div",{className:Ke.scrollContainer,children:n!=null?k.jsxs(k.Fragment,{children:[k.jsx("div",{className:Ke.traitInfoTitle,children:"Trait ID"}),k.jsx("div",{className:Ke.traitInfoText,children:n==null?void 0:n.id}),k.jsx("div",{className:Ke.traitInfoTitle,children:"Trait Name"}),k.jsx("div",{className:Ke.traitInfoText,children:n==null?void 0:n.name}),k.jsx("div",{className:Ke.traitInfoTitle,children:"Description"}),k.jsx("div",{className:Ke.traitInfoText,children:(n==null?void 0:n.description)||"A nice "+(n==null?void 0:n.name)}),k.jsx("div",{className:Ke.traitInfoTitle,children:"Culling Options"}),k.jsx("br",{}),k.jsxs("div",{className:Ke.traitInfoText,children:["Culling Layer",k.jsx("input",{type:"number",min:"0",max:"100",value:l,onChange:f,className:Ke["input-box"],step:1}),k.jsx("br",{}),k.jsx("br",{}),k.jsx(Gh,{title:"Out Distance",value:i,onChange:A,min:0,max:1,step:.001,stepBox:.01}),k.jsx("br",{}),k.jsx(Gh,{title:"In Distance",value:o,onChange:u,min:0,max:1,step:.001,stepBox:.01}),k.jsx("div",{className:Ke.actionButton,onClick:h,children:k.jsx("div",{children:"Update Culling "})})]})]}):k.jsx(k.Fragment,{children:k.jsx("div",{className:Ke.traitInfoTitle,children:"No Trait Selected"})})})]})})}var Hj={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var e=s(be),t=r(xV);function r(b){return b&&b.__esModule?b:{default:b}}function i(){if(typeof WeakMap!="function")return null;var b=new WeakMap;return i=function(){return b},b}function s(b){if(b&&b.__esModule)return b;if(b===null||o(b)!=="object"&&typeof b!="function")return{default:b};var B=i();if(B&&B.has(b))return B.get(b);var M={},I=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var S in b)if(Object.prototype.hasOwnProperty.call(b,S)){var L=I?Object.getOwnPropertyDescriptor(b,S):null;L&&(L.get||L.set)?Object.defineProperty(M,S,L):M[S]=b[S]}return M.default=b,B&&B.set(b,M),M}function o(b){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?o=function(M){return typeof M}:o=function(M){return M&&typeof Symbol=="function"&&M.constructor===Symbol&&M!==Symbol.prototype?"symbol":typeof M},o(b)}function a(){return a=Object.assign||function(b){for(var B=1;B"u"?w:M.placeholder,value:""},isOpen:!1},I.dropdownRef=(0,e.createRef)(),I.mounted=!0,I.handleDocumentClick=I.handleDocumentClick.bind(g(I)),I.fireChangeEvent=I.fireChangeEvent.bind(g(I)),I}return h(B,[{key:"componentDidUpdate",value:function(I){if(this.props.value!==I.value)if(this.props.value){var S=this.parseValue(this.props.value,this.props.options);S!==this.state.selected&&this.setState({selected:S})}else this.setState({selected:{label:typeof this.props.placeholder>"u"?w:this.props.placeholder,value:""}})}},{key:"componentDidMount",value:function(){document.addEventListener("click",this.handleDocumentClick,!1),document.addEventListener("touchend",this.handleDocumentClick,!1)}},{key:"componentWillUnmount",value:function(){this.mounted=!1,document.removeEventListener("click",this.handleDocumentClick,!1),document.removeEventListener("touchend",this.handleDocumentClick,!1)}},{key:"handleMouseDown",value:function(I){this.props.onFocus&&typeof this.props.onFocus=="function"&&this.props.onFocus(this.state.isOpen),!(I.type==="mousedown"&&I.button!==0)&&(I.stopPropagation(),I.preventDefault(),this.props.disabled||this.setState({isOpen:!this.state.isOpen}))}},{key:"parseValue",value:function(I,S){var L;if(typeof I=="string")for(var D=0,T=S.length;D"u"&&(L=I.label||I);var D=I.label||I.value||I,T=L===this.state.selected.value||L===this.state.selected,y=(S={},A(S,"".concat(this.props.baseClassName,"-option"),!0),A(S,I.className,!!I.className),A(S,"is-selected",T),S),E=(0,t.default)(y),R=Object.keys(I.data||{}).reduce(function(F,O){return c({},F,A({},"data-".concat(O),I.data[O]))},{});return e.default.createElement("div",a({key:L,className:E,onMouseDown:this.setValue.bind(this,L,D),onClick:this.setValue.bind(this,L,D),role:"option","aria-selected":T?"true":"false"},R),D)}},{key:"buildMenu",value:function(){var I=this,S=this.props,L=S.options,D=S.baseClassName,T=L.map(function(y){if(y.type==="group"){var E=e.default.createElement("div",{className:"".concat(D,"-title")},y.name),R=y.items.map(function(F){return I.renderOption(F)});return e.default.createElement("div",{className:"".concat(D,"-group"),key:y.name,role:"listbox",tabIndex:"-1"},E,R)}else return I.renderOption(y)});return T.length?T:e.default.createElement("div",{className:"".concat(D,"-noresults")},"No options found")}},{key:"handleDocumentClick",value:function(I){this.mounted&&(this.dropdownRef.current.contains(I.target)||this.state.isOpen&&this.setState({isOpen:!1}))}},{key:"isValueSelected",value:function(){return typeof this.state.selected=="string"||this.state.selected.value!==""}},{key:"render",value:function(){var I,S,L,D,T,y=this.props,E=y.baseClassName,R=y.controlClassName,F=y.placeholderClassName,O=y.menuClassName,z=y.arrowClassName,j=y.arrowClosed,H=y.arrowOpen,C=y.className,W=this.props.disabled?"Dropdown-disabled":"",ee=typeof this.state.selected=="string"?this.state.selected:this.state.selected.label,P=(0,t.default)((I={},A(I,"".concat(E,"-root"),!0),A(I,C,!!C),A(I,"is-open",this.state.isOpen),I)),re=(0,t.default)((S={},A(S,"".concat(E,"-control"),!0),A(S,R,!!R),A(S,W,!!W),S)),ue=(0,t.default)((L={},A(L,"".concat(E,"-placeholder"),!0),A(L,F,!!F),A(L,"is-selected",this.isValueSelected()),L)),le=(0,t.default)((D={},A(D,"".concat(E,"-menu"),!0),A(D,O,!!O),D)),me=(0,t.default)((T={},A(T,"".concat(E,"-arrow"),!0),A(T,z,!!z),T)),ie=e.default.createElement("div",{className:ue},ee),ge=this.state.isOpen?e.default.createElement("div",{className:le,"aria-expanded":"true"},this.buildMenu()):null;return e.default.createElement("div",{ref:this.dropdownRef,className:P},e.default.createElement("div",{className:re,onMouseDown:this.handleMouseDown.bind(this),onTouchEnd:this.handleMouseDown.bind(this),"aria-haspopup":"listbox"},ie,e.default.createElement("div",{className:"".concat(E,"-arrow-wrapper")},H&&j?this.state.isOpen?H:j:e.default.createElement("span",{className:me}))),ge)}}]),B}(e.Component);_.defaultProps={baseClassName:"Dropdown"};var x=_;n.default=x})(Hj);const kc=oc(Hj);function cke({selectedTrait:n,selectedVRM:e}){const{manifest:t,loraDataGenerator:r,sceneElements:i}=J.useContext(sr),[s,o]=be.useState([]),[a,l]=be.useState(null),c=u=>{(t==null?void 0:t.loras)!=null&&(l(t.loras[u.value]),console.log(t.loras[u.value]))},A=async()=>{const u=i.parent;u.remove(i),await r.createLoraData(a),u.add(i)};return be.useEffect(()=>{if((t==null?void 0:t.loras)!=null){const u=t.loras.map((f,h)=>({value:h,label:f.name,description:f.description,manifest:f.manifest}));o(u)}},[t]),k.jsx("div",{children:k.jsxs("div",{className:Ke.InformationContainerPos,children:[k.jsx(il,{title:"Lora Creation",width:180,right:20}),k.jsxs("div",{className:Ke.scrollContainer,children:[k.jsx("div",{className:Ke.traitInfoTitle,children:"Lora Manifests"}),k.jsx(kc,{className:Ke.dropdownControl,options:s,onChange:c,placeholder:"Select an option"}),";",k.jsx("div",{className:Ke.traitInfoText,children:(a==null?void 0:a.description)||""}),a!=null&&k.jsx("div",{className:Ke.actionButton,onClick:A,children:k.jsx("div",{children:" Create Lora Data "})})]})]})})}function Ake({selectedTrait:n,selectedVRM:e}){const{manifest:t,spriteAtlasGenerator:r,sceneElements:i}=J.useContext(sr),[s,o]=be.useState([]),[a,l]=be.useState(""),[c,A]=be.useState(null),u=h=>{(t==null?void 0:t.sprites)!=null&&(l(t.sprites[h.value].description),A(t.sprites[h.value]))},f=async()=>{const h=i.parent;h.remove(i),await r.createSpriteAtlas(c),h.add(i)};return be.useEffect(()=>{if((t==null?void 0:t.sprites)!=null){const h=t.sprites.map((d,m)=>({value:m,label:d.name,description:d.description,manifest:d.manifest}));o(h)}},[t]),k.jsx("div",{children:k.jsxs("div",{className:Ke.InformationContainerPos,children:[k.jsx(il,{title:"Sprite Creation",width:180,right:20}),k.jsxs("div",{className:Ke.scrollContainer,children:[k.jsx("div",{className:Ke.traitInfoTitle,children:"Sprite Manifests"}),k.jsx(kc,{className:Ke.dropdownControl,options:s,onChange:u,placeholder:"Select an option"}),";",k.jsx("div",{className:Ke.traitInfoText,children:a||""}),c!=null&&k.jsx("div",{className:Ke.actionButton,onClick:f,children:k.jsx("div",{children:" Create Sprite Data "})})]})]})})}const h4=4096;function uke({selectedTrait:n,traitGroupName:e}){const{manifest:t,thumbnailsGenerator:r,sceneElements:i,characterManager:s}=J.useContext(sr),[o,a]=be.useState([]),[l,c]=be.useState(""),[A,u]=be.useState(""),[f,h]=be.useState(""),[d,m]=be.useState(!1),[g,p]=be.useState(512),[v,w]=be.useState(512),[_,x]=be.useState(.1),[b,B]=be.useState(.1),[M,I]=be.useState("center"),[S,L]=be.useState("center"),[D,T]=be.useState("center"),[y,E]=be.useState("head"),[R,F]=be.useState("chest"),[O,z]=be.useState(!0),[j,H]=be.useState(!1),C=[{label:"center"},{label:"left"},{label:"right"}],W=[{label:"center"},{label:"top"},{label:"bottom"}],ee=[{label:"center"},{label:"front"},{label:"back"}],P=[{label:"head"},{label:"neck"},{label:"chest"},{label:"spine"},{label:"hips"},{label:"upperLeg"},{label:"lowerLeg"},{label:"foot"}],re=Ae=>{(t==null?void 0:t.thumbnails)!=null&&(c(t.thumbnails[Ae.value].description),h(t.thumbnails[Ae.value].manifest),u(t.thumbnails[Ae.value].name))},ue=(Ae,Z,q,he)=>isNaN(Ae)?he:Ae>q?q:Ae{const Z=parseInt(Ae.target.value);p(ue(Z,1,h4,512))},me=Ae=>{const Z=parseInt(Ae.target.value);w(ue(Z,1,h4,512))},ie=Ae=>{const Z=parseFloat(Ae.target.value);x(ue(Z,0,1,.1))},ge=Ae=>{const Z=parseFloat(Ae.target.value);B(ue(Z,0,1,.1))},_e=Ae=>{m(Ae)},se=async()=>{const Ae=i.parent;Ae.remove(i),await r.createThumbnails(t.thumbnails[0]),Ae.add(i)},Q=(Ae=!0)=>({topFrameOffset:b,bottomFrameOffset:_,thumbnailsWidth:g,thumbnailsHeight:v,backgroundColor:[0,0,0,0],thumbnailsCollection:[{traitGroup:e,cameraPosition:S+"-"+D+"-"+M,topBoneName:y==="upperLeg"||y==="lowerLeg"||y==="foot"?"left"+y[0].toUpperCase()+y.slice(1):y,topBoneMaxVertex:O,bottomBoneName:R==="upperLeg"||R==="lowerLeg"||y==="foot"?"left"+R[0].toUpperCase()+R.slice(1):R,bottomBoneMaxVertex:j,saveOnlyIDs:Ae?null:n.id}]}),fe=async(Ae=!1)=>{s.storeCurrentAvatar();const Z=i.parent;Z.remove(i),Ae?await r.createThumbnailsWithObjectData(Q(),!1,null,e+"_thumbnails"):await r.createThumbnailsWithObjectData(Q(!1),!1),Z.add(i),s.loadStoredAvatar()};return be.useEffect(()=>{if((t==null?void 0:t.thumbnails)!=null){const Ae=t.thumbnails.map((Z,q)=>({value:q,label:Z.name,description:Z.description,manifest:Z.manifest}));a(Ae)}},[t]),k.jsx("div",{children:k.jsxs("div",{className:Ke.InformationContainerPos,children:[k.jsx(il,{title:"Thumbnail Creation",width:180,right:20}),k.jsxs("div",{className:Ke.scrollContainer,children:[k.jsxs("div",{className:Ke.tabHolder,children:[k.jsx("div",{className:Ke.tabButton+(d?"":" "+Ke.tabButtonSelected),onClick:()=>{_e(!1)},children:k.jsxs("div",{children:[" ","Custom"," "]})}),k.jsx("div",{className:Ke.tabButton+(d?" "+Ke.tabButtonSelected:""),onClick:()=>{_e(!0)},children:k.jsxs("div",{children:[" ","Manifest"," "]})})]}),k.jsx("br",{}),d?k.jsxs(k.Fragment,{children:[k.jsx("div",{className:Ke.traitInfoTitle+" "+Ke.centerAlign,children:"Thumbnail Manifests"}),k.jsx(kc,{className:Ke.dropdownControl,options:o,value:A,onChange:re,placeholder:"Select an option"}),";",k.jsx("div",{className:Ke.traitInfoText,children:l||""}),f!=""&&k.jsx("div",{className:Ke.actionButton,onClick:se,children:k.jsx("div",{children:" Create Thumbnails "})})]}):k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:Ke.traitInfoText,children:[k.jsx("div",{className:Ke.traitInfoTitle+" "+Ke.centerAlign,style:{margin:"10px 0px 10px"},children:"Resolution"}),"Width ",k.jsx("input",{value:g,className:Ke["input-box"],step:1,onChange:Ae=>{p(Ae.target.value)},onBlur:le}),k.jsx("br",{}),"Height ",k.jsx("input",{value:v,className:Ke["input-box"],step:1,onChange:Ae=>{w(Ae.target.value)},onBlur:me}),k.jsx("br",{}),"Top Spacing ",k.jsx("input",{value:_,className:Ke["input-box"],step:.1,onChange:Ae=>{x(Ae.target.value)},onBlur:ie}),k.jsx("br",{}),"Bottom Spacing ",k.jsx("input",{value:b,className:Ke["input-box"],step:.1,onChange:Ae=>{B(Ae.target.value)},onBlur:ge}),k.jsx("br",{}),k.jsx("div",{className:Ke.traitInfoTitle+" "+Ke.centerAlign,style:{margin:"20px"},children:"Camera Position"})]}),k.jsxs("div",{className:Ke.dropdownFlex,children:[k.jsx("div",{className:Ke.traitInfoTitle,style:{margin:"0px"},children:"X"}),k.jsx(kc,{className:Ke.dropdownControlSmall,options:C,onChange:Ae=>{L(Ae.label)},value:S})]}),k.jsxs("div",{className:Ke.dropdownFlex,children:[k.jsx("div",{className:Ke.traitInfoTitle,style:{margin:"0px"},children:"Y"}),k.jsx(kc,{className:Ke.dropdownControlSmall,options:W,onChange:Ae=>{T(Ae.label)},value:D})]}),k.jsxs("div",{className:Ke.dropdownFlex,children:[k.jsx("div",{className:Ke.traitInfoTitle,style:{margin:"0px"},children:"Z"}),k.jsx(kc,{className:Ke.dropdownControlSmall,options:ee,onChange:Ae=>{I(Ae.label)},value:M})]}),k.jsx("div",{className:Ke.traitInfoTitle+" "+Ke.centerAlign,style:{margin:"30px 0px 30px"},children:"Target Bones"}),k.jsxs("div",{className:Ke.dropdownFlex,style:{justifyContent:"space-between"},children:[k.jsx("div",{className:Ke.traitInfoTitle,style:{margin:"0px"},children:"Top"}),k.jsx(kc,{className:Ke.dropdownControlSmall,options:P,onChange:Ae=>{E(Ae.label)},value:y})]}),k.jsxs("div",{className:Ke.dropdownFlex,style:{justifyContent:"space-between"},children:[k.jsx("div",{className:Ke.traitInfoTitle,style:{margin:"0px"},children:"Bottom"}),k.jsx(kc,{className:Ke.dropdownControlSmall,options:P,onChange:Ae=>{F(Ae.label)},value:R})]}),k.jsxs("div",{style:{textAlign:"left"},children:[k.jsxs("div",{className:Ke.checkboxFlex,style:{marginTop:"20px"},children:[k.jsx("input",{type:"checkbox",checked:O,onChange:Ae=>{z(Ae.target.checked)}}),k.jsx("div",{className:Ke.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Top bone ${O?"uses Top":"uses Low"} Vertex`})]}),k.jsxs("div",{className:Ke.checkboxFlex,style:{marginTop:"10px"},children:[k.jsx("input",{type:"checkbox",checked:j,onChange:Ae=>{H(Ae.target.checked)}}),k.jsx("div",{className:Ke.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Bottom bone ${j?"uses Top":"uses Low"} Vertex`})]})]}),e==""?k.jsx("div",{className:Ke.traitInfoText+" "+Ke.centerAlign,style:{marginTop:"40px"},children:"Please choose a trait category in the left side menu."}):k.jsxs(k.Fragment,{children:[k.jsx("div",{className:Ke.traitInfoTitle+" "+Ke.centerAlign,style:{marginTop:"20px"},children:"Generate"}),k.jsx("div",{className:Ke.traitInfoText+" "+Ke.centerAlign,style:{margin:"0px auto 20px"},children:"( "+e+" )"}),k.jsxs("div",{className:Ke.simpleFlex,style:{marginTop:"0px"},children:[k.jsx("div",{className:Ke.actionButton,style:{margin:"0px"},onClick:()=>{fe(!1)},children:k.jsx("div",{children:" Current "})}),k.jsx("div",{className:Ke.actionButton,style:{margin:"0px"},onClick:()=>{fe(!0)},children:k.jsx("div",{children:" All "})})]})]})]})]})]})})}function fke({selectedTrait:n,selectedVRM:e,traitGroupName:t}){const[r,i]=J.useState(""),s=o=>{o!=r?i(o):i("")};return k.jsxs("div",{children:[r=="Information"&&k.jsx(lke,{selectedTrait:n,selectedVRM:e}),r=="LoraCreation"&&k.jsx(cke,{selectedTrait:n,selectedVRM:e}),r=="SpriteCreation"&&k.jsx(Ake,{selectedTrait:n,selectedVRM:e}),r=="ThumbnailCreation"&&k.jsx(uke,{selectedTrait:n,traitGroupName:t}),k.jsxs("div",{className:yS.InformationContainerPos,children:[k.jsx(il,{title:"Tools",width:90,right:0}),k.jsx("div",{className:yS.scrollContainer,children:k.jsxs("div",{className:yS.optionsContainer,children:[k.jsx("div",{onClick:()=>{s("Information")},children:k.jsx(Qa,{size:56,icon:N3e,rarity:r=="Information"?"mythic":"none"})},"Information"),k.jsx("div",{onClick:()=>{s("LoraCreation")},children:k.jsx(Qa,{size:56,icon:k3e,rarity:r=="LoraCreation"?"mythic":"none"})},"LoraCreation"),k.jsx("div",{onClick:()=>{s("SpriteCreation")},children:k.jsx(Qa,{size:56,icon:O3e,rarity:r=="SpriteCreation"?"mythic":"none"})},"SpriteCreation"),k.jsx("div",{onClick:()=>{s("ThumbnailCreation")},children:k.jsx(Qa,{size:56,icon:H3e,rarity:r=="ThumbnailCreation"?"mythic":"none"})},"ThumbnailCreation")]})})]})]})}const ji={TRAIT:0,BLEND_SHAPE:1,DECAL:2};function hke(){var me;const{isLoading:n,setViewMode:e,setIsLoading:t}=J.useContext(us),{toggleDebugMode:r,characterManager:i,animationManager:s,moveCamera:o}=J.useContext(sr),[a,l]=J.useState(ji.TRAIT),{playSound:c}=J.useContext(Co),{isMute:A}=J.useContext(Mo),{t:u}=be.useContext(Aa),f=()=>{!A&&c("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),e(wt.CREATE),r(!1)},[h,d]=J.useState(null),[m,g]=J.useState(null),[p,v]=J.useState(null),[w,_]=J.useState(null),[x,b]=J.useState({}),[B,M]=J.useState(null),[I,S]=J.useState(""),[L,D]=J.useState(!1),[T,y]=J.useState({background:"#ffffff"}),E=()=>{!A&&c("backNextButton"),e(wt.SAVE),r(!1)},R=()=>{t(!0),d(null),i.loadRandomTraits().then(()=>{console.log("success"),p&&p.trait!=""&&_(i.getCurrentTraitData(p.trait)),t(!1)}).catch(ie=>{t(!1),console.error("Error loading random traits:",ie.message)})},F=ie=>{y({background:ie.hex})},O=ie=>{y({background:ie.hex}),i.setTraitColor(p==null?void 0:p.trait,ie.hex)},z=async ie=>{const ge=Kl(ie.name),_e=URL.createObjectURL(ie);await s.loadAnimation(_e,!1,0,!0,"",ge),S(s.getCurrentAnimationName())},j=ie=>{if(D(!1),p&&p.trait!=""){t(!0);const ge=URL.createObjectURL(ie);i.loadCustomTexture(p.trait,ge).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},H=ie=>{if(D(!1),p&&p.trait!=""){t(!0);const ge=URL.createObjectURL(ie);i.loadCustomTrait(p.trait,ge).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},C=ie=>{var ge;if(ie.id===(w==null?void 0:w.id)){((ge=ie.blendshapeTraits)==null?void 0:ge.length)>0&&l(ji.BLEND_SHAPE);return}D(!1),t(!0),i.loadTrait(ie.traitGroup.trait,ie.id).then(()=>{var _e;if(t(!1),((_e=ie.blendshapeTraits)==null?void 0:_e.length)>0){const se=i.getCurrentBlendShapeTraitData(ie.traitGroup.trait);b(Object.entries(se).reduce((Q,[fe,Ae])=>(Q[fe]=Ae.id,Q),{})),l(ji.BLEND_SHAPE)}_(ie)})},W=ie=>{D(!1),i.removeTrait(ie),_(null)},ee=ie=>{D(!1),t(!0),i.loadRandomTrait(ie).then(()=>{t(!1),_(i.getCurrentTraitData(ie))})},P=ie=>{D(!1);const ge=Array.from(ie),_e=[],se=Q=>new Promise((fe,Ae)=>{var Z;if(Q&&Q.name.toLowerCase().endsWith(".json")){const q=new FileReader,he=`${(Z=i.manifestData)==null?void 0:Z.getAssetsDirectory()}/anata/_thumbnails/t_${Q.name.split("_")[0]}.jpg`;console.log(he),q.onload=function(X){try{const G=JSON.parse(X.target.result);G.thumb=he,_e.push(G),fe()}catch(G){console.error("Error parsing the JSON file:",G),Ae(G)}},q.readAsText(Q)}});Promise.all(ge.map(se)).then(()=>{_e.length>0&&(d(_e),t(!0),i.loadTraitsFromNFTObject(_e[0]).then(()=>{t(!1)}))}).catch(Q=>{console.error("Error processing files:",Q)})},re=async ie=>{const ge=ie[0];ge&&ge.name.toLowerCase().endsWith(".fbx")&&z(ge),ge&&(ge.name.toLowerCase().endsWith(".png")||ge.name.toLowerCase().endsWith(".jpg"))&&j(ge),ge&&ge.name.toLowerCase().endsWith(".vrm")&&H(ge),ge&&ge.name.toLowerCase().endsWith(".json")&&P(ie)},ue=ie=>{if(!A&&c("optionClick"),D(!1),(p==null?void 0:p.trait)!==ie.trait){l(ji.TRAIT),g(i.getTraits(ie.trait)),v(ie);const ge=i.getCurrentTraitData(ie.trait),_e=i.getCurrentBlendShapeTraitData(ie.trait);_(ge),b(Object.entries(_e).reduce((se,[Q,fe])=>(se[Q]=fe.id,se),{})),M(i.getCurrentTraitVRM(ie.trait)),o({targetY:ie.cameraTarget.height,distance:ie.cameraTarget.distance})}else g(null),v(null),_(null),b({}),o({targetY:.8,distance:3.2})},le=()=>{D(!1);var ie=document.createElement("input");if(ie.type="file",ie.accept=".vrm",!p)return console.error("Please select a trait group first");ie.onchange=ge=>{var _e=ge.target.files[0];if(_e.name.endsWith(".vrm")){const se=URL.createObjectURL(_e);t(!0),i.loadCustomTrait(p.trait,se).then(()=>{t(!1)})}},ie.click()};return k.jsxs("div",{className:jt.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:u("pageTitles.chooseAppearance")}),k.jsx(S0,{onFilesDrop:re}),k.jsxs("div",{className:jt.sideMenu,children:[k.jsx(il,{title:"Appearance",left:20}),k.jsx("div",{className:jt.bottomLine}),k.jsx("div",{className:jt.scrollContainer,children:k.jsx("div",{className:jt["editor-container"],children:i.getGroupTraits().map((ie,ge)=>k.jsxs("div",{className:jt.editorButton,onClick:()=>{ue(ie)},children:[k.jsx(Qa,{size:56,icon:ie.fullIconSvg,rarity:(p==null?void 0:p.trait)!==ie.trait?"none":"mythic"}),k.jsx("div",{className:jt.editorText,children:ie.name})]},"options_"+ge))})})]}),!!m&&p&&k.jsxs("div",{className:jt.selectorContainerPos,children:[k.jsx(il,{title:p.trait,width:130,left:20}),k.jsxs("div",{className:jt.selectorPickerTabs,children:[w&&a==ji.TRAIT&&k.jsx("div",{className:jt.selectorColorPickerButton,onClick:()=>{D(!L)},children:k.jsx("img",{className:jt.selectorColorPickerImg,src:V_e})}),p&&((me=p.getAllDecals())==null?void 0:me.length)&&k.jsx("div",{className:jt.selectorColorPickerButton,onClick:()=>a==ji.DECAL?l(ji.TRAIT):l(ji.DECAL),children:k.jsx("img",{className:jt.selectorColorPickerImg,src:g_e})})]}),a==ji.TRAIT&&!!L&&k.jsx("div",{draggable:!1,className:jt.selectorColorPickerUI,children:k.jsx(a3e,{styles:{default:{picker:{width:"200px"}}},color:T.background,onChange:F,onChangeComplete:O})}),k.jsx("div",{className:jt.bottomLine}),k.jsxs("div",{className:jt.scrollContainerOptions,children:[a==ji.TRAIT&&k.jsxs("div",{className:jt["selector-container"],children:[k.jsx("div",{className:`${jt.selectorButton}`,onClick:()=>{ee(p.trait)},children:k.jsx(Qa,{size:56,icon:G_e,rarity:"none"})},"randomize-trait"),i.isTraitGroupRequired(p.trait)?k.jsx(k.Fragment,{}):k.jsx("div",{className:`${jt.selectorButton}`,icon:ux,onClick:()=>{W(p.trait)},children:k.jsx(Qa,{size:56,icon:ux,rarity:w==null?"mythic":"none"})},"no-trait"),m.map(ie=>{let ge=ie.id===(w==null?void 0:w.id);return k.jsx("div",{className:`${jt.selectorButton}`,onClick:()=>{C(ie)},children:k.jsx(Qa,{size:56,icon:ie.fullThumbnail,rarity:ge?"mythic":"none"})},ie.id)})]}),a==ji.BLEND_SHAPE&&k.jsx(dke,{selectedTrait:w,onBack:()=>{l(ji.TRAIT)},selectedBlendShapeTrait:x,setSelectedBlendshapeTrait:b}),a==ji.DECAL&&k.jsx(z_e,{selectedTraitGroup:p,onBack:()=>{l(ji.TRAIT)}})]}),k.jsx("div",{className:jt.uploadContainer,children:k.jsx("div",{className:jt.uploadButton,onClick:le,children:k.jsx("div",{children:"Upload "})})})]}),k.jsx(y2,{jsonSelectionArray:h}),k.jsx(fke,{selectedTrait:w,selectedVRM:B,traitGroupName:(p==null?void 0:p.trait)||""}),k.jsx(D1,{loadedAnimationName:I,randomize:R}),k.jsxs("div",{className:jt.buttonContainer,children:[k.jsx(Bn,{theme:"light",text:u("callToAction.back"),size:14,className:jt.buttonLeft,onClick:f}),i.canDownload()&&k.jsx(Bn,{theme:"light",text:u("callToAction.next"),size:14,className:jt.buttonRight,onClick:E})]})]})}const dke=({selectedTrait:n,onBack:e,selectedBlendShapeTrait:t,setSelectedBlendshapeTrait:r})=>{const{characterManager:i,moveCamera:s}=J.useContext(sr),o=i.getBlendShapeGroupTraits((n==null?void 0:n.traitGroup.trait)||"",(n==null?void 0:n.id)||""),a=(c,A)=>{i.removeBlendShapeTrait(c,A.trait);const u={...t};delete u[A.trait],r(u)},l=c=>{const A=c.parentGroup;i.loadBlendShapeTrait((n==null?void 0:n.traitGroup.trait)||"",A.trait||"",(c==null?void 0:c.id)||""),s({targetY:A.cameraTarget.height,distance:A.cameraTarget.distance});const u={...t};u[A.trait||""]=c.id,r(u)};return k.jsxs("div",{className:jt["selector-container-column"],children:[k.jsx(Bn,{theme:"dark",text:"Back",size:14,className:jt.buttonLeft,onClick:e}),o&&o.length>0&&o.map(c=>k.jsxs("div",{className:jt.blendshapeGroup,children:[k.jsx("div",{children:c.name}),k.jsxs("div",{className:jt["selector-container"],children:[k.jsx(d4,{src:ux,active:!t[c.trait],blendshapeID:"cancel",select:()=>a(n.traitGroup.trait,c)},"empty"),c.collection.map(A=>{let u=A.id===t[c.trait];return k.jsx(d4,{src:A.fullThumbnail||"",active:u,blendshapeID:A.id,select:()=>l(A)},A.id)})]})]},c.trait))]})},d4=({active:n,blendshapeID:e,src:t,select:r})=>k.jsx("div",{className:`${jt.selectorButton}`,onClick:r,children:k.jsx(Qa,{size:56,icon:t||"",rarity:n?"mythic":"none"})},e),pke="_InformationContainerPos_rgqwy_1",mke="_traitInfoTitle_rgqwy_13",gke="_traitInfoText_rgqwy_21",vke="_flexSelect_rgqwy_30",yke="_scrollContainer_rgqwy_65",wke="_checked_rgqwy_90",_ke="_checkmark_rgqwy_94",xke="_checkboxHolder_rgqwy_107",bke="_buttonContainer_rgqwy_114",Eke="_buttonLeft_rgqwy_123",Bke="_buttonRight_rgqwy_127",Ske="_buttonCenter_rgqwy_131",Oi={InformationContainerPos:pke,traitInfoTitle:mke,traitInfoText:gke,flexSelect:vke,"arrow-button":"_arrow-button_rgqwy_37","left-button":"_left-button_rgqwy_51","right-button":"_right-button_rgqwy_58",scrollContainer:yke,"custom-checkbox":"_custom-checkbox_rgqwy_76","checkbox-container":"_checkbox-container_rgqwy_81",checked:wke,checkmark:_ke,checkboxHolder:xke,buttonContainer:bke,buttonLeft:Eke,buttonRight:Bke,buttonCenter:Ske},Mke="_InformationContainerPos_11mqa_2",Cke="_scrollContainer_11mqa_16",Tke="_traitInfoTitle_11mqa_28",Ike="_traitInfoText_11mqa_38",Rke="_flexSelect_11mqa_66",Uke="_checked_11mqa_124",Fke="_checkmark_11mqa_128",Pke="_checkboxHolder_11mqa_141",cr={InformationContainerPos:Mke,scrollContainer:Cke,traitInfoTitle:Tke,traitInfoText:Ike,"input-box":"_input-box_11mqa_47",flexSelect:Rke,"arrow-button":"_arrow-button_11mqa_76","left-button":"_left-button_11mqa_91","right-button":"_right-button_11mqa_98","anim-button":"_anim-button_11mqa_105","custom-checkbox":"_custom-checkbox_11mqa_110","checkbox-container":"_checkbox-container_11mqa_115",checked:Uke,checkmark:Fke,checkboxHolder:Pke};function uU({model:n,name:e,files:t,index:r,nextVrm:i,previousVrm:s}){const{characterManager:o}=J.useContext(sr),[a,l]=be.useState(0),[c,A]=be.useState(0),[u,f]=be.useState(0),[h,d]=be.useState(0),[m,g]=be.useState(0),[p,v]=be.useState(0),[w,_]=be.useState(0),[x,b]=be.useState(0),[B,M]=be.useState(0),[I,S]=be.useState(0);return be.useEffect(()=>{if(n!=null){const L=Od(n,"Mesh"),D=Od(n,"SkinnedMesh");l(L.length),A(D.length);const T=L.concat(D),{stdMats:y,stdCutoutpMats:E,stdTranspMats:R,mToonMats:F,mToonCutoutMats:O,mToonTranspMats:z}=dge(T);f(y.length),d(R.length),g(E.length),v(F.length),_(z.length),b(O.length);const{triangles:j,bones:H}=o.getBoneTriangleCount();M(j),S(H)}},[n]),n!=null?k.jsx("div",{children:k.jsxs("div",{className:cr.InformationContainerPos,children:[k.jsx(il,{title:"Model Information",width:180,right:20}),k.jsxs("div",{className:cr.scrollContainer,children:[k.jsxs("div",{className:cr.flexSelect,children:[(t==null?void 0:t.length)>1?k.jsx("div",{className:`${cr["arrow-button"]} ${cr["left-button"]}`,onClick:s}):k.jsx(k.Fragment,{}),e&&k.jsx("div",{style:{textAlign:"center"},children:k.jsx("div",{className:cr.traitInfoTitle,style:{margin:"auto",fontSize:"14px",width:"200px",textAlign:"center",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"},children:e})}),(t==null?void 0:t.length)>1?k.jsx("div",{className:`${cr["arrow-button"]} ${cr["right-button"]}`,onClick:i}):k.jsx(k.Fragment,{})]}),k.jsx("div",{className:cr.traitInfoTitle,children:"Geometry info:"}),k.jsxs("div",{className:cr.traitInfoText,children:["Meshes: ",a]}),k.jsxs("div",{className:cr.traitInfoText,children:["SkinnedMeshes: ",c]}),k.jsxs("div",{className:cr.traitInfoText,children:["Triangles: ",B]}),k.jsxs("div",{className:cr.traitInfoText,children:["Bones: ",I]}),k.jsx("div",{className:cr.traitInfoTitle,children:"Standard Material Count:"}),k.jsxs("div",{className:cr.traitInfoText,children:["opaque: ",u]}),k.jsxs("div",{className:cr.traitInfoText,children:["cutout: ",m]}),k.jsxs("div",{className:cr.traitInfoText,children:["transparent: ",h]}),k.jsx("div",{className:cr.traitInfoTitle,children:"MToon Material Count:"}),k.jsxs("div",{className:cr.traitInfoText,children:["opaque: ",p]}),k.jsxs("div",{className:cr.traitInfoText,children:["cutout: ",x]}),k.jsxs("div",{className:cr.traitInfoText,children:["transparent: ",w]})]})]})}):k.jsx(k.Fragment,{})}const Lke="_InformationContainerPos_b0msk_1",Dke="_traitInfoTitle_b0msk_13",Nke="_traitInfoText_b0msk_22",Oke="_flexSelect_b0msk_33",kke="_scrollContainer_b0msk_68",Hke="_checked_b0msk_93",Qke="_checkmark_b0msk_97",zke="_checkboxHolder_b0msk_110",gt={InformationContainerPos:Lke,traitInfoTitle:Dke,traitInfoText:Nke,flexSelect:Oke,"arrow-button":"_arrow-button_b0msk_40","left-button":"_left-button_b0msk_54","right-button":"_right-button_b0msk_61",scrollContainer:kke,"custom-checkbox":"_custom-checkbox_b0msk_79","checkbox-container":"_checkbox-container_b0msk_84",checked:Hke,checkmark:Qke,checkboxHolder:zke};function q1({showDropToDownload:n,showCreateAtlas:e,mergeMenuTitle:t}){const[r,i]=be.useState(Qe.mergeOptions_atlas_std_size||6),[s,o]=be.useState(Qe.mergeOptions_atlas_std_transp_size||6),[a,l]=be.useState(Qe.mergeOptions_atlas_mtoon_size||6),[c,A]=be.useState(Qe.mergeOptions_atlas_mtoon_transp_size||6),[u,f]=be.useState(Qe.mergeOptions_sel_option||0),[h,d]=be.useState(Qe.mergeOptions_two_sided_mat||!1),[m]=be.useState(["Merge to Standard","Merge to MToon","Keep Both"]),[g,p]=be.useState(Qe.mergeOptions_download_vrm==null?!0:Qe.mergeOptions_download_vrm),[v,w]=be.useState(Qe.mergeOptions_download_vrm_preview==null?!0:Qe.mergeOptions_download_vrm_preview),[_,x]=be.useState(Qe.mergeOptions_drop_download||!1),[b,B]=be.useState(Qe.merge_options_ktx_compression||!1),[M,I]=be.useState(Qe.mergeOptions_create_atlas==null?!0:Qe.mergeOptions_create_atlas),[S,L]=be.useState(Qe.mergeOptions_download_lora==null?!0:Qe.mergeOptions_download_lora),[D,T]=be.useState(Qe.mergeOptions_download_sprites==null?!0:Qe.mergeOptions_download_sprites),y=P=>{x(P.target.checked),Qe.mergeOptions_drop_download=P.target.checked},E=P=>{d(P.target.checked),Qe.mergeOptions_two_sided_mat=P.target.checked},R=P=>{B(P.target.checked),Qe.merge_options_ktx_compression=P.target.checked},F=P=>{I(P.target.checked),Qe.mergeOptions_create_atlas=P.target.checked},O=P=>{p(P.target.checked),Qe.mergeOptions_download_vrm=P.target.checked},z=P=>{w(P.target.checked),Qe.mergeOptions_download_vrm_preview=P.target.checked},j=P=>{L(P.target.checked),Qe.mergeOptions_download_lora=P.target.checked},H=P=>{T(P.target.checked),Qe.mergeOptions_download_sprites=P.target.checked},C=()=>{let P=u;u<=0?P=m.length-1:P-=1,f(P),Qe.mergeOptions_sel_option=P},W=()=>{let P=u;u>=m.length-1?P=0:P+=1,f(P),Qe.mergeOptions_sel_option=P},ee=async(P,re)=>{let ue=parseInt(P.target.value);ue>8?ue=8:ue<0&&(ue=0),(me=>{switch(re){case"standard opaque":i(me),Qe.mergeOptions_atlas_std_size=me;break;case"standard transparent":o(me),Qe.mergeOptions_atlas_std_transp_size=me;break;case"mtoon opaque":l(me),Qe.mergeOptions_atlas_mtoon_size=me;break;case"mtoon transparent":A(me),Qe.mergeOptions_atlas_mtoon_transp_size=me;break}})(ue)};return k.jsxs("div",{className:gt.InformationContainerPos,children:[k.jsx(il,{title:t,width:180,left:20}),k.jsxs("div",{className:gt.scrollContainer,children:[k.jsx("div",{className:gt.traitInfoTitle,children:"Download Options"}),k.jsx(k.Fragment,{children:k.jsx("div",{className:gt.traitInfoText,children:k.jsxs("div",{className:gt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:gt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:g,onChange:O}),k.jsx("div",{className:gt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download VRM"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:gt.traitInfoText,children:k.jsxs("div",{className:gt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:gt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:v,onChange:z}),k.jsx("div",{className:gt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download VRM Preview"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:gt.traitInfoText,children:k.jsxs("div",{className:gt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:gt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:S,onChange:j}),k.jsx("div",{className:gt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download Lora Data"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:gt.traitInfoText,children:k.jsxs("div",{className:gt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:gt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:D,onChange:H}),k.jsx("div",{className:gt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download Sprites Data"]})})}),g&&k.jsxs(k.Fragment,{children:[e&&k.jsx(k.Fragment,{children:k.jsx("div",{className:gt.traitInfoText,children:k.jsxs("div",{className:gt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:gt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:M,onChange:F}),k.jsx("div",{className:gt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Create Atlas"]})})}),(e==!1||M)&&k.jsxs(k.Fragment,{children:[k.jsx("br",{}),k.jsx("div",{className:gt.traitInfoTitle,children:"Merge Atlas Type"}),k.jsx("br",{}),k.jsxs("div",{className:gt.flexSelect,children:[k.jsx("div",{className:`${gt["arrow-button"]} ${gt["left-button"]}`,onClick:C}),k.jsx("div",{className:gt.traitInfoText,style:{marginBottom:"0"},children:m[u]}),k.jsx("div",{className:`${gt["arrow-button"]} ${gt["right-button"]}`,onClick:W})]}),k.jsx("br",{}),k.jsx("br",{}),(u===0||u==2)&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:gt.traitInfoTitle,children:"Standard Atlas Size"}),k.jsx("br",{}),k.jsxs("div",{className:gt.traitInfoText,children:["Opaque: ",Nn(r)+" x "+Nn(r)]}),k.jsx(Gh,{value:r,onChange:P=>ee(P,"standard opaque"),min:1,max:8,step:1}),k.jsx("br",{}),k.jsxs("div",{className:gt.traitInfoText,children:["Transparent: ",Nn(s)+" x "+Nn(s)]}),k.jsx(Gh,{value:s,onChange:P=>ee(P,"standard transparent"),min:1,max:8,step:1}),k.jsx("br",{})," ",k.jsx("br",{})]}),(u===1||u==2)&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:gt.traitInfoTitle,children:"MToon Atlas Size"}),k.jsx("br",{}),k.jsxs("div",{className:gt.traitInfoText,children:["Opaque: ",Nn(a)+" x "+Nn(a)]}),k.jsx(Gh,{value:a,onChange:P=>ee(P,"mtoon opaque"),min:1,max:8,step:1}),k.jsx("br",{}),k.jsxs("div",{className:gt.traitInfoText,children:["Transparent: ",Nn(c)+" x "+Nn(c)]}),k.jsx(Gh,{value:c,onChange:P=>ee(P,"mtoon transparent"),min:1,max:8,step:1}),k.jsx("br",{})," ",k.jsx("br",{})]}),k.jsx("div",{className:gt.traitInfoTitle,children:"Options"}),k.jsx("div",{className:gt.traitInfoText,children:k.jsxs("div",{className:gt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:gt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:h,onChange:E}),k.jsx("div",{className:gt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Two Sided Material"]})}),n&&k.jsx(k.Fragment,{children:k.jsx("div",{className:gt.traitInfoText,children:k.jsxs("div",{className:gt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:gt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:_,onChange:y}),k.jsx("div",{className:gt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Drag Drop - Download"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:gt.traitInfoText,children:k.jsxs("div",{className:gt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:gt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:b,onChange:R}),k.jsx("div",{className:gt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"KTX Compression"]})})})]})]})]})]})}function Gke(){const{isLoading:n,setViewMode:e,setIsLoading:t}=J.useContext(us),{manifest:r,toggleDebugMode:i,characterManager:s,animationManager:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:c}=J.useContext(sr),[A,u]=be.useState(null),[f,h]=be.useState(""),[d,m]=J.useState(""),{playSound:g}=J.useContext(Co),{isMute:p}=J.useContext(Mo),[v,w]=J.useState(null),_=()=>{!p&&g("backNextButton"),s.removeCurrentCharacter(),s.removeCurrentManifest(),i(!1),e(wt.LANDING)},x=()=>{const T=Qe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:Nn(Qe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Nn(Qe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Nn(Qe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Nn(Qe.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:T===0||T==2,exportMtoonAtlas:T===1||T==2,ktxCompression:Qe.merge_options_ktx_compression||!1,twoSidedMaterial:Qe.mergeOptions_two_sided_mat||!1}},b=(T,y=!1)=>{console.log(y),(async()=>{await s.loadTraitsFromNFTObject(v[T]),(Qe.mergeOptions_download_vrm==null?!0:Qe.mergeOptions_download_vrm)&&await s.downloadVRM(v[T].name,x());const F=new ep,O=c.parent;O.remove(c);const z=Qe.mergeOptions_download_lora==null?!0:Qe.mergeOptions_download_lora;if(z===!0){const H=r.loras.map(async C=>a.createLoraData(C,F));await Promise.all(H)}const j=Qe.mergeOptions_download_sprites==null?!0:Qe.mergeOptions_download_sprites;if(j===!0){const H=r.sprites.map(async C=>l.createSpriteAtlas(C,F));await Promise.all(H)}(z===!0||j===!0)&&F.saveZip(v[T].name),O.add(c),T{t(!0),b(0,!0)},{t:M}=be.useContext(Aa),I=async T=>{if(s.getCurrentCharacterModel()){const E=Kl(T.name),R=URL.createObjectURL(T);await o.loadAnimation(R,!1,0,!0,"",E),m(o.getCurrentAnimationName()),URL.revokeObjectURL(R)}else console.warn("Please load a vrm model to test animations.")},S=async T=>{const y=URL.createObjectURL(T);await s.loadOptimizerCharacter(y),URL.revokeObjectURL(y);const E=Kl(T.name);h(E),u(s.getCurrentCharacterModel())},L=T=>{const y=Array.from(T),E=[],R=F=>new Promise((O,z)=>{var j;if(F&&F.name.toLowerCase().endsWith(".json")){const H=new FileReader,C=`${(j=s.manifestData)==null?void 0:j.getAssetsDirectory()}/anata/_thumbnails/t_${F.name.split("_")[0]}.jpg`;H.onload=function(W){try{const ee=JSON.parse(W.target.result);ee.thumb=C,E.push(ee),O()}catch(ee){console.error("Error parsing the JSON file:",ee),z(ee)}},H.readAsText(F)}});Promise.all(y.map(R)).then(()=>{E.length>0&&(w(E),t(!0),s.loadTraitsFromNFTObject(E[0]).then(()=>{t(!1)}))}).catch(F=>{console.error("Error processing files:",F)})},D=async T=>{const y=T[0];console.log("anim"),y&&y.name.toLowerCase().endsWith(".fbx")&&(console.log("anim2"),I(y)),y&&y.name.toLowerCase().endsWith(".vrm")&&S(y),y&&y.name.toLowerCase().endsWith(".json")&&L(T)};return k.jsxs("div",{className:Oi.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:"Batch Download"}),k.jsx(S0,{onFilesDrop:D}),k.jsx(q1,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),k.jsx(uU,{model:A}),k.jsx(y2,{jsonSelectionArray:v}),k.jsx(D1,{loadedAnimationName:d}),k.jsxs("div",{className:Oi.buttonContainer,children:[k.jsx(Bn,{theme:"light",text:M("callToAction.back"),size:14,className:Oi.buttonLeft,onClick:_}),(v==null?void 0:v.length)==1&&k.jsx(Bn,{theme:"light",text:"Download",size:14,className:Oi.buttonRight,onClick:B}),(v==null?void 0:v.length)>1&&k.jsx(Bn,{theme:"light",text:"Download All",size:14,className:Oi.buttonRight,onClick:B})]})]})}const D0="abi/5.7.0",zt=new xe(D0),Hu={};let p4={calldata:!0,memory:!0,storage:!0},Vke={calldata:!0,memory:!0};function Wy(n,e){if(n==="bytes"||n==="string"){if(p4[e])return!0}else if(n==="address"){if(e==="payable")return!0}else if((n.indexOf("[")>=0||n==="tuple")&&Vke[e])return!0;return(p4[e]||e==="payable")&&zt.throwArgumentError("invalid modifier","name",e),!1}function jke(n,e){let t=n;function r(a){zt.throwArgumentError(`unexpected character at position ${a}`,"param",n)}n=n.replace(/\s/g," ");function i(a){let l={type:"",name:"",parent:a,state:{allowType:!0}};return e&&(l.indexed=!1),l}let s={type:"",name:"",state:{allowType:!0}},o=s;for(let a=0;aJSON.parse(i.format(e)))),JSON.stringify(r)}let t="";return this.baseType==="array"?(t+=this.arrayChildren.format(e),t+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==Zt.sighash&&(t+=this.type),t+="("+this.components.map(r=>r.format(e)).join(e===Zt.full?", ":",")+")"):t+=this.type,e!==Zt.sighash&&(this.indexed===!0&&(t+=" indexed"),e===Zt.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return typeof e=="string"?Vr.fromString(e,t):Vr.fromObject(e)}static fromObject(e){return Vr.isParamType(e)?e:new Vr(Hu,{name:e.name||null,type:hh(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(Vr.fromObject):null})}static fromString(e,t){function r(i){return Vr.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return r(jke(e,!!t))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function e0(n,e){return Xke(n).map(t=>Vr.fromString(t,e))}class Gl{constructor(e,t){e!==Hu&&zt.throwError("use a static from method",xe.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Hw(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return Gl.isFragment(e)?e:typeof e=="string"?Gl.fromString(e):Gl.fromObject(e)}static fromObject(e){if(Gl.isFragment(e))return e;switch(e.type){case"function":return Da.fromObject(e);case"event":return Ol.fromObject(e);case"constructor":return La.fromObject(e);case"error":return Gc.fromObject(e);case"fallback":case"receive":return null}return zt.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?Ol.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?Da.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?La.fromString(e.trim()):e.split(" ")[0]==="error"?Gc.fromString(e.substring(5).trim()):zt.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class Ol extends Gl{format(e){if(e||(e=Zt.sighash),Zt[e]||zt.throwArgumentError("invalid format type","format",e),e===Zt.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==Zt.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Zt.full?", ":",")+") ",e!==Zt.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return typeof e=="string"?Ol.fromString(e):Ol.fromObject(e)}static fromObject(e){if(Ol.isEventFragment(e))return e;e.type!=="event"&&zt.throwArgumentError("invalid event object","value",e);const t={name:t0(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(Vr.fromObject):[],type:"event"};return new Ol(Hu,t)}static fromString(e){let t=e.match(n0);t||zt.throwArgumentError("invalid event string","value",e);let r=!1;return t[3].split(" ").forEach(i=>{switch(i.trim()){case"anonymous":r=!0;break;case"":break;default:zt.warn("unknown modifier: "+i)}}),Ol.fromObject({name:t[1].trim(),anonymous:r,inputs:e0(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function Qj(n,e){e.gas=null;let t=n.split("@");return t.length!==1?(t.length>2&&zt.throwArgumentError("invalid human-readable ABI signature","value",n),t[1].match(/^[0-9]+$/)||zt.throwArgumentError("invalid human-readable ABI signature gas","value",n),e.gas=Ve.from(t[1]),t[0]):n}function zj(n,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",n.split(" ").forEach(t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+t)}})}function Gj(n){let e={constant:!1,payable:!0,stateMutability:"payable"};return n.stateMutability!=null?(e.stateMutability=n.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",n.constant!=null&&!!n.constant!==e.constant&&zt.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",n),e.payable=e.stateMutability==="payable",n.payable!=null&&!!n.payable!==e.payable&&zt.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",n)):n.payable!=null?(e.payable=!!n.payable,n.constant==null&&!e.payable&&n.type!=="constructor"&&zt.throwArgumentError("unable to determine stateMutability","value",n),e.constant=!!n.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&zt.throwArgumentError("cannot have constant payable function","value",n)):n.constant!=null?(e.constant=!!n.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):n.type!=="constructor"&&zt.throwArgumentError("unable to determine stateMutability","value",n),e}class La extends Gl{format(e){if(e||(e=Zt.sighash),Zt[e]||zt.throwArgumentError("invalid format type","format",e),e===Zt.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});e===Zt.sighash&&zt.throwError("cannot format a constructor for sighash",xe.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map(r=>r.format(e)).join(e===Zt.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(t+=this.stateMutability+" "),t.trim()}static from(e){return typeof e=="string"?La.fromString(e):La.fromObject(e)}static fromObject(e){if(La.isConstructorFragment(e))return e;e.type!=="constructor"&&zt.throwArgumentError("invalid constructor object","value",e);let t=Gj(e);t.constant&&zt.throwArgumentError("constructor cannot be constant","value",e);const r={name:null,type:e.type,inputs:e.inputs?e.inputs.map(Vr.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ve.from(e.gas):null};return new La(Hu,r)}static fromString(e){let t={type:"constructor"};e=Qj(e,t);let r=e.match(n0);return(!r||r[1].trim()!=="constructor")&&zt.throwArgumentError("invalid constructor string","value",e),t.inputs=e0(r[2].trim(),!1),zj(r[3].trim(),t),La.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class Da extends La{format(e){if(e||(e=Zt.sighash),Zt[e]||zt.throwArgumentError("invalid format type","format",e),e===Zt.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(e))),outputs:this.outputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==Zt.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Zt.full?", ":",")+") ",e!==Zt.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map(r=>r.format(e)).join(", ")+") "),this.gas!=null&&(t+="@"+this.gas.toString()+" ")),t.trim()}static from(e){return typeof e=="string"?Da.fromString(e):Da.fromObject(e)}static fromObject(e){if(Da.isFunctionFragment(e))return e;e.type!=="function"&&zt.throwArgumentError("invalid function object","value",e);let t=Gj(e);const r={type:e.type,name:t0(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(Vr.fromObject):[],outputs:e.outputs?e.outputs.map(Vr.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ve.from(e.gas):null};return new Da(Hu,r)}static fromString(e){let t={type:"function"};e=Qj(e,t);let r=e.split(" returns ");r.length>2&&zt.throwArgumentError("invalid function string","value",e);let i=r[0].match(n0);if(i||zt.throwArgumentError("invalid function signature","value",e),t.name=i[1].trim(),t.name&&t0(t.name),t.inputs=e0(i[2],!1),zj(i[3].trim(),t),r.length>1){let s=r[1].match(n0);(s[1].trim()!=""||s[3].trim()!="")&&zt.throwArgumentError("unexpected tokens","value",e),t.outputs=e0(s[2],!1)}else t.outputs=[];return Da.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function m4(n){const e=n.format();return(e==="Error(string)"||e==="Panic(uint256)")&&zt.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",n),n}class Gc extends Gl{format(e){if(e||(e=Zt.sighash),Zt[e]||zt.throwArgumentError("invalid format type","format",e),e===Zt.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==Zt.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Zt.full?", ":",")+") ",t.trim()}static from(e){return typeof e=="string"?Gc.fromString(e):Gc.fromObject(e)}static fromObject(e){if(Gc.isErrorFragment(e))return e;e.type!=="error"&&zt.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:t0(e.name),inputs:e.inputs?e.inputs.map(Vr.fromObject):[]};return m4(new Gc(Hu,t))}static fromString(e){let t={type:"error"},r=e.match(n0);return r||zt.throwArgumentError("invalid error signature","value",e),t.name=r[1].trim(),t.name&&t0(t.name),t.inputs=e0(r[2],!1),m4(Gc.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function hh(n){return n.match(/^uint($|[^1-9])/)?n="uint256"+n.substring(4):n.match(/^int($|[^1-9])/)&&(n="int256"+n.substring(3)),n}const Kke=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function t0(n){return(!n||!n.match(Kke))&&zt.throwArgumentError(`invalid identifier "${n}"`,"value",n),n}const n0=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function Xke(n){n=n.trim();let e=[],t="",r=0;for(let i=0;ithis.wordSize&&fU.throwError("value out-of-bounds",xe.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=Ms([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}}class xx{constructor(e,t,r,i){Ue(this,"_data",pt(e)),Ue(this,"wordSize",t||32),Ue(this,"_coerceFunc",r),Ue(this,"allowLoose",i),this._offset=0}get data(){return lt(this._data)}get consumed(){return this._offset}static coerce(e,t){let r=e.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(t=t.toNumber()),t}coerce(e,t){return this._coerceFunc?this._coerceFunc(e,t):xx.coerce(e,t)}_peekBytes(e,t,r){let i=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&r&&this._offset+t<=this._data.length?i=t:fU.throwError("data out-of-bounds",xe.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new xx(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,t){let r=this._peekBytes(0,e,!!t);return this._offset+=r.length,r.slice(0,e)}readValue(){return Ve.from(this.readBytes(this.wordSize))}}class $ke extends dc{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=ai(t)}catch(r){this._throwError(r.message,t)}return e.writeValue(t)}decode(e){return ai(rr(e.readValue().toHexString(),20))}}class Zke extends dc{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}const Vh=new xe(D0);function Vj(n,e,t){let r=null;if(Array.isArray(t))r=t;else if(t&&typeof t=="object"){let l={};r=e.map(c=>{const A=c.localName;return A||Vh.throwError("cannot encode object for signature with missing names",xe.errors.INVALID_ARGUMENT,{argument:"values",coder:c,value:t}),l[A]&&Vh.throwError("cannot encode object for signature with duplicate names",xe.errors.INVALID_ARGUMENT,{argument:"values",coder:c,value:t}),l[A]=!0,t[A]})}else Vh.throwArgumentError("invalid tuple value","tuple",t);e.length!==r.length&&Vh.throwArgumentError("types/value length mismatch","tuple",t);let i=new jT(n.wordSize),s=new jT(n.wordSize),o=[];e.forEach((l,c)=>{let A=r[c];if(l.dynamic){let u=s.length;l.encode(s,A);let f=i.writeUpdatableValue();o.push(h=>{f(h+u)})}else l.encode(i,A)}),o.forEach(l=>{l(i.length)});let a=n.appendWriter(i);return a+=n.appendWriter(s),a}function jj(n,e){let t=[],r=n.subReader(0);e.forEach(s=>{let o=null;if(s.dynamic){let a=n.readValue(),l=r.subReader(a.toNumber());try{o=s.decode(l)}catch(c){if(c.code===xe.errors.BUFFER_OVERRUN)throw c;o=c,o.baseType=s.name,o.name=s.localName,o.type=s.type}}else try{o=s.decode(n)}catch(a){if(a.code===xe.errors.BUFFER_OVERRUN)throw a;o=a,o.baseType=s.name,o.name=s.localName,o.type=s.type}o!=null&&t.push(o)});const i=e.reduce((s,o)=>{const a=o.localName;return a&&(s[a]||(s[a]=0),s[a]++),s},{});e.forEach((s,o)=>{let a=s.localName;if(!a||i[a]!==1||(a==="length"&&(a="_length"),t[a]!=null))return;const l=t[o];l instanceof Error?Object.defineProperty(t,a,{enumerable:!0,get:()=>{throw l}}):t[a]=l});for(let s=0;s{throw o}})}return Object.freeze(t)}class Jke extends dc{constructor(e,t,r){const i=e.type+"["+(t>=0?t:"")+"]",s=t===-1||e.dynamic;super("array",i,r,s),this.coder=e,this.length=t}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let r=0;re._data.length&&Vh.throwError("insufficient data length",xe.errors.BUFFER_OVERRUN,{length:e._data.length,count:t}));let r=[];for(let i=0;i{o.dynamic&&(r=!0),i.push(o.type)});const s="tuple("+i.join(",")+")";super("tuple",s,t,r),this.coders=e}defaultValue(){const e=[];this.coders.forEach(r=>{e.push(r.defaultValue())});const t=this.coders.reduce((r,i)=>{const s=i.localName;return s&&(r[s]||(r[s]=0),r[s]++),r},{});return this.coders.forEach((r,i)=>{let s=r.localName;!s||t[s]!==1||(s==="length"&&(s="_length"),e[s]==null&&(e[s]=e[i]))}),Object.freeze(e)}encode(e,t){return Vj(e,this.coders,t)}decode(e){return e.coerce(this.name,jj(e,this.coders))}}const Xy=new xe(D0),s4e=new RegExp(/^bytes([0-9]*)$/),o4e=new RegExp(/^(u?int)([0-9]*)$/);class a4e{constructor(e){Ue(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new $ke(e.name);case"bool":return new qke(e.name);case"string":return new i4e(e.name);case"bytes":return new e4e(e.name);case"array":return new Jke(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new Ky((e.components||[]).map(r=>this._getCoder(r)),e.name);case"":return new n4e(e.name)}let t=e.type.match(o4e);if(t){let r=parseInt(t[2]||"256");return(r===0||r>256||r%8!==0)&&Xy.throwArgumentError("invalid "+t[1]+" bit length","param",e),new r4e(r/8,t[1]==="int",e.name)}if(t=e.type.match(s4e),t){let r=parseInt(t[1]);return(r===0||r>32)&&Xy.throwArgumentError("invalid bytes length","param",e),new t4e(r,e.name)}return Xy.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new xx(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new jT(this._getWordSize())}getDefaultValue(e){const t=e.map(i=>this._getCoder(Vr.from(i)));return new Ky(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&Xy.throwError("types/values length mismatch",xe.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const r=e.map(o=>this._getCoder(Vr.from(o))),i=new Ky(r,"_"),s=this._getWriter();return i.encode(s,t),s.data}decode(e,t,r){const i=e.map(o=>this._getCoder(Vr.from(o)));return new Ky(i,"_").decode(this._getReader(pt(t),r))}}const l4e=new a4e,zn=new xe(D0);class c4e extends o0{}class A4e extends o0{}class u4e extends o0{}class WT extends o0{static isIndexed(e){return!!(e&&e._isIndexed)}}const f4e={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function g4(n,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${n}`);return t.error=e,t}class v4{constructor(e){let t=[];typeof e=="string"?t=JSON.parse(e):t=e,Ue(this,"fragments",t.map(r=>Gl.from(r)).filter(r=>r!=null)),Ue(this,"_abiCoder",Cs(new.target,"getAbiCoder")()),Ue(this,"functions",{}),Ue(this,"errors",{}),Ue(this,"events",{}),Ue(this,"structs",{}),this.fragments.forEach(r=>{let i=null;switch(r.type){case"constructor":if(this.deploy){zn.warn("duplicate definition - constructor");return}Ue(this,"deploy",r);return;case"function":i=this.functions;break;case"event":i=this.events;break;case"error":i=this.errors;break;default:return}let s=r.format();if(i[s]){zn.warn("duplicate definition - "+s);return}i[s]=r}),this.deploy||Ue(this,"deploy",La.from({payable:!1,type:"constructor"})),Ue(this,"_isInterface",!0)}format(e){e||(e=Zt.full),e===Zt.sighash&&zn.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map(r=>r.format(e));return e===Zt.json?JSON.stringify(t.map(r=>JSON.parse(r))):t}static getAbiCoder(){return l4e}static getAddress(e){return ai(e)}static getSighash(e){return mi(dh(e.format()),0,4)}static getEventTopic(e){return dh(e.format())}getFunction(e){if(It(e)){for(const r in this.functions)if(e===this.getSighash(r))return this.functions[r];zn.throwArgumentError("no matching function","sighash",e)}if(e.indexOf("(")===-1){const r=e.trim(),i=Object.keys(this.functions).filter(s=>s.split("(")[0]===r);return i.length===0?zn.throwArgumentError("no matching function","name",r):i.length>1&&zn.throwArgumentError("multiple matching functions","name",r),this.functions[i[0]]}const t=this.functions[Da.fromString(e).format()];return t||zn.throwArgumentError("no matching function","signature",e),t}getEvent(e){if(It(e)){const r=e.toLowerCase();for(const i in this.events)if(r===this.getEventTopic(i))return this.events[i];zn.throwArgumentError("no matching event","topichash",r)}if(e.indexOf("(")===-1){const r=e.trim(),i=Object.keys(this.events).filter(s=>s.split("(")[0]===r);return i.length===0?zn.throwArgumentError("no matching event","name",r):i.length>1&&zn.throwArgumentError("multiple matching events","name",r),this.events[i[0]]}const t=this.events[Ol.fromString(e).format()];return t||zn.throwArgumentError("no matching event","signature",e),t}getError(e){if(It(e)){const r=Cs(this.constructor,"getSighash");for(const i in this.errors){const s=this.errors[i];if(e===r(s))return this.errors[i]}zn.throwArgumentError("no matching error","sighash",e)}if(e.indexOf("(")===-1){const r=e.trim(),i=Object.keys(this.errors).filter(s=>s.split("(")[0]===r);return i.length===0?zn.throwArgumentError("no matching error","name",r):i.length>1&&zn.throwArgumentError("multiple matching errors","name",r),this.errors[i[0]]}const t=this.errors[Da.fromString(e).format()];return t||zn.throwArgumentError("no matching error","signature",e),t}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch{throw t}}return Cs(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),Cs(this.constructor,"getEventTopic")(e)}_decodeParams(e,t){return this._abiCoder.decode(e,t)}_encodeParams(e,t){return this._abiCoder.encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){typeof e=="string"&&(e=this.getError(e));const r=pt(t);return lt(r.slice(0,4))!==this.getSighash(e)&&zn.throwArgumentError(`data signature does not match error ${e.name}.`,"data",lt(r)),this._decodeParams(e.inputs,r.slice(4))}encodeErrorResult(e,t){return typeof e=="string"&&(e=this.getError(e)),lt(Ms([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionData(e,t){typeof e=="string"&&(e=this.getFunction(e));const r=pt(t);return lt(r.slice(0,4))!==this.getSighash(e)&&zn.throwArgumentError(`data signature does not match function ${e.name}.`,"data",lt(r)),this._decodeParams(e.inputs,r.slice(4))}encodeFunctionData(e,t){return typeof e=="string"&&(e=this.getFunction(e)),lt(Ms([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionResult(e,t){typeof e=="string"&&(e=this.getFunction(e));let r=pt(t),i=null,s="",o=null,a=null,l=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch{}break;case 4:{const c=lt(r.slice(0,4)),A=f4e[c];if(A)o=this._abiCoder.decode(A.inputs,r.slice(4)),a=A.name,l=A.signature,A.reason&&(i=o[0]),a==="Error"?s=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:a==="Panic"&&(s=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const u=this.getError(c);o=this._abiCoder.decode(u.inputs,r.slice(4)),a=u.name,l=u.format()}catch{}break}}return zn.throwError("call revert exception"+s,xe.errors.CALL_EXCEPTION,{method:e.format(),data:lt(t),errorArgs:o,errorName:a,errorSignature:l,reason:i})}encodeFunctionResult(e,t){return typeof e=="string"&&(e=this.getFunction(e)),lt(this._abiCoder.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){typeof e=="string"&&(e=this.getEvent(e)),t.length>e.inputs.length&&zn.throwError("too many arguments for "+e.format(),xe.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let r=[];e.anonymous||r.push(this.getEventTopic(e));const i=(s,o)=>s.type==="string"?dh(o):s.type==="bytes"?Er(lt(o)):(s.type==="bool"&&typeof o=="boolean"&&(o=o?"0x01":"0x00"),s.type.match(/^u?int/)&&(o=Ve.from(o).toHexString()),s.type==="address"&&this._abiCoder.encode(["address"],[o]),rr(lt(o),32));for(t.forEach((s,o)=>{let a=e.inputs[o];if(!a.indexed){s!=null&&zn.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+a.name,s);return}s==null?r.push(null):a.baseType==="array"||a.baseType==="tuple"?zn.throwArgumentError("filtering with tuples or arrays not supported","contract."+a.name,s):Array.isArray(s)?r.push(s.map(l=>i(a,l))):r.push(i(a,s))});r.length&&r[r.length-1]===null;)r.pop();return r}encodeEventLog(e,t){typeof e=="string"&&(e=this.getEvent(e));const r=[],i=[],s=[];return e.anonymous||r.push(this.getEventTopic(e)),t.length!==e.inputs.length&&zn.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach((o,a)=>{const l=t[a];if(o.indexed)if(o.type==="string")r.push(dh(l));else if(o.type==="bytes")r.push(Er(l));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");r.push(this._abiCoder.encode([o.type],[l]))}else i.push(o),s.push(l)}),{data:this._abiCoder.encode(i,s),topics:r}}decodeEventLog(e,t,r){if(typeof e=="string"&&(e=this.getEvent(e)),r!=null&&!e.anonymous){let f=this.getEventTopic(e);(!It(r[0],32)||r[0].toLowerCase()!==f)&&zn.throwError("fragment/topic mismatch",xe.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:f,value:r[0]}),r=r.slice(1)}let i=[],s=[],o=[];e.inputs.forEach((f,h)=>{f.indexed?f.type==="string"||f.type==="bytes"||f.baseType==="tuple"||f.baseType==="array"?(i.push(Vr.fromObject({type:"bytes32",name:f.name})),o.push(!0)):(i.push(f),o.push(!1)):(s.push(f),o.push(!1))});let a=r!=null?this._abiCoder.decode(i,Ms(r)):null,l=this._abiCoder.decode(s,t,!0),c=[],A=0,u=0;e.inputs.forEach((f,h)=>{if(f.indexed)if(a==null)c[h]=new WT({_isIndexed:!0,hash:null});else if(o[h])c[h]=new WT({_isIndexed:!0,hash:a[u++]});else try{c[h]=a[u++]}catch(d){c[h]=d}else try{c[h]=l[A++]}catch(d){c[h]=d}if(f.name&&c[f.name]==null){const d=c[h];d instanceof Error?Object.defineProperty(c,f.name,{enumerable:!0,get:()=>{throw g4(`property ${JSON.stringify(f.name)}`,d)}}):c[f.name]=d}});for(let f=0;f{throw g4(`index ${f}`,h)}})}return Object.freeze(c)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new A4e({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:Ve.from(e.value||"0")}):null}parseLog(e){let t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new c4e({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}parseError(e){const t=lt(e);let r=this.getError(t.substring(0,10).toLowerCase());return r?new u4e({args:this._abiCoder.decode(r.inputs,"0x"+t.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(e){return!!(e&&e._isInterface)}}const h4e="contracts/5.7.0";var Qu=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const fr=new xe(h4e);function bx(n,e){return Qu(this,void 0,void 0,function*(){const t=yield e;typeof t!="string"&&fr.throwArgumentError("invalid address or ENS name","name",t);try{return ai(t)}catch{}n||fr.throwError("a provider or signer is needed to resolve ENS names",xe.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const r=yield n.resolveName(t);return r==null&&fr.throwArgumentError("resolver or addr is not configured for ENS name","name",t),r})}function Qw(n,e,t){return Qu(this,void 0,void 0,function*(){return Array.isArray(t)?yield Promise.all(t.map((r,i)=>Qw(n,Array.isArray(e)?e[i]:e[r.name],r))):t.type==="address"?yield bx(n,e):t.type==="tuple"?yield Qw(n,e,t.components):t.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(r=>Qw(n,r,t.arrayChildren))):Promise.reject(fr.makeError("invalid value for array",xe.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function eb(n,e,t){return Qu(this,void 0,void 0,function*(){let r={};t.length===e.inputs.length+1&&typeof t[t.length-1]=="object"&&(r=Hn(t.pop())),fr.checkArgumentCount(t.length,e.inputs.length,"passed to contract"),n.signer?r.from?r.from=wr({override:bx(n.signer,r.from),signer:n.signer.getAddress()}).then(c=>Qu(this,void 0,void 0,function*(){return ai(c.signer)!==c.override&&fr.throwError("Contract with a Signer cannot override from",xe.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),c.override})):r.from=n.signer.getAddress():r.from&&(r.from=bx(n.provider,r.from));const i=yield wr({args:Qw(n.signer||n.provider,t,e.inputs),address:n.resolvedAddress,overrides:wr(r)||{}}),s=n.interface.encodeFunctionData(e,i.args),o={data:s,to:i.address},a=i.overrides;if(a.nonce!=null&&(o.nonce=Ve.from(a.nonce).toNumber()),a.gasLimit!=null&&(o.gasLimit=Ve.from(a.gasLimit)),a.gasPrice!=null&&(o.gasPrice=Ve.from(a.gasPrice)),a.maxFeePerGas!=null&&(o.maxFeePerGas=Ve.from(a.maxFeePerGas)),a.maxPriorityFeePerGas!=null&&(o.maxPriorityFeePerGas=Ve.from(a.maxPriorityFeePerGas)),a.from!=null&&(o.from=a.from),a.type!=null&&(o.type=a.type),a.accessList!=null&&(o.accessList=Vu(a.accessList)),o.gasLimit==null&&e.gas!=null){let c=21e3;const A=pt(s);for(let u=0;ur[c]!=null);return l.length&&fr.throwError(`cannot override ${l.map(c=>JSON.stringify(c)).join(",")}`,xe.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:l}),o})}function d4e(n,e){return function(...t){return eb(n,e,t)}}function p4e(n,e){const t=n.signer||n.provider;return function(...r){return Qu(this,void 0,void 0,function*(){t||fr.throwError("estimate require a provider or signer",xe.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield eb(n,e,r);return yield t.estimateGas(i)})}}function m4e(n,e){const t=e.wait.bind(e);e.wait=r=>t(r).then(i=>(i.events=i.logs.map(s=>{let o=Ps(s),a=null;try{a=n.interface.parseLog(s)}catch{}return a&&(o.args=a.args,o.decode=(l,c)=>n.interface.decodeEventLog(a.eventFragment,l,c),o.event=a.name,o.eventSignature=a.signature),o.removeListener=()=>n.provider,o.getBlock=()=>n.provider.getBlock(i.blockHash),o.getTransaction=()=>n.provider.getTransaction(i.transactionHash),o.getTransactionReceipt=()=>Promise.resolve(i),o}),i))}function Kj(n,e,t){const r=n.signer||n.provider;return function(...i){return Qu(this,void 0,void 0,function*(){let s;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const l=Hn(i.pop());l.blockTag!=null&&(s=yield l.blockTag),delete l.blockTag,i.push(l)}n.deployTransaction!=null&&(yield n._deployed(s));const o=yield eb(n,e,i),a=yield r.call(o,s);try{let l=n.interface.decodeFunctionResult(e,a);return t&&e.outputs.length===1&&(l=l[0]),l}catch(l){throw l.code===xe.errors.CALL_EXCEPTION&&(l.address=n.address,l.args=i,l.transaction=o),l}})}}function g4e(n,e){return function(...t){return Qu(this,void 0,void 0,function*(){n.signer||fr.throwError("sending a transaction requires a signer",xe.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),n.deployTransaction!=null&&(yield n._deployed());const r=yield eb(n,e,t),i=yield n.signer.sendTransaction(r);return m4e(n,i),i})}}function y4(n,e,t){return e.constant?Kj(n,e,t):g4e(n,e)}function Xj(n){return n.address&&(n.topics==null||n.topics.length===0)?"*":(n.address||"*")+"@"+(n.topics?n.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):"")}class r0{constructor(e,t){Ue(this,"tag",e),Ue(this,"filter",t),this._listeners=[]}addListener(e,t){this._listeners.push({listener:e,once:t})}removeListener(e){let t=!1;this._listeners=this._listeners.filter(r=>t||r.listener!==e?!0:(t=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){const t=this.listenerCount();return this._listeners=this._listeners.filter(r=>{const i=e.slice();return setTimeout(()=>{r.listener.apply(this,i)},0),!r.once}),t}prepareEvent(e){}getEmit(e){return[e]}}class v4e extends r0{constructor(){super("error",null)}}class w4 extends r0{constructor(e,t,r,i){const s={address:e};let o=t.getEventTopic(r);i?(o!==i[0]&&fr.throwArgumentError("topic mismatch","topics",i),s.topics=i.slice()):s.topics=[o],super(Xj(s),s),Ue(this,"address",e),Ue(this,"interface",t),Ue(this,"fragment",r)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(t,r)=>this.interface.decodeEventLog(this.fragment,t,r);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(t){e.args=null,e.decodeError=t}}getEmit(e){const t=Yke(e.args);if(t.length)throw t[0].error;const r=(e.args||[]).slice();return r.push(e),r}}class _4 extends r0{constructor(e,t){super("*",{address:e}),Ue(this,"address",e),Ue(this,"interface",t)}prepareEvent(e){super.prepareEvent(e);try{const t=this.interface.parseLog(e);e.event=t.name,e.eventSignature=t.signature,e.decode=(r,i)=>this.interface.decodeEventLog(t.eventFragment,r,i),e.args=t.args}catch{}}}class y4e{constructor(e,t,r){Ue(this,"interface",Cs(new.target,"getInterface")(t)),r==null?(Ue(this,"provider",null),Ue(this,"signer",null)):A0.isSigner(r)?(Ue(this,"provider",r.provider||null),Ue(this,"signer",r)):a0.isProvider(r)?(Ue(this,"provider",r),Ue(this,"signer",null)):fr.throwArgumentError("invalid signer or provider","signerOrProvider",r),Ue(this,"callStatic",{}),Ue(this,"estimateGas",{}),Ue(this,"functions",{}),Ue(this,"populateTransaction",{}),Ue(this,"filters",{});{const o={};Object.keys(this.interface.events).forEach(a=>{const l=this.interface.events[a];Ue(this.filters,a,(...c)=>({address:this.address,topics:this.interface.encodeFilterTopics(l,c)})),o[l.name]||(o[l.name]=[]),o[l.name].push(a)}),Object.keys(o).forEach(a=>{const l=o[a];l.length===1?Ue(this.filters,a,this.filters[l[0]]):fr.warn(`Duplicate definition of ${a} (${l.join(", ")})`)})}if(Ue(this,"_runningEvents",{}),Ue(this,"_wrappedEmits",{}),e==null&&fr.throwArgumentError("invalid contract address or ENS name","addressOrName",e),Ue(this,"address",e),this.provider)Ue(this,"resolvedAddress",bx(this.provider,e));else try{Ue(this,"resolvedAddress",Promise.resolve(ai(e)))}catch{fr.throwError("provider is required to use ENS name as contract address",xe.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(o=>{});const i={},s={};Object.keys(this.interface.functions).forEach(o=>{const a=this.interface.functions[o];if(s[o]){fr.warn(`Duplicate ABI entry for ${JSON.stringify(o)}`);return}s[o]=!0;{const l=a.name;i[`%${l}`]||(i[`%${l}`]=[]),i[`%${l}`].push(o)}this[o]==null&&Ue(this,o,y4(this,a,!0)),this.functions[o]==null&&Ue(this.functions,o,y4(this,a,!1)),this.callStatic[o]==null&&Ue(this.callStatic,o,Kj(this,a,!0)),this.populateTransaction[o]==null&&Ue(this.populateTransaction,o,d4e(this,a)),this.estimateGas[o]==null&&Ue(this.estimateGas,o,p4e(this,a))}),Object.keys(i).forEach(o=>{const a=i[o];if(a.length>1)return;o=o.substring(1);const l=a[0];try{this[o]==null&&Ue(this,o,this[l])}catch{}this.functions[o]==null&&Ue(this.functions,o,this.functions[l]),this.callStatic[o]==null&&Ue(this.callStatic,o,this.callStatic[l]),this.populateTransaction[o]==null&&Ue(this.populateTransaction,o,this.populateTransaction[l]),this.estimateGas[o]==null&&Ue(this.estimateGas,o,this.estimateGas[l])})}static getContractAddress(e){return vH(e)}static getInterface(e){return v4.isInterface(e)?e:new v4(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(t=>(t==="0x"&&fr.throwError("contract not deployed",xe.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||fr.throwError("sending a transactions require a signer",xe.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=Hn(e||{});return["from","to"].forEach(function(r){t[r]!=null&&fr.throwError("cannot override "+r,xe.errors.UNSUPPORTED_OPERATION,{operation:r})}),t.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(t))}connect(e){typeof e=="string"&&(e=new pI(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&Ue(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return WT.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if(typeof e=="string"){if(e==="error")return this._normalizeRunningEvent(new v4e);if(e==="event")return this._normalizeRunningEvent(new r0("event",null));if(e==="*")return this._normalizeRunningEvent(new _4(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new w4(this.address,this.interface,t))}if(e.topics&&e.topics.length>0){try{const r=e.topics[0];if(typeof r!="string")throw new Error("invalid topic");const i=this.interface.getEvent(r);return this._normalizeRunningEvent(new w4(this.address,this.interface,i,e.topics))}catch{}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new r0(Xj(t),t))}return this._normalizeRunningEvent(new _4(this.address,this.interface))}_checkRunningEvents(e){if(e.listenerCount()===0){delete this._runningEvents[e.tag];const t=this._wrappedEmits[e.tag];t&&e.filter&&(this.provider.off(e.filter,t),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,t,r){const i=Ps(t);return i.removeListener=()=>{r&&(e.removeListener(r),this._checkRunningEvents(e))},i.getBlock=()=>this.provider.getBlock(t.blockHash),i.getTransaction=()=>this.provider.getTransaction(t.transactionHash),i.getTransactionReceipt=()=>this.provider.getTransactionReceipt(t.transactionHash),e.prepareEvent(i),i}_addEventListener(e,t,r){if(this.provider||fr.throwError("events require a provider or a signer with a provider",xe.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(t,r),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const i=s=>{let o=this._wrapEvent(e,s,t);if(o.decodeError==null)try{const a=e.getEmit(o);this.emit(e.filter,...a)}catch(a){o.decodeError=a.error}e.filter!=null&&this.emit("event",o),o.decodeError!=null&&this.emit("error",o.decodeError,o)};this._wrappedEmits[e.tag]=i,e.filter!=null&&this.provider.on(e.filter,i)}}queryFilter(e,t,r){const i=this._getRunningEvent(e),s=Hn(i.filter);return typeof t=="string"&&It(t,32)?(r!=null&&fr.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),s.blockHash=t):(s.fromBlock=t??0,s.toBlock=r??"latest"),this.provider.getLogs(s).then(o=>o.map(a=>this._wrapEvent(i,a,null)))}on(e,t){return this._addEventListener(this._getRunningEvent(e),t,!1),this}once(e,t){return this._addEventListener(this._getRunningEvent(e),t,!0),this}emit(e,...t){if(!this.provider)return!1;const r=this._getRunningEvent(e),i=r.run(t)>0;return this._checkRunningEvents(r),i}listenerCount(e){return this.provider?e==null?Object.keys(this._runningEvents).reduce((t,r)=>t+this._runningEvents[r].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(e==null){const t=[];for(let r in this._runningEvents)this._runningEvents[r].listeners().forEach(i=>{t.push(i)});return t}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(e==null){for(const r in this._runningEvents){const i=this._runningEvents[r];i.removeAllListeners(),this._checkRunningEvents(i)}return this}const t=this._getRunningEvent(e);return t.removeAllListeners(),this._checkRunningEvents(t),this}off(e,t){if(!this.provider)return this;const r=this._getRunningEvent(e);return r.removeListener(t),this._checkRunningEvents(r),this}removeListener(e,t){return this.off(e,t)}}class tb extends y4e{}const w4e="0x543D43F390b7d681513045e8a85707438c463d80",Ex={owner:"0x634B0510C5062CFf8009eAAc2435eB93bc4764ad",address:"0x69341F01C2113E2d09Cd4837bbF1786dfbBc41d7",abi:[{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"tokenPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"numberOfTokens",type:"uint256"},{internalType:"string",name:"_tokenURI",type:"string"}],name:"mintToken",outputs:[],stateMutability:"payable",type:"function"}]},x4={address:"0x0000000000000aF8FE6E4DE40F4804C90fA8Ea8F",abi:[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"AddressMismatch",type:"error"},{inputs:[],name:"AlreadyProxied",type:"error"},{inputs:[],name:"ColdAddressCannotBeTheSameAsHot",type:"error"},{inputs:[],name:"ColdIsAddressZero",type:"error"},{inputs:[],name:"ColdWalletCannotInteractUseHot",type:"error"},{inputs:[],name:"DeliveryCannotBeTheZeroAddress",type:"error"},{inputs:[],name:"DeliveryIsAddressZero",type:"error"},{inputs:[],name:"EthWithdrawFailed",type:"error"},{inputs:[],name:"IncorrectProxyRegisterFee",type:"error"},{inputs:[],name:"MigrationIsAllowedOnceOnly",type:"error"},{inputs:[],name:"NoPaymentPendingForAddress",type:"error"},{inputs:[],name:"NoRecordFoundForAddress",type:"error"},{inputs:[],name:"OnlyHotAddressCanChangeAddress",type:"error"},{inputs:[],name:"ProxyRegisterFeeRequired",type:"error"},{inputs:[],name:"RegisterAddressLocked",type:"error"},{inputs:[],name:"RewardRateIsLocked",type:"error"},{inputs:[],name:"UnknownAmount",type:"error"},{inputs:[],name:"UnrecognisedEPSAPIAmount",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!0,internalType:"address",name:"delivery",type:"address"},{indexed:!1,internalType:"address",name:"oldDelivery",type:"address"},{indexed:!1,internalType:"uint256",name:"provider",type:"uint256"}],name:"DeliveryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"ensReverseRegistrarAddress",type:"address"}],name:"ENSReverseRegistrarSet",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"erc20",type:"address"},{indexed:!1,internalType:"uint256",name:"erc20Fee_",type:"uint256"}],name:"ERC20FeeUpdated",type:"event"},{anonymous:!1,inputs:[],name:"MigrationComplete",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"address",name:"delivery",type:"address"},{indexed:!0,internalType:"uint64",name:"provider",type:"uint64"}],name:"NominationAccepted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"address",name:"delivery",type:"address"},{indexed:!1,internalType:"uint256",name:"provider",type:"uint256"}],name:"NominationMade",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"address",name:"delivery",type:"address"},{indexed:!0,internalType:"uint64",name:"provider",type:"uint64"}],name:"ProxyRecordLive",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"enum IEPSProxyRegister.Participant",name:"initiator",type:"uint8"},{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"uint256",name:"provider",type:"uint256"}],name:"RecordDeleted",type:"event"},{anonymous:!1,inputs:[],name:"RewardRateLocked",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint96",name:"rewardRate",type:"uint96"}],name:"RewardRateUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"newToken",type:"address"}],name:"RewardTokenUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"hot_",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"}],name:"acceptNomination",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"activeEthAddresses",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"bool",name:"checkingHot_",type:"bool"}],name:"addressIsAvailable",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"}],name:"beneficiaryBalance",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryBalanceOf",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"id_",type:"uint256"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryBalanceOf1155",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryBalanceOf20",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"tokenId_",type:"uint256"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryOf",outputs:[{internalType:"address",name:"beneficiary_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"}],name:"coldIsActiveOnRegister",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"}],name:"coldIsLive",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"coldToHot",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"provider_",type:"uint256"}],name:"deleteRecord",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"deletionNominalEth",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"ensReverseRegistrar",outputs:[{internalType:"contract ENSReverseRegistrar",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"epsAPIBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc1155DelegationRegister",outputs:[{internalType:"contract IERC1155DelegateRegister",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc1155DelegationRegisterAddressLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc20DelegationRegister",outputs:[{internalType:"contract IERC20DelegateRegister",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc20DelegationRegisterAddressLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"erc20PerTransactionFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc721DelegationRegister",outputs:[{internalType:"contract IERC721DelegateRegister",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc721DelegationRegisterAddressLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAddresses1155",outputs:[{internalType:"address[]",name:"proxyAddresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAddresses20",outputs:[{internalType:"address[]",name:"proxyAddresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAddresses721",outputs:[{internalType:"address[]",name:"proxyAddresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAllAddresses",outputs:[{internalType:"address[]",name:"erc721Addresses_",type:"address[]"},{internalType:"address[]",name:"erc1155Addresses_",type:"address[]"},{internalType:"address[]",name:"erc20Addresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_receivedAddress",type:"address"}],name:"getColdAndDeliveryAddresses",outputs:[{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"bool",name:"isProxied",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"}],name:"getProxyRecordForAddress",outputs:[{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"},{internalType:"bool",name:"feePaid",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"}],name:"getProxyRecordForCold",outputs:[{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"},{internalType:"bool",name:"feePaid",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"}],name:"getProxyRecordForHot",outputs:[{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"},{internalType:"bool",name:"feePaid",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"}],name:"hotIsActiveOnRegister",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"}],name:"hotIsLive",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"hotToRecord",outputs:[{internalType:"uint64",name:"provider",type:"uint64"},{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"bool",name:"feePaid",type:"bool"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"},{internalType:"address",name:"cold_",type:"address"},{internalType:"address",name:"delivery_",type:"address"}],name:"isValidAddresses",outputs:[],stateMutability:"pure",type:"function"},{inputs:[],name:"lockERC1155DelegationRegisterAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockERC20DelegationRegisterAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockERC721DelegationRegisterAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockRewardRate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"}],internalType:"struct EPSRegister.MigratedRecord[]",name:"migratedRecords_",type:"tuple[]"}],name:"migration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"migrationComplete",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"},{internalType:"address",name:"delivery_",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"}],name:"nominate",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"sender_",type:"address"},{internalType:"uint256",name:"erc20Value_",type:"uint256"},{internalType:"bytes",name:"data_",type:"bytes"}],name:"onTokenTransfer",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxyRegisterFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC1155",name:"token_",type:"address"},{internalType:"uint256",name:"tokenId_",type:"uint256"}],name:"rescueERC1155",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"token_",type:"address"},{internalType:"uint256",name:"amount_",type:"uint256"}],name:"rescueERC20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC721",name:"token_",type:"address"},{internalType:"uint256",name:"tokenId_",type:"uint256"}],name:"rescueERC721",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"rewardRate",outputs:[{internalType:"uint88",name:"",type:"uint88"}],stateMutability:"view",type:"function"},{inputs:[],name:"rewardRateLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"rewardToken",outputs:[{internalType:"contract IOAT",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"deleteNominalEth_",type:"uint256"}],name:"setDeletionNominalEth",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"ensName_",type:"string"}],name:"setENSName",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"ensReverseRegistrar_",type:"address"}],name:"setENSReverseRegistrar",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc1155DelegationRegister_",type:"address"}],name:"setERC1155DelegationRegister",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc20DelegationRegister_",type:"address"}],name:"setERC20DelegationRegister",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc20_",type:"address"},{internalType:"uint256",name:"erc20Fee_",type:"uint256"}],name:"setERC20Fee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc721DelegationRegister_",type:"address"}],name:"setERC721DelegationRegister",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"count_",type:"uint256"},{internalType:"uint256",name:"air_",type:"uint256"}],name:"setNNumberOfEthAddressesAndAirdropAmount",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"registerFee_",type:"uint256"}],name:"setRegisterFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint88",name:"rewardRate_",type:"uint88"}],name:"setRewardRate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"rewardToken_",type:"address"}],name:"setRewardToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"treasuryAddress_",type:"address"}],name:"setTreasuryAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"treasury",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"delivery_",type:"address"},{internalType:"uint256",name:"provider_",type:"uint256"}],name:"updateDeliveryAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"token_",type:"address"},{internalType:"uint256",name:"amount_",type:"uint256"}],name:"withdrawERC20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount_",type:"uint256"}],name:"withdrawETH",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}]};function Yj(n,e){return function(){return n.apply(e,arguments)}}const{toString:_4e}=Object.prototype,{getPrototypeOf:hU}=Object,nb=(n=>e=>{const t=_4e.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),ha=n=>(n=n.toLowerCase(),e=>nb(e)===n),rb=n=>e=>typeof e===n,{isArray:up}=Array,i0=rb("undefined");function x4e(n){return n!==null&&!i0(n)&&n.constructor!==null&&!i0(n.constructor)&&Os(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const $j=ha("ArrayBuffer");function b4e(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&$j(n.buffer),e}const E4e=rb("string"),Os=rb("function"),Zj=rb("number"),ib=n=>n!==null&&typeof n=="object",B4e=n=>n===!0||n===!1,zw=n=>{if(nb(n)!=="object")return!1;const e=hU(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},S4e=ha("Date"),M4e=ha("File"),C4e=ha("Blob"),T4e=ha("FileList"),I4e=n=>ib(n)&&Os(n.pipe),R4e=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||Os(n.append)&&((e=nb(n))==="formdata"||e==="object"&&Os(n.toString)&&n.toString()==="[object FormData]"))},U4e=ha("URLSearchParams"),[F4e,P4e,L4e,D4e]=["ReadableStream","Request","Response","Headers"].map(ha),N4e=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function N0(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let r,i;if(typeof n!="object"&&(n=[n]),up(n))for(r=0,i=n.length;r0;)if(i=t[r],e===i.toLowerCase())return i;return null}const pu=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),qj=n=>!i0(n)&&n!==pu;function KT(){const{caseless:n}=qj(this)&&this||{},e={},t=(r,i)=>{const s=n&&Jj(e,i)||i;zw(e[s])&&zw(r)?e[s]=KT(e[s],r):zw(r)?e[s]=KT({},r):up(r)?e[s]=r.slice():e[s]=r};for(let r=0,i=arguments.length;r(N0(e,(i,s)=>{t&&Os(i)?n[s]=Yj(i,t):n[s]=i},{allOwnKeys:r}),n),k4e=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),H4e=(n,e,t,r)=>{n.prototype=Object.create(e.prototype,r),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},Q4e=(n,e,t,r)=>{let i,s,o;const a={};if(e=e||{},n==null)return e;do{for(i=Object.getOwnPropertyNames(n),s=i.length;s-- >0;)o=i[s],(!r||r(o,n,e))&&!a[o]&&(e[o]=n[o],a[o]=!0);n=t!==!1&&hU(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},z4e=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const r=n.indexOf(e,t);return r!==-1&&r===t},G4e=n=>{if(!n)return null;if(up(n))return n;let e=n.length;if(!Zj(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},V4e=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&hU(Uint8Array)),j4e=(n,e)=>{const r=(n&&n[Symbol.iterator]).call(n);let i;for(;(i=r.next())&&!i.done;){const s=i.value;e.call(n,s[0],s[1])}},W4e=(n,e)=>{let t;const r=[];for(;(t=n.exec(e))!==null;)r.push(t);return r},K4e=ha("HTMLFormElement"),X4e=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,i){return r.toUpperCase()+i}),b4=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),Y4e=ha("RegExp"),eW=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),r={};N0(t,(i,s)=>{let o;(o=e(i,s,n))!==!1&&(r[s]=o||i)}),Object.defineProperties(n,r)},$4e=n=>{eW(n,(e,t)=>{if(Os(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const r=n[t];if(Os(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},Z4e=(n,e)=>{const t={},r=i=>{i.forEach(s=>{t[s]=!0})};return up(n)?r(n):r(String(n).split(e)),t},J4e=()=>{},q4e=(n,e)=>n!=null&&Number.isFinite(n=+n)?n:e,wS="abcdefghijklmnopqrstuvwxyz",E4="0123456789",tW={DIGIT:E4,ALPHA:wS,ALPHA_DIGIT:wS+wS.toUpperCase()+E4},eHe=(n=16,e=tW.ALPHA_DIGIT)=>{let t="";const{length:r}=e;for(;n--;)t+=e[Math.random()*r|0];return t};function tHe(n){return!!(n&&Os(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const nHe=n=>{const e=new Array(10),t=(r,i)=>{if(ib(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const s=up(r)?[]:{};return N0(r,(o,a)=>{const l=t(o,i+1);!i0(l)&&(s[a]=l)}),e[i]=void 0,s}}return r};return t(n,0)},rHe=ha("AsyncFunction"),iHe=n=>n&&(ib(n)||Os(n))&&Os(n.then)&&Os(n.catch),nW=((n,e)=>n?setImmediate:e?((t,r)=>(pu.addEventListener("message",({source:i,data:s})=>{i===pu&&s===t&&r.length&&r.shift()()},!1),i=>{r.push(i),pu.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Os(pu.postMessage)),sHe=typeof queueMicrotask<"u"?queueMicrotask.bind(pu):typeof process<"u"&&process.nextTick||nW,Ie={isArray:up,isArrayBuffer:$j,isBuffer:x4e,isFormData:R4e,isArrayBufferView:b4e,isString:E4e,isNumber:Zj,isBoolean:B4e,isObject:ib,isPlainObject:zw,isReadableStream:F4e,isRequest:P4e,isResponse:L4e,isHeaders:D4e,isUndefined:i0,isDate:S4e,isFile:M4e,isBlob:C4e,isRegExp:Y4e,isFunction:Os,isStream:I4e,isURLSearchParams:U4e,isTypedArray:V4e,isFileList:T4e,forEach:N0,merge:KT,extend:O4e,trim:N4e,stripBOM:k4e,inherits:H4e,toFlatObject:Q4e,kindOf:nb,kindOfTest:ha,endsWith:z4e,toArray:G4e,forEachEntry:j4e,matchAll:W4e,isHTMLForm:K4e,hasOwnProperty:b4,hasOwnProp:b4,reduceDescriptors:eW,freezeMethods:$4e,toObjectSet:Z4e,toCamelCase:X4e,noop:J4e,toFiniteNumber:q4e,findKey:Jj,global:pu,isContextDefined:qj,ALPHABET:tW,generateString:eHe,isSpecCompliantForm:tHe,toJSONObject:nHe,isAsyncFn:rHe,isThenable:iHe,setImmediate:nW,asap:sHe};function bt(n,e,t,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}Ie.inherits(bt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ie.toJSONObject(this.config),code:this.code,status:this.status}}});const rW=bt.prototype,iW={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{iW[n]={value:n}});Object.defineProperties(bt,iW);Object.defineProperty(rW,"isAxiosError",{value:!0});bt.from=(n,e,t,r,i,s)=>{const o=Object.create(rW);return Ie.toFlatObject(n,o,function(l){return l!==Error.prototype},a=>a!=="isAxiosError"),bt.call(o,n.message,e,t,r,i),o.cause=n,o.name=n.name,s&&Object.assign(o,s),o};const oHe=null;function XT(n){return Ie.isPlainObject(n)||Ie.isArray(n)}function sW(n){return Ie.endsWith(n,"[]")?n.slice(0,-2):n}function B4(n,e,t){return n?n.concat(e).map(function(i,s){return i=sW(i),!t&&s?"["+i+"]":i}).join(t?".":""):e}function aHe(n){return Ie.isArray(n)&&!n.some(XT)}const lHe=Ie.toFlatObject(Ie,{},null,function(e){return/^is[A-Z]/.test(e)});function sb(n,e,t){if(!Ie.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=Ie.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,g){return!Ie.isUndefined(g[m])});const r=t.metaTokens,i=t.visitor||A,s=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&Ie.isSpecCompliantForm(e);if(!Ie.isFunction(i))throw new TypeError("visitor must be a function");function c(d){if(d===null)return"";if(Ie.isDate(d))return d.toISOString();if(!l&&Ie.isBlob(d))throw new bt("Blob is not supported. Use a Buffer instead.");return Ie.isArrayBuffer(d)||Ie.isTypedArray(d)?l&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function A(d,m,g){let p=d;if(d&&!g&&typeof d=="object"){if(Ie.endsWith(m,"{}"))m=r?m:m.slice(0,-2),d=JSON.stringify(d);else if(Ie.isArray(d)&&aHe(d)||(Ie.isFileList(d)||Ie.endsWith(m,"[]"))&&(p=Ie.toArray(d)))return m=sW(m),p.forEach(function(w,_){!(Ie.isUndefined(w)||w===null)&&e.append(o===!0?B4([m],_,s):o===null?m:m+"[]",c(w))}),!1}return XT(d)?!0:(e.append(B4(g,m,s),c(d)),!1)}const u=[],f=Object.assign(lHe,{defaultVisitor:A,convertValue:c,isVisitable:XT});function h(d,m){if(!Ie.isUndefined(d)){if(u.indexOf(d)!==-1)throw Error("Circular reference detected in "+m.join("."));u.push(d),Ie.forEach(d,function(p,v){(!(Ie.isUndefined(p)||p===null)&&i.call(e,p,Ie.isString(v)?v.trim():v,m,f))===!0&&h(p,m?m.concat(v):[v])}),u.pop()}}if(!Ie.isObject(n))throw new TypeError("data must be an object");return h(n),e}function S4(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function dU(n,e){this._pairs=[],n&&sb(n,this,e)}const oW=dU.prototype;oW.append=function(e,t){this._pairs.push([e,t])};oW.toString=function(e){const t=e?function(r){return e.call(this,r,S4)}:S4;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function cHe(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function aW(n,e,t){if(!e)return n;const r=t&&t.encode||cHe,i=t&&t.serialize;let s;if(i?s=i(e,t):s=Ie.isURLSearchParams(e)?e.toString():new dU(e,t).toString(r),s){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}class AHe{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Ie.forEach(this.handlers,function(r){r!==null&&e(r)})}}const M4=AHe,lW={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},uHe=typeof URLSearchParams<"u"?URLSearchParams:dU,fHe=typeof FormData<"u"?FormData:null,hHe=typeof Blob<"u"?Blob:null,dHe={isBrowser:!0,classes:{URLSearchParams:uHe,FormData:fHe,Blob:hHe},protocols:["http","https","file","blob","url","data"]},pU=typeof window<"u"&&typeof document<"u",YT=typeof navigator=="object"&&navigator||void 0,pHe=pU&&(!YT||["ReactNative","NativeScript","NS"].indexOf(YT.product)<0),mHe=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),gHe=pU&&window.location.href||"http://localhost",vHe=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:pU,hasStandardBrowserEnv:pHe,hasStandardBrowserWebWorkerEnv:mHe,navigator:YT,origin:gHe},Symbol.toStringTag,{value:"Module"})),ls={...vHe,...dHe};function yHe(n,e){return sb(n,new ls.classes.URLSearchParams,Object.assign({visitor:function(t,r,i,s){return ls.isNode&&Ie.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function wHe(n){return Ie.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function _He(n){const e={},t=Object.keys(n);let r;const i=t.length;let s;for(r=0;r=t.length;return o=!o&&Ie.isArray(i)?i.length:o,l?(Ie.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!a):((!i[o]||!Ie.isObject(i[o]))&&(i[o]=[]),e(t,r,i[o],s)&&Ie.isArray(i[o])&&(i[o]=_He(i[o])),!a)}if(Ie.isFormData(n)&&Ie.isFunction(n.entries)){const t={};return Ie.forEachEntry(n,(r,i)=>{e(wHe(r),i,t,0)}),t}return null}function xHe(n,e,t){if(Ie.isString(n))try{return(e||JSON.parse)(n),Ie.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}const mU={transitional:lW,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,s=Ie.isObject(e);if(s&&Ie.isHTMLForm(e)&&(e=new FormData(e)),Ie.isFormData(e))return i?JSON.stringify(cW(e)):e;if(Ie.isArrayBuffer(e)||Ie.isBuffer(e)||Ie.isStream(e)||Ie.isFile(e)||Ie.isBlob(e)||Ie.isReadableStream(e))return e;if(Ie.isArrayBufferView(e))return e.buffer;if(Ie.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return yHe(e,this.formSerializer).toString();if((a=Ie.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return sb(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),xHe(e)):e}],transformResponse:[function(e){const t=this.transitional||mU.transitional,r=t&&t.forcedJSONParsing,i=this.responseType==="json";if(Ie.isResponse(e)||Ie.isReadableStream(e))return e;if(e&&Ie.isString(e)&&(r&&!this.responseType||i)){const o=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?bt.from(a,bt.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ls.classes.FormData,Blob:ls.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ie.forEach(["delete","get","head","post","put","patch"],n=>{mU.headers[n]={}});const gU=mU,bHe=Ie.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),EHe=n=>{const e={};let t,r,i;return n&&n.split(` -`).forEach(function(o){i=o.indexOf(":"),t=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!t||e[t]&&bHe[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)}),e},C4=Symbol("internals");function fm(n){return n&&String(n).trim().toLowerCase()}function Gw(n){return n===!1||n==null?n:Ie.isArray(n)?n.map(Gw):String(n)}function BHe(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=t.exec(n);)e[r[1]]=r[2];return e}const SHe=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function _S(n,e,t,r,i){if(Ie.isFunction(r))return r.call(this,e,t);if(i&&(e=t),!!Ie.isString(e)){if(Ie.isString(r))return e.indexOf(r)!==-1;if(Ie.isRegExp(r))return r.test(e)}}function MHe(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}function CHe(n,e){const t=Ie.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(n,r+t,{value:function(i,s,o){return this[r].call(this,e,i,s,o)},configurable:!0})})}class ob{constructor(e){e&&this.set(e)}set(e,t,r){const i=this;function s(a,l,c){const A=fm(l);if(!A)throw new Error("header name must be a non-empty string");const u=Ie.findKey(i,A);(!u||i[u]===void 0||c===!0||c===void 0&&i[u]!==!1)&&(i[u||l]=Gw(a))}const o=(a,l)=>Ie.forEach(a,(c,A)=>s(c,A,l));if(Ie.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(Ie.isString(e)&&(e=e.trim())&&!SHe(e))o(EHe(e),t);else if(Ie.isHeaders(e))for(const[a,l]of e.entries())s(l,a,r);else e!=null&&s(t,e,r);return this}get(e,t){if(e=fm(e),e){const r=Ie.findKey(this,e);if(r){const i=this[r];if(!t)return i;if(t===!0)return BHe(i);if(Ie.isFunction(t))return t.call(this,i,r);if(Ie.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=fm(e),e){const r=Ie.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||_S(this,this[r],r,t)))}return!1}delete(e,t){const r=this;let i=!1;function s(o){if(o=fm(o),o){const a=Ie.findKey(r,o);a&&(!t||_S(r,r[a],a,t))&&(delete r[a],i=!0)}}return Ie.isArray(e)?e.forEach(s):s(e),i}clear(e){const t=Object.keys(this);let r=t.length,i=!1;for(;r--;){const s=t[r];(!e||_S(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const t=this,r={};return Ie.forEach(this,(i,s)=>{const o=Ie.findKey(r,s);if(o){t[o]=Gw(i),delete t[s];return}const a=e?MHe(s):String(s).trim();a!==s&&delete t[s],t[a]=Gw(i),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Ie.forEach(this,(r,i)=>{r!=null&&r!==!1&&(t[i]=e&&Ie.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[C4]=this[C4]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=fm(o);r[a]||(CHe(i,o),r[a]=!0)}return Ie.isArray(e)?e.forEach(s):s(e),this}}ob.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ie.reduceDescriptors(ob.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}});Ie.freezeMethods(ob);const sa=ob;function xS(n,e){const t=this||gU,r=e||t,i=sa.from(r.headers);let s=r.data;return Ie.forEach(n,function(a){s=a.call(t,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function AW(n){return!!(n&&n.__CANCEL__)}function fp(n,e,t){bt.call(this,n??"canceled",bt.ERR_CANCELED,e,t),this.name="CanceledError"}Ie.inherits(fp,bt,{__CANCEL__:!0});function uW(n,e,t){const r=t.config.validateStatus;!t.status||!r||r(t.status)?n(t):e(new bt("Request failed with status code "+t.status,[bt.ERR_BAD_REQUEST,bt.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function THe(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function IHe(n,e){n=n||10;const t=new Array(n),r=new Array(n);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),A=r[s];o||(o=c),t[i]=l,r[i]=c;let u=s,f=0;for(;u!==i;)f+=t[u++],u=u%n;if(i=(i+1)%n,i===s&&(s=(s+1)%n),c-o{t=A,i=null,s&&(clearTimeout(s),s=null),n.apply(null,c)};return[(...c)=>{const A=Date.now(),u=A-t;u>=r?o(c,A):(i=c,s||(s=setTimeout(()=>{s=null,o(i)},r-u)))},()=>i&&o(i)]}const Bx=(n,e,t=3)=>{let r=0;const i=IHe(50,250);return RHe(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,l=o-r,c=i(l),A=o<=a;r=o;const u={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&A?(a-o)/c:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};n(u)},t)},T4=(n,e)=>{const t=n!=null;return[r=>e[0]({lengthComputable:t,total:n,loaded:r}),e[1]]},I4=n=>(...e)=>Ie.asap(()=>n(...e)),UHe=ls.hasStandardBrowserEnv?function(){const e=ls.navigator&&/(msie|trident)/i.test(ls.navigator.userAgent),t=document.createElement("a");let r;function i(s){let o=s;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return r=i(window.location.href),function(o){const a=Ie.isString(o)?i(o):o;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}(),FHe=ls.hasStandardBrowserEnv?{write(n,e,t,r,i,s){const o=[n+"="+encodeURIComponent(e)];Ie.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),Ie.isString(r)&&o.push("path="+r),Ie.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(n){const e=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function PHe(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function LHe(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function fW(n,e){return n&&!PHe(e)?LHe(n,e):e}const R4=n=>n instanceof sa?{...n}:n;function zu(n,e){e=e||{};const t={};function r(c,A,u){return Ie.isPlainObject(c)&&Ie.isPlainObject(A)?Ie.merge.call({caseless:u},c,A):Ie.isPlainObject(A)?Ie.merge({},A):Ie.isArray(A)?A.slice():A}function i(c,A,u){if(Ie.isUndefined(A)){if(!Ie.isUndefined(c))return r(void 0,c,u)}else return r(c,A,u)}function s(c,A){if(!Ie.isUndefined(A))return r(void 0,A)}function o(c,A){if(Ie.isUndefined(A)){if(!Ie.isUndefined(c))return r(void 0,c)}else return r(void 0,A)}function a(c,A,u){if(u in e)return r(c,A);if(u in n)return r(void 0,c)}const l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(c,A)=>i(R4(c),R4(A),!0)};return Ie.forEach(Object.keys(Object.assign({},n,e)),function(A){const u=l[A]||i,f=u(n[A],e[A],A);Ie.isUndefined(f)&&u!==a||(t[A]=f)}),t}const hW=n=>{const e=zu({},n);let{data:t,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=sa.from(o),e.url=aW(fW(e.baseURL,e.url),n.params,n.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let l;if(Ie.isFormData(t)){if(ls.hasStandardBrowserEnv||ls.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((l=o.getContentType())!==!1){const[c,...A]=l?l.split(";").map(u=>u.trim()).filter(Boolean):[];o.setContentType([c||"multipart/form-data",...A].join("; "))}}if(ls.hasStandardBrowserEnv&&(r&&Ie.isFunction(r)&&(r=r(e)),r||r!==!1&&UHe(e.url))){const c=i&&s&&FHe.read(s);c&&o.set(i,c)}return e},DHe=typeof XMLHttpRequest<"u",NHe=DHe&&function(n){return new Promise(function(t,r){const i=hW(n);let s=i.data;const o=sa.from(i.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:c}=i,A,u,f,h,d;function m(){h&&h(),d&&d(),i.cancelToken&&i.cancelToken.unsubscribe(A),i.signal&&i.signal.removeEventListener("abort",A)}let g=new XMLHttpRequest;g.open(i.method.toUpperCase(),i.url,!0),g.timeout=i.timeout;function p(){if(!g)return;const w=sa.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),x={data:!a||a==="text"||a==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:w,config:n,request:g};uW(function(B){t(B),m()},function(B){r(B),m()},x),g=null}"onloadend"in g?g.onloadend=p:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(p)},g.onabort=function(){g&&(r(new bt("Request aborted",bt.ECONNABORTED,n,g)),g=null)},g.onerror=function(){r(new bt("Network Error",bt.ERR_NETWORK,n,g)),g=null},g.ontimeout=function(){let _=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const x=i.transitional||lW;i.timeoutErrorMessage&&(_=i.timeoutErrorMessage),r(new bt(_,x.clarifyTimeoutError?bt.ETIMEDOUT:bt.ECONNABORTED,n,g)),g=null},s===void 0&&o.setContentType(null),"setRequestHeader"in g&&Ie.forEach(o.toJSON(),function(_,x){g.setRequestHeader(x,_)}),Ie.isUndefined(i.withCredentials)||(g.withCredentials=!!i.withCredentials),a&&a!=="json"&&(g.responseType=i.responseType),c&&([f,d]=Bx(c,!0),g.addEventListener("progress",f)),l&&g.upload&&([u,h]=Bx(l),g.upload.addEventListener("progress",u),g.upload.addEventListener("loadend",h)),(i.cancelToken||i.signal)&&(A=w=>{g&&(r(!w||w.type?new fp(null,n,g):w),g.abort(),g=null)},i.cancelToken&&i.cancelToken.subscribe(A),i.signal&&(i.signal.aborted?A():i.signal.addEventListener("abort",A)));const v=THe(i.url);if(v&&ls.protocols.indexOf(v)===-1){r(new bt("Unsupported protocol "+v+":",bt.ERR_BAD_REQUEST,n));return}g.send(s||null)})},OHe=(n,e)=>{const{length:t}=n=n?n.filter(Boolean):[];if(e||t){let r=new AbortController,i;const s=function(c){if(!i){i=!0,a();const A=c instanceof Error?c:this.reason;r.abort(A instanceof bt?A:new fp(A instanceof Error?A.message:A))}};let o=e&&setTimeout(()=>{o=null,s(new bt(`timeout ${e} of ms exceeded`,bt.ETIMEDOUT))},e);const a=()=>{n&&(o&&clearTimeout(o),o=null,n.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),n=null)};n.forEach(c=>c.addEventListener("abort",s));const{signal:l}=r;return l.unsubscribe=()=>Ie.asap(a),l}},kHe=OHe,HHe=function*(n,e){let t=n.byteLength;if(!e||t{const i=QHe(n,e);let s=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:c,value:A}=await i.next();if(c){a(),l.close();return}let u=A.byteLength;if(t){let f=s+=u;t(f)}l.enqueue(new Uint8Array(A))}catch(c){throw a(c),c}},cancel(l){return a(l),i.return()}},{highWaterMark:2})},ab=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",dW=ab&&typeof ReadableStream=="function",GHe=ab&&(typeof TextEncoder=="function"?(n=>e=>n.encode(e))(new TextEncoder):async n=>new Uint8Array(await new Response(n).arrayBuffer())),pW=(n,...e)=>{try{return!!n(...e)}catch{return!1}},VHe=dW&&pW(()=>{let n=!1;const e=new Request(ls.origin,{body:new ReadableStream,method:"POST",get duplex(){return n=!0,"half"}}).headers.has("Content-Type");return n&&!e}),F4=64*1024,$T=dW&&pW(()=>Ie.isReadableStream(new Response("").body)),Sx={stream:$T&&(n=>n.body)};ab&&(n=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Sx[e]&&(Sx[e]=Ie.isFunction(n[e])?t=>t[e]():(t,r)=>{throw new bt(`Response type '${e}' is not supported`,bt.ERR_NOT_SUPPORT,r)})})})(new Response);const jHe=async n=>{if(n==null)return 0;if(Ie.isBlob(n))return n.size;if(Ie.isSpecCompliantForm(n))return(await new Request(ls.origin,{method:"POST",body:n}).arrayBuffer()).byteLength;if(Ie.isArrayBufferView(n)||Ie.isArrayBuffer(n))return n.byteLength;if(Ie.isURLSearchParams(n)&&(n=n+""),Ie.isString(n))return(await GHe(n)).byteLength},WHe=async(n,e)=>{const t=Ie.toFiniteNumber(n.getContentLength());return t??jHe(e)},KHe=ab&&(async n=>{let{url:e,method:t,data:r,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:l,responseType:c,headers:A,withCredentials:u="same-origin",fetchOptions:f}=hW(n);c=c?(c+"").toLowerCase():"text";let h=kHe([i,s&&s.toAbortSignal()],o),d;const m=h&&h.unsubscribe&&(()=>{h.unsubscribe()});let g;try{if(l&&VHe&&t!=="get"&&t!=="head"&&(g=await WHe(A,r))!==0){let x=new Request(e,{method:"POST",body:r,duplex:"half"}),b;if(Ie.isFormData(r)&&(b=x.headers.get("content-type"))&&A.setContentType(b),x.body){const[B,M]=T4(g,Bx(I4(l)));r=U4(x.body,F4,B,M)}}Ie.isString(u)||(u=u?"include":"omit");const p="credentials"in Request.prototype;d=new Request(e,{...f,signal:h,method:t.toUpperCase(),headers:A.normalize().toJSON(),body:r,duplex:"half",credentials:p?u:void 0});let v=await fetch(d);const w=$T&&(c==="stream"||c==="response");if($T&&(a||w&&m)){const x={};["status","statusText","headers"].forEach(I=>{x[I]=v[I]});const b=Ie.toFiniteNumber(v.headers.get("content-length")),[B,M]=a&&T4(b,Bx(I4(a),!0))||[];v=new Response(U4(v.body,F4,B,()=>{M&&M(),m&&m()}),x)}c=c||"text";let _=await Sx[Ie.findKey(Sx,c)||"text"](v,n);return!w&&m&&m(),await new Promise((x,b)=>{uW(x,b,{data:_,headers:sa.from(v.headers),status:v.status,statusText:v.statusText,config:n,request:d})})}catch(p){throw m&&m(),p&&p.name==="TypeError"&&/fetch/i.test(p.message)?Object.assign(new bt("Network Error",bt.ERR_NETWORK,n,d),{cause:p.cause||p}):bt.from(p,p&&p.code,n,d)}}),ZT={http:oHe,xhr:NHe,fetch:KHe};Ie.forEach(ZT,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const P4=n=>`- ${n}`,XHe=n=>Ie.isFunction(n)||n===null||n===!1,mW={getAdapter:n=>{n=Ie.isArray(n)?n:[n];const{length:e}=n;let t,r;const i={};for(let s=0;s`adapter ${a} `+(l===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : -`+s.map(P4).join(` -`):" "+P4(s[0]):"as no adapter specified";throw new bt("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:ZT};function bS(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new fp(null,n)}function L4(n){return bS(n),n.headers=sa.from(n.headers),n.data=xS.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),mW.getAdapter(n.adapter||gU.adapter)(n).then(function(r){return bS(n),r.data=xS.call(n,n.transformResponse,r),r.headers=sa.from(r.headers),r},function(r){return AW(r)||(bS(n),r&&r.response&&(r.response.data=xS.call(n,n.transformResponse,r.response),r.response.headers=sa.from(r.response.headers))),Promise.reject(r)})}const gW="1.7.7",vU={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{vU[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});const D4={};vU.transitional=function(e,t,r){function i(s,o){return"[Axios v"+gW+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,a)=>{if(e===!1)throw new bt(i(o," has been removed"+(t?" in "+t:"")),bt.ERR_DEPRECATED);return t&&!D4[o]&&(D4[o]=!0,console.warn(i(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,o,a):!0}};function YHe(n,e,t){if(typeof n!="object")throw new bt("options must be an object",bt.ERR_BAD_OPTION_VALUE);const r=Object.keys(n);let i=r.length;for(;i-- >0;){const s=r[i],o=e[s];if(o){const a=n[s],l=a===void 0||o(a,s,n);if(l!==!0)throw new bt("option "+s+" must be "+l,bt.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new bt("Unknown option "+s,bt.ERR_BAD_OPTION)}}const JT={assertOptions:YHe,validators:vU},Uc=JT.validators;class Mx{constructor(e){this.defaults=e,this.interceptors={request:new M4,response:new M4}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+s):r.stack=s}catch{}}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=zu(this.defaults,t);const{transitional:r,paramsSerializer:i,headers:s}=t;r!==void 0&&JT.assertOptions(r,{silentJSONParsing:Uc.transitional(Uc.boolean),forcedJSONParsing:Uc.transitional(Uc.boolean),clarifyTimeoutError:Uc.transitional(Uc.boolean)},!1),i!=null&&(Ie.isFunction(i)?t.paramsSerializer={serialize:i}:JT.assertOptions(i,{encode:Uc.function,serialize:Uc.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&Ie.merge(s.common,s[t.method]);s&&Ie.forEach(["delete","get","head","post","put","patch","common"],d=>{delete s[d]}),t.headers=sa.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(t)===!1||(l=l&&m.synchronous,a.unshift(m.fulfilled,m.rejected))});const c=[];this.interceptors.response.forEach(function(m){c.push(m.fulfilled,m.rejected)});let A,u=0,f;if(!l){const d=[L4.bind(this),void 0];for(d.unshift.apply(d,a),d.push.apply(d,c),f=d.length,A=Promise.resolve(t);u{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{r.subscribe(a),s=a}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},e(function(s,o,a){r.reason||(r.reason=new fp(s,o,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=r=>{e.abort(r)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new yU(function(i){e=i}),cancel:e}}}const $He=yU;function ZHe(n){return function(t){return n.apply(null,t)}}function JHe(n){return Ie.isObject(n)&&n.isAxiosError===!0}const qT={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(qT).forEach(([n,e])=>{qT[e]=n});const qHe=qT;function vW(n){const e=new Vw(n),t=Yj(Vw.prototype.request,e);return Ie.extend(t,Vw.prototype,e,{allOwnKeys:!0}),Ie.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return vW(zu(n,i))},t}const Cr=vW(gU);Cr.Axios=Vw;Cr.CanceledError=fp;Cr.CancelToken=$He;Cr.isCancel=AW;Cr.VERSION=gW;Cr.toFormData=sb;Cr.AxiosError=bt;Cr.Cancel=Cr.CanceledError;Cr.all=function(e){return Promise.all(e)};Cr.spread=ZHe;Cr.isAxiosError=JHe;Cr.mergeConfig=zu;Cr.AxiosHeaders=sa;Cr.formToJSON=n=>cW(Ie.isHTMLForm(n)?new FormData(n):n);Cr.getAdapter=mW.getAdapter;Cr.HttpStatusCode=qHe;Cr.default=Cr;const eQe=Cr,tQe={}.VITE_OPENSEA_KEY,nQe={}.VITE_PINATA_API_KEY,rQe={}.VITE_PINATA_API_SECRET,ES="0x89";let Yy;async function iQe(){if(Yy!=null)return Yy;const n=new eQ("https://polygon-rpc.com/"),t=await new tb(Ex.address,Ex.abi,n).tokenPrice();return Yy=Ve.from(t).mul(1),Yy}function sQe(n,e){const t={method:"GET",headers:{accept:"application/json","x-api-key":tQe}};return console.log(t),new Promise((r,i)=>{fetch("https://api.opensea.io/api/v2/chain/ethereum/account/"+n+"/nfts?collection="+e,t).then(s=>{if(s.ok)return s.json();i("Failed to fetch data from Opensea API")}).then(s=>{r(s)}).catch(s=>{i(s)})})}async function wU(){if(window.ethereum)try{const n=await window.ethereum.request({method:"eth_chainId"});if(parseInt(n,16)==parseInt(ES,16)){const e=await window.ethereum.request({method:"eth_requestAccounts"});return e.length>0?e[0]:""}else try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:ES}]});const e=await window.ethereum.request({method:"eth_requestAccounts"});return e.length>0?e[0]:""}catch(e){console.log("polygon not find:",e);try{await window.ethereum.request({method:"wallet_addEthereumChain",params:[{chainId:"0x89",chainName:"Polygon Mainnet",rpcUrls:["https://polygon-rpc.com"],nativeCurrency:{name:"Matic",symbol:"MATIC",decimals:18},blockExplorerUrls:["https://polygonscan.com/"]}]}),await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:ES}]});const t=await window.ethereum.request({method:"eth_requestAccounts"});return t.length>0?t[0]:""}catch(t){console.log("Adding polygon chain failed",t)}}}catch{return""}else return""}async function BS(n,e){if(!n)return console.warn("Error saving to pinata: No file data");const t="https://api.pinata.cloud/pinning/pinFileToIPFS";let r=new FormData;return r.append("file",n,e),(await eQe.post(t,r,{maxContentLength:"Infinity",maxBodyLength:"Infinity",headers:{"Content-Type":`multipart/form-data; boundary=${r._boundary}`,pinata_api_key:nQe,pinata_secret_api_key:rQe}})).data}const oQe=n=>{let e=[];return Object.keys(n).map(t=>{Object.keys(n[t]).length!==0&&e.push({trait_type:t,value:n[t].name})}),e};async function aQe(n,e,t,r,i){if(!n)throw new Error("No avatar was provided");if(!e)throw new Error("No screenshot was provided");if(!t)throw new Error("No model was provided");const s=await wU();if(s=="")return"Please Connect Wallet";if(!i||await lQe(s)){console.log("minting");let a="AvatarImage_"+Date.now()+".png",l=await(async()=>{for(let v=0;v<10;v++)try{return await BS(e,a).catch(_=>{console.error(v,"---",_)})}catch(w){return console.warn(w),w}return"Failed to upload screenshot"})();const c=await x0e(t,n,4096);let A;if(c){let v="AvatarGlb_"+Date.now()+".glb";A=await(async()=>{for(let w=0;w<10;w++)try{return await BS(c,v).catch(x=>(console.error(w,"---",x),"Couldn't save glb to pinata"))}catch(_){return console.warn(_),"Couldn't save glb to pinata"}return"Failed to upload glb"})()}else return"Unable to get glb";const u={name:r||"Avatars",description:"Character Studio Avatars.",image:`ipfs://${l.IpfsHash}`,animation_url:`ipfs://${A.IpfsHash}`,attributes:oQe(n)},f=JSON.stringify(u),d=`ipfs://${(await BS(new Blob([f]),"AvatarMetadata_"+Date.now()+".json")).IpfsHash}`;let m=await iQe();const g=new gI(window.ethereum).getSigner(),p=new tb(Ex.address,Ex.abi,g);try{const v={value:m,from:s};if((await(await p.mintToken(1,d,v)).wait()).transactionHash)return console.log("Mint success!"),"Mint success!"}catch{return"Public Mint failed."}}}const lQe=async n=>{if(n){const e="0x6e58309CD851A5B124E3A56768a42d12f3B6D104",t=cY("mainnet",{alchemy:{}.VITE_ALCHEMY_API_KEY}),i=await new tb(x4.address,x4.abi,t).beneficiaryBalanceOf(e,w4e,1);return parseInt(i)>0?!0:(console.log(`Currently in alpha. You need a genesis pass to mint. - Will be public soon!`),!1)}else return console.log("Please connect your wallet"),!1};function cQe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=J.useContext(us),{manifest:r,characterManager:i,animationManager:s,toggleDebugMode:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:c}=J.useContext(sr),[A,u]=be.useState(null),[f,h]=be.useState(""),{playSound:d}=J.useContext(Co),{isMute:m}=J.useContext(Mo);J.useState(null);const[g,p]=J.useState(null),[v,w]=J.useState(""),_=()=>{!m&&d("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),o(!1),e(wt.LANDING)},x=()=>{const y=Qe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:Nn(Qe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Nn(Qe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Nn(Qe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Nn(Qe.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:y===0||y==2,exportMtoonAtlas:y===1||y==2,ktxCompression:Qe.merge_options_ktx_compression||!1,twoSidedMaterial:Qe.mergeOptions_two_sided_mat||!1}},b=y=>{const E=g[y].manifestName;(async()=>{(Qe.mergeOptions_download_vrm_preview==null?!0:Qe.mergeOptions_download_vrm_preview)&&i.savePortraitScreenshot(E,512,1024,1.5,-.1),(Qe.mergeOptions_download_vrm==null?!0:Qe.mergeOptions_download_vrm)&&await i.downloadVRM(E,x());const z=new ep,j=c.parent;j.remove(c);const H=Qe.mergeOptions_download_lora==null?!0:Qe.mergeOptions_download_lora;if(H===!0){const W=r.loras.map(async ee=>a.createLoraData(ee,z));await Promise.all(W)}const C=Qe.mergeOptions_download_sprites==null?!0:Qe.mergeOptions_download_sprites;if(C===!0){const W=r.sprites.map(async ee=>l.createSpriteAtlas(ee,z));await Promise.all(W)}(H===!0||C===!0)&&z.saveZip(g[y].manifestName),j.add(c),y{y==0?(console.log(r.loras[0]),b(y)):(await i.setManifest(g[y]),t(!0),i.loadInitialTraits().then(async()=>{await(R=>new Promise(F=>setTimeout(F,R)))(1),b(y)}))},M=()=>{t(!0),B(0)},{t:I}=be.useContext(Aa),S=async y=>{if(i.getCurrentCharacterModel()){const R=Kl(y.name),F=URL.createObjectURL(y);await s.loadAnimation(F,!1,0,!0,"",R),w(s.getCurrentAnimationName()),URL.revokeObjectURL(F)}else console.warn("Please load a vrm model to test animations.")},L=async y=>{const E=URL.createObjectURL(y);await i.loadOptimizerCharacter(E),URL.revokeObjectURL(E);const R=Kl(y.name);h(R),u(i.getCurrentCharacterModel())},D=y=>{const E=Array.from(y),R=[],F=O=>new Promise((z,j)=>{if(O&&O.name.toLowerCase().endsWith(".json")){const H=new FileReader,C=O.name.replace(/\.[^/.]+$/,"");H.onload=function(W){try{const ee=JSON.parse(W.target.result),P=ee.thumbnail;ee.manifestName=C,R.push(ee),z()}catch(ee){console.error("Error parsing the JSON file:",ee),j(ee)}},H.readAsText(O)}});Promise.all(E.map(F)).then(()=>{R.length>0&&(p(R),i.setManifest(R[0]),t(!0),i.loadInitialTraits().then(()=>{t(!1)}))}).catch(O=>{console.error("Error processing files:",O)})},T=async y=>{const E=y[0];E&&E.name.toLowerCase().endsWith(".fbx")&&S(E),E&&E.name.toLowerCase().endsWith(".vrm")&&L(E),E&&E.name.toLowerCase().endsWith(".json")&&D(y)};return k.jsxs("div",{className:Oi.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:"NFT Characters"}),k.jsx(S0,{onFilesDrop:T}),k.jsx(q1,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),k.jsx(uU,{model:A}),k.jsx(y2,{jsonSelectionArray:g,byManifest:!0}),(g==null?void 0:g.length)>0&&k.jsx(D1,{loadedAnimationName:v}),k.jsxs("div",{className:Oi.buttonContainer,children:[k.jsx(Bn,{theme:"light",text:I("callToAction.back"),size:14,className:Oi.buttonLeft,onClick:_}),(g==null?void 0:g.length)==1&&k.jsx(Bn,{theme:"light",text:"Download",size:14,className:Oi.buttonRight,onClick:M}),(g==null?void 0:g.length)>1&&k.jsx(Bn,{theme:"light",text:"Download All",size:14,className:Oi.buttonRight,onClick:M})]})]})}const AQe="_classdisabled_hpzv8_1",uQe="_container_hpzv8_6",fQe="_classContainer_hpzv8_14",hQe="_icon_hpzv8_39",dQe="_name_hpzv8_70",pQe="_description_hpzv8_79",mQe="_classFrame_hpzv8_84",gQe="_frameContainer_hpzv8_104",vQe="_frame_hpzv8_104",yQe="_image_hpzv8_114",wQe="_lockedContainer_hpzv8_120",_Qe="_locked_hpzv8_120",xQe="_buttonContainer_hpzv8_134",bQe="_buttonLeft_hpzv8_143",EQe="_buttonRight_hpzv8_147",BQe="_buttonCenter_hpzv8_151",SQe="_topLine_hpzv8_165",MQe="_bottomLine_hpzv8_191",ht={classdisabled:AQe,container:uQe,classContainer:fQe,class:"_class_hpzv8_1",icon:hQe,name:dQe,description:pQe,classFrame:mQe,frameContainer:gQe,frame:vQe,image:yQe,lockedContainer:wQe,locked:_Qe,buttonContainer:xQe,buttonLeft:bQe,buttonRight:EQe,buttonCenter:BQe,topLine:SQe,bottomLine:MQe};function CQe(){const{t:n}=be.useContext(Aa),{setViewMode:e,setIsLoading:t,isLoading:r}=J.useContext(us),{playSound:i}=J.useContext(Co),{isMute:s}=J.useContext(Mo),{manifest:o,characterManager:a}=J.useContext(sr),[l,c]=be.useState([]);be.useEffect(()=>{if((o==null?void 0:o.characters)!=null){const d=o.characters.map(m=>({name:m.name,image:m.portrait,description:m.description,manifest:m.manifest,icon:m.icon,format:m.format,disabled:!1}));c(d)}},[o]);const A=()=>{e(wt.LANDING),!s&&i("backNextButton")},u=async d=>{t(!0),a.loadManifest(o.characters[d].manifest).then(()=>{e(wt.BATCHDOWNLOAD),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},f=()=>{e(wt.BATCHMANIFEST)},h=()=>{!s&&i("classMouseOver")};return k.jsxs("div",{className:`${ht.container} horizontalScroll`,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),k.jsx("div",{className:ht.vrmOptimizerButton}),k.jsx("div",{className:ht.topLine}),k.jsxs("div",{className:ht.classContainer,children:[l.map((d,m)=>k.jsxs("div",{className:d.disabled?ht.classdisabled:ht.class,onClick:d.disabled?null:()=>u(m),onMouseOver:d.disabled?null:()=>h(),children:[k.jsxs("div",{className:ht.classFrame,style:{backgroundImage:`url(${d.image})`},children:[k.jsx("div",{className:ht.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ht.frame})}),k.jsx("div",{className:ht.lockedContainer,children:d.disabled&&k.jsx("img",{src:"./assets/icons/locked.svg",className:ht.locked})})]}),k.jsx("div",{className:ht.name,children:d.name}),k.jsx("div",{className:ht.description,children:d.description})]},m)),k.jsxs("div",{className:ht.class,onClick:()=>f(),onMouseOver:()=>h(),children:[k.jsx("div",{className:ht.classFrame,style:{backgroundImage:"url(./assets/media/disabled.png)"},children:k.jsx("div",{className:ht.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ht.frame})})}),k.jsx("div",{className:ht.name,children:"Manifest"}),k.jsx("div",{className:ht.description,children:"Load by manifest"})]},"manifest-load")]}),k.jsx("div",{className:ht.bottomLine}),k.jsx("div",{className:ht.buttonContainer,children:k.jsx(Bn,{theme:"light",text:n("callToAction.back"),size:14,className:ht.buttonLeft,onClick:A})})]})}function TQe(){const{t:n}=be.useContext(Aa),{setViewMode:e,setIsLoading:t,isLoading:r}=J.useContext(us),{playSound:i}=J.useContext(Co),{isMute:s}=J.useContext(Mo),{manifest:o,characterManager:a}=J.useContext(sr),[l,c]=be.useState([]);be.useEffect(()=>{if((o==null?void 0:o.characters)!=null){const h=o.characters.map(d=>({name:d.name,image:d.portrait,description:d.description,manifest:d.manifest,icon:d.icon,format:d.format,disabled:!1}));c(h)}},[o]);const A=()=>{e(wt.LANDING),!s&&i("backNextButton")},u=async h=>{t(!0),a.loadManifest(o.characters[h].manifest).then(()=>{e(wt.APPEARANCE),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},f=()=>{!s&&i("classMouseOver")};return k.jsxs("div",{className:`${ht.container} horizontalScroll`,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),k.jsx("div",{className:ht.vrmOptimizerButton}),k.jsx("div",{className:ht.topLine}),k.jsx("div",{className:ht.classContainer,children:l.map((h,d)=>k.jsxs("div",{className:h.disabled?ht.classdisabled:ht.class,onClick:h.disabled?null:()=>u(d),onMouseOver:h.disabled?null:()=>f(),children:[k.jsxs("div",{className:ht.classFrame,style:{backgroundImage:`url(${h.image})`},children:[k.jsx("div",{className:ht.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ht.frame})}),k.jsx("div",{className:ht.lockedContainer,children:h.disabled&&k.jsx("img",{src:"./assets/icons/locked.svg",className:ht.locked})})]}),k.jsx("div",{className:ht.name,children:h.name}),k.jsx("div",{className:ht.description,children:h.description})]},d))}),k.jsx("div",{className:ht.bottomLine}),k.jsx("div",{className:ht.buttonContainer,children:k.jsx(Bn,{theme:"light",text:n("callToAction.back"),size:14,className:ht.buttonLeft,onClick:A})})]})}const IQe="_buttonContainer_1ueuk_1",RQe="_button_1ueuk_1",Vf={buttonContainer:IQe,button:RQe},N4={}.VITE_OPENSEA_KEY;function UQe(){const{setViewMode:n}=J.useContext(us),{playSound:e}=J.useContext(Co),{isMute:t}=J.useContext(Mo),{characterManager:r}=J.useContext(sr),i=()=>{n(wt.CREATE),!t&&e("backNextButton")},s=()=>{n(wt.CLAIM),!t&&e("backNextButton")},o=()=>{n(wt.OPTIMIZER),r.loadOptimizerManifest(),!t&&e("backNextButton")},a=async()=>{await wU()!=""&&n(wt.WALLET),!t&&e("backNextButton")};return k.jsx("div",{className:Vf.container,children:k.jsxs("div",{className:Vf.buttonContainer,children:[k.jsx("button",{className:Vf.button,onClick:i,children:k.jsx("img",{src:"./assets/media/btn_create_character.png"})}),k.jsx("button",{className:Vf.button,onClick:s,children:k.jsx("img",{src:"./assets/media/btn_batch_download_character.png"})}),k.jsx("button",{className:Vf.button,onClick:o,children:k.jsx("img",{src:"./assets/media/btn_optimize_character.png"})}),N4&&N4!=""&&k.jsx("button",{className:Vf.button,onClick:a,children:k.jsx("img",{src:"./assets/media/btn_optimize_character.png"})})]})})}const JA={};var _U={exports:{}},ud=typeof Reflect=="object"?Reflect:null,O4=ud&&typeof ud.apply=="function"?ud.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},jw;ud&&typeof ud.ownKeys=="function"?jw=ud.ownKeys:Object.getOwnPropertySymbols?jw=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:jw=function(e){return Object.getOwnPropertyNames(e)};function FQe(n){console&&console.warn&&console.warn(n)}var yW=Number.isNaN||function(e){return e!==e};function gn(){gn.init.call(this)}_U.exports=gn;_U.exports.once=NQe;gn.EventEmitter=gn;gn.prototype._events=void 0;gn.prototype._eventsCount=0;gn.prototype._maxListeners=void 0;var k4=10;function lb(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(gn,"defaultMaxListeners",{enumerable:!0,get:function(){return k4},set:function(n){if(typeof n!="number"||n<0||yW(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");k4=n}});gn.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};gn.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||yW(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function wW(n){return n._maxListeners===void 0?gn.defaultMaxListeners:n._maxListeners}gn.prototype.getMaxListeners=function(){return wW(this)};gn.prototype.emit=function(e){for(var t=[],r=1;r0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=s[e];if(l===void 0)return!1;if(typeof l=="function")O4(l,this,t);else for(var c=l.length,A=BW(l,c),r=0;r0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=n,a.type=e,a.count=o.length,FQe(a)}return n}gn.prototype.addListener=function(e,t){return _W(this,e,t,!1)};gn.prototype.on=gn.prototype.addListener;gn.prototype.prependListener=function(e,t){return _W(this,e,t,!0)};function PQe(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function xW(n,e,t){var r={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},i=PQe.bind(r);return i.listener=t,r.wrapFn=i,i}gn.prototype.once=function(e,t){return lb(t),this.on(e,xW(this,e,t)),this};gn.prototype.prependOnceListener=function(e,t){return lb(t),this.prependListener(e,xW(this,e,t)),this};gn.prototype.removeListener=function(e,t){var r,i,s,o,a;if(lb(t),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===t||r.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if(typeof r!="function"){for(s=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,s=o;break}if(s<0)return this;s===0?r.shift():LQe(r,s),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};gn.prototype.off=gn.prototype.removeListener;gn.prototype.removeAllListeners=function(e){var t,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var s=Object.keys(r),o;for(i=0;i=0;i--)this.removeListener(e,t[i]);return this};function bW(n,e,t){var r=n._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?t?[i.listener||i]:[i]:t?DQe(i):BW(i,i.length)}gn.prototype.listeners=function(e){return bW(this,e,!0)};gn.prototype.rawListeners=function(e){return bW(this,e,!1)};gn.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):EW.call(n,e)};gn.prototype.listenerCount=EW;function EW(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}gn.prototype.eventNames=function(){return this._eventsCount>0?jw(this._events):[]};function BW(n,e){for(var t=new Array(e),r=0;r"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Ww(n,e,t){return zQe()?Ww=Reflect.construct:Ww=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),c=new l;return o&&Cx(c,o.prototype),c},Ww.apply(null,arguments)}function GQe(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function Tx(n){var e=typeof Map=="function"?new Map:void 0;return Tx=function(r){if(r===null||!GQe(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return Ww(r,arguments,tI(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Cx(i,r)},Tx(n)}function $y(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}typeof Symbol<"u"&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")));typeof Symbol<"u"&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));function jf(n,e){try{var t=n()}catch(r){return e(r)}return t&&t.then?t.then(void 0,e):t}function xa(n){return n.hasOwnProperty("result")?n.result:n}var SS=function(n){xU(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t.message="No Ethereum provider was found on window.ethereum.",t}return e}(Tx(Error)),VQe=function(n){xU(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t.message="The user rejected the request.",t}return e}(Tx(Error)),jQe=function(n){xU(e,n);function e(r){var i;return i=n.call(this,r)||this,i.handleNetworkChanged=i.handleNetworkChanged.bind($y(i)),i.handleChainChanged=i.handleChainChanged.bind($y(i)),i.handleAccountsChanged=i.handleAccountsChanged.bind($y(i)),i.handleClose=i.handleClose.bind($y(i)),i}var t=e.prototype;return t.handleChainChanged=function(i){this.emitUpdate({chainId:i,provider:window.ethereum})},t.handleAccountsChanged=function(i){i.length===0?this.emitDeactivate():this.emitUpdate({account:i[0]})},t.handleClose=function(i,s){this.emitDeactivate()},t.handleNetworkChanged=function(i){this.emitUpdate({chainId:i,provider:window.ethereum})},t.activate=function(){try{var i=function(A){if(s)return A;function u(){return eI({provider:window.ethereum},a?{account:a}:{})}var f=function(){if(!a)return Promise.resolve(window.ethereum.enable().then(function(h){return h&&xa(h)[0]})).then(function(h){a=h})}();return f&&f.then?f.then(u):u(f)},s=!1,o=this;if(!window.ethereum)throw new SS;window.ethereum.on&&(window.ethereum.on("chainChanged",o.handleChainChanged),window.ethereum.on("accountsChanged",o.handleAccountsChanged),window.ethereum.on("close",o.handleClose),window.ethereum.on("networkChanged",o.handleNetworkChanged)),window.ethereum.isMetaMask&&(window.ethereum.autoRefreshOnNetworkChange=!1);var a,l=jf(function(){return Promise.resolve(window.ethereum.send("eth_requestAccounts").then(function(c){return xa(c)[0]})).then(function(c){a=c})},function(c){if(c.code===4001)throw new VQe});return Promise.resolve(l&&l.then?l.then(i):i(l))}catch(c){return Promise.reject(c)}},t.getProvider=function(){try{return Promise.resolve(window.ethereum)}catch(i){return Promise.reject(i)}},t.getChainId=function(){try{var i=function(){function l(){if(!s)try{s=xa(window.ethereum.send({method:"net_version"}))}catch{}return s||(window.ethereum.isDapper?s=xa(window.ethereum.cachedResults.net_version):s=window.ethereum.chainId||window.ethereum.netVersion||window.ethereum.networkVersion||window.ethereum._chainId),s}var c=function(){if(!s){var A=jf(function(){return Promise.resolve(window.ethereum.send("net_version").then(xa)).then(function(u){s=u})},function(){});if(A&&A.then)return A.then(function(){})}}();return c&&c.then?c.then(l):l(c)};if(!window.ethereum)throw new SS;var s,o=jf(function(){return Promise.resolve(window.ethereum.send("eth_chainId").then(xa)).then(function(a){s=a})},function(){});return Promise.resolve(o&&o.then?o.then(i):i(o))}catch(a){return Promise.reject(a)}},t.getAccount=function(){try{var i=function(){function l(){return s||(s=xa(window.ethereum.send({method:"eth_accounts"}))[0]),s}var c=function(){if(!s){var A=jf(function(){return Promise.resolve(window.ethereum.enable().then(function(u){return xa(u)[0]})).then(function(u){s=u})},function(){});if(A&&A.then)return A.then(function(){})}}();return c&&c.then?c.then(l):l(c)};if(!window.ethereum)throw new SS;var s,o=jf(function(){return Promise.resolve(window.ethereum.send("eth_accounts").then(function(a){return xa(a)[0]})).then(function(a){s=a})},function(){});return Promise.resolve(o&&o.then?o.then(i):i(o))}catch(a){return Promise.reject(a)}},t.deactivate=function(){window.ethereum&&window.ethereum.removeListener&&(window.ethereum.removeListener("chainChanged",this.handleChainChanged),window.ethereum.removeListener("accountsChanged",this.handleAccountsChanged),window.ethereum.removeListener("close",this.handleClose),window.ethereum.removeListener("networkChanged",this.handleNetworkChanged))},t.isAuthorized=function(){try{return window.ethereum?Promise.resolve(jf(function(){return Promise.resolve(window.ethereum.send("eth_accounts").then(function(i){return xa(i).length>0}))},function(){return!1})):Promise.resolve(!1)}catch(i){return Promise.reject(i)}},e}(QQe);function WQe(){const{account:n,library:e,activate:t}=vY(),[r,i]=be.useState([]),{setViewMode:s}=J.useContext(us),{playSound:o}=J.useContext(Co),{isMute:a}=J.useContext(Mo),l=new jQe({supportedChainIds:[137,1,3,4,5,42,97]});be.useEffect(()=>{if(n&&e){const f="0x69341F01C2113E2d09Cd4837bbF1786dfbBc41d7",h=["function balanceOf(address owner) external view returns (uint256)","function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256)","function tokenURI(uint256 tokenId) external view returns (string)"],d=new tb(f,h,e);d.balanceOf(n).then(m=>{const g=[];for(let p=0;p{const v=p.map(w=>d.tokenURI(w));Promise.all(v).then(w=>{i(w)})})})}},[n,e]);const c=()=>{t(l)},A=f=>{!a&&o("backNextButton"),s(wt.APPEARANCE)},u=()=>{s(wt.LANDING),!a&&o("backNextButton")};return k.jsxs("div",{className:JA.container,children:[!n&&k.jsxs("div",{className:JA.message,children:["Please connect your wallet to load your characters",k.jsx("button",{className:JA.button,onClick:()=>c(),children:"Connect"})]}),k.jsxs("div",{className:JA.characterContainer,children:[k.jsx("div",{className:JA.title,children:"Load Character"}),r.map((f,h)=>k.jsx("div",{className:JA.character,onClick:()=>{A()},children:JSON.stringify(f)},h))]}),k.jsx("button",{className:JA.button,onClick:()=>u(),children:"Back"})]})}const KQe="_container_q73cc_1",XQe="_mintContainer_q73cc_6",YQe="_mainTitleWrap_q73cc_33",$Qe="_mainTitle_q73cc_33",ZQe="_mintButtonContainer_q73cc_49",JQe="_mintButton_q73cc_49",qQe="_genesisText_q73cc_60",e5e="_required_q73cc_64",t5e="_divider_q73cc_68",n5e="_bottomContainer_q73cc_75",r5e="_mintInfo_q73cc_85",i5e="_topLine_q73cc_91",s5e="_bottomLine_q73cc_104",Wi={container:KQe,mintContainer:XQe,mainTitleWrap:YQe,mainTitle:$Qe,mintButtonContainer:ZQe,mintButton:JQe,genesisText:qQe,required:e5e,divider:t5e,bottomContainer:n5e,mintInfo:r5e,topLine:i5e,bottomLine:s5e};function o5e(){const{model:n,avatar:e}=J.useContext(sr),{setViewMode:t}=J.useContext(us),{playSound:r}=J.useContext(Co),{isMute:i}=J.useContext(Mo),[s,o]=J.useState(""),[a,l]=J.useState(!1),c=()=>{t(wt.SAVE),!i&&r("backNextButton")};function A(){return k.jsxs("div",{className:Wi.mainTitleWrap,children:[k.jsx("div",{className:Wi.topLine}),k.jsx("div",{className:Wi.mainTitle,children:"Mint"})]})}async function u(){!i&&r("backNextButton"),l(!0),o("Please check your wallet");const d=await aQe(e,null,n,{name:"XXXRestore"}.name);o(d),l(!1),console.log(d)}return k.jsxs("div",{className:Wi.container,children:[k.jsx("div",{className:"sectionTitle",children:"Mint Your Character"}),k.jsxs("div",{className:Wi.mintContainer,children:[k.jsx(A,{}),k.jsxs("div",{className:Wi.mintButtonContainer,children:[k.jsx(Bn,{size:16,theme:"light",icon:"polygon",text:a?"Minting...":"Open Edition",className:Wi.mintButton,disabled:a,onClick:u,minWidth:220}),k.jsx("div",{className:Wi.divider}),k.jsx(Bn,{size:16,theme:"light",icon:"tokens",text:"Genesis Edition",className:Wi.mintButton,disabled:!0,minWidth:220}),k.jsxs("span",{className:Wi.genesisText,children:["(",k.jsx("span",{className:Wi.required,children:"Coming Soon!"}),")"]})]}),k.jsxs("span",{className:Wi.mintInfo,children:[s," "]})]}),k.jsx("div",{className:Wi.bottomContainer,children:k.jsx(Bn,{theme:"light",text:"Back",size:14,className:Wi.buttonLeft,onClick:c})})]})}function a5e(){const{isLoading:n,setViewMode:e}=J.useContext(us),{manifest:t,characterManager:r,animationManager:i,sceneElements:s,loraDataGenerator:o,spriteAtlasGenerator:a}=J.useContext(sr),{playSound:l}=J.useContext(Co),{isMute:c}=J.useContext(Mo),[A,u]=be.useState(null),[f,h]=be.useState(""),[d,m]=be.useState([]),[g,p]=be.useState(0),[v,w]=J.useState("T-Pose"),_=()=>{!c&&l("backNextButton"),r.removeCurrentCharacter(),r.removeCurrentManifest(),e(wt.LANDING)},x=()=>{const E=Qe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:Nn(Qe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Nn(Qe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Nn(Qe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Nn(Qe.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:E===0||E==2,exportMtoonAtlas:E===1||E==2,ktxCompression:Qe.merge_options_ktx_compression||!1,twoSidedMaterial:Qe.mergeOptions_two_sided_mat||!1}},b=async()=>{for(let E=0;E{typeof E!="string"&&(E=f),await(async()=>{var W;(Qe.mergeOptions_download_vrm_preview==null?!0:Qe.mergeOptions_download_vrm_preview)&&r.savePortraitScreenshot(E+"_portrait",512,1024,1.5,-.1),(Qe.mergeOptions_download_vrm==null?!0:Qe.mergeOptions_download_vrm)&&await r.downloadVRM(E+"_merged",x());const z=new ep,j=s.parent;j.remove(s),(W=r.getCurrentOptimizerCharacterModel().data)==null||W.isVRM0;const H=Qe.mergeOptions_download_lora==null?!0:Qe.mergeOptions_download_lora;if(H===!0){const ee=t.loras.map(async P=>o.createLoraData(P,z));await Promise.all(ee)}const C=Qe.mergeOptions_download_sprites==null?!0:Qe.mergeOptions_download_sprites;if(C===!0){const ee=t.sprites.map(async P=>a.createSpriteAtlas(P,z));await Promise.all(ee)}(H===!0||C===!0)&&z.saveZip(E),j.add(s)})()},{t:M}=be.useContext(Aa),I=async E=>{if(r.getCurrentOptimizerCharacterModel()){const F=Kl(E.name),O=URL.createObjectURL(E);await i.loadAnimation(O,!1,0,!0,"",F),w(i.getCurrentAnimationName()),URL.revokeObjectURL(O)}else console.warn("Please load a vrm model to test animations.")},S=()=>{if(g===0)D(d[d.length-1]),p(d.length-1);else{const E=g-1;D(d[E]),p(E)}},L=()=>{if(g>=d.length-1)D(d[0]),p(0);else{const E=g+1;D(d[E]),p(E)}},D=async E=>{const R=URL.createObjectURL(E);await r.loadOptimizerCharacter(R),URL.revokeObjectURL(R);const F=Kl(E.name);h(F),u({...r.getCurrentCharacterModel()})},T=async E=>{D(E[0]);const R=[];for(let F=0;F{const R=E[0];R&&R.name.toLowerCase().endsWith(".fbx")&&I(R),R&&R.name.toLowerCase().endsWith(".vrm")&&T(E)};return k.jsxs("div",{className:Oi.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:"Optimize your character"}),k.jsx(S0,{onFilesDrop:y}),k.jsx(q1,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Optimizer Options"}),k.jsx(uU,{model:A,name:f,files:d,index:g,nextVrm:L,previousVrm:S}),k.jsx(D1,{loadedAnimationName:v}),k.jsxs("div",{className:Oi.buttonContainer,children:[k.jsx(Bn,{theme:"light",text:M("callToAction.back"),size:14,className:Oi.buttonLeft,onClick:_}),(d==null?void 0:d.length)>1!=""&&k.jsx(Bn,{theme:"light",text:"Download All",size:14,className:Oi.buttonRight,onClick:b}),A!=""&&k.jsx(Bn,{theme:"light",text:"Download",size:14,className:Oi.buttonRight,onClick:B})]})]})}const l5e="_buttonContainer_1fd4o_1",c5e="_buttonLeft_1fd4o_10",A5e="_buttonRight_1fd4o_14",u5e="_buttonCenter_1fd4o_18",Zy={buttonContainer:l5e,buttonLeft:c5e,buttonRight:A5e,buttonCenter:u5e},f5e="_button_13dfi_1",H4={button:f5e},h5e="Anon",d5e=()=>{be.useContext(Aa);const[n]=J.useState(localStorage.getItem("name")||h5e),{model:e,characterManager:t}=be.useContext(sr),r=()=>{const o=Qe.mergeOptions_sel_option||0;return{createTextureAtlas:Qe.mergeOptions_create_atlas==null?!0:Qe.mergeOptions_create_atlas,mToonAtlasSize:Nn(Qe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Nn(Qe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Nn(Qe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Nn(Qe.mergeOptions_atlas_std_transp_size||6),ktxCompression:Qe.merge_options_ktx_compression,exportStdAtlas:o===0||o==2,exportMtoonAtlas:o===1||o==2,twoSidedMaterial:Qe.mergeOptions_two_sided_mat||!1}},i=o=>{const a=r();a.isVrm0=Object.values(t.avatar)[0].vrm.meta.metaVersion=="0",a.outputVRM0=o!==1,t.downloadVRM(n,a)},s=()=>{const o=r();t.downloadGLB(n,o)};return k.jsxs(J.Fragment,{children:[k.jsx(Bn,{theme:"light",text:"GLB",icon:"download",size:14,className:H4.button,onClick:()=>{s()}}),k.jsx(Bn,{theme:"light",text:"VRM 0",icon:"download",size:14,className:H4.button,onClick:()=>i(0)})]})};function p5e(){const{t:n}=be.useContext(Aa),{playSound:e}=J.useContext(Co),{isMute:t}=J.useContext(Mo),{setViewMode:r}=J.useContext(us),i=()=>{r(wt.APPEARANCE),!t&&e("backNextButton")},s=()=>{r(wt.MINT),!t&&e("backNextButton")},o=async a=>{const l=a[0];l&&l.name.toLowerCase().endsWith(".json")};return k.jsxs("div",{className:Zy.container,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.saveCharacter")}),k.jsxs("div",{className:Zy.buttonContainer,children:[k.jsx(S0,{onFilesDrop:o}),k.jsx(Bn,{theme:"light",text:n("callToAction.back"),size:14,className:Zy.buttonLeft,onClick:i}),k.jsx(q1,{showCreateAtlas:!0,mergeMenuTitle:"Download Options"}),k.jsx(d5e,{}),k.jsx(Bn,{theme:"light",text:"mint",size:14,className:Zy.buttonRight,onClick:s})]})]})}function m5e(){const{t:n}=be.useContext(Aa),{setViewMode:e,setIsLoading:t,isLoading:r}=J.useContext(us),{playSound:i}=J.useContext(Co),{isMute:s}=J.useContext(Mo),{manifest:o,characterManager:a}=J.useContext(sr);be.useState([]);const[l,c]=be.useState([]);be.useEffect(()=>{A()},[]);const A=async()=>{const m=await wU();sQe(m,"the-anata-nft").then(g=>{c(g.nfts),console.log(g.nfts)})},u=()=>{e(wt.LANDING),!s&&i("backNextButton")},f=async m=>{t(!0),a.loadManifest(o[m].manifest).then(()=>{e(wt.APPEARANCE),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},h=()=>{console.log("ttt"),a.loadManifest(o[0].manifest).then(()=>{a.loadAppendManifest(o[1].manifest,!0).then(()=>{console.log(a.manifestData)})})},d=()=>{!s&&i("classMouseOver")};return k.jsxs("div",{className:`${ht.container} horizontalScroll`,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),k.jsx("div",{className:ht.vrmOptimizerButton}),k.jsx("div",{className:ht.topLine}),k.jsx("div",{className:ht.classContainer,children:l.map((m,g)=>k.jsxs("div",{className:ht.class,onClick:()=>f(g),onMouseOver:()=>d(),children:[k.jsx("div",{className:ht.classFrame,style:{backgroundImage:`url(${m.image_url})`},children:k.jsx("div",{className:ht.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ht.frame})})}),k.jsx("div",{className:ht.name,children:m.name})]},g))}),k.jsx("div",{className:ht.bottomLine}),k.jsxs("div",{className:ht.buttonContainer,children:[k.jsx(Bn,{theme:"light",text:n("callToAction.back"),size:14,className:ht.buttonLeft,onClick:u}),k.jsx(Bn,{theme:"light",text:"test",size:14,className:ht.buttonLeft,onClick:h})]})]})}const g5e=".//manifest.json",v5e=6,y5e=new $(0,.8,0);new $(-2.2367993753934425,1.1512971720174363,2.2612065299409223);async function w5e(n){try{const e=await fetch(n);if(!e.ok)throw new Error(`Failed to fetch manifest. Status: ${e.status}`);return await e.json()}catch(e){return console.error(`Error fetching manifest: ${e.message}`),[]}}async function _5e(){const n=await w5e(g5e),e=new rwe;return{initialManifest:n,effectManager:e}}const x5e=()=>{let n,e;const r=_5e().then(i=>{n="success",e=i},i=>{n="error",e=i});return{read(){if(n==="error")throw e;if(n==="success")return e;throw r}}},b5e=x5e();function E5e(){const{initialManifest:n,effectManager:e}=b5e.read(),[t,r]=be.useState(!1),{camera:i,controls:s,scene:o,moveCamera:a,setManifest:l,lookAtManager:c,showEnvironmentModels:A}=be.useContext(sr),{viewMode:u}=be.useContext(us);e.camera=i,e.scene=o;const f=()=>{e.camera&&(a({targetX:0,targetY:y5e.y,targetZ:0,distance:v5e}),s&&([wt.APPEARANCE,wt.SAVE,wt.OPTIMIZER,wt.BATCHDOWNLOAD,wt.BATCHMANIFEST].includes(u)?s.enabled=!0:s.enabled=!1))},[h,d]=be.useState(!1),[m,g]=be.useState(""),[p,v]=be.useState([]),w=(b,B)=>{g(b),d(!0),v([B])},_={[wt.LANDING]:k.jsx(UQe,{}),[wt.APPEARANCE]:k.jsx(hke,{confirmDialog:w}),[wt.OPTIMIZER]:k.jsx(a5e,{}),[wt.CREATE]:k.jsx(TQe,{}),[wt.WALLET]:k.jsx(m5e,{}),[wt.CLAIM]:k.jsx(CQe,{}),[wt.BATCHMANIFEST]:k.jsx(cQe,{}),[wt.BATCHDOWNLOAD]:k.jsx(Gke,{}),[wt.LOAD]:k.jsx(WQe,{}),[wt.MINT]:k.jsx(o5e,{}),[wt.SAVE]:k.jsx(p5e,{})};let x=0;return be.useEffect(()=>{const b=B=>{const M=new Date().getTime(),I=M-x;I<300&&I>10&&B.target.id=="editor-scene"&&r(!t),x=M};return window.addEventListener("touchend",b),window.addEventListener("click",b),()=>{window.removeEventListener("touchend",b),window.removeEventListener("click",b)}},[t]),be.useEffect(()=>{if(c!=null)return f(),c.enabled=!0,[wt.LANDING,wt.CREATE,wt.CLAIM,wt.LOAD,wt.CLAIM,wt.CLAIM].includes(u)?A(!1):A(!0),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}},[u,c]),be.useEffect(()=>{l(n)},[n]),be.useContext(Aa),k.jsxs(be.Fragment,{children:[k.jsx("div",{className:"generalTitle",children:"Character Studio"}),k.jsx(_we,{confirmDialogText:m,confirmDialogCallback:p,confirmDialogWindow:h,setConfirmDialogWindow:d}),k.jsx(Bwe,{}),_[u]]})}const B5e=n=>{const e=new gI(n);return e.pollingInterval=12e3,e};NS.createRoot(document.getElementById("root")).render(k.jsx(J.StrictMode,{children:k.jsx(mY,{getLibrary:B5e,children:k.jsx(MZ,{children:k.jsx(Lye,{children:k.jsx(BZ,{children:k.jsx(uve,{children:k.jsx(cve,{children:k.jsx(_ve,{children:k.jsx(be.Suspense,{children:k.jsx(E5e,{})})})})})})})})})}));export{Na as c,oc as g}; + `),Z.createElement("div",{style:A.white,className:"saturation-white"},Z.createElement("div",{style:A.black,className:"saturation-black"}),Z.createElement("div",{style:A.pointer},this.props.pointer?Z.createElement(this.props.pointer,this.props):Z.createElement("div",{style:A.circle}))))}}]),e}(be.PureComponent||be.Component);function UDe(n,e){for(var t=-1,r=n==null?0:n.length;++t=0,s=!t&&i&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(r=this.toRgbString()),e==="prgb"&&(r=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(r=this.toHexString()),e==="hex3"&&(r=this.toHexString(!0)),e==="hex4"&&(r=this.toHex8String(!0)),e==="hex8"&&(r=this.toHex8String()),e==="name"&&(r=this.toName()),e==="hsl"&&(r=this.toHslString()),e==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return ot(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(qDe,arguments)},brighten:function(){return this._applyModification(eNe,arguments)},darken:function(){return this._applyModification(tNe,arguments)},desaturate:function(){return this._applyModification($De,arguments)},saturate:function(){return this._applyModification(ZDe,arguments)},greyscale:function(){return this._applyModification(JDe,arguments)},spin:function(){return this._applyModification(nNe,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(sNe,arguments)},complement:function(){return this._applyCombination(rNe,arguments)},monochromatic:function(){return this._applyCombination(oNe,arguments)},splitcomplement:function(){return this._applyCombination(iNe,arguments)},triad:function(){return this._applyCombination(zk,[3])},tetrad:function(){return this._applyCombination(zk,[4])}};ot.fromRatio=function(n,e){if(_x(n)=="object"){var t={};for(var r in n)n.hasOwnProperty(r)&&(r==="a"?t[r]=n[r]:t[r]=Dm(n[r]));n=t}return ot(n,e)};function jDe(n){var e={r:0,g:0,b:0},t=1,r=null,i=null,s=null,o=!1,a=!1;return typeof n=="string"&&(n=uNe(n)),_x(n)=="object"&&(El(n.r)&&El(n.g)&&El(n.b)?(e=WDe(n.r,n.g,n.b),o=!0,a=String(n.r).substr(-1)==="%"?"prgb":"rgb"):El(n.h)&&El(n.s)&&El(n.v)?(r=Dm(n.s),i=Dm(n.v),e=XDe(n.h,r,i),o=!0,a="hsv"):El(n.h)&&El(n.s)&&El(n.l)&&(r=Dm(n.s),s=Dm(n.l),e=KDe(n.h,r,s),o=!0,a="hsl"),n.hasOwnProperty("a")&&(t=n.a)),t=Mj(t),{ok:o,format:n.format||a,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function WDe(n,e,t){return{r:Dn(n,255)*255,g:Dn(e,255)*255,b:Dn(t,255)*255}}function Ok(n,e,t){n=Dn(n,255),e=Dn(e,255),t=Dn(t,255);var r=Math.max(n,e,t),i=Math.min(n,e,t),s,o,a=(r+i)/2;if(r==i)s=o=0;else{var l=r-i;switch(o=a>.5?l/(2-r-i):l/(r+i),r){case n:s=(e-t)/l+(e1&&(u-=1),u<1/6?c+(A-c)*6*u:u<1/2?A:u<2/3?c+(A-c)*(2/3-u)*6:c}if(e===0)r=i=s=t;else{var a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;r=o(l,a,n+1/3),i=o(l,a,n),s=o(l,a,n-1/3)}return{r:r*255,g:i*255,b:s*255}}function kk(n,e,t){n=Dn(n,255),e=Dn(e,255),t=Dn(t,255);var r=Math.max(n,e,t),i=Math.min(n,e,t),s,o,a=r,l=r-i;if(o=r===0?0:l/r,r==i)s=0;else{switch(r){case n:s=(e-t)/l+(e>1)+720)%360;--e;)r.h=(r.h+i)%360,s.push(ot(r));return s}function oNe(n,e){e=e||6;for(var t=ot(n).toHsv(),r=t.h,i=t.s,s=t.v,o=[],a=1/e;e--;)o.push(ot({h:r,s:i,v:s})),s=(s+a)%1;return o}ot.mix=function(n,e,t){t=t===0?0:t||50;var r=ot(n).toRgb(),i=ot(e).toRgb(),s=t/100,o={r:(i.r-r.r)*s+r.r,g:(i.g-r.g)*s+r.g,b:(i.b-r.b)*s+r.b,a:(i.a-r.a)*s+r.a};return ot(o)};ot.readability=function(n,e){var t=ot(n),r=ot(e);return(Math.max(t.getLuminance(),r.getLuminance())+.05)/(Math.min(t.getLuminance(),r.getLuminance())+.05)};ot.isReadable=function(n,e,t){var r=ot.readability(n,e),i,s;switch(s=!1,i=fNe(t),i.level+i.size){case"AAsmall":case"AAAlarge":s=r>=4.5;break;case"AAlarge":s=r>=3;break;case"AAAsmall":s=r>=7;break}return s};ot.mostReadable=function(n,e,t){var r=null,i=0,s,o,a,l;t=t||{},o=t.includeFallbackColors,a=t.level,l=t.size;for(var c=0;ci&&(i=s,r=ot(e[c]));return ot.isReadable(n,r,{level:a,size:l})||!o?r:(t.includeFallbackColors=!1,ot.mostReadable(n,["#fff","#000"],t))};var zT=ot.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},aNe=ot.hexNames=lNe(zT);function lNe(n){var e={};for(var t in n)n.hasOwnProperty(t)&&(e[n[t]]=t);return e}function Mj(n){return n=parseFloat(n),(isNaN(n)||n<0||n>1)&&(n=1),n}function Dn(n,e){cNe(n)&&(n="100%");var t=ANe(n);return n=Math.min(e,Math.max(0,parseFloat(n))),t&&(n=parseInt(n*e,10)/100),Math.abs(n-e)<1e-6?1:n%e/parseFloat(e)}function q1(n){return Math.min(1,Math.max(0,n))}function ys(n){return parseInt(n,16)}function cNe(n){return typeof n=="string"&&n.indexOf(".")!=-1&&parseFloat(n)===1}function ANe(n){return typeof n=="string"&&n.indexOf("%")!=-1}function ta(n){return n.length==1?"0"+n:""+n}function Dm(n){return n<=1&&(n=n*100+"%"),n}function Sj(n){return Math.round(parseFloat(n)*255).toString(16)}function Gk(n){return ys(n)/255}var Go=function(){var n="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+n+")",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",i="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function El(n){return!!Go.CSS_UNIT.exec(n)}function uNe(n){n=n.replace(GDe,"").replace(VDe,"").toLowerCase();var e=!1;if(zT[n])n=zT[n],e=!0;else if(n=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=Go.rgb.exec(n))?{r:t[1],g:t[2],b:t[3]}:(t=Go.rgba.exec(n))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=Go.hsl.exec(n))?{h:t[1],s:t[2],l:t[3]}:(t=Go.hsla.exec(n))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=Go.hsv.exec(n))?{h:t[1],s:t[2],v:t[3]}:(t=Go.hsva.exec(n))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=Go.hex8.exec(n))?{r:ys(t[1]),g:ys(t[2]),b:ys(t[3]),a:Gk(t[4]),format:e?"name":"hex8"}:(t=Go.hex6.exec(n))?{r:ys(t[1]),g:ys(t[2]),b:ys(t[3]),format:e?"name":"hex"}:(t=Go.hex4.exec(n))?{r:ys(t[1]+""+t[1]),g:ys(t[2]+""+t[2]),b:ys(t[3]+""+t[3]),a:Gk(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=Go.hex3.exec(n))?{r:ys(t[1]+""+t[1]),g:ys(t[2]+""+t[2]),b:ys(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function fNe(n){var e,t;return n=n||{level:"AA",size:"small"},e=(n.level||"AA").toUpperCase(),t=(n.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}var Vk=function(e){var t=["r","g","b","a","h","s","l","v"],r=0,i=0;return zDe(t,function(s){if(e[s]&&(r+=1,isNaN(e[s])||(i+=1),s==="s"||s==="l")){var o=/^\d+%$/;o.test(e[s])&&(i+=1)}}),r===i?e:!1},Nm=function(e,t){var r=e.hex?ot(e.hex):ot(e),i=r.toHsl(),s=r.toHsv(),o=r.toRgb(),a=r.toHex();i.s===0&&(i.h=t||0,s.h=t||0);var l=a==="000000"&&o.a===0;return{hsl:i,hex:l?"transparent":"#"+a,rgb:o,hsv:s,oldHue:e.h||t||i.h,source:e.source}},LA=function(e){if(e==="transparent")return!0;var t=String(e).charAt(0)==="#"?1:0;return e.length!==4+t&&e.length<7+t&&ot(e).isValid()},X2=function(e){if(!e)return"#fff";var t=Nm(e);if(t.hex==="transparent")return"rgba(0,0,0,0.4)";var r=(t.rgb.r*299+t.rgb.g*587+t.rgb.b*114)/1e3;return r>=128?"#000":"#fff"},yM=function(e,t){var r=e.replace("°","");return ot(t+" ("+r+")")._ok},um=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){wNe(i,r);function i(){var s,o,a,l;yNe(this,i);for(var c=arguments.length,A=Array(c),u=0;ua))return!1;var c=s.get(n),A=s.get(e);if(c&&A)return c==e&&A==n;var u=-1,f=!0,h=t&UNe?new xx:void 0;for(s.set(n,e),s.set(e,n);++u=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var Vy=24,e3e=Nj.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?Vy:r,s=n.height,o=s===void 0?Vy:s,a=n.style,l=a===void 0?{}:a,c=qOe(n,["fill","width","height","style"]);return c4.default.createElement("svg",l4({viewBox:"0 0 "+Vy+" "+Vy,style:l4({fill:t,width:i,height:o},l)},c),c4.default.createElement("path",{d:"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"}))},t3e=function(){function n(e,t){for(var r=0;r1&&(i.a=1),r.props.onChange({h:r.props.hsl.h,s:r.props.hsl.s,l:r.props.hsl.l,a:Math.round(i.a*100)/100,source:"rgb"},s)):(i.h||i.s||i.l)&&(typeof i.s=="string"&&i.s.includes("%")&&(i.s=i.s.replace("%","")),typeof i.l=="string"&&i.l.includes("%")&&(i.l=i.l.replace("%","")),i.s==1?i.s=.01:i.l==1&&(i.l=.01),r.props.onChange({h:i.h||r.props.hsl.h,s:Number(a4(i.s)?r.props.hsl.s:i.s),l:Number(a4(i.l)?r.props.hsl.l:i.l),source:"hsl"},s))},r.showHighlight=function(i){i.currentTarget.style.background="#eee"},r.hideHighlight=function(i){i.currentTarget.style.background="transparent"},t.hsl.a!==1&&t.view==="hex"?r.state={view:"rgb"}:r.state={view:t.view},r}return t3e(e,[{key:"render",value:function(){var r=this,i=vt({default:{wrap:{paddingTop:"16px",display:"flex"},fields:{flex:"1",display:"flex",marginLeft:"-6px"},field:{paddingLeft:"6px",width:"100%"},alpha:{paddingLeft:"6px",width:"100%"},toggle:{width:"32px",textAlign:"right",position:"relative"},icon:{marginRight:"-4px",marginTop:"12px",cursor:"pointer",position:"relative"},iconHighlight:{position:"absolute",width:"24px",height:"28px",background:"#eee",borderRadius:"4px",top:"10px",left:"12px",display:"none"},input:{fontSize:"11px",color:"#333",width:"100%",borderRadius:"2px",border:"none",boxShadow:"inset 0 0 0 1px #dadada",height:"21px",textAlign:"center"},label:{textTransform:"uppercase",fontSize:"11px",lineHeight:"11px",color:"#969696",textAlign:"center",display:"block",marginTop:"12px"},svg:{fill:"#333",width:"24px",height:"24px",border:"1px transparent solid",borderRadius:"5px"}},disableAlpha:{alpha:{display:"none"}}},this.props,this.state),s=void 0;return this.state.view==="hex"?s=Z.createElement("div",{style:i.fields,className:"flexbox-fix"},Z.createElement("div",{style:i.field},Z.createElement(Ht,{style:{input:i.input,label:i.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?s=Z.createElement("div",{style:i.fields,className:"flexbox-fix"},Z.createElement("div",{style:i.field},Z.createElement(Ht,{style:{input:i.input,label:i.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),Z.createElement("div",{style:i.field},Z.createElement(Ht,{style:{input:i.input,label:i.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),Z.createElement("div",{style:i.field},Z.createElement(Ht,{style:{input:i.input,label:i.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),Z.createElement("div",{style:i.alpha},Z.createElement(Ht,{style:{input:i.input,label:i.label},label:"a",value:this.props.rgb.a,arrowOffset:.01,onChange:this.handleChange}))):this.state.view==="hsl"&&(s=Z.createElement("div",{style:i.fields,className:"flexbox-fix"},Z.createElement("div",{style:i.field},Z.createElement(Ht,{style:{input:i.input,label:i.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),Z.createElement("div",{style:i.field},Z.createElement(Ht,{style:{input:i.input,label:i.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),Z.createElement("div",{style:i.field},Z.createElement(Ht,{style:{input:i.input,label:i.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),Z.createElement("div",{style:i.alpha},Z.createElement(Ht,{style:{input:i.input,label:i.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),Z.createElement("div",{style:i.wrap,className:"flexbox-fix"},s,Z.createElement("div",{style:i.toggle},Z.createElement("div",{style:i.icon,onClick:this.toggleViews,ref:function(a){return r.icon=a}},Z.createElement(e3e,{style:i.svg,onMouseOver:this.showHighlight,onMouseEnter:this.showHighlight,onMouseOut:this.hideHighlight}))))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.hsl.a!==1&&i.view==="hex"?{view:"rgb"}:null}}]),e}(Z.Component);Oj.defaultProps={view:"hex"};var A4=function(){var e=vt({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",transform:"translate(-6px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}});return Z.createElement("div",{style:e.picker})},s3e=function(){var e=vt({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return Z.createElement("div",{style:e.picker})},eU=function(e){var t=e.width,r=e.onChange,i=e.disableAlpha,s=e.rgb,o=e.hsl,a=e.hsv,l=e.hex,c=e.renderers,A=e.styles,u=A===void 0?{}:A,f=e.className,h=f===void 0?"":f,d=e.defaultView,m=vt(fs({default:{picker:{width:t,background:"#fff",borderRadius:"2px",boxShadow:"0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3)",boxSizing:"initial",fontFamily:"Menlo"},saturation:{width:"100%",paddingBottom:"55%",position:"relative",borderRadius:"2px 2px 0 0",overflow:"hidden"},Saturation:{radius:"2px 2px 0 0"},body:{padding:"16px 16px 12px"},controls:{display:"flex"},color:{width:"32px"},swatch:{marginTop:"6px",width:"16px",height:"16px",borderRadius:"8px",position:"relative",overflow:"hidden"},active:{absolute:"0px 0px 0px 0px",borderRadius:"8px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.1)",background:"rgba("+s.r+", "+s.g+", "+s.b+", "+s.a+")",zIndex:"2"},toggles:{flex:"1"},hue:{height:"10px",position:"relative",marginBottom:"8px"},Hue:{radius:"2px"},alpha:{height:"10px",position:"relative"},Alpha:{radius:"2px"}},disableAlpha:{color:{width:"22px"},alpha:{display:"none"},hue:{marginBottom:"0px"},swatch:{width:"10px",height:"10px",marginTop:"0px"}}},u),{disableAlpha:i});return Z.createElement("div",{style:m.picker,className:"chrome-picker "+h},Z.createElement("div",{style:m.saturation},Z.createElement(J1,{style:m.Saturation,hsl:o,hsv:a,pointer:s3e,onChange:r})),Z.createElement("div",{style:m.body},Z.createElement("div",{style:m.controls,className:"flexbox-fix"},Z.createElement("div",{style:m.color},Z.createElement("div",{style:m.swatch},Z.createElement("div",{style:m.active}),Z.createElement(lp,{renderers:c}))),Z.createElement("div",{style:m.toggles},Z.createElement("div",{style:m.hue},Z.createElement(cp,{style:m.Hue,hsl:o,pointer:A4,onChange:r})),Z.createElement("div",{style:m.alpha},Z.createElement(Q2,{style:m.Alpha,rgb:s,hsl:o,pointer:A4,renderers:c,onChange:r})))),Z.createElement(Oj,{rgb:s,hsl:o,hex:l,view:d,onChange:r,disableAlpha:i})))};eU.propTypes={width:Ve.oneOfType([Ve.string,Ve.number]),disableAlpha:Ve.bool,styles:Ve.object,defaultView:Ve.oneOf(["hex","rgb","hsl"])};eU.defaultProps={width:225,disableAlpha:!1,styles:{}};const o3e=hs(eU);var a3e=function(e){var t=e.color,r=e.onClick,i=r===void 0?function(){}:r,s=e.onSwatchHover,o=e.active,a=vt({default:{color:{background:t,width:"15px",height:"15px",float:"left",marginRight:"5px",marginBottom:"5px",position:"relative",cursor:"pointer"},dot:{absolute:"5px 5px 5px 5px",background:X2(t),borderRadius:"50%",opacity:"0"}},active:{dot:{opacity:"1"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},dot:{background:"#000"}},transparent:{dot:{background:"#000"}}},{active:o,"color-#FFFFFF":t==="#FFFFFF",transparent:t==="transparent"});return Z.createElement(nf,{style:a.color,color:t,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},Z.createElement("div",{style:a.dot}))},l3e=function(e){var t=e.hex,r=e.rgb,i=e.onChange,s=vt({default:{fields:{display:"flex",paddingBottom:"6px",paddingRight:"5px",position:"relative"},active:{position:"absolute",top:"6px",left:"5px",height:"9px",width:"9px",background:t},HEXwrap:{flex:"6",position:"relative"},HEXinput:{width:"80%",padding:"0px",paddingLeft:"20%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},HEXlabel:{display:"none"},RGBwrap:{flex:"3",position:"relative"},RGBinput:{width:"70%",padding:"0px",paddingLeft:"30%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},RGBlabel:{position:"absolute",top:"3px",left:"0px",lineHeight:"16px",textTransform:"uppercase",fontSize:"12px",color:"#999"}}}),o=function(l,c){l.r||l.g||l.b?i({r:l.r||r.r,g:l.g||r.g,b:l.b||r.b,source:"rgb"},c):i({hex:l.hex,source:"hex"},c)};return Z.createElement("div",{style:s.fields,className:"flexbox-fix"},Z.createElement("div",{style:s.active}),Z.createElement(Ht,{style:{wrap:s.HEXwrap,input:s.HEXinput,label:s.HEXlabel},label:"hex",value:t,onChange:o}),Z.createElement(Ht,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"r",value:r.r,onChange:o}),Z.createElement(Ht,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"g",value:r.g,onChange:o}),Z.createElement(Ht,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"b",value:r.b,onChange:o}))},tU=function(e){var t=e.onChange,r=e.onSwatchHover,i=e.colors,s=e.hex,o=e.rgb,a=e.styles,l=a===void 0?{}:a,c=e.className,A=c===void 0?"":c,u=vt(fs({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},l)),f=function(d,m){d.hex?LA(d.hex)&&t({hex:d.hex,source:"hex"},m):t(d,m)};return Z.createElement(D0,{style:u.Compact,styles:l},Z.createElement("div",{style:u.compact,className:"compact-picker "+A},Z.createElement("div",null,rf(i,function(h){return Z.createElement(a3e,{key:h,color:h,active:h.toLowerCase()===s,onClick:f,onSwatchHover:r})}),Z.createElement("div",{style:u.clear})),Z.createElement(l3e,{hex:s,rgb:o,onChange:f})))};tU.propTypes={colors:Ve.arrayOf(Ve.string),styles:Ve.object};tU.defaultProps={colors:["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#cccccc","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"],styles:{}};hs(tU);var c3e=function(e){var t=e.hover,r=e.color,i=e.onClick,s=e.onSwatchHover,o={position:"relative",zIndex:"2",outline:"2px solid #fff",boxShadow:"0 0 5px 2px rgba(0,0,0,0.25)"},a=vt({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:o}},{hover:t});return Z.createElement("div",{style:a.swatch},Z.createElement(nf,{color:r,onClick:i,onHover:s,focusStyle:o}))};const A3e=k2(c3e);var nU=function(e){var t=e.width,r=e.colors,i=e.onChange,s=e.onSwatchHover,o=e.triangle,a=e.styles,l=a===void 0?{}:a,c=e.className,A=c===void 0?"":c,u=vt(fs({default:{card:{width:t,background:"#fff",border:"1px solid rgba(0,0,0,0.2)",boxShadow:"0 3px 12px rgba(0,0,0,0.15)",borderRadius:"4px",position:"relative",padding:"5px",display:"flex",flexWrap:"wrap"},triangle:{position:"absolute",border:"7px solid transparent",borderBottomColor:"#fff"},triangleShadow:{position:"absolute",border:"8px solid transparent",borderBottomColor:"rgba(0,0,0,0.15)"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-14px",left:"10px"},triangleShadow:{top:"-16px",left:"9px"}},"top-right-triangle":{triangle:{top:"-14px",right:"10px"},triangleShadow:{top:"-16px",right:"9px"}},"bottom-left-triangle":{triangle:{top:"35px",left:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",left:"9px",transform:"rotate(180deg)"}},"bottom-right-triangle":{triangle:{top:"35px",right:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",right:"9px",transform:"rotate(180deg)"}}},l),{"hide-triangle":o==="hide","top-left-triangle":o==="top-left","top-right-triangle":o==="top-right","bottom-left-triangle":o==="bottom-left","bottom-right-triangle":o==="bottom-right"}),f=function(d,m){return i({hex:d,source:"hex"},m)};return Z.createElement("div",{style:u.card,className:"github-picker "+A},Z.createElement("div",{style:u.triangleShadow}),Z.createElement("div",{style:u.triangle}),rf(r,function(h){return Z.createElement(A3e,{color:h,key:h,onClick:f,onSwatchHover:s})}))};nU.propTypes={width:Ve.oneOfType([Ve.string,Ve.number]),colors:Ve.arrayOf(Ve.string),triangle:Ve.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:Ve.object};nU.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};hs(nU);var u3e=function(e){var t=e.direction,r=vt({default:{picker:{width:"18px",height:"18px",borderRadius:"50%",transform:"translate(-9px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}},vertical:{picker:{transform:"translate(-3px, -9px)"}}},{vertical:t==="vertical"});return Z.createElement("div",{style:r.picker})},f3e=Object.assign||function(n){for(var e=1;e.5});return Z.createElement("div",{style:r.picker})},m3e=function(){var e=vt({default:{triangle:{width:0,height:0,borderStyle:"solid",borderWidth:"4px 0 4px 6px",borderColor:"transparent transparent transparent #fff",position:"absolute",top:"1px",left:"1px"},triangleBorder:{width:0,height:0,borderStyle:"solid",borderWidth:"5px 0 5px 8px",borderColor:"transparent transparent transparent #555"},left:{Extend:"triangleBorder",transform:"translate(-13px, -4px)"},leftInside:{Extend:"triangle",transform:"translate(-8px, -5px)"},right:{Extend:"triangleBorder",transform:"translate(20px, -14px) rotate(180deg)"},rightInside:{Extend:"triangle",transform:"translate(-8px, -5px)"}}});return Z.createElement("div",{style:e.pointer},Z.createElement("div",{style:e.left},Z.createElement("div",{style:e.leftInside})),Z.createElement("div",{style:e.right},Z.createElement("div",{style:e.rightInside})))},u4=function(e){var t=e.onClick,r=e.label,i=e.children,s=e.active,o=vt({default:{button:{backgroundImage:"linear-gradient(-180deg, #FFFFFF 0%, #E6E6E6 100%)",border:"1px solid #878787",borderRadius:"2px",height:"20px",boxShadow:"0 1px 0 0 #EAEAEA",fontSize:"14px",color:"#000",lineHeight:"20px",textAlign:"center",marginBottom:"10px",cursor:"pointer"}},active:{button:{boxShadow:"0 0 0 1px #878787"}}},{active:s});return Z.createElement("div",{style:o.button,onClick:t},r||i)},g3e=function(e){var t=e.rgb,r=e.currentColor,i=vt({default:{swatches:{border:"1px solid #B3B3B3",borderBottom:"1px solid #F0F0F0",marginBottom:"2px",marginTop:"1px"},new:{height:"34px",background:"rgb("+t.r+","+t.g+", "+t.b+")",boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 1px 0 #000"},current:{height:"34px",background:r,boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 -1px 0 #000"},label:{fontSize:"14px",color:"#000",textAlign:"center"}}});return Z.createElement("div",null,Z.createElement("div",{style:i.label},"new"),Z.createElement("div",{style:i.swatches},Z.createElement("div",{style:i.new}),Z.createElement("div",{style:i.current})),Z.createElement("div",{style:i.label},"current"))},v3e=function(){function n(e,t){for(var r=0;r100&&(A.a=100),A.a/=100,t({h:i.h,s:i.s,l:i.l,a:A.a,source:"rgb"},u))};return Z.createElement("div",{style:a.fields,className:"flexbox-fix"},Z.createElement("div",{style:a.double},Z.createElement(Ht,{style:{input:a.input,label:a.label},label:"hex",value:s.replace("#",""),onChange:l})),Z.createElement("div",{style:a.single},Z.createElement(Ht,{style:{input:a.input,label:a.label},label:"r",value:r.r,onChange:l,dragLabel:"true",dragMax:"255"})),Z.createElement("div",{style:a.single},Z.createElement(Ht,{style:{input:a.input,label:a.label},label:"g",value:r.g,onChange:l,dragLabel:"true",dragMax:"255"})),Z.createElement("div",{style:a.single},Z.createElement(Ht,{style:{input:a.input,label:a.label},label:"b",value:r.b,onChange:l,dragLabel:"true",dragMax:"255"})),Z.createElement("div",{style:a.alpha},Z.createElement(Ht,{style:{input:a.input,label:a.label},label:"a",value:Math.round(r.a*100),onChange:l,dragLabel:"true",dragMax:"100"})))},b3e=Object.assign||function(n){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var jy=24,I3e=Qj.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?jy:r,s=n.height,o=s===void 0?jy:s,a=n.style,l=a===void 0?{}:a,c=T3e(n,["fill","width","height","style"]);return h4.default.createElement("svg",f4({viewBox:"0 0 "+jy+" "+jy,style:f4({fill:t,width:i,height:o},l)},c),h4.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},R3e=function(e){var t=e.color,r=e.onClick,i=r===void 0?function(){}:r,s=e.onSwatchHover,o=e.first,a=e.last,l=e.active,c=vt({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:t,marginBottom:"1px"},check:{color:X2(t),marginLeft:"8px",display:"none"}},first:{color:{overflow:"hidden",borderRadius:"2px 2px 0 0"}},last:{color:{overflow:"hidden",borderRadius:"0 0 2px 2px"}},active:{check:{display:"block"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},check:{color:"#333"}},transparent:{check:{color:"#333"}}},{first:o,last:a,active:l,"color-#FFFFFF":t==="#FFFFFF",transparent:t==="transparent"});return Z.createElement(nf,{color:t,style:c.color,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},Z.createElement("div",{style:c.check},Z.createElement(I3e,null)))},U3e=function(e){var t=e.onClick,r=e.onSwatchHover,i=e.group,s=e.active,o=vt({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return Z.createElement("div",{style:o.group},rf(i,function(a,l){return Z.createElement(R3e,{key:a,color:a,active:a.toLowerCase()===s,first:l===0,last:l===i.length-1,onClick:t,onSwatchHover:r})}))},aU=function(e){var t=e.width,r=e.height,i=e.onChange,s=e.onSwatchHover,o=e.colors,a=e.hex,l=e.styles,c=l===void 0?{}:l,A=e.className,u=A===void 0?"":A,f=vt(fs({default:{picker:{width:t,height:r},overflow:{height:r,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},c)),h=function(m,g){return i({hex:m,source:"hex"},g)};return Z.createElement("div",{style:f.picker,className:"swatches-picker "+u},Z.createElement(D0,null,Z.createElement("div",{style:f.overflow},Z.createElement("div",{style:f.body},rf(o,function(d){return Z.createElement(U3e,{key:d.toString(),group:d,active:a,onClick:h,onSwatchHover:s})}),Z.createElement("div",{style:f.clear})))))};aU.propTypes={width:Ve.oneOfType([Ve.string,Ve.number]),height:Ve.oneOfType([Ve.string,Ve.number]),colors:Ve.arrayOf(Ve.arrayOf(Ve.string)),styles:Ve.object};aU.defaultProps={width:320,height:240,colors:[[Jf[900],Jf[700],Jf[500],Jf[300],Jf[100]],[qf[900],qf[700],qf[500],qf[300],qf[100]],[eh[900],eh[700],eh[500],eh[300],eh[100]],[th[900],th[700],th[500],th[300],th[100]],[nh[900],nh[700],nh[500],nh[300],nh[100]],[rh[900],rh[700],rh[500],rh[300],rh[100]],[ih[900],ih[700],ih[500],ih[300],ih[100]],[sh[900],sh[700],sh[500],sh[300],sh[100]],[oh[900],oh[700],oh[500],oh[300],oh[100]],["#194D33",Om[700],Om[500],Om[300],Om[100]],[ah[900],ah[700],ah[500],ah[300],ah[100]],[lh[900],lh[700],lh[500],lh[300],lh[100]],[ch[900],ch[700],ch[500],ch[300],ch[100]],[Ah[900],Ah[700],Ah[500],Ah[300],Ah[100]],[uh[900],uh[700],uh[500],uh[300],uh[100]],[fh[900],fh[700],fh[500],fh[300],fh[100]],[hh[900],hh[700],hh[500],hh[300],hh[100]],[dh[900],dh[700],dh[500],dh[300],dh[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};hs(aU);var lU=function(e){var t=e.onChange,r=e.onSwatchHover,i=e.hex,s=e.colors,o=e.width,a=e.triangle,l=e.styles,c=l===void 0?{}:l,A=e.className,u=A===void 0?"":A,f=vt(fs({default:{card:{width:o,background:"#fff",border:"0 solid rgba(0,0,0,0.25)",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",borderRadius:"4px",position:"relative"},body:{padding:"15px 9px 9px 15px"},label:{fontSize:"18px",color:"#fff"},triangle:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent #fff transparent",position:"absolute"},triangleShadow:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent rgba(0,0,0,.1) transparent",position:"absolute"},hash:{background:"#F0F0F0",height:"30px",width:"30px",borderRadius:"4px 0 0 4px",float:"left",color:"#98A1A4",display:"flex",alignItems:"center",justifyContent:"center"},input:{width:"100px",fontSize:"14px",color:"#666",border:"0px",outline:"none",height:"28px",boxShadow:"inset 0 0 0 1px #F0F0F0",boxSizing:"content-box",borderRadius:"0 4px 4px 0",float:"left",paddingLeft:"8px"},swatch:{width:"30px",height:"30px",float:"left",borderRadius:"4px",margin:"0 6px 6px 0"},clear:{clear:"both"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-10px",left:"12px"},triangleShadow:{top:"-11px",left:"12px"}},"top-right-triangle":{triangle:{top:"-10px",right:"12px"},triangleShadow:{top:"-11px",right:"12px"}}},c),{"hide-triangle":a==="hide","top-left-triangle":a==="top-left","top-right-triangle":a==="top-right"}),h=function(m,g){LA(m)&&t({hex:m,source:"hex"},g)};return Z.createElement("div",{style:f.card,className:"twitter-picker "+u},Z.createElement("div",{style:f.triangleShadow}),Z.createElement("div",{style:f.triangle}),Z.createElement("div",{style:f.body},rf(s,function(d,m){return Z.createElement(nf,{key:m,color:d,hex:d,style:f.swatch,onClick:h,onHover:r,focusStyle:{boxShadow:"0 0 4px "+d}})}),Z.createElement("div",{style:f.hash},"#"),Z.createElement(Ht,{label:null,style:{input:f.input},value:i.replace("#",""),onChange:h}),Z.createElement("div",{style:f.clear})))};lU.propTypes={width:Ve.oneOfType([Ve.string,Ve.number]),triangle:Ve.oneOf(["hide","top-left","top-right"]),colors:Ve.arrayOf(Ve.string),styles:Ve.object};lU.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};hs(lU);var cU=function(e){var t=vt({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",border:"2px #fff solid",transform:"translate(-12px, -13px)",background:"hsl("+Math.round(e.hsl.h)+", "+Math.round(e.hsl.s*100)+"%, "+Math.round(e.hsl.l*100)+"%)"}}});return Z.createElement("div",{style:t.picker})};cU.propTypes={hsl:Ve.shape({h:Ve.number,s:Ve.number,l:Ve.number,a:Ve.number})};cU.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var AU=function(e){var t=vt({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",transform:"translate(-10px, -7px)",background:"hsl("+Math.round(e.hsl.h)+", 100%, 50%)",border:"2px white solid"}}});return Z.createElement("div",{style:t.picker})};AU.propTypes={hsl:Ve.shape({h:Ve.number,s:Ve.number,l:Ve.number,a:Ve.number})};AU.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var F3e=function(e){var t=e.onChange,r=e.rgb,i=e.hsl,s=e.hex,o=e.hsv,a=function(h,d){if(h.hex)LA(h.hex)&&t({hex:h.hex,source:"hex"},d);else if(h.rgb){var m=h.rgb.split(",");yM(h.rgb,"rgb")&&t({r:m[0],g:m[1],b:m[2],a:1,source:"rgb"},d)}else if(h.hsv){var g=h.hsv.split(",");yM(h.hsv,"hsv")&&(g[2]=g[2].replace("%",""),g[1]=g[1].replace("%",""),g[0]=g[0].replace("°",""),g[1]==1?g[1]=.01:g[2]==1&&(g[2]=.01),t({h:Number(g[0]),s:Number(g[1]),v:Number(g[2]),source:"hsv"},d))}else if(h.hsl){var p=h.hsl.split(",");yM(h.hsl,"hsl")&&(p[2]=p[2].replace("%",""),p[1]=p[1].replace("%",""),p[0]=p[0].replace("°",""),u[1]==1?u[1]=.01:u[2]==1&&(u[2]=.01),t({h:Number(p[0]),s:Number(p[1]),v:Number(p[2]),source:"hsl"},d))}},l=vt({default:{wrap:{display:"flex",height:"100px",marginTop:"4px"},fields:{width:"100%"},column:{paddingTop:"10px",display:"flex",justifyContent:"space-between"},double:{padding:"0px 4.4px",boxSizing:"border-box"},input:{width:"100%",height:"38px",boxSizing:"border-box",padding:"4px 10% 3px",textAlign:"center",border:"1px solid #dadce0",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",fontFamily:"Roboto,Arial,sans-serif"},input2:{height:"38px",width:"100%",border:"1px solid #dadce0",boxSizing:"border-box",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",paddingLeft:"10px",fontFamily:"Roboto,Arial,sans-serif"},label:{textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"35px",top:"-6px",left:"0",right:"0",marginLeft:"auto",marginRight:"auto",fontFamily:"Roboto,Arial,sans-serif"},label2:{left:"10px",textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"32px",top:"-6px",fontFamily:"Roboto,Arial,sans-serif"},single:{flexGrow:"1",margin:"0px 4.4px"}}}),c=r.r+", "+r.g+", "+r.b,A=Math.round(i.h)+"°, "+Math.round(i.s*100)+"%, "+Math.round(i.l*100)+"%",u=Math.round(o.h)+"°, "+Math.round(o.s*100)+"%, "+Math.round(o.v*100)+"%";return Z.createElement("div",{style:l.wrap,className:"flexbox-fix"},Z.createElement("div",{style:l.fields},Z.createElement("div",{style:l.double},Z.createElement(Ht,{style:{input:l.input,label:l.label},label:"hex",value:s,onChange:a})),Z.createElement("div",{style:l.column},Z.createElement("div",{style:l.single},Z.createElement(Ht,{style:{input:l.input2,label:l.label2},label:"rgb",value:c,onChange:a})),Z.createElement("div",{style:l.single},Z.createElement(Ht,{style:{input:l.input2,label:l.label2},label:"hsv",value:u,onChange:a})),Z.createElement("div",{style:l.single},Z.createElement(Ht,{style:{input:l.input2,label:l.label2},label:"hsl",value:A,onChange:a})))))},uU=function(e){var t=e.width,r=e.onChange,i=e.rgb,s=e.hsl,o=e.hsv,a=e.hex,l=e.header,c=e.styles,A=c===void 0?{}:c,u=e.className,f=u===void 0?"":u,h=vt(fs({default:{picker:{width:t,background:"#fff",border:"1px solid #dfe1e5",boxSizing:"initial",display:"flex",flexWrap:"wrap",borderRadius:"8px 8px 0px 0px"},head:{height:"57px",width:"100%",paddingTop:"16px",paddingBottom:"16px",paddingLeft:"16px",fontSize:"20px",boxSizing:"border-box",fontFamily:"Roboto-Regular,HelveticaNeue,Arial,sans-serif"},saturation:{width:"70%",padding:"0px",position:"relative",overflow:"hidden"},swatch:{width:"30%",height:"228px",padding:"0px",background:"rgba("+i.r+", "+i.g+", "+i.b+", 1)",position:"relative",overflow:"hidden"},body:{margin:"auto",width:"95%"},controls:{display:"flex",boxSizing:"border-box",height:"52px",paddingTop:"22px"},color:{width:"32px"},hue:{height:"8px",position:"relative",margin:"0px 16px 0px 16px",width:"100%"},Hue:{radius:"2px"}}},A));return Z.createElement("div",{style:h.picker,className:"google-picker "+f},Z.createElement("div",{style:h.head},l),Z.createElement("div",{style:h.swatch}),Z.createElement("div",{style:h.saturation},Z.createElement(J1,{hsl:s,hsv:o,pointer:cU,onChange:r})),Z.createElement("div",{style:h.body},Z.createElement("div",{style:h.controls,className:"flexbox-fix"},Z.createElement("div",{style:h.hue},Z.createElement(cp,{style:h.Hue,hsl:s,radius:"4px",pointer:AU,onChange:r}))),Z.createElement(F3e,{rgb:i,hsl:s,hex:a,hsv:o,onChange:r})))};uU.propTypes={width:Ve.oneOfType([Ve.string,Ve.number]),styles:Ve.object,header:Ve.string};uU.defaultProps={width:652,styles:{},header:"Color picker"};hs(uU);const P3e="_InformationContainerPos_1dnrx_2",L3e="_scrollContainer_1dnrx_15",_M={InformationContainerPos:P3e,scrollContainer:L3e,"options-container":"_options-container_1dnrx_24"},D3e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAABE5AAAROQEb2ZNGAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxODowNS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6NDctMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6NDctMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmU1ZTg4ZDczLWQ3YmItNjg0NS1iNDkxLWYxZTU0YmRhZDE1MiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDphYTA0ZDdmOC1lYzY0LWU4NGQtYjI0My1kOGY0YTI1ZTdmM2YiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDphYTA0ZDdmOC1lYzY0LWU4NGQtYjI0My1kOGY0YTI1ZTdmM2YiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmFhMDRkN2Y4LWVjNjQtZTg0ZC1iMjQzLWQ4ZjRhMjVlN2YzZiIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxODowNS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDozNzgwNzA3Yy0zNDg5LTAzNDctYmEwNy1kOTFhY2ZkYmUwODYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6MjQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6ZTVlODhkNzMtZDdiYi02ODQ1LWI0OTEtZjFlNTRiZGFkMTUyIiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjQ3LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+okruHwAAA6NJREFUeNrt279LG2EYwHG1CCqKPwKOJQU3cXYqXZ0KofgPuBWcUmsgoouCFArS0UXaWUpTFxHcUnE4cO6fULoUbWnTFk2ftz4p19BoLve+d33vvsN3KWre97lPUvPm7Gs2m32U3xgCABgCAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABABnlV5VR6QH0mOpIq229VSacPj4E/oY7Y9b0TWZtY0AwO7Qp6WH0q70XrqSmh1qSLMO1zKrj9Hp8a90jbu65mkAxBv4svRR+nHD0MOZr5t3uJ75iGsxa18GQPRBl6Sgy0GHu5QWHa5rUR8j6rrMXkoAuH3Ag9KLHgYcbsfh+nZirs3sbRAA/x5uQXrb4zMs3AdpyMH6hvRnx1nbpe6xAIC/hzssHcUcbrjnUr/F9fXrz7S1PrPXYQBcD3dKemdxuKZP0pzFNc7pz7S5RrPnqVwDkAGMSTXLg211auNtmL4NPXW0RrP3sVwC0EOVwNFgW9XjPMv01anueI2By8Or/xKAbHhSeuN4sK3OpPvSQIT1Dej3nCW0RjOLyVwA0Jf9IKHBhk8IX0vFLtZX1K9tJLzGII3/DtJ4q1dLeLDhvkjH0jNpSXqkLem/HevXpLW+WtJvEZP+IKee4nB9qZ7kB0pJPvOPuLiRzgkKmQCgz/xDLmrkDpN4JUjikOeEi9lzJ64Pi1wDOOAixu7AZwBVLmDsqr7/DrAhfeVCRs7MbCMr7wLWuKCRW8vaOYC5cfIbF/bWzIwqWT0J3LRww0eWM7PZzPpnAeUUztl9yMyknJdPA7el71z0P5lZbOftfgDzSvCTi/97BuW83hG0lfNfDM3et/J+T+BKjgGscFfwNYL1DodF+yl/Pm/j/oP9Doc869wVfPNh0Z50Vzr3GMC57mEvjUMeH/8yqKJvh15Ko9I96cJjABe6h1HdUyPJQx4fAdyRFtruz/MdQDG0nwWzRwB0DyJTAPjjUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAhgDMSJ89BmDWPgOA3gGMS0+kVU8zax8HAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIACQlX4BjeT0VuSSEBUAAAAASUVORK5CYII=",N3e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoyMTozMy0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MTgtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MTgtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjA4MDc2OWJhLTIwNzQtMjU0Zi1iNjM5LWJiZjEyMTFlMjljNSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpjMTM0ZDhjYS01ZTFlLWMzNGMtOWZjNC0zZWU4MjRkNWE1YWMiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpjMTM0ZDhjYS01ZTFlLWMzNGMtOWZjNC0zZWU4MjRkNWE1YWMiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmMxMzRkOGNhLTVlMWUtYzM0Yy05ZmM0LTNlZTgyNGQ1YTVhYyIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoyMTozMy0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo4NzUzMzYxZC05NmIzLTgwNDctYTA0ZC0wODcxYmNiNzY4MDAiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6Mjk6NTctMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MDgwNzY5YmEtMjA3NC0yNTRmLWI2MzktYmJmMTIxMWUyOWM1IiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjE4LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Yrc/VQAAAzxJREFUeNrt3b9LFnEcwHE3IW1oiUCF/gCXcgibmhyaDEqnWhoCaRXqUQhByKVVXAqsMbQyGgIHA6GhSdpNc7E/IBehp8/h94ErRLzoOc671/Ce7/O572t4/PHc9bTb7R41NzcBADcBAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAiAinVrudUfPY92o+0ut5uu1Q9AtQCsRe2SWgMAAAAAAAAAAEo/7KHoWnQl12i0USKAjXTN/AzZTEMAdB/AQvQjfRrvtBMdlAjgIF0zP0M20wIA3QewVOJBF20JAAAAAACAbgJYrDCARQD+30EPRjei66nsU/fVaLXCAFbTjKO5ubMdBgEoDuBR9Cv6+VeHFQZweMy82Q6PACgOYLbCB120WQCKA5ipEYAZAAAAoCCAxzUC8BiAk3+3fzeajCZSN6OXNQLwMu3U2W8y7TwEwNENaTe0CQCWW7cbDOA2AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACcWQB3GgzgDgDLrbHoa/Ql1+foe40O+nvaKb9jtvMYAMutc9Hl9C3hTgPR0xoBeJp2yu+Y7XzO8wE8IAIAAAAAAABPCQPgTwD3ok/Req6P0V6FD3ovzZifOdvhHgD/9hKI7JPzpVwXoxcVBvAizZifeaDKL5fwsGgPiwYAAAAAAACAswJgKnqf3tzV6W20X+JB76dr5mfIZpoCoPsAeqPz6aeETheiDyUC+JCumZ8hm6kXAO8NBAAAAAAAoFQAfdG7EgFk1+oDoLuHOhI9jB6covvRVokAttI1TzNbtsMIAMUBPKnRXwOfAOD/AQAAAAAAACj04si6APDiyBMOejh6Fs3naqX/pqkLgPW0U37HbOdhAI7eoNXUbwZNAuC7gQAAAAAADQYw3mAA440BkD7svYlWotepV9FmgwFspnvQuR8r6R5N1hHAfIMPumjzdQQw52BP3RwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADA2QQwHe1E36JtHdu3dI+mfTVMAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAAV7DcOsgfgT8DmTAAAAABJRU5ErkJggg==",O3e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAAOxAAADsQH1g+1JAAAE7mlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0xMS0yN1QxNToyNToyMC0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMTEtMjdUMTU6MzM6MjgtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMTEtMjdUMTU6MzM6MjgtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjdlZDg3MTgxLTIyMTUtOGY0Ni1iYWM3LTZlNjE0ZmM3ZTljNiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo3ZWQ4NzE4MS0yMjE1LThmNDYtYmFjNy02ZTYxNGZjN2U5YzYiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo3ZWQ4NzE4MS0yMjE1LThmNDYtYmFjNy02ZTYxNGZjN2U5YzYiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjdlZDg3MTgxLTIyMTUtOGY0Ni1iYWM3LTZlNjE0ZmM3ZTljNiIgc3RFdnQ6d2hlbj0iMjAyNC0xMS0yN1QxNToyNToyMC0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDwvcmRmOlNlcT4gPC94bXBNTTpIaXN0b3J5PiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgVVvLIAAAprSURBVHja7Z1rTFvXHcBdRZpAVatVWV5SpX2Z1g9LlCaCD2FLk4YlJOmgiVKyAkmhTSAPViAuYCgLwcBiygIYQ2KwsXHwdTDGBgyBBFhIAgbaoLXLa1IXVaqUSHzZ162VmsQ7x7meHOPHfZzre6/9//BTFAP/e+79/+65556XFV6vVwEkLnARQAC4CCAAAAIAIAAAAgAgAAACACAAAAIAIAAAAgAgAAACACBACA5e/pwzH1rPKUyTgwrzlEvxR2vt/z8fvz39CvrXSPME4Q1mX89n3nf1n0bDGIBCTrC9lvEiQBpiOZeqWw6VdA4CBLKM0IEA0hNgdeu4NfWw9ex/oiWdpwDBpCDWgQAiCpDdd7ZO5eoYYpN4ggJgJhGrQYDYC1CAWOKSeMICYO4jXCBAbARYg9jJJ/ECCOCnC7EeBBBOgG2If5NIvkAC+CkAAcgLsBXxHankCyzAU0Q5CEBWgKckky+wAJjniKMgAH8BtgiR/BgI4CcbBOAuQBrpal8EATBKEIC9AGtINvhEFuBHRDEIwE6AnUImP8YCYNoRSUInfXd3GedONSkJkC908kUQAKMFAZgJsBSnAniFSjw6F0Vmr0qR1VslawFWIZpikXwRBXiMSCYtwHumCl5jKqIKcNJY7+NYT11KrJIvogCYiySTn2FUKjLNKvkKoNVqfTR0XEhNEAEeIbaQSP4ufQnvxIsuwAeWGh+HLDX/JZBYSwBSFQCzX6jpWXJtA6TxTXzNdUO+eenqb3DMds/gdtW4vjCSCEwFyDLVtP5pSHvijFuXjzloqf4CfW7mKwEIQKOboPB0rmU+yW+bc7wbKrZmxprJUwBz89+cO4LjotetLr4SgAA0i4uLrxyxqXkJEC722D/nk/kI8FF/Q3W42ARqgYcgwIsCG/lW/0IJcMyhOSOgAM9AAIkL8LH9fHmouMP3Z18DAcgJ8ISvAKXudmWo2MXDrVV8BNhn/Kxj9MH8q8FxMwzKS4TmDNSDAGTe6y3BNUG010EWr4H4TjfjmF23Jzf5/0/oddANApDr3LGEgFQ/gJlw4kEAAQSQS08gCAACgAAgwAtmEWtBgMQVAFMEAoAAIAAIAAIwQXekv76x0+NMvbQwvPX8dcs+/JlIAtgx9VPmrJZb/e8UD7V8Sn/GJsb3u7vLth+wVOehMhUhUkCACMnHBP+9eWn8LS4S8BXgmENTFVwW/BlLCZbfM1W4UXl+oMv1LcIdgnoQIETy/TTftKXHWAC7crSjMMwgEataAAnApLzPEc9oHoIAQbju3XrjUN+f22IpQIRRQiEECMd+xNsJLwAmx1anYfMo4CGA3Xnv5i8kIgDmEeIiIjmhBaBj6ZhKwFEA+8iDudcjlYGNALsNZ7wHLleTerN5HO/zAXQsJBBCAHuWWaWPdGzcLmAjwB4kgACvuFpEUrxOCIkqgGpcf4SJBCwFsGcYlJZox86zqRvZSCWQAJh2xGlZCOCcmfhVLnWO6UpgXam7/WS0mEWu5spoErAQwB6p0efHcXdmLdvn//u9VUJ2dv2IUEpegJueWXznsJkUqjPdufpWtLhXF+4kfWg790U4ERgKYM8wRr/zuTT+dnWVxKrXM1sO6wLYduTomMZvmu7bE6pxGEUA312vuWHdwyL5rASIcdf3ETksDmUlwOfjXblsjmNYcG8KEEGHBDAFJxyT09eoGfpm4Q2mcTs8rlQOXcCxFgB3JJXHkwA+CT5xaGq4HrdswHAyMPFcYhgW3ZtQVc46+X8wV4oxAPaU3mBTsgJwWR2sq5syHxRji3THP26s5XLnp6Nnf2avyivWKChivVQFWIeY5CKBesqcFcvkd6M7n0vyMXuNSjGTj+mS8g4hqxH3uUhQcEVTq51z/Fbo5OdY1Zpd+hJOyU/vKvUesFSLLQDGJeUtYlw8TkzXfM2WLkTiA9sLXAeRJJB4P/fpm02yu4R18ZEA0780uWH0oedVXs/5uzNrMTnUOQ2fxGMyxK/6g5mkH7uSFGA9oZPUKcc6Cmsnez6w/X3yTaZlwn36bPv1oyVfIlV/MClS3im0gPA2sbpgft9daguq2nlX8ytG/LrLpJj4QCS9V3A53Ykh20mhEk++5AVQ0N2YshRgP//JHrFAJ4ft4rNlJIBtr6G856DlLJ6iFgjfMl8MA9+4y3L5xhAlPcQpZQFspSPaFZNFjw82VfKV4PjAym5v1bg+n5AERskLQP/uaXqygyQFKHOZC8Od58cOTTWfu3/w6xsh5yG23LbvICCBPASgfz+JnvYkKQEyDEqv/cs7G8IOPo3qCrmWtdTZdjrKNUwcAYL+9rHYAqQHTOyoGO09KoQAZS7BBfDKVYBk+uQfxVoAnPi9Kzt42sKd57EX7QDij4D2ucFtCStAQIy36UUSqlgIgMfzs0IP6bY1TPWu2Ab21NCFEr6NwJODzRXBcdXTvQcINQLlLUCImA8DllI9JyEAizl8bWGQ6mtg/AkQFL8+1ILLXErzbYahHCf3h/SuUjeq0pdfXrRR5pu2jcmyVMmhQwcEYIN6Yizl8OXGInRn52X2qrZnmiu/x8u0/BBcsQMCSFGAoDIUJVKyQQAQAAQIxPbNVGrxcOu/QIAEFQBzfsbqBgESWAD67UCsBFB5NnXnYWutCQSIbwEoTKW7s1g769il8zh3+MFluH7vq1WBnxU5mxv9fwMCyFsAXxId81MbuJTNODeyWWgRQADhBKA6pwd+R6KMxx1NGqEkAAFe9BiSnH9IlTq15T1fjW0mWc5Ls1e3FTqaGgmL8CThBaDL8oxU8hsmTNlClvXUUEstQQmMIAA5AajqUX1hjMpLql0AAgSMIvJK/omBC+pYLlTN729s5VnmnxANIACZzasppscZeTD3876F8V+XOH1fbOW/kyndLccO/DOmcSbuen7GsxaQx6xgGQhAOb6+weg1r8LdWRwlaVSB/S+tNdcMnzCJVzdtzuMhQRoI8HJ59nO5kIWOlsZosUc986+xfG5TTGuVHKpOH68rg2ItwBYOcwwp89L4xkhx+z233uR4l1KnnH+tjVZuzXXL+xziT4IABGbZFgycb40U79o9z6pc7neoT4KyYW05w7eCuFkdLKYAyWymnBcPt0bcrOqw9SyJQR4q94paT1CAJsQqEIBAg/CU60LYKvrK4sQvCXbYUIQEWJLyFjFSEoDRCqRcW/g7k3CXLXV6qCWkbKZ590YWx8oHAZiVLYnhWkTqaH9D+0tfZfPl2MYTjmY16cGbbPQ4Md0eeanB2bM4uvlQX81lhjF2SnmXMEkJQJevmOGqZCoEgg4vczgW3pR7jSwFEBllHEz7+s7f6QMCcCNbxsl/SvdvKEAAfhwVas8igZMv+e3i5UQ54d3LhK72t4IA5CmQQfJxg2+bHL4zSK6s57mjqZDsDNfaBwHI4+K4wbUQLEX6TgAQQDhWc9zqniRNfM4BBODPOo5fekFi0+eUwIEdEEAa6OjpVqQT/hMdN41keUEA4TAGwHnefkCMBiHKKZoAgPyBiwACwEUAAQAQAAABABAAAAEAEAAAAQAQAAABABAAAAEAEACIV/4HmscvZd8W84IAAAAASUVORK5CYII=",k3e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxOTozNC0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzM6MTEtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzM6MTEtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjJkMTY5MDdlLWQyY2EtZDA0Mi05MWRjLTliZTMyYzYyYjlmOSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDowMzZkNWExYy1jOTYwLTAxNDktODlkMC00NzQ0NDMwM2QyNWQiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowMzZkNWExYy1jOTYwLTAxNDktODlkMC00NzQ0NDMwM2QyNWQiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjAzNmQ1YTFjLWM5NjAtMDE0OS04OWQwLTQ3NDQ0MzAzZDI1ZCIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxOTozNC0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo2N2JiZmQ0OC0yMGMzLTI0NDktODQyNS1kNWJmOTBlNzMwYjYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6MTQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MmQxNjkwN2UtZDJjYS1kMDQyLTkxZGMtOWJlMzJjNjJiOWY5IiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMzOjExLTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Q6I0lAAAAs1JREFUeNrt3TtrFFEYgOFE2HjFXgv9AyIYsbATMaAWQtqAYBPQ0ibCgoSA/yGbwsJ/o6Ag3gMWEkurTeGlcfwGzoIs7LKT3TXOOU/xFlnYkNnvIRNOZs4sVFW1oHLzIQDgQwBAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAiAiVt91l2OXkRVi3oTXQVg+uHfjX60bPiDfkUPADj48C+2ePh/dx2AgwF4ncHw695HHQCaA6gy6hYAZQPYAqBsANsAlA1gBwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAogDE14tRt359RL3ocbQSLQGQH4Aj0bsJ31tfF3EDgPwAvGzw/t/ROgDlAhhcY7gMQLkABpeXnQSgXAB1mwCUDeAjAGUD6ANQNoB9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOCQ6wFQNoAnQ8fWiXYBKAfAnaFjOxXtATAewIdMhv85Ojp0bGfqq3sBGA/gcrodKrt9guO11Sm+XxkA0gd1P90Y2dbhb4w4rm8ATI5gpYVbx+8On/eHHoJRAdAMwVJ9j3zaNKE3ZmOFw6z+uTaj29HxEcdxLvoKQIHVd/XW9/XN4LcLAC0c/vno04xOLwC0bPj3oi8z/PsCgIYDWExLr/+iTlrkORutTbHYA8AMAXTTuvu8e5XO8XtTLPIAMAcATzNbVgagIYAdAAAAAAAAAAAAAADKA7CdGYA+AM0AbGUG4C0AzQDczAzABgDNAHTSHrs5DL9ebTwGQHME1zIY/vfoQjG7hc8BwXr0s8XDXyvqeQFzQnClhZeXPY8uFffEkDkiOB09ShDq/9rt/4f10/n+YXSiyGcGqfCnhgkAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAAaBp+gMB5Yr6zMTlPAAAAABJRU5ErkJggg==",Q3e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxOTo1Ny0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MjYtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MjYtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmFmYmE3YzFhLWI0MTMtMGQ0MS05YmRkLTE2ZGY2MTllOTgyMSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo5MTFjMjQ0NC01M2M4LWI1NDgtYmYwZi03M2VhOGZlOTVmM2UiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo5MTFjMjQ0NC01M2M4LWI1NDgtYmYwZi03M2VhOGZlOTVmM2UiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjkxMWMyNDQ0LTUzYzgtYjU0OC1iZjBmLTczZWE4ZmU5NWYzZSIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxOTo1Ny0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpmNjZhMzQ1Ni02ODczLWQ5NDYtOTRkMy1mZTYwZjQ5NzliNjYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6NDQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6YWZiYTdjMWEtYjQxMy0wZDQxLTliZGQtMTZkZjYxOWU5ODIxIiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjI2LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+F7DBkwAABCVJREFUeNrt3TtMFEEYwHHuAiYkNjRg74mJpSYUkCiGAhKxsLKXggQ6yi2wQUh8RMCGRJulEgotjgLwVaCVDYYeHzQaKU5FCRo4vwnfRdQgHvu4mZ1/8W/Iec7c/u7gdmd368rlch35Gy8CAHgRAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAJLpUhjkpW5pQfoolaRPjlXSsZs59Jg5AeDgDZ+T2qRFaUcqZyQzl0c6txwA9n/X9+m7ppzR1nWOeQD8DaBD+pzhjV/JzLEDAL9v/JPSmgcbv5KZaysAfv3ev+PRxq80acPfAzYAKEgrHgIwcy4AIAwGpS8eAjBzHgBAGEx7uPErhQAIg6LHAIoACIM5jwHMAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIuA3pjbYBgOwDMOvyNqUZ6azUuGcMjfqz+/qYHQBkC8BXaUI6/p/rE8b13wAgAwB+SOel+irGVC91St8B4DYAs8K4J8LYehJepQyAhAEMVfPO3+eTYAgAbgJYinGMSwBwC8A36VyMY+zU5wSAIwCWpeYYx9gsvQKAOwAe7P2eH8MYzX6ChwBwB8DtOE+60PMWxwHgDoCRBMY5AgB3AIzHeQaufgJMAIC/AQDg8beAZQC4A2Argf0AWwBwa0/gc+lIDONr0OdiT6CjxwJyEcaW41iA2wDeS70RxnZBnwMADq8HMOfhXzzEuHpTuG4BAFJaEWQO5IxKp/61f0C/75vHXEvo4A8Aarwm8J00K13WpV9HtYL+bFYfw5pAT5aFb2osC+e8AABkFcBOxADgGIBt6YU0pUfwhqWrh2xYn2NKn3MbAHYDeCId0713ed2RE0d5fc4W6TEA7APwVuqPsgK4ypXC/XpKGQAsAPBB6qrBuLti2EsIgIgAzFk/fTUce5+OAQA1AjCTxsf+Ab8OZgBQGwDmtiynLRj/mQj3OQBABAAv41z1E2H8LToWAKQMwOy3b7Bg/A06FgCkDOCmRbe7uQWA9AGMWgRgFADpAxizCMAYAAAAAAAAgL8BAJAagOsWAbgBgPQBPJWaLBh/k/QMAOkDMIsz7lkw/rsRFooAIIbDweY27avS65Rb1f+bw8EsCgUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcCCAoscAigAIg2mPAYQACIPBFC7GZGNmzgMA2L0+z4qHAMycCwDYPf9+0kMAk3He08BZAIqgVVrzaOObuZ6w4bW3AoAiaI9wkqVLmTm22/K62wTA/Cq4kvCNGmvdul5TIA+A/RG0SQspXqwxrYtULurccja95lYB+OOSrd3SvH4ilPR6AC5V0rHP6y1o8za+1lYCIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAFXRT5xealqlzx1wAAAAAElFTkSuQmCC",H3e="_InformationContainerPos_1m76y_2",z3e="_scrollContainer_1m76y_15",G3e="_centerAlign_1m76y_25",V3e="_traitInfoTitle_1m76y_28",j3e="_dropdownFlex_1m76y_38",W3e="_checkboxFlex_1m76y_44",K3e="_simpleFlex_1m76y_49",X3e="_traitInfoText_1m76y_55",Y3e="_dropdownBase_1m76y_64",$3e="_dropdownControl_1m76y_74",Z3e="_dropdownControlSmall_1m76y_80",J3e="_flexSelect_1m76y_106",q3e="_checked_1m76y_163",eke="_checkmark_1m76y_167",tke="_checkboxHolder_1m76y_180",nke="_actionButton_1m76y_189",rke="_tabHolder_1m76y_209",ike="_tabButton_1m76y_215",ske="_tabButtonSelected_1m76y_235",Ke={InformationContainerPos:H3e,scrollContainer:z3e,centerAlign:G3e,traitInfoTitle:V3e,dropdownFlex:j3e,checkboxFlex:W3e,simpleFlex:K3e,traitInfoText:X3e,dropdownBase:Y3e,dropdownControl:$3e,dropdownControlSmall:Z3e,"input-box":"_input-box_1m76y_87",flexSelect:J3e,"arrow-button":"_arrow-button_1m76y_114","left-button":"_left-button_1m76y_130","right-button":"_right-button_1m76y_137","anim-button":"_anim-button_1m76y_144","custom-checkbox":"_custom-checkbox_1m76y_149","checkbox-container":"_checkbox-container_1m76y_154",checked:q3e,checkmark:eke,checkboxHolder:tke,actionButton:nke,tabHolder:rke,tabButton:ike,tabButtonSelected:ske},oke="_slider_1y6nx_1",ake="_infoContainer_1y6nx_13",Wy={"slider-container":"_slider-container_1y6nx_1",slider:oke,infoContainer:ake,"input-box":"_input-box_1y6nx_18"};function mu({title:n,value:e,min:t,max:r,onChange:i,step:s,stepBox:o}){return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:Wy.infoContainer,children:[n,o&&k.jsx("input",{type:"number",min:"0",max:"100",value:e,onChange:i,className:Wy["input-box"],step:o})]}),k.jsx("div",{className:Wy["slider-container"],children:k.jsx("input",{type:"range",min:t,max:r,value:e,onChange:i,className:Wy.slider,step:s})})]})}function lke({selectedTrait:n,selectedVRM:e}){const{animationManager:t,characterManager:r}=be.useContext($n),[i,s]=be.useState(0),[o,a]=be.useState(0),[l,c]=be.useState(0);be.useEffect(()=>{var d,m,g;e!=null&&(c((d=e.data)==null?void 0:d.cullingLayer),s(((m=e.data)==null?void 0:m.cullingDistance[0])||0),a(((g=e.data)==null?void 0:g.cullingDistance[1])||0))},[e]);const A=d=>{s(d.target.value),e!=null&&e.data&&(e.data.cullingDistance[0]=d.target.value)},u=d=>{a(d.target.value),e!=null&&e.data&&(e.data.cullingDistance[1]=d.target.value)},f=d=>{e!=null&&e.data&&(c(d.target.value),e.data.cullingLayer=d.target.value)},h=()=>{r.updateCullHiddenMeshes()};return k.jsx("div",{children:k.jsxs("div",{className:Ke.InformationContainerPos,children:[k.jsx(Aa,{title:"Trait Information",width:180,right:20}),k.jsx("div",{className:Ke.scrollContainer,children:n!=null?k.jsxs(k.Fragment,{children:[k.jsx("div",{className:Ke.traitInfoTitle,children:"Trait ID"}),k.jsx("div",{className:Ke.traitInfoText,children:n==null?void 0:n.id}),k.jsx("div",{className:Ke.traitInfoTitle,children:"Trait Name"}),k.jsx("div",{className:Ke.traitInfoText,children:n==null?void 0:n.name}),k.jsx("div",{className:Ke.traitInfoTitle,children:"Description"}),k.jsx("div",{className:Ke.traitInfoText,children:(n==null?void 0:n.description)||"A nice "+(n==null?void 0:n.name)}),k.jsx("div",{className:Ke.traitInfoTitle,children:"Culling Options"}),k.jsx("br",{}),k.jsxs("div",{className:Ke.traitInfoText,children:["Culling Layer",k.jsx("input",{type:"number",min:"0",max:"100",value:l,onChange:f,className:Ke["input-box"],step:1}),k.jsx("br",{}),k.jsx("br",{}),k.jsx(mu,{title:"Out Distance",value:i,onChange:A,min:0,max:1,step:.001,stepBox:.01}),k.jsx("br",{}),k.jsx(mu,{title:"In Distance",value:o,onChange:u,min:0,max:1,step:.001,stepBox:.01}),k.jsx("div",{className:Ke.actionButton,onClick:h,children:k.jsx("div",{children:"Update Culling "})})]})]}):k.jsx(k.Fragment,{children:k.jsx("div",{className:Ke.traitInfoTitle,children:"No Trait Selected"})})})]})})}var Hj={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var e=s(be),t=r(bV);function r(b){return b&&b.__esModule?b:{default:b}}function i(){if(typeof WeakMap!="function")return null;var b=new WeakMap;return i=function(){return b},b}function s(b){if(b&&b.__esModule)return b;if(b===null||o(b)!=="object"&&typeof b!="function")return{default:b};var B=i();if(B&&B.has(b))return B.get(b);var S={},I=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var M in b)if(Object.prototype.hasOwnProperty.call(b,M)){var L=I?Object.getOwnPropertyDescriptor(b,M):null;L&&(L.get||L.set)?Object.defineProperty(S,M,L):S[M]=b[M]}return S.default=b,B&&B.set(b,S),S}function o(b){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?o=function(S){return typeof S}:o=function(S){return S&&typeof Symbol=="function"&&S.constructor===Symbol&&S!==Symbol.prototype?"symbol":typeof S},o(b)}function a(){return a=Object.assign||function(b){for(var B=1;B"u"?w:S.placeholder,value:""},isOpen:!1},I.dropdownRef=(0,e.createRef)(),I.mounted=!0,I.handleDocumentClick=I.handleDocumentClick.bind(g(I)),I.fireChangeEvent=I.fireChangeEvent.bind(g(I)),I}return h(B,[{key:"componentDidUpdate",value:function(I){if(this.props.value!==I.value)if(this.props.value){var M=this.parseValue(this.props.value,this.props.options);M!==this.state.selected&&this.setState({selected:M})}else this.setState({selected:{label:typeof this.props.placeholder>"u"?w:this.props.placeholder,value:""}})}},{key:"componentDidMount",value:function(){document.addEventListener("click",this.handleDocumentClick,!1),document.addEventListener("touchend",this.handleDocumentClick,!1)}},{key:"componentWillUnmount",value:function(){this.mounted=!1,document.removeEventListener("click",this.handleDocumentClick,!1),document.removeEventListener("touchend",this.handleDocumentClick,!1)}},{key:"handleMouseDown",value:function(I){this.props.onFocus&&typeof this.props.onFocus=="function"&&this.props.onFocus(this.state.isOpen),!(I.type==="mousedown"&&I.button!==0)&&(I.stopPropagation(),I.preventDefault(),this.props.disabled||this.setState({isOpen:!this.state.isOpen}))}},{key:"parseValue",value:function(I,M){var L;if(typeof I=="string")for(var D=0,T=M.length;D"u"&&(L=I.label||I);var D=I.label||I.value||I,T=L===this.state.selected.value||L===this.state.selected,y=(M={},A(M,"".concat(this.props.baseClassName,"-option"),!0),A(M,I.className,!!I.className),A(M,"is-selected",T),M),E=(0,t.default)(y),R=Object.keys(I.data||{}).reduce(function(F,O){return c({},F,A({},"data-".concat(O),I.data[O]))},{});return e.default.createElement("div",a({key:L,className:E,onMouseDown:this.setValue.bind(this,L,D),onClick:this.setValue.bind(this,L,D),role:"option","aria-selected":T?"true":"false"},R),D)}},{key:"buildMenu",value:function(){var I=this,M=this.props,L=M.options,D=M.baseClassName,T=L.map(function(y){if(y.type==="group"){var E=e.default.createElement("div",{className:"".concat(D,"-title")},y.name),R=y.items.map(function(F){return I.renderOption(F)});return e.default.createElement("div",{className:"".concat(D,"-group"),key:y.name,role:"listbox",tabIndex:"-1"},E,R)}else return I.renderOption(y)});return T.length?T:e.default.createElement("div",{className:"".concat(D,"-noresults")},"No options found")}},{key:"handleDocumentClick",value:function(I){this.mounted&&(this.dropdownRef.current.contains(I.target)||this.state.isOpen&&this.setState({isOpen:!1}))}},{key:"isValueSelected",value:function(){return typeof this.state.selected=="string"||this.state.selected.value!==""}},{key:"render",value:function(){var I,M,L,D,T,y=this.props,E=y.baseClassName,R=y.controlClassName,F=y.placeholderClassName,O=y.menuClassName,z=y.arrowClassName,j=y.arrowClosed,Q=y.arrowOpen,C=y.className,W=this.props.disabled?"Dropdown-disabled":"",ee=typeof this.state.selected=="string"?this.state.selected:this.state.selected.label,P=(0,t.default)((I={},A(I,"".concat(E,"-root"),!0),A(I,C,!!C),A(I,"is-open",this.state.isOpen),I)),re=(0,t.default)((M={},A(M,"".concat(E,"-control"),!0),A(M,R,!!R),A(M,W,!!W),M)),ue=(0,t.default)((L={},A(L,"".concat(E,"-placeholder"),!0),A(L,F,!!F),A(L,"is-selected",this.isValueSelected()),L)),le=(0,t.default)((D={},A(D,"".concat(E,"-menu"),!0),A(D,O,!!O),D)),me=(0,t.default)((T={},A(T,"".concat(E,"-arrow"),!0),A(T,z,!!z),T)),ie=e.default.createElement("div",{className:ue},ee),ge=this.state.isOpen?e.default.createElement("div",{className:le,"aria-expanded":"true"},this.buildMenu()):null;return e.default.createElement("div",{ref:this.dropdownRef,className:P},e.default.createElement("div",{className:re,onMouseDown:this.handleMouseDown.bind(this),onTouchEnd:this.handleMouseDown.bind(this),"aria-haspopup":"listbox"},ie,e.default.createElement("div",{className:"".concat(E,"-arrow-wrapper")},Q&&j?this.state.isOpen?Q:j:e.default.createElement("span",{className:me}))),ge)}}]),B}(e.Component);_.defaultProps={baseClassName:"Dropdown"};var x=_;n.default=x})(Hj);const Qc=oc(Hj);function cke({selectedTrait:n,selectedVRM:e}){const{manifest:t,loraDataGenerator:r,sceneElements:i}=Z.useContext($n),[s,o]=be.useState([]),[a,l]=be.useState(null),c=u=>{(t==null?void 0:t.loras)!=null&&(l(t.loras[u.value]),console.log(t.loras[u.value]))},A=async()=>{const u=i.parent;u.remove(i),await r.createLoraData(a),u.add(i)};return be.useEffect(()=>{if((t==null?void 0:t.loras)!=null){const u=t.loras.map((f,h)=>({value:h,label:f.name,description:f.description,manifest:f.manifest}));o(u)}},[t]),k.jsx("div",{children:k.jsxs("div",{className:Ke.InformationContainerPos,children:[k.jsx(Aa,{title:"Lora Creation",width:180,right:20}),k.jsxs("div",{className:Ke.scrollContainer,children:[k.jsx("div",{className:Ke.traitInfoTitle,children:"Lora Manifests"}),k.jsx(Qc,{className:Ke.dropdownControl,options:s,onChange:c,placeholder:"Select an option"}),";",k.jsx("div",{className:Ke.traitInfoText,children:(a==null?void 0:a.description)||""}),a!=null&&k.jsx("div",{className:Ke.actionButton,onClick:A,children:k.jsx("div",{children:" Create Lora Data "})})]})]})})}function Ake({selectedTrait:n,selectedVRM:e}){const{manifest:t,spriteAtlasGenerator:r,sceneElements:i}=Z.useContext($n),[s,o]=be.useState([]),[a,l]=be.useState(""),[c,A]=be.useState(null),u=h=>{(t==null?void 0:t.sprites)!=null&&(l(t.sprites[h.value].description),A(t.sprites[h.value]))},f=async()=>{const h=i.parent;h.remove(i),await r.createSpriteAtlas(c),h.add(i)};return be.useEffect(()=>{if((t==null?void 0:t.sprites)!=null){const h=t.sprites.map((d,m)=>({value:m,label:d.name,description:d.description,manifest:d.manifest}));o(h)}},[t]),k.jsx("div",{children:k.jsxs("div",{className:Ke.InformationContainerPos,children:[k.jsx(Aa,{title:"Sprite Creation",width:180,right:20}),k.jsxs("div",{className:Ke.scrollContainer,children:[k.jsx("div",{className:Ke.traitInfoTitle,children:"Sprite Manifests"}),k.jsx(Qc,{className:Ke.dropdownControl,options:s,onChange:u,placeholder:"Select an option"}),";",k.jsx("div",{className:Ke.traitInfoText,children:a||""}),c!=null&&k.jsx("div",{className:Ke.actionButton,onClick:f,children:k.jsx("div",{children:" Create Sprite Data "})})]})]})})}const d4=4096;function uke({selectedTrait:n,traitGroupName:e}){const{manifest:t,thumbnailsGenerator:r,sceneElements:i,characterManager:s}=Z.useContext($n),[o,a]=be.useState([]),[l,c]=be.useState(""),[A,u]=be.useState(""),[f,h]=be.useState(""),[d,m]=be.useState(!1),[g,p]=be.useState(512),[v,w]=be.useState(512),[_,x]=be.useState(.1),[b,B]=be.useState(.1),[S,I]=be.useState("center"),[M,L]=be.useState("center"),[D,T]=be.useState("center"),[y,E]=be.useState("head"),[R,F]=be.useState("chest"),[O,z]=be.useState(!0),[j,Q]=be.useState(!1),C=[{label:"center"},{label:"left"},{label:"right"}],W=[{label:"center"},{label:"top"},{label:"bottom"}],ee=[{label:"center"},{label:"front"},{label:"back"}],P=[{label:"head"},{label:"neck"},{label:"chest"},{label:"spine"},{label:"hips"},{label:"upperLeg"},{label:"lowerLeg"},{label:"foot"}],re=Ae=>{(t==null?void 0:t.thumbnails)!=null&&(c(t.thumbnails[Ae.value].description),h(t.thumbnails[Ae.value].manifest),u(t.thumbnails[Ae.value].name))},ue=(Ae,J,q,he)=>isNaN(Ae)?he:Ae>q?q:Ae{const J=parseInt(Ae.target.value);p(ue(J,1,d4,512))},me=Ae=>{const J=parseInt(Ae.target.value);w(ue(J,1,d4,512))},ie=Ae=>{const J=parseFloat(Ae.target.value);x(ue(J,0,1,.1))},ge=Ae=>{const J=parseFloat(Ae.target.value);B(ue(J,0,1,.1))},_e=Ae=>{m(Ae)},se=async()=>{const Ae=i.parent;Ae.remove(i),await r.createThumbnails(t.thumbnails[0]),Ae.add(i)},H=(Ae=!0)=>({topFrameOffset:b,bottomFrameOffset:_,thumbnailsWidth:g,thumbnailsHeight:v,backgroundColor:[0,0,0,0],thumbnailsCollection:[{traitGroup:e,cameraPosition:M+"-"+D+"-"+S,topBoneName:y==="upperLeg"||y==="lowerLeg"||y==="foot"?"left"+y[0].toUpperCase()+y.slice(1):y,topBoneMaxVertex:O,bottomBoneName:R==="upperLeg"||R==="lowerLeg"||y==="foot"?"left"+R[0].toUpperCase()+R.slice(1):R,bottomBoneMaxVertex:j,saveOnlyIDs:Ae?null:n.id}]}),fe=async(Ae=!1)=>{s.storeCurrentAvatar();const J=i.parent;J.remove(i),Ae?await r.createThumbnailsWithObjectData(H(),!1,null,e+"_thumbnails"):await r.createThumbnailsWithObjectData(H(!1),!1),J.add(i),s.loadStoredAvatar()};return be.useEffect(()=>{if((t==null?void 0:t.thumbnails)!=null){const Ae=t.thumbnails.map((J,q)=>({value:q,label:J.name,description:J.description,manifest:J.manifest}));a(Ae)}},[t]),k.jsx("div",{children:k.jsxs("div",{className:Ke.InformationContainerPos,children:[k.jsx(Aa,{title:"Thumbnail Creation",width:180,right:20}),k.jsxs("div",{className:Ke.scrollContainer,children:[k.jsxs("div",{className:Ke.tabHolder,children:[k.jsx("div",{className:Ke.tabButton+(d?"":" "+Ke.tabButtonSelected),onClick:()=>{_e(!1)},children:k.jsxs("div",{children:[" ","Custom"," "]})}),k.jsx("div",{className:Ke.tabButton+(d?" "+Ke.tabButtonSelected:""),onClick:()=>{_e(!0)},children:k.jsxs("div",{children:[" ","Manifest"," "]})})]}),k.jsx("br",{}),d?k.jsxs(k.Fragment,{children:[k.jsx("div",{className:Ke.traitInfoTitle+" "+Ke.centerAlign,children:"Thumbnail Manifests"}),k.jsx(Qc,{className:Ke.dropdownControl,options:o,value:A,onChange:re,placeholder:"Select an option"}),";",k.jsx("div",{className:Ke.traitInfoText,children:l||""}),f!=""&&k.jsx("div",{className:Ke.actionButton,onClick:se,children:k.jsx("div",{children:" Create Thumbnails "})})]}):k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:Ke.traitInfoText,children:[k.jsx("div",{className:Ke.traitInfoTitle+" "+Ke.centerAlign,style:{margin:"10px 0px 10px"},children:"Resolution"}),"Width ",k.jsx("input",{value:g,className:Ke["input-box"],step:1,onChange:Ae=>{p(Ae.target.value)},onBlur:le}),k.jsx("br",{}),"Height ",k.jsx("input",{value:v,className:Ke["input-box"],step:1,onChange:Ae=>{w(Ae.target.value)},onBlur:me}),k.jsx("br",{}),"Top Spacing ",k.jsx("input",{value:_,className:Ke["input-box"],step:.1,onChange:Ae=>{x(Ae.target.value)},onBlur:ie}),k.jsx("br",{}),"Bottom Spacing ",k.jsx("input",{value:b,className:Ke["input-box"],step:.1,onChange:Ae=>{B(Ae.target.value)},onBlur:ge}),k.jsx("br",{}),k.jsx("div",{className:Ke.traitInfoTitle+" "+Ke.centerAlign,style:{margin:"20px"},children:"Camera Position"})]}),k.jsxs("div",{className:Ke.dropdownFlex,children:[k.jsx("div",{className:Ke.traitInfoTitle,style:{margin:"0px"},children:"X"}),k.jsx(Qc,{className:Ke.dropdownControlSmall,options:C,onChange:Ae=>{L(Ae.label)},value:M})]}),k.jsxs("div",{className:Ke.dropdownFlex,children:[k.jsx("div",{className:Ke.traitInfoTitle,style:{margin:"0px"},children:"Y"}),k.jsx(Qc,{className:Ke.dropdownControlSmall,options:W,onChange:Ae=>{T(Ae.label)},value:D})]}),k.jsxs("div",{className:Ke.dropdownFlex,children:[k.jsx("div",{className:Ke.traitInfoTitle,style:{margin:"0px"},children:"Z"}),k.jsx(Qc,{className:Ke.dropdownControlSmall,options:ee,onChange:Ae=>{I(Ae.label)},value:S})]}),k.jsx("div",{className:Ke.traitInfoTitle+" "+Ke.centerAlign,style:{margin:"30px 0px 30px"},children:"Target Bones"}),k.jsxs("div",{className:Ke.dropdownFlex,style:{justifyContent:"space-between"},children:[k.jsx("div",{className:Ke.traitInfoTitle,style:{margin:"0px"},children:"Top"}),k.jsx(Qc,{className:Ke.dropdownControlSmall,options:P,onChange:Ae=>{E(Ae.label)},value:y})]}),k.jsxs("div",{className:Ke.dropdownFlex,style:{justifyContent:"space-between"},children:[k.jsx("div",{className:Ke.traitInfoTitle,style:{margin:"0px"},children:"Bottom"}),k.jsx(Qc,{className:Ke.dropdownControlSmall,options:P,onChange:Ae=>{F(Ae.label)},value:R})]}),k.jsxs("div",{style:{textAlign:"left"},children:[k.jsxs("div",{className:Ke.checkboxFlex,style:{marginTop:"20px"},children:[k.jsx("input",{type:"checkbox",checked:O,onChange:Ae=>{z(Ae.target.checked)}}),k.jsx("div",{className:Ke.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Top bone ${O?"uses Top":"uses Low"} Vertex`})]}),k.jsxs("div",{className:Ke.checkboxFlex,style:{marginTop:"10px"},children:[k.jsx("input",{type:"checkbox",checked:j,onChange:Ae=>{Q(Ae.target.checked)}}),k.jsx("div",{className:Ke.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Bottom bone ${j?"uses Top":"uses Low"} Vertex`})]})]}),e==""?k.jsx("div",{className:Ke.traitInfoText+" "+Ke.centerAlign,style:{marginTop:"40px"},children:"Please choose a trait category in the left side menu."}):k.jsxs(k.Fragment,{children:[k.jsx("div",{className:Ke.traitInfoTitle+" "+Ke.centerAlign,style:{marginTop:"20px"},children:"Generate"}),k.jsx("div",{className:Ke.traitInfoText+" "+Ke.centerAlign,style:{margin:"0px auto 20px"},children:"( "+e+" )"}),k.jsxs("div",{className:Ke.simpleFlex,style:{marginTop:"0px"},children:[k.jsx("div",{className:Ke.actionButton,style:{margin:"0px"},onClick:()=>{fe(!1)},children:k.jsx("div",{children:" Current "})}),k.jsx("div",{className:Ke.actionButton,style:{margin:"0px"},onClick:()=>{fe(!0)},children:k.jsx("div",{children:" All "})})]})]})]})]})]})})}const fke="_InformationContainerPos_10g06_2",hke="_scrollContainer_10g06_15",dke="_centerAlign_10g06_25",pke="_traitInfoTitle_10g06_28",mke="_traitInfoText_10g06_39",gke="_checked_10g06_65",vke="_checkmark_10g06_69",yke="_checkboxHolder_10g06_82",wke="_actionButton_10g06_92",Uc={InformationContainerPos:fke,scrollContainer:hke,centerAlign:dke,traitInfoTitle:pke,traitInfoText:mke,"custom-checkbox":"_custom-checkbox_10g06_51","checkbox-container":"_checkbox-container_10g06_56",checked:gke,checkmark:vke,checkboxHolder:yke,actionButton:wke};function _ke(){const{characterManager:n,moveCamera:e}=Z.useContext($n),[t,r]=Z.useState(!1),[i,s]=Z.useState(1),o=n.emotionManager.availableEmotions;be.useEffect(()=>{e({targetY:1.8,distance:2})},[]);const a=l=>{n.emotionManager.playEmotion(l,void 0,t,i)};return k.jsx("div",{children:k.jsxs("div",{className:Uc.InformationContainerPos,children:[k.jsx(Aa,{title:"Emotions",width:180,right:20}),k.jsxs("div",{className:Uc.scrollContainer,children:[k.jsx("div",{className:Uc.traitInfoText,children:"View different emotions"}),k.jsxs("div",{className:Uc.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:Uc["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:t,onChange:()=>r(!t)}),k.jsx("div",{className:Uc["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),k.jsx("div",{style:{color:"white"},children:"Constant Emotion"})]}),k.jsx("br",{}),k.jsxs("div",{className:Uc.traitInfoText,children:["Intensity: ",parseFloat(i.toFixed(2))]}),k.jsx(mu,{title:"",value:parseFloat(i.toFixed(2)),onChange:l=>s(parseFloat(l.currentTarget.value.toString())),min:0,max:1,step:.01}),k.jsx("br",{}),o.map((l,c)=>k.jsx("div",{className:Uc.actionButton,onClick:()=>{a(l)},children:k.jsxs("div",{children:[" ",l," "]})},c))]})]})})}function xke({selectedTrait:n,selectedVRM:e,traitGroupName:t}){const[r,i]=Z.useState(""),s=o=>{o!=r?i(o):i("")};return k.jsxs("div",{children:[r=="Information"&&k.jsx(lke,{selectedTrait:n,selectedVRM:e}),r=="LoraCreation"&&k.jsx(cke,{selectedTrait:n,selectedVRM:e}),r=="SpriteCreation"&&k.jsx(Ake,{selectedTrait:n,selectedVRM:e}),r=="ThumbnailCreation"&&k.jsx(uke,{selectedTrait:n,traitGroupName:t}),r=="EmotionManager"&&k.jsx(_ke,{}),k.jsxs("div",{className:_M.InformationContainerPos,children:[k.jsx(Aa,{title:"Tools",width:90,right:0}),k.jsx("div",{className:_M.scrollContainer,children:k.jsxs("div",{className:_M.optionsContainer,children:[k.jsx("div",{onClick:()=>{s("Information")},children:k.jsx(Jo,{size:56,icon:D3e,rarity:r=="Information"?"mythic":"none"})},"Information"),k.jsx("div",{onClick:()=>{s("LoraCreation")},children:k.jsx(Jo,{size:56,icon:k3e,rarity:r=="LoraCreation"?"mythic":"none"})},"LoraCreation"),k.jsx("div",{onClick:()=>{s("SpriteCreation")},children:k.jsx(Jo,{size:56,icon:N3e,rarity:r=="SpriteCreation"?"mythic":"none"})},"SpriteCreation"),k.jsx("div",{onClick:()=>{s("ThumbnailCreation")},children:k.jsx(Jo,{size:56,icon:Q3e,rarity:r=="ThumbnailCreation"?"mythic":"none"})},"ThumbnailCreation"),k.jsx("div",{onClick:()=>{s("EmotionManager")},children:k.jsx(Jo,{size:56,icon:O3e,rarity:r=="EmotionManager"?"mythic":"none"})},"Emotions")]})})]})]})}const ji={TRAIT:0,BLEND_SHAPE:1,DECAL:2};function bke(){var me;const{isLoading:n,setViewMode:e,setIsLoading:t}=Z.useContext(us),{toggleDebugMode:r,characterManager:i,animationManager:s,moveCamera:o}=Z.useContext($n),[a,l]=Z.useState(ji.TRAIT),{playSound:c}=Z.useContext(Co),{isMute:A}=Z.useContext(So),{t:u}=be.useContext(fa),f=()=>{!A&&c("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),e(wt.CREATE),r(!1)},[h,d]=Z.useState(null),[m,g]=Z.useState(null),[p,v]=Z.useState(null),[w,_]=Z.useState(null),[x,b]=Z.useState({}),[B,S]=Z.useState(null),[I,M]=Z.useState(""),[L,D]=Z.useState(!1),[T,y]=Z.useState({background:"#ffffff"}),E=()=>{!A&&c("backNextButton"),e(wt.SAVE),r(!1)},R=()=>{t(!0),d(null),i.loadRandomTraits().then(()=>{console.log("success"),p&&p.trait!=""&&_(i.getCurrentTraitData(p.trait)),t(!1)}).catch(ie=>{t(!1),console.error("Error loading random traits:",ie.message)})},F=ie=>{y({background:ie.hex})},O=ie=>{y({background:ie.hex}),i.setTraitColor(p==null?void 0:p.trait,ie.hex)},z=async ie=>{const ge=Kl(ie.name),_e=URL.createObjectURL(ie);await s.loadAnimation(_e,!1,0,!0,"",ge),M(s.getCurrentAnimationName())},j=ie=>{if(D(!1),p&&p.trait!=""){t(!0);const ge=URL.createObjectURL(ie);i.loadCustomTexture(p.trait,ge).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},Q=ie=>{if(D(!1),p&&p.trait!=""){t(!0);const ge=URL.createObjectURL(ie);i.loadCustomTrait(p.trait,ge).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},C=ie=>{var ge;if(ie.id===(w==null?void 0:w.id)){((ge=ie.blendshapeTraits)==null?void 0:ge.length)>0&&l(ji.BLEND_SHAPE);return}D(!1),t(!0),i.loadTrait(ie.traitGroup.trait,ie.id).then(()=>{var _e;if(t(!1),((_e=ie.blendshapeTraits)==null?void 0:_e.length)>0){const se=i.getCurrentBlendShapeTraitData(ie.traitGroup.trait);b(Object.entries(se).reduce((H,[fe,Ae])=>(H[fe]=Ae.id,H),{})),l(ji.BLEND_SHAPE)}_(ie)})},W=ie=>{D(!1),i.removeTrait(ie),_(null)},ee=ie=>{D(!1),t(!0),i.loadRandomTrait(ie).then(()=>{t(!1),_(i.getCurrentTraitData(ie))})},P=ie=>{D(!1);const ge=Array.from(ie),_e=[],se=H=>new Promise((fe,Ae)=>{var J;if(H&&H.name.toLowerCase().endsWith(".json")){const q=new FileReader,he=`${(J=i.manifestData)==null?void 0:J.getAssetsDirectory()}/anata/_thumbnails/t_${H.name.split("_")[0]}.jpg`;console.log(he),q.onload=function(X){try{const G=JSON.parse(X.target.result);G.thumb=he,_e.push(G),fe()}catch(G){console.error("Error parsing the JSON file:",G),Ae(G)}},q.readAsText(H)}});Promise.all(ge.map(se)).then(()=>{_e.length>0&&(d(_e),t(!0),i.loadTraitsFromNFTObject(_e[0]).then(()=>{t(!1)}))}).catch(H=>{console.error("Error processing files:",H)})},re=async ie=>{const ge=ie[0];ge&&ge.name.toLowerCase().endsWith(".fbx")&&z(ge),ge&&(ge.name.toLowerCase().endsWith(".png")||ge.name.toLowerCase().endsWith(".jpg"))&&j(ge),ge&&ge.name.toLowerCase().endsWith(".vrm")&&Q(ge),ge&&ge.name.toLowerCase().endsWith(".json")&&P(ie)},ue=ie=>{if(!A&&c("optionClick"),D(!1),(p==null?void 0:p.trait)!==ie.trait){l(ji.TRAIT),g(i.getTraits(ie.trait)),v(ie);const ge=i.getCurrentTraitData(ie.trait),_e=i.getCurrentBlendShapeTraitData(ie.trait);_(ge),b(Object.entries(_e).reduce((se,[H,fe])=>(se[H]=fe.id,se),{})),S(i.getCurrentTraitVRM(ie.trait)),o({targetY:ie.cameraTarget.height,distance:ie.cameraTarget.distance})}else g(null),v(null),_(null),b({}),o({targetY:.8,distance:3.2})},le=()=>{D(!1);var ie=document.createElement("input");if(ie.type="file",ie.accept=".vrm",!p)return console.error("Please select a trait group first");ie.onchange=ge=>{var _e=ge.target.files[0];if(_e.name.endsWith(".vrm")){const se=URL.createObjectURL(_e);t(!0),i.loadCustomTrait(p.trait,se).then(()=>{t(!1)})}},ie.click()};return k.jsxs("div",{className:jt.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:u("pageTitles.chooseAppearance")}),k.jsx(S0,{onFilesDrop:re}),k.jsxs("div",{className:jt.sideMenu,children:[k.jsx(Aa,{title:"Appearance",left:20}),k.jsx("div",{className:jt.bottomLine}),k.jsx("div",{className:jt.scrollContainer,children:k.jsx("div",{className:jt["editor-container"],children:i.getGroupTraits().map((ie,ge)=>k.jsxs("div",{className:jt.editorButton,onClick:()=>{ue(ie)},children:[k.jsx(Jo,{size:56,icon:ie.fullIconSvg,rarity:(p==null?void 0:p.trait)!==ie.trait?"none":"mythic"}),k.jsx("div",{className:jt.editorText,children:ie.name})]},"options_"+ge))})})]}),!!m&&p&&k.jsxs("div",{className:jt.selectorContainerPos,children:[k.jsx(Aa,{title:p.trait,width:130,left:20}),k.jsxs("div",{className:jt.selectorPickerTabs,children:[w&&a==ji.TRAIT&&k.jsx("div",{className:jt.selectorColorPickerButton,onClick:()=>{D(!L)},children:k.jsx("img",{className:jt.selectorColorPickerImg,src:G_e})}),p&&((me=p.getAllDecals())==null?void 0:me.length)&&k.jsx("div",{className:jt.selectorColorPickerButton,onClick:()=>a==ji.DECAL?l(ji.TRAIT):l(ji.DECAL),children:k.jsx("img",{className:jt.selectorColorPickerImg,src:m_e})})]}),a==ji.TRAIT&&!!L&&k.jsx("div",{draggable:!1,className:jt.selectorColorPickerUI,children:k.jsx(o3e,{styles:{default:{picker:{width:"200px"}}},color:T.background,onChange:F,onChangeComplete:O})}),k.jsx("div",{className:jt.bottomLine}),k.jsxs("div",{className:jt.scrollContainerOptions,children:[a==ji.TRAIT&&k.jsxs("div",{className:jt["selector-container"],children:[k.jsx("div",{className:`${jt.selectorButton}`,onClick:()=>{ee(p.trait)},children:k.jsx(Jo,{size:56,icon:z_e,rarity:"none"})},"randomize-trait"),i.isTraitGroupRequired(p.trait)?k.jsx(k.Fragment,{}):k.jsx("div",{className:`${jt.selectorButton}`,icon:fx,onClick:()=>{W(p.trait)},children:k.jsx(Jo,{size:56,icon:fx,rarity:w==null?"mythic":"none"})},"no-trait"),m.map(ie=>{let ge=ie.id===(w==null?void 0:w.id);return k.jsx("div",{className:`${jt.selectorButton}`,onClick:()=>{C(ie)},children:k.jsx(Jo,{size:56,icon:ie.fullThumbnail,rarity:ge?"mythic":"none"})},ie.id)})]}),a==ji.BLEND_SHAPE&&k.jsx(Eke,{selectedTrait:w,onBack:()=>{l(ji.TRAIT)},selectedBlendShapeTrait:x,setSelectedBlendshapeTrait:b}),a==ji.DECAL&&k.jsx(H_e,{selectedTraitGroup:p,onBack:()=>{l(ji.TRAIT)}})]}),k.jsx("div",{className:jt.uploadContainer,children:k.jsx("div",{className:jt.uploadButton,onClick:le,children:k.jsx("div",{children:"Upload "})})})]}),k.jsx(w2,{jsonSelectionArray:h}),k.jsx(xke,{selectedTrait:w,selectedVRM:B,traitGroupName:(p==null?void 0:p.trait)||""}),k.jsx(O1,{loadedAnimationName:I,randomize:R}),k.jsxs("div",{className:jt.buttonContainer,children:[k.jsx(Bn,{theme:"light",text:u("callToAction.back"),size:14,className:jt.buttonLeft,onClick:f}),i.canDownload()&&k.jsx(Bn,{theme:"light",text:u("callToAction.next"),size:14,className:jt.buttonRight,onClick:E})]})]})}const Eke=({selectedTrait:n,onBack:e,selectedBlendShapeTrait:t,setSelectedBlendshapeTrait:r})=>{const{characterManager:i,moveCamera:s}=Z.useContext($n),o=i.getBlendShapeGroupTraits((n==null?void 0:n.traitGroup.trait)||"",(n==null?void 0:n.id)||""),a=(c,A)=>{i.removeBlendShapeTrait(c,A.trait);const u={...t};delete u[A.trait],r(u)},l=c=>{const A=c.parentGroup;i.loadBlendShapeTrait((n==null?void 0:n.traitGroup.trait)||"",A.trait||"",(c==null?void 0:c.id)||""),s({targetY:A.cameraTarget.height,distance:A.cameraTarget.distance});const u={...t};u[A.trait||""]=c.id,r(u)};return k.jsxs("div",{className:jt["selector-container-column"],children:[k.jsx(Bn,{theme:"dark",text:"Back",size:14,className:jt.buttonLeft,onClick:e}),o&&o.length>0&&o.map(c=>k.jsxs("div",{className:jt.blendshapeGroup,children:[k.jsx("div",{children:c.name}),k.jsxs("div",{className:jt["selector-container"],children:[k.jsx(p4,{src:fx,active:!t[c.trait],blendshapeID:"cancel",select:()=>a(n.traitGroup.trait,c)},"empty"),c.collection.map(A=>{let u=A.id===t[c.trait];return k.jsx(p4,{src:A.fullThumbnail||"",active:u,blendshapeID:A.id,select:()=>l(A)},A.id)})]})]},c.trait))]})},p4=({active:n,blendshapeID:e,src:t,select:r})=>k.jsx("div",{className:`${jt.selectorButton}`,onClick:r,children:k.jsx(Jo,{size:56,icon:t||"",rarity:n?"mythic":"none"})},e),Bke="_InformationContainerPos_rgqwy_1",Mke="_traitInfoTitle_rgqwy_13",Ske="_traitInfoText_rgqwy_21",Cke="_flexSelect_rgqwy_30",Tke="_scrollContainer_rgqwy_65",Ike="_checked_rgqwy_90",Rke="_checkmark_rgqwy_94",Uke="_checkboxHolder_rgqwy_107",Fke="_buttonContainer_rgqwy_114",Pke="_buttonLeft_rgqwy_123",Lke="_buttonRight_rgqwy_127",Dke="_buttonCenter_rgqwy_131",Oi={InformationContainerPos:Bke,traitInfoTitle:Mke,traitInfoText:Ske,flexSelect:Cke,"arrow-button":"_arrow-button_rgqwy_37","left-button":"_left-button_rgqwy_51","right-button":"_right-button_rgqwy_58",scrollContainer:Tke,"custom-checkbox":"_custom-checkbox_rgqwy_76","checkbox-container":"_checkbox-container_rgqwy_81",checked:Ike,checkmark:Rke,checkboxHolder:Uke,buttonContainer:Fke,buttonLeft:Pke,buttonRight:Lke,buttonCenter:Dke},Nke="_InformationContainerPos_11mqa_2",Oke="_scrollContainer_11mqa_16",kke="_traitInfoTitle_11mqa_28",Qke="_traitInfoText_11mqa_38",Hke="_flexSelect_11mqa_66",zke="_checked_11mqa_124",Gke="_checkmark_11mqa_128",Vke="_checkboxHolder_11mqa_141",cr={InformationContainerPos:Nke,scrollContainer:Oke,traitInfoTitle:kke,traitInfoText:Qke,"input-box":"_input-box_11mqa_47",flexSelect:Hke,"arrow-button":"_arrow-button_11mqa_76","left-button":"_left-button_11mqa_91","right-button":"_right-button_11mqa_98","anim-button":"_anim-button_11mqa_105","custom-checkbox":"_custom-checkbox_11mqa_110","checkbox-container":"_checkbox-container_11mqa_115",checked:zke,checkmark:Gke,checkboxHolder:Vke};function fU({model:n,name:e,files:t,index:r,nextVrm:i,previousVrm:s}){const{characterManager:o}=Z.useContext($n),[a,l]=be.useState(0),[c,A]=be.useState(0),[u,f]=be.useState(0),[h,d]=be.useState(0),[m,g]=be.useState(0),[p,v]=be.useState(0),[w,_]=be.useState(0),[x,b]=be.useState(0),[B,S]=be.useState(0),[I,M]=be.useState(0);return be.useEffect(()=>{if(n!=null){const L=kd(n,"Mesh"),D=kd(n,"SkinnedMesh");l(L.length),A(D.length);const T=L.concat(D),{stdMats:y,stdCutoutpMats:E,stdTranspMats:R,mToonMats:F,mToonCutoutMats:O,mToonTranspMats:z}=fge(T);f(y.length),d(R.length),g(E.length),v(F.length),_(z.length),b(O.length);const{triangles:j,bones:Q}=o.getBoneTriangleCount();S(j),M(Q)}},[n]),n!=null?k.jsx("div",{children:k.jsxs("div",{className:cr.InformationContainerPos,children:[k.jsx(Aa,{title:"Model Information",width:180,right:20}),k.jsxs("div",{className:cr.scrollContainer,children:[k.jsxs("div",{className:cr.flexSelect,children:[(t==null?void 0:t.length)>1?k.jsx("div",{className:`${cr["arrow-button"]} ${cr["left-button"]}`,onClick:s}):k.jsx(k.Fragment,{}),e&&k.jsx("div",{style:{textAlign:"center"},children:k.jsx("div",{className:cr.traitInfoTitle,style:{margin:"auto",fontSize:"14px",width:"200px",textAlign:"center",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"},children:e})}),(t==null?void 0:t.length)>1?k.jsx("div",{className:`${cr["arrow-button"]} ${cr["right-button"]}`,onClick:i}):k.jsx(k.Fragment,{})]}),k.jsx("div",{className:cr.traitInfoTitle,children:"Geometry info:"}),k.jsxs("div",{className:cr.traitInfoText,children:["Meshes: ",a]}),k.jsxs("div",{className:cr.traitInfoText,children:["SkinnedMeshes: ",c]}),k.jsxs("div",{className:cr.traitInfoText,children:["Triangles: ",B]}),k.jsxs("div",{className:cr.traitInfoText,children:["Bones: ",I]}),k.jsx("div",{className:cr.traitInfoTitle,children:"Standard Material Count:"}),k.jsxs("div",{className:cr.traitInfoText,children:["opaque: ",u]}),k.jsxs("div",{className:cr.traitInfoText,children:["cutout: ",m]}),k.jsxs("div",{className:cr.traitInfoText,children:["transparent: ",h]}),k.jsx("div",{className:cr.traitInfoTitle,children:"MToon Material Count:"}),k.jsxs("div",{className:cr.traitInfoText,children:["opaque: ",p]}),k.jsxs("div",{className:cr.traitInfoText,children:["cutout: ",x]}),k.jsxs("div",{className:cr.traitInfoText,children:["transparent: ",w]})]})]})}):k.jsx(k.Fragment,{})}const jke="_InformationContainerPos_b0msk_1",Wke="_traitInfoTitle_b0msk_13",Kke="_traitInfoText_b0msk_22",Xke="_flexSelect_b0msk_33",Yke="_scrollContainer_b0msk_68",$ke="_checked_b0msk_93",Zke="_checkmark_b0msk_97",Jke="_checkboxHolder_b0msk_110",gt={InformationContainerPos:jke,traitInfoTitle:Wke,traitInfoText:Kke,flexSelect:Xke,"arrow-button":"_arrow-button_b0msk_40","left-button":"_left-button_b0msk_54","right-button":"_right-button_b0msk_61",scrollContainer:Yke,"custom-checkbox":"_custom-checkbox_b0msk_79","checkbox-container":"_checkbox-container_b0msk_84",checked:$ke,checkmark:Zke,checkboxHolder:Jke};function up(){localStorage&&Object.keys(localStorage).map(n=>{this.setItem(n,localStorage[n],!1)}),Object.defineProperty(this,"length",{get:function(){return Object.keys(this).length},enumerable:!1})}up.prototype.key=function(n){return Object.keys(this)[n]};up.prototype.getItem=function(n){try{return JSON.parse(this[n])}catch{}return this[n]};up.prototype.setItem=function(n,e,t=!0){const r=typeof e=="string"?e:JSON.stringify(e);return t&&localStorage.setItem(n,r),this[n]=r};up.prototype.removeItem=function(n){delete this[n]};up.prototype.clear=function(){Object.keys(this).forEach(n=>delete this[n])};let qke=new up;const e4e=n=>({get(e,t){return n.getItem(String(t))},set(e,t,r){return n.setItem(String(t),r),!0}}),t4e=(n=qke)=>new Proxy({},e4e(n)),ze=t4e();function tb({showDropToDownload:n,showCreateAtlas:e,mergeMenuTitle:t}){const[r,i]=be.useState(ze.mergeOptions_atlas_std_size||6),[s,o]=be.useState(ze.mergeOptions_atlas_std_transp_size||6),[a,l]=be.useState(ze.mergeOptions_atlas_mtoon_size||6),[c,A]=be.useState(ze.mergeOptions_atlas_mtoon_transp_size||6),[u,f]=be.useState(ze.mergeOptions_sel_option||0),[h,d]=be.useState(ze.mergeOptions_two_sided_mat||!1),[m]=be.useState(["Merge to Standard","Merge to MToon","Keep Both"]),[g,p]=be.useState(ze.mergeOptions_download_vrm==null?!0:ze.mergeOptions_download_vrm),[v,w]=be.useState(ze.mergeOptions_download_vrm_preview==null?!0:ze.mergeOptions_download_vrm_preview),[_,x]=be.useState(ze.mergeOptions_drop_download||!1),[b,B]=be.useState(ze.merge_options_ktx_compression||!1),[S,I]=be.useState(ze.mergeOptions_create_atlas==null?!0:ze.mergeOptions_create_atlas),[M,L]=be.useState(ze.mergeOptions_download_lora==null?!0:ze.mergeOptions_download_lora),[D,T]=be.useState(ze.mergeOptions_download_sprites==null?!0:ze.mergeOptions_download_sprites),y=P=>{x(P.target.checked),ze.mergeOptions_drop_download=P.target.checked},E=P=>{d(P.target.checked),ze.mergeOptions_two_sided_mat=P.target.checked},R=P=>{B(P.target.checked),ze.merge_options_ktx_compression=P.target.checked},F=P=>{I(P.target.checked),ze.mergeOptions_create_atlas=P.target.checked},O=P=>{p(P.target.checked),ze.mergeOptions_download_vrm=P.target.checked},z=P=>{w(P.target.checked),ze.mergeOptions_download_vrm_preview=P.target.checked},j=P=>{L(P.target.checked),ze.mergeOptions_download_lora=P.target.checked},Q=P=>{T(P.target.checked),ze.mergeOptions_download_sprites=P.target.checked},C=()=>{let P=u;u<=0?P=m.length-1:P-=1,f(P),ze.mergeOptions_sel_option=P},W=()=>{let P=u;u>=m.length-1?P=0:P+=1,f(P),ze.mergeOptions_sel_option=P},ee=async(P,re)=>{let ue=parseInt(P.target.value);ue>8?ue=8:ue<0&&(ue=0),(me=>{switch(re){case"standard opaque":i(me),ze.mergeOptions_atlas_std_size=me;break;case"standard transparent":o(me),ze.mergeOptions_atlas_std_transp_size=me;break;case"mtoon opaque":l(me),ze.mergeOptions_atlas_mtoon_size=me;break;case"mtoon transparent":A(me),ze.mergeOptions_atlas_mtoon_transp_size=me;break}})(ue)};return k.jsxs("div",{className:gt.InformationContainerPos,children:[k.jsx(Aa,{title:t,width:180,left:20}),k.jsxs("div",{className:gt.scrollContainer,children:[k.jsx("div",{className:gt.traitInfoTitle,children:"Download Options"}),k.jsx(k.Fragment,{children:k.jsx("div",{className:gt.traitInfoText,children:k.jsxs("div",{className:gt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:gt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:g,onChange:O}),k.jsx("div",{className:gt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download VRM"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:gt.traitInfoText,children:k.jsxs("div",{className:gt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:gt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:v,onChange:z}),k.jsx("div",{className:gt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download VRM Preview"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:gt.traitInfoText,children:k.jsxs("div",{className:gt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:gt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:M,onChange:j}),k.jsx("div",{className:gt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download Lora Data"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:gt.traitInfoText,children:k.jsxs("div",{className:gt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:gt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:D,onChange:Q}),k.jsx("div",{className:gt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download Sprites Data"]})})}),g&&k.jsxs(k.Fragment,{children:[e&&k.jsx(k.Fragment,{children:k.jsx("div",{className:gt.traitInfoText,children:k.jsxs("div",{className:gt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:gt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:S,onChange:F}),k.jsx("div",{className:gt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Create Atlas"]})})}),(e==!1||S)&&k.jsxs(k.Fragment,{children:[k.jsx("br",{}),k.jsx("div",{className:gt.traitInfoTitle,children:"Merge Atlas Type"}),k.jsx("br",{}),k.jsxs("div",{className:gt.flexSelect,children:[k.jsx("div",{className:`${gt["arrow-button"]} ${gt["left-button"]}`,onClick:C}),k.jsx("div",{className:gt.traitInfoText,style:{marginBottom:"0"},children:m[u]}),k.jsx("div",{className:`${gt["arrow-button"]} ${gt["right-button"]}`,onClick:W})]}),k.jsx("br",{}),k.jsx("br",{}),(u===0||u==2)&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:gt.traitInfoTitle,children:"Standard Atlas Size"}),k.jsx("br",{}),k.jsxs("div",{className:gt.traitInfoText,children:["Opaque: ",Nn(r)+" x "+Nn(r)]}),k.jsx(mu,{value:r,onChange:P=>ee(P,"standard opaque"),min:1,max:8,step:1}),k.jsx("br",{}),k.jsxs("div",{className:gt.traitInfoText,children:["Transparent: ",Nn(s)+" x "+Nn(s)]}),k.jsx(mu,{value:s,onChange:P=>ee(P,"standard transparent"),min:1,max:8,step:1}),k.jsx("br",{})," ",k.jsx("br",{})]}),(u===1||u==2)&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:gt.traitInfoTitle,children:"MToon Atlas Size"}),k.jsx("br",{}),k.jsxs("div",{className:gt.traitInfoText,children:["Opaque: ",Nn(a)+" x "+Nn(a)]}),k.jsx(mu,{value:a,onChange:P=>ee(P,"mtoon opaque"),min:1,max:8,step:1}),k.jsx("br",{}),k.jsxs("div",{className:gt.traitInfoText,children:["Transparent: ",Nn(c)+" x "+Nn(c)]}),k.jsx(mu,{value:c,onChange:P=>ee(P,"mtoon transparent"),min:1,max:8,step:1}),k.jsx("br",{})," ",k.jsx("br",{})]}),k.jsx("div",{className:gt.traitInfoTitle,children:"Options"}),k.jsx("div",{className:gt.traitInfoText,children:k.jsxs("div",{className:gt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:gt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:h,onChange:E}),k.jsx("div",{className:gt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Two Sided Material"]})}),n&&k.jsx(k.Fragment,{children:k.jsx("div",{className:gt.traitInfoText,children:k.jsxs("div",{className:gt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:gt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:_,onChange:y}),k.jsx("div",{className:gt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Drag Drop - Download"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:gt.traitInfoText,children:k.jsxs("div",{className:gt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:gt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:b,onChange:R}),k.jsx("div",{className:gt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"KTX Compression"]})})})]})]})]})]})}function n4e(){const{isLoading:n,setViewMode:e,setIsLoading:t}=Z.useContext(us),{manifest:r,toggleDebugMode:i,characterManager:s,animationManager:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:c}=Z.useContext($n),[A,u]=be.useState(null),[f,h]=be.useState(""),[d,m]=Z.useState(""),{playSound:g}=Z.useContext(Co),{isMute:p}=Z.useContext(So),[v,w]=Z.useState(null),_=()=>{!p&&g("backNextButton"),s.removeCurrentCharacter(),s.removeCurrentManifest(),i(!1),e(wt.LANDING)},x=()=>{const T=ze.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:Nn(ze.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Nn(ze.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Nn(ze.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Nn(ze.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:T===0||T==2,exportMtoonAtlas:T===1||T==2,ktxCompression:ze.merge_options_ktx_compression||!1,twoSidedMaterial:ze.mergeOptions_two_sided_mat||!1}},b=(T,y=!1)=>{console.log(y),(async()=>{await s.loadTraitsFromNFTObject(v[T]),(ze.mergeOptions_download_vrm==null?!0:ze.mergeOptions_download_vrm)&&await s.downloadVRM(v[T].name,x());const F=new ep,O=c.parent;O.remove(c);const z=ze.mergeOptions_download_lora==null?!0:ze.mergeOptions_download_lora;if(z===!0){const Q=r.loras.map(async C=>a.createLoraData(C,F));await Promise.all(Q)}const j=ze.mergeOptions_download_sprites==null?!0:ze.mergeOptions_download_sprites;if(j===!0){const Q=r.sprites.map(async C=>l.createSpriteAtlas(C,F));await Promise.all(Q)}(z===!0||j===!0)&&F.saveZip(v[T].name),O.add(c),T{t(!0),b(0,!0)},{t:S}=be.useContext(fa),I=async T=>{if(s.getCurrentCharacterModel()){const E=Kl(T.name),R=URL.createObjectURL(T);await o.loadAnimation(R,!1,0,!0,"",E),m(o.getCurrentAnimationName()),URL.revokeObjectURL(R)}else console.warn("Please load a vrm model to test animations.")},M=async T=>{const y=URL.createObjectURL(T);await s.loadOptimizerCharacter(y),URL.revokeObjectURL(y);const E=Kl(T.name);h(E),u(s.getCurrentCharacterModel())},L=T=>{const y=Array.from(T),E=[],R=F=>new Promise((O,z)=>{var j;if(F&&F.name.toLowerCase().endsWith(".json")){const Q=new FileReader,C=`${(j=s.manifestData)==null?void 0:j.getAssetsDirectory()}/anata/_thumbnails/t_${F.name.split("_")[0]}.jpg`;Q.onload=function(W){try{const ee=JSON.parse(W.target.result);ee.thumb=C,E.push(ee),O()}catch(ee){console.error("Error parsing the JSON file:",ee),z(ee)}},Q.readAsText(F)}});Promise.all(y.map(R)).then(()=>{E.length>0&&(w(E),t(!0),s.loadTraitsFromNFTObject(E[0]).then(()=>{t(!1)}))}).catch(F=>{console.error("Error processing files:",F)})},D=async T=>{const y=T[0];console.log("anim"),y&&y.name.toLowerCase().endsWith(".fbx")&&(console.log("anim2"),I(y)),y&&y.name.toLowerCase().endsWith(".vrm")&&M(y),y&&y.name.toLowerCase().endsWith(".json")&&L(T)};return k.jsxs("div",{className:Oi.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:"Batch Download"}),k.jsx(S0,{onFilesDrop:D}),k.jsx(tb,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),k.jsx(fU,{model:A}),k.jsx(w2,{jsonSelectionArray:v}),k.jsx(O1,{loadedAnimationName:d}),k.jsxs("div",{className:Oi.buttonContainer,children:[k.jsx(Bn,{theme:"light",text:S("callToAction.back"),size:14,className:Oi.buttonLeft,onClick:_}),(v==null?void 0:v.length)==1&&k.jsx(Bn,{theme:"light",text:"Download",size:14,className:Oi.buttonRight,onClick:B}),(v==null?void 0:v.length)>1&&k.jsx(Bn,{theme:"light",text:"Download All",size:14,className:Oi.buttonRight,onClick:B})]})]})}const N0="abi/5.7.0",zt=new xe(N0),zu={};let m4={calldata:!0,memory:!0,storage:!0},r4e={calldata:!0,memory:!0};function Ky(n,e){if(n==="bytes"||n==="string"){if(m4[e])return!0}else if(n==="address"){if(e==="payable")return!0}else if((n.indexOf("[")>=0||n==="tuple")&&r4e[e])return!0;return(m4[e]||e==="payable")&&zt.throwArgumentError("invalid modifier","name",e),!1}function i4e(n,e){let t=n;function r(a){zt.throwArgumentError(`unexpected character at position ${a}`,"param",n)}n=n.replace(/\s/g," ");function i(a){let l={type:"",name:"",parent:a,state:{allowType:!0}};return e&&(l.indexed=!1),l}let s={type:"",name:"",state:{allowType:!0}},o=s;for(let a=0;aJSON.parse(i.format(e)))),JSON.stringify(r)}let t="";return this.baseType==="array"?(t+=this.arrayChildren.format(e),t+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==Zt.sighash&&(t+=this.type),t+="("+this.components.map(r=>r.format(e)).join(e===Zt.full?", ":",")+")"):t+=this.type,e!==Zt.sighash&&(this.indexed===!0&&(t+=" indexed"),e===Zt.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return typeof e=="string"?Vr.fromString(e,t):Vr.fromObject(e)}static fromObject(e){return Vr.isParamType(e)?e:new Vr(zu,{name:e.name||null,type:ph(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(Vr.fromObject):null})}static fromString(e,t){function r(i){return Vr.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return r(i4e(e,!!t))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function t0(n,e){return a4e(n).map(t=>Vr.fromString(t,e))}class Gl{constructor(e,t){e!==zu&&zt.throwError("use a static from method",xe.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Hw(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return Gl.isFragment(e)?e:typeof e=="string"?Gl.fromString(e):Gl.fromObject(e)}static fromObject(e){if(Gl.isFragment(e))return e;switch(e.type){case"function":return Oa.fromObject(e);case"event":return Ol.fromObject(e);case"constructor":return Na.fromObject(e);case"error":return Vc.fromObject(e);case"fallback":case"receive":return null}return zt.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?Ol.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?Oa.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?Na.fromString(e.trim()):e.split(" ")[0]==="error"?Vc.fromString(e.substring(5).trim()):zt.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class Ol extends Gl{format(e){if(e||(e=Zt.sighash),Zt[e]||zt.throwArgumentError("invalid format type","format",e),e===Zt.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==Zt.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Zt.full?", ":",")+") ",e!==Zt.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return typeof e=="string"?Ol.fromString(e):Ol.fromObject(e)}static fromObject(e){if(Ol.isEventFragment(e))return e;e.type!=="event"&&zt.throwArgumentError("invalid event object","value",e);const t={name:n0(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(Vr.fromObject):[],type:"event"};return new Ol(zu,t)}static fromString(e){let t=e.match(r0);t||zt.throwArgumentError("invalid event string","value",e);let r=!1;return t[3].split(" ").forEach(i=>{switch(i.trim()){case"anonymous":r=!0;break;case"":break;default:zt.warn("unknown modifier: "+i)}}),Ol.fromObject({name:t[1].trim(),anonymous:r,inputs:t0(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function zj(n,e){e.gas=null;let t=n.split("@");return t.length!==1?(t.length>2&&zt.throwArgumentError("invalid human-readable ABI signature","value",n),t[1].match(/^[0-9]+$/)||zt.throwArgumentError("invalid human-readable ABI signature gas","value",n),e.gas=je.from(t[1]),t[0]):n}function Gj(n,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",n.split(" ").forEach(t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+t)}})}function Vj(n){let e={constant:!1,payable:!0,stateMutability:"payable"};return n.stateMutability!=null?(e.stateMutability=n.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",n.constant!=null&&!!n.constant!==e.constant&&zt.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",n),e.payable=e.stateMutability==="payable",n.payable!=null&&!!n.payable!==e.payable&&zt.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",n)):n.payable!=null?(e.payable=!!n.payable,n.constant==null&&!e.payable&&n.type!=="constructor"&&zt.throwArgumentError("unable to determine stateMutability","value",n),e.constant=!!n.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&zt.throwArgumentError("cannot have constant payable function","value",n)):n.constant!=null?(e.constant=!!n.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):n.type!=="constructor"&&zt.throwArgumentError("unable to determine stateMutability","value",n),e}class Na extends Gl{format(e){if(e||(e=Zt.sighash),Zt[e]||zt.throwArgumentError("invalid format type","format",e),e===Zt.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});e===Zt.sighash&&zt.throwError("cannot format a constructor for sighash",xe.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map(r=>r.format(e)).join(e===Zt.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(t+=this.stateMutability+" "),t.trim()}static from(e){return typeof e=="string"?Na.fromString(e):Na.fromObject(e)}static fromObject(e){if(Na.isConstructorFragment(e))return e;e.type!=="constructor"&&zt.throwArgumentError("invalid constructor object","value",e);let t=Vj(e);t.constant&&zt.throwArgumentError("constructor cannot be constant","value",e);const r={name:null,type:e.type,inputs:e.inputs?e.inputs.map(Vr.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?je.from(e.gas):null};return new Na(zu,r)}static fromString(e){let t={type:"constructor"};e=zj(e,t);let r=e.match(r0);return(!r||r[1].trim()!=="constructor")&&zt.throwArgumentError("invalid constructor string","value",e),t.inputs=t0(r[2].trim(),!1),Gj(r[3].trim(),t),Na.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class Oa extends Na{format(e){if(e||(e=Zt.sighash),Zt[e]||zt.throwArgumentError("invalid format type","format",e),e===Zt.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(e))),outputs:this.outputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==Zt.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Zt.full?", ":",")+") ",e!==Zt.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map(r=>r.format(e)).join(", ")+") "),this.gas!=null&&(t+="@"+this.gas.toString()+" ")),t.trim()}static from(e){return typeof e=="string"?Oa.fromString(e):Oa.fromObject(e)}static fromObject(e){if(Oa.isFunctionFragment(e))return e;e.type!=="function"&&zt.throwArgumentError("invalid function object","value",e);let t=Vj(e);const r={type:e.type,name:n0(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(Vr.fromObject):[],outputs:e.outputs?e.outputs.map(Vr.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?je.from(e.gas):null};return new Oa(zu,r)}static fromString(e){let t={type:"function"};e=zj(e,t);let r=e.split(" returns ");r.length>2&&zt.throwArgumentError("invalid function string","value",e);let i=r[0].match(r0);if(i||zt.throwArgumentError("invalid function signature","value",e),t.name=i[1].trim(),t.name&&n0(t.name),t.inputs=t0(i[2],!1),Gj(i[3].trim(),t),r.length>1){let s=r[1].match(r0);(s[1].trim()!=""||s[3].trim()!="")&&zt.throwArgumentError("unexpected tokens","value",e),t.outputs=t0(s[2],!1)}else t.outputs=[];return Oa.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function g4(n){const e=n.format();return(e==="Error(string)"||e==="Panic(uint256)")&&zt.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",n),n}class Vc extends Gl{format(e){if(e||(e=Zt.sighash),Zt[e]||zt.throwArgumentError("invalid format type","format",e),e===Zt.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==Zt.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Zt.full?", ":",")+") ",t.trim()}static from(e){return typeof e=="string"?Vc.fromString(e):Vc.fromObject(e)}static fromObject(e){if(Vc.isErrorFragment(e))return e;e.type!=="error"&&zt.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:n0(e.name),inputs:e.inputs?e.inputs.map(Vr.fromObject):[]};return g4(new Vc(zu,t))}static fromString(e){let t={type:"error"},r=e.match(r0);return r||zt.throwArgumentError("invalid error signature","value",e),t.name=r[1].trim(),t.name&&n0(t.name),t.inputs=t0(r[2],!1),g4(Vc.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function ph(n){return n.match(/^uint($|[^1-9])/)?n="uint256"+n.substring(4):n.match(/^int($|[^1-9])/)&&(n="int256"+n.substring(3)),n}const o4e=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function n0(n){return(!n||!n.match(o4e))&&zt.throwArgumentError(`invalid identifier "${n}"`,"value",n),n}const r0=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function a4e(n){n=n.trim();let e=[],t="",r=0;for(let i=0;ithis.wordSize&&hU.throwError("value out-of-bounds",xe.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=Ss([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}}class bx{constructor(e,t,r,i){Ue(this,"_data",pt(e)),Ue(this,"wordSize",t||32),Ue(this,"_coerceFunc",r),Ue(this,"allowLoose",i),this._offset=0}get data(){return lt(this._data)}get consumed(){return this._offset}static coerce(e,t){let r=e.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(t=t.toNumber()),t}coerce(e,t){return this._coerceFunc?this._coerceFunc(e,t):bx.coerce(e,t)}_peekBytes(e,t,r){let i=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&r&&this._offset+t<=this._data.length?i=t:hU.throwError("data out-of-bounds",xe.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new bx(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,t){let r=this._peekBytes(0,e,!!t);return this._offset+=r.length,r.slice(0,e)}readValue(){return je.from(this.readBytes(this.wordSize))}}class c4e extends dc{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=ai(t)}catch(r){this._throwError(r.message,t)}return e.writeValue(t)}decode(e){return ai(ir(e.readValue().toHexString(),20))}}class A4e extends dc{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}const jh=new xe(N0);function jj(n,e,t){let r=null;if(Array.isArray(t))r=t;else if(t&&typeof t=="object"){let l={};r=e.map(c=>{const A=c.localName;return A||jh.throwError("cannot encode object for signature with missing names",xe.errors.INVALID_ARGUMENT,{argument:"values",coder:c,value:t}),l[A]&&jh.throwError("cannot encode object for signature with duplicate names",xe.errors.INVALID_ARGUMENT,{argument:"values",coder:c,value:t}),l[A]=!0,t[A]})}else jh.throwArgumentError("invalid tuple value","tuple",t);e.length!==r.length&&jh.throwArgumentError("types/value length mismatch","tuple",t);let i=new KT(n.wordSize),s=new KT(n.wordSize),o=[];e.forEach((l,c)=>{let A=r[c];if(l.dynamic){let u=s.length;l.encode(s,A);let f=i.writeUpdatableValue();o.push(h=>{f(h+u)})}else l.encode(i,A)}),o.forEach(l=>{l(i.length)});let a=n.appendWriter(i);return a+=n.appendWriter(s),a}function Wj(n,e){let t=[],r=n.subReader(0);e.forEach(s=>{let o=null;if(s.dynamic){let a=n.readValue(),l=r.subReader(a.toNumber());try{o=s.decode(l)}catch(c){if(c.code===xe.errors.BUFFER_OVERRUN)throw c;o=c,o.baseType=s.name,o.name=s.localName,o.type=s.type}}else try{o=s.decode(n)}catch(a){if(a.code===xe.errors.BUFFER_OVERRUN)throw a;o=a,o.baseType=s.name,o.name=s.localName,o.type=s.type}o!=null&&t.push(o)});const i=e.reduce((s,o)=>{const a=o.localName;return a&&(s[a]||(s[a]=0),s[a]++),s},{});e.forEach((s,o)=>{let a=s.localName;if(!a||i[a]!==1||(a==="length"&&(a="_length"),t[a]!=null))return;const l=t[o];l instanceof Error?Object.defineProperty(t,a,{enumerable:!0,get:()=>{throw l}}):t[a]=l});for(let s=0;s{throw o}})}return Object.freeze(t)}class u4e extends dc{constructor(e,t,r){const i=e.type+"["+(t>=0?t:"")+"]",s=t===-1||e.dynamic;super("array",i,r,s),this.coder=e,this.length=t}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let r=0;re._data.length&&jh.throwError("insufficient data length",xe.errors.BUFFER_OVERRUN,{length:e._data.length,count:t}));let r=[];for(let i=0;i{o.dynamic&&(r=!0),i.push(o.type)});const s="tuple("+i.join(",")+")";super("tuple",s,t,r),this.coders=e}defaultValue(){const e=[];this.coders.forEach(r=>{e.push(r.defaultValue())});const t=this.coders.reduce((r,i)=>{const s=i.localName;return s&&(r[s]||(r[s]=0),r[s]++),r},{});return this.coders.forEach((r,i)=>{let s=r.localName;!s||t[s]!==1||(s==="length"&&(s="_length"),e[s]==null&&(e[s]=e[i]))}),Object.freeze(e)}encode(e,t){return jj(e,this.coders,t)}decode(e){return e.coerce(this.name,Wj(e,this.coders))}}const Yy=new xe(N0),v4e=new RegExp(/^bytes([0-9]*)$/),y4e=new RegExp(/^(u?int)([0-9]*)$/);class w4e{constructor(e){Ue(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new c4e(e.name);case"bool":return new f4e(e.name);case"string":return new g4e(e.name);case"bytes":return new h4e(e.name);case"array":return new u4e(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new Xy((e.components||[]).map(r=>this._getCoder(r)),e.name);case"":return new p4e(e.name)}let t=e.type.match(y4e);if(t){let r=parseInt(t[2]||"256");return(r===0||r>256||r%8!==0)&&Yy.throwArgumentError("invalid "+t[1]+" bit length","param",e),new m4e(r/8,t[1]==="int",e.name)}if(t=e.type.match(v4e),t){let r=parseInt(t[1]);return(r===0||r>32)&&Yy.throwArgumentError("invalid bytes length","param",e),new d4e(r,e.name)}return Yy.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new bx(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new KT(this._getWordSize())}getDefaultValue(e){const t=e.map(i=>this._getCoder(Vr.from(i)));return new Xy(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&Yy.throwError("types/values length mismatch",xe.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const r=e.map(o=>this._getCoder(Vr.from(o))),i=new Xy(r,"_"),s=this._getWriter();return i.encode(s,t),s.data}decode(e,t,r){const i=e.map(o=>this._getCoder(Vr.from(o)));return new Xy(i,"_").decode(this._getReader(pt(t),r))}}const _4e=new w4e,zn=new xe(N0);class x4e extends a0{}class b4e extends a0{}class E4e extends a0{}class XT extends a0{static isIndexed(e){return!!(e&&e._isIndexed)}}const B4e={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function v4(n,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${n}`);return t.error=e,t}class y4{constructor(e){let t=[];typeof e=="string"?t=JSON.parse(e):t=e,Ue(this,"fragments",t.map(r=>Gl.from(r)).filter(r=>r!=null)),Ue(this,"_abiCoder",Cs(new.target,"getAbiCoder")()),Ue(this,"functions",{}),Ue(this,"errors",{}),Ue(this,"events",{}),Ue(this,"structs",{}),this.fragments.forEach(r=>{let i=null;switch(r.type){case"constructor":if(this.deploy){zn.warn("duplicate definition - constructor");return}Ue(this,"deploy",r);return;case"function":i=this.functions;break;case"event":i=this.events;break;case"error":i=this.errors;break;default:return}let s=r.format();if(i[s]){zn.warn("duplicate definition - "+s);return}i[s]=r}),this.deploy||Ue(this,"deploy",Na.from({payable:!1,type:"constructor"})),Ue(this,"_isInterface",!0)}format(e){e||(e=Zt.full),e===Zt.sighash&&zn.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map(r=>r.format(e));return e===Zt.json?JSON.stringify(t.map(r=>JSON.parse(r))):t}static getAbiCoder(){return _4e}static getAddress(e){return ai(e)}static getSighash(e){return mi(mh(e.format()),0,4)}static getEventTopic(e){return mh(e.format())}getFunction(e){if(It(e)){for(const r in this.functions)if(e===this.getSighash(r))return this.functions[r];zn.throwArgumentError("no matching function","sighash",e)}if(e.indexOf("(")===-1){const r=e.trim(),i=Object.keys(this.functions).filter(s=>s.split("(")[0]===r);return i.length===0?zn.throwArgumentError("no matching function","name",r):i.length>1&&zn.throwArgumentError("multiple matching functions","name",r),this.functions[i[0]]}const t=this.functions[Oa.fromString(e).format()];return t||zn.throwArgumentError("no matching function","signature",e),t}getEvent(e){if(It(e)){const r=e.toLowerCase();for(const i in this.events)if(r===this.getEventTopic(i))return this.events[i];zn.throwArgumentError("no matching event","topichash",r)}if(e.indexOf("(")===-1){const r=e.trim(),i=Object.keys(this.events).filter(s=>s.split("(")[0]===r);return i.length===0?zn.throwArgumentError("no matching event","name",r):i.length>1&&zn.throwArgumentError("multiple matching events","name",r),this.events[i[0]]}const t=this.events[Ol.fromString(e).format()];return t||zn.throwArgumentError("no matching event","signature",e),t}getError(e){if(It(e)){const r=Cs(this.constructor,"getSighash");for(const i in this.errors){const s=this.errors[i];if(e===r(s))return this.errors[i]}zn.throwArgumentError("no matching error","sighash",e)}if(e.indexOf("(")===-1){const r=e.trim(),i=Object.keys(this.errors).filter(s=>s.split("(")[0]===r);return i.length===0?zn.throwArgumentError("no matching error","name",r):i.length>1&&zn.throwArgumentError("multiple matching errors","name",r),this.errors[i[0]]}const t=this.errors[Oa.fromString(e).format()];return t||zn.throwArgumentError("no matching error","signature",e),t}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch{throw t}}return Cs(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),Cs(this.constructor,"getEventTopic")(e)}_decodeParams(e,t){return this._abiCoder.decode(e,t)}_encodeParams(e,t){return this._abiCoder.encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){typeof e=="string"&&(e=this.getError(e));const r=pt(t);return lt(r.slice(0,4))!==this.getSighash(e)&&zn.throwArgumentError(`data signature does not match error ${e.name}.`,"data",lt(r)),this._decodeParams(e.inputs,r.slice(4))}encodeErrorResult(e,t){return typeof e=="string"&&(e=this.getError(e)),lt(Ss([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionData(e,t){typeof e=="string"&&(e=this.getFunction(e));const r=pt(t);return lt(r.slice(0,4))!==this.getSighash(e)&&zn.throwArgumentError(`data signature does not match function ${e.name}.`,"data",lt(r)),this._decodeParams(e.inputs,r.slice(4))}encodeFunctionData(e,t){return typeof e=="string"&&(e=this.getFunction(e)),lt(Ss([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionResult(e,t){typeof e=="string"&&(e=this.getFunction(e));let r=pt(t),i=null,s="",o=null,a=null,l=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch{}break;case 4:{const c=lt(r.slice(0,4)),A=B4e[c];if(A)o=this._abiCoder.decode(A.inputs,r.slice(4)),a=A.name,l=A.signature,A.reason&&(i=o[0]),a==="Error"?s=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:a==="Panic"&&(s=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const u=this.getError(c);o=this._abiCoder.decode(u.inputs,r.slice(4)),a=u.name,l=u.format()}catch{}break}}return zn.throwError("call revert exception"+s,xe.errors.CALL_EXCEPTION,{method:e.format(),data:lt(t),errorArgs:o,errorName:a,errorSignature:l,reason:i})}encodeFunctionResult(e,t){return typeof e=="string"&&(e=this.getFunction(e)),lt(this._abiCoder.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){typeof e=="string"&&(e=this.getEvent(e)),t.length>e.inputs.length&&zn.throwError("too many arguments for "+e.format(),xe.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let r=[];e.anonymous||r.push(this.getEventTopic(e));const i=(s,o)=>s.type==="string"?mh(o):s.type==="bytes"?Er(lt(o)):(s.type==="bool"&&typeof o=="boolean"&&(o=o?"0x01":"0x00"),s.type.match(/^u?int/)&&(o=je.from(o).toHexString()),s.type==="address"&&this._abiCoder.encode(["address"],[o]),ir(lt(o),32));for(t.forEach((s,o)=>{let a=e.inputs[o];if(!a.indexed){s!=null&&zn.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+a.name,s);return}s==null?r.push(null):a.baseType==="array"||a.baseType==="tuple"?zn.throwArgumentError("filtering with tuples or arrays not supported","contract."+a.name,s):Array.isArray(s)?r.push(s.map(l=>i(a,l))):r.push(i(a,s))});r.length&&r[r.length-1]===null;)r.pop();return r}encodeEventLog(e,t){typeof e=="string"&&(e=this.getEvent(e));const r=[],i=[],s=[];return e.anonymous||r.push(this.getEventTopic(e)),t.length!==e.inputs.length&&zn.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach((o,a)=>{const l=t[a];if(o.indexed)if(o.type==="string")r.push(mh(l));else if(o.type==="bytes")r.push(Er(l));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");r.push(this._abiCoder.encode([o.type],[l]))}else i.push(o),s.push(l)}),{data:this._abiCoder.encode(i,s),topics:r}}decodeEventLog(e,t,r){if(typeof e=="string"&&(e=this.getEvent(e)),r!=null&&!e.anonymous){let f=this.getEventTopic(e);(!It(r[0],32)||r[0].toLowerCase()!==f)&&zn.throwError("fragment/topic mismatch",xe.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:f,value:r[0]}),r=r.slice(1)}let i=[],s=[],o=[];e.inputs.forEach((f,h)=>{f.indexed?f.type==="string"||f.type==="bytes"||f.baseType==="tuple"||f.baseType==="array"?(i.push(Vr.fromObject({type:"bytes32",name:f.name})),o.push(!0)):(i.push(f),o.push(!1)):(s.push(f),o.push(!1))});let a=r!=null?this._abiCoder.decode(i,Ss(r)):null,l=this._abiCoder.decode(s,t,!0),c=[],A=0,u=0;e.inputs.forEach((f,h)=>{if(f.indexed)if(a==null)c[h]=new XT({_isIndexed:!0,hash:null});else if(o[h])c[h]=new XT({_isIndexed:!0,hash:a[u++]});else try{c[h]=a[u++]}catch(d){c[h]=d}else try{c[h]=l[A++]}catch(d){c[h]=d}if(f.name&&c[f.name]==null){const d=c[h];d instanceof Error?Object.defineProperty(c,f.name,{enumerable:!0,get:()=>{throw v4(`property ${JSON.stringify(f.name)}`,d)}}):c[f.name]=d}});for(let f=0;f{throw v4(`index ${f}`,h)}})}return Object.freeze(c)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new b4e({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:je.from(e.value||"0")}):null}parseLog(e){let t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new x4e({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}parseError(e){const t=lt(e);let r=this.getError(t.substring(0,10).toLowerCase());return r?new E4e({args:this._abiCoder.decode(r.inputs,"0x"+t.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(e){return!!(e&&e._isInterface)}}const M4e="contracts/5.7.0";var Gu=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const fr=new xe(M4e);function Ex(n,e){return Gu(this,void 0,void 0,function*(){const t=yield e;typeof t!="string"&&fr.throwArgumentError("invalid address or ENS name","name",t);try{return ai(t)}catch{}n||fr.throwError("a provider or signer is needed to resolve ENS names",xe.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const r=yield n.resolveName(t);return r==null&&fr.throwArgumentError("resolver or addr is not configured for ENS name","name",t),r})}function zw(n,e,t){return Gu(this,void 0,void 0,function*(){return Array.isArray(t)?yield Promise.all(t.map((r,i)=>zw(n,Array.isArray(e)?e[i]:e[r.name],r))):t.type==="address"?yield Ex(n,e):t.type==="tuple"?yield zw(n,e,t.components):t.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(r=>zw(n,r,t.arrayChildren))):Promise.reject(fr.makeError("invalid value for array",xe.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function nb(n,e,t){return Gu(this,void 0,void 0,function*(){let r={};t.length===e.inputs.length+1&&typeof t[t.length-1]=="object"&&(r=Qn(t.pop())),fr.checkArgumentCount(t.length,e.inputs.length,"passed to contract"),n.signer?r.from?r.from=wr({override:Ex(n.signer,r.from),signer:n.signer.getAddress()}).then(c=>Gu(this,void 0,void 0,function*(){return ai(c.signer)!==c.override&&fr.throwError("Contract with a Signer cannot override from",xe.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),c.override})):r.from=n.signer.getAddress():r.from&&(r.from=Ex(n.provider,r.from));const i=yield wr({args:zw(n.signer||n.provider,t,e.inputs),address:n.resolvedAddress,overrides:wr(r)||{}}),s=n.interface.encodeFunctionData(e,i.args),o={data:s,to:i.address},a=i.overrides;if(a.nonce!=null&&(o.nonce=je.from(a.nonce).toNumber()),a.gasLimit!=null&&(o.gasLimit=je.from(a.gasLimit)),a.gasPrice!=null&&(o.gasPrice=je.from(a.gasPrice)),a.maxFeePerGas!=null&&(o.maxFeePerGas=je.from(a.maxFeePerGas)),a.maxPriorityFeePerGas!=null&&(o.maxPriorityFeePerGas=je.from(a.maxPriorityFeePerGas)),a.from!=null&&(o.from=a.from),a.type!=null&&(o.type=a.type),a.accessList!=null&&(o.accessList=Wu(a.accessList)),o.gasLimit==null&&e.gas!=null){let c=21e3;const A=pt(s);for(let u=0;ur[c]!=null);return l.length&&fr.throwError(`cannot override ${l.map(c=>JSON.stringify(c)).join(",")}`,xe.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:l}),o})}function S4e(n,e){return function(...t){return nb(n,e,t)}}function C4e(n,e){const t=n.signer||n.provider;return function(...r){return Gu(this,void 0,void 0,function*(){t||fr.throwError("estimate require a provider or signer",xe.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield nb(n,e,r);return yield t.estimateGas(i)})}}function T4e(n,e){const t=e.wait.bind(e);e.wait=r=>t(r).then(i=>(i.events=i.logs.map(s=>{let o=Ps(s),a=null;try{a=n.interface.parseLog(s)}catch{}return a&&(o.args=a.args,o.decode=(l,c)=>n.interface.decodeEventLog(a.eventFragment,l,c),o.event=a.name,o.eventSignature=a.signature),o.removeListener=()=>n.provider,o.getBlock=()=>n.provider.getBlock(i.blockHash),o.getTransaction=()=>n.provider.getTransaction(i.transactionHash),o.getTransactionReceipt=()=>Promise.resolve(i),o}),i))}function Xj(n,e,t){const r=n.signer||n.provider;return function(...i){return Gu(this,void 0,void 0,function*(){let s;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const l=Qn(i.pop());l.blockTag!=null&&(s=yield l.blockTag),delete l.blockTag,i.push(l)}n.deployTransaction!=null&&(yield n._deployed(s));const o=yield nb(n,e,i),a=yield r.call(o,s);try{let l=n.interface.decodeFunctionResult(e,a);return t&&e.outputs.length===1&&(l=l[0]),l}catch(l){throw l.code===xe.errors.CALL_EXCEPTION&&(l.address=n.address,l.args=i,l.transaction=o),l}})}}function I4e(n,e){return function(...t){return Gu(this,void 0,void 0,function*(){n.signer||fr.throwError("sending a transaction requires a signer",xe.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),n.deployTransaction!=null&&(yield n._deployed());const r=yield nb(n,e,t),i=yield n.signer.sendTransaction(r);return T4e(n,i),i})}}function w4(n,e,t){return e.constant?Xj(n,e,t):I4e(n,e)}function Yj(n){return n.address&&(n.topics==null||n.topics.length===0)?"*":(n.address||"*")+"@"+(n.topics?n.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):"")}class i0{constructor(e,t){Ue(this,"tag",e),Ue(this,"filter",t),this._listeners=[]}addListener(e,t){this._listeners.push({listener:e,once:t})}removeListener(e){let t=!1;this._listeners=this._listeners.filter(r=>t||r.listener!==e?!0:(t=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){const t=this.listenerCount();return this._listeners=this._listeners.filter(r=>{const i=e.slice();return setTimeout(()=>{r.listener.apply(this,i)},0),!r.once}),t}prepareEvent(e){}getEmit(e){return[e]}}class R4e extends i0{constructor(){super("error",null)}}class _4 extends i0{constructor(e,t,r,i){const s={address:e};let o=t.getEventTopic(r);i?(o!==i[0]&&fr.throwArgumentError("topic mismatch","topics",i),s.topics=i.slice()):s.topics=[o],super(Yj(s),s),Ue(this,"address",e),Ue(this,"interface",t),Ue(this,"fragment",r)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(t,r)=>this.interface.decodeEventLog(this.fragment,t,r);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(t){e.args=null,e.decodeError=t}}getEmit(e){const t=l4e(e.args);if(t.length)throw t[0].error;const r=(e.args||[]).slice();return r.push(e),r}}class x4 extends i0{constructor(e,t){super("*",{address:e}),Ue(this,"address",e),Ue(this,"interface",t)}prepareEvent(e){super.prepareEvent(e);try{const t=this.interface.parseLog(e);e.event=t.name,e.eventSignature=t.signature,e.decode=(r,i)=>this.interface.decodeEventLog(t.eventFragment,r,i),e.args=t.args}catch{}}}class U4e{constructor(e,t,r){Ue(this,"interface",Cs(new.target,"getInterface")(t)),r==null?(Ue(this,"provider",null),Ue(this,"signer",null)):u0.isSigner(r)?(Ue(this,"provider",r.provider||null),Ue(this,"signer",r)):l0.isProvider(r)?(Ue(this,"provider",r),Ue(this,"signer",null)):fr.throwArgumentError("invalid signer or provider","signerOrProvider",r),Ue(this,"callStatic",{}),Ue(this,"estimateGas",{}),Ue(this,"functions",{}),Ue(this,"populateTransaction",{}),Ue(this,"filters",{});{const o={};Object.keys(this.interface.events).forEach(a=>{const l=this.interface.events[a];Ue(this.filters,a,(...c)=>({address:this.address,topics:this.interface.encodeFilterTopics(l,c)})),o[l.name]||(o[l.name]=[]),o[l.name].push(a)}),Object.keys(o).forEach(a=>{const l=o[a];l.length===1?Ue(this.filters,a,this.filters[l[0]]):fr.warn(`Duplicate definition of ${a} (${l.join(", ")})`)})}if(Ue(this,"_runningEvents",{}),Ue(this,"_wrappedEmits",{}),e==null&&fr.throwArgumentError("invalid contract address or ENS name","addressOrName",e),Ue(this,"address",e),this.provider)Ue(this,"resolvedAddress",Ex(this.provider,e));else try{Ue(this,"resolvedAddress",Promise.resolve(ai(e)))}catch{fr.throwError("provider is required to use ENS name as contract address",xe.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(o=>{});const i={},s={};Object.keys(this.interface.functions).forEach(o=>{const a=this.interface.functions[o];if(s[o]){fr.warn(`Duplicate ABI entry for ${JSON.stringify(o)}`);return}s[o]=!0;{const l=a.name;i[`%${l}`]||(i[`%${l}`]=[]),i[`%${l}`].push(o)}this[o]==null&&Ue(this,o,w4(this,a,!0)),this.functions[o]==null&&Ue(this.functions,o,w4(this,a,!1)),this.callStatic[o]==null&&Ue(this.callStatic,o,Xj(this,a,!0)),this.populateTransaction[o]==null&&Ue(this.populateTransaction,o,S4e(this,a)),this.estimateGas[o]==null&&Ue(this.estimateGas,o,C4e(this,a))}),Object.keys(i).forEach(o=>{const a=i[o];if(a.length>1)return;o=o.substring(1);const l=a[0];try{this[o]==null&&Ue(this,o,this[l])}catch{}this.functions[o]==null&&Ue(this.functions,o,this.functions[l]),this.callStatic[o]==null&&Ue(this.callStatic,o,this.callStatic[l]),this.populateTransaction[o]==null&&Ue(this.populateTransaction,o,this.populateTransaction[l]),this.estimateGas[o]==null&&Ue(this.estimateGas,o,this.estimateGas[l])})}static getContractAddress(e){return yQ(e)}static getInterface(e){return y4.isInterface(e)?e:new y4(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(t=>(t==="0x"&&fr.throwError("contract not deployed",xe.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||fr.throwError("sending a transactions require a signer",xe.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=Qn(e||{});return["from","to"].forEach(function(r){t[r]!=null&&fr.throwError("cannot override "+r,xe.errors.UNSUPPORTED_OPERATION,{operation:r})}),t.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(t))}connect(e){typeof e=="string"&&(e=new gI(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&Ue(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return XT.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if(typeof e=="string"){if(e==="error")return this._normalizeRunningEvent(new R4e);if(e==="event")return this._normalizeRunningEvent(new i0("event",null));if(e==="*")return this._normalizeRunningEvent(new x4(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new _4(this.address,this.interface,t))}if(e.topics&&e.topics.length>0){try{const r=e.topics[0];if(typeof r!="string")throw new Error("invalid topic");const i=this.interface.getEvent(r);return this._normalizeRunningEvent(new _4(this.address,this.interface,i,e.topics))}catch{}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new i0(Yj(t),t))}return this._normalizeRunningEvent(new x4(this.address,this.interface))}_checkRunningEvents(e){if(e.listenerCount()===0){delete this._runningEvents[e.tag];const t=this._wrappedEmits[e.tag];t&&e.filter&&(this.provider.off(e.filter,t),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,t,r){const i=Ps(t);return i.removeListener=()=>{r&&(e.removeListener(r),this._checkRunningEvents(e))},i.getBlock=()=>this.provider.getBlock(t.blockHash),i.getTransaction=()=>this.provider.getTransaction(t.transactionHash),i.getTransactionReceipt=()=>this.provider.getTransactionReceipt(t.transactionHash),e.prepareEvent(i),i}_addEventListener(e,t,r){if(this.provider||fr.throwError("events require a provider or a signer with a provider",xe.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(t,r),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const i=s=>{let o=this._wrapEvent(e,s,t);if(o.decodeError==null)try{const a=e.getEmit(o);this.emit(e.filter,...a)}catch(a){o.decodeError=a.error}e.filter!=null&&this.emit("event",o),o.decodeError!=null&&this.emit("error",o.decodeError,o)};this._wrappedEmits[e.tag]=i,e.filter!=null&&this.provider.on(e.filter,i)}}queryFilter(e,t,r){const i=this._getRunningEvent(e),s=Qn(i.filter);return typeof t=="string"&&It(t,32)?(r!=null&&fr.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),s.blockHash=t):(s.fromBlock=t??0,s.toBlock=r??"latest"),this.provider.getLogs(s).then(o=>o.map(a=>this._wrapEvent(i,a,null)))}on(e,t){return this._addEventListener(this._getRunningEvent(e),t,!1),this}once(e,t){return this._addEventListener(this._getRunningEvent(e),t,!0),this}emit(e,...t){if(!this.provider)return!1;const r=this._getRunningEvent(e),i=r.run(t)>0;return this._checkRunningEvents(r),i}listenerCount(e){return this.provider?e==null?Object.keys(this._runningEvents).reduce((t,r)=>t+this._runningEvents[r].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(e==null){const t=[];for(let r in this._runningEvents)this._runningEvents[r].listeners().forEach(i=>{t.push(i)});return t}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(e==null){for(const r in this._runningEvents){const i=this._runningEvents[r];i.removeAllListeners(),this._checkRunningEvents(i)}return this}const t=this._getRunningEvent(e);return t.removeAllListeners(),this._checkRunningEvents(t),this}off(e,t){if(!this.provider)return this;const r=this._getRunningEvent(e);return r.removeListener(t),this._checkRunningEvents(r),this}removeListener(e,t){return this.off(e,t)}}class rb extends U4e{}const F4e="0x543D43F390b7d681513045e8a85707438c463d80",Bx={owner:"0x634B0510C5062CFf8009eAAc2435eB93bc4764ad",address:"0x69341F01C2113E2d09Cd4837bbF1786dfbBc41d7",abi:[{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"tokenPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"numberOfTokens",type:"uint256"},{internalType:"string",name:"_tokenURI",type:"string"}],name:"mintToken",outputs:[],stateMutability:"payable",type:"function"}]},b4={address:"0x0000000000000aF8FE6E4DE40F4804C90fA8Ea8F",abi:[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"AddressMismatch",type:"error"},{inputs:[],name:"AlreadyProxied",type:"error"},{inputs:[],name:"ColdAddressCannotBeTheSameAsHot",type:"error"},{inputs:[],name:"ColdIsAddressZero",type:"error"},{inputs:[],name:"ColdWalletCannotInteractUseHot",type:"error"},{inputs:[],name:"DeliveryCannotBeTheZeroAddress",type:"error"},{inputs:[],name:"DeliveryIsAddressZero",type:"error"},{inputs:[],name:"EthWithdrawFailed",type:"error"},{inputs:[],name:"IncorrectProxyRegisterFee",type:"error"},{inputs:[],name:"MigrationIsAllowedOnceOnly",type:"error"},{inputs:[],name:"NoPaymentPendingForAddress",type:"error"},{inputs:[],name:"NoRecordFoundForAddress",type:"error"},{inputs:[],name:"OnlyHotAddressCanChangeAddress",type:"error"},{inputs:[],name:"ProxyRegisterFeeRequired",type:"error"},{inputs:[],name:"RegisterAddressLocked",type:"error"},{inputs:[],name:"RewardRateIsLocked",type:"error"},{inputs:[],name:"UnknownAmount",type:"error"},{inputs:[],name:"UnrecognisedEPSAPIAmount",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!0,internalType:"address",name:"delivery",type:"address"},{indexed:!1,internalType:"address",name:"oldDelivery",type:"address"},{indexed:!1,internalType:"uint256",name:"provider",type:"uint256"}],name:"DeliveryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"ensReverseRegistrarAddress",type:"address"}],name:"ENSReverseRegistrarSet",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"erc20",type:"address"},{indexed:!1,internalType:"uint256",name:"erc20Fee_",type:"uint256"}],name:"ERC20FeeUpdated",type:"event"},{anonymous:!1,inputs:[],name:"MigrationComplete",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"address",name:"delivery",type:"address"},{indexed:!0,internalType:"uint64",name:"provider",type:"uint64"}],name:"NominationAccepted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"address",name:"delivery",type:"address"},{indexed:!1,internalType:"uint256",name:"provider",type:"uint256"}],name:"NominationMade",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"address",name:"delivery",type:"address"},{indexed:!0,internalType:"uint64",name:"provider",type:"uint64"}],name:"ProxyRecordLive",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"enum IEPSProxyRegister.Participant",name:"initiator",type:"uint8"},{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"uint256",name:"provider",type:"uint256"}],name:"RecordDeleted",type:"event"},{anonymous:!1,inputs:[],name:"RewardRateLocked",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint96",name:"rewardRate",type:"uint96"}],name:"RewardRateUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"newToken",type:"address"}],name:"RewardTokenUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"hot_",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"}],name:"acceptNomination",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"activeEthAddresses",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"bool",name:"checkingHot_",type:"bool"}],name:"addressIsAvailable",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"}],name:"beneficiaryBalance",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryBalanceOf",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"id_",type:"uint256"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryBalanceOf1155",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryBalanceOf20",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"tokenId_",type:"uint256"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryOf",outputs:[{internalType:"address",name:"beneficiary_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"}],name:"coldIsActiveOnRegister",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"}],name:"coldIsLive",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"coldToHot",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"provider_",type:"uint256"}],name:"deleteRecord",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"deletionNominalEth",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"ensReverseRegistrar",outputs:[{internalType:"contract ENSReverseRegistrar",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"epsAPIBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc1155DelegationRegister",outputs:[{internalType:"contract IERC1155DelegateRegister",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc1155DelegationRegisterAddressLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc20DelegationRegister",outputs:[{internalType:"contract IERC20DelegateRegister",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc20DelegationRegisterAddressLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"erc20PerTransactionFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc721DelegationRegister",outputs:[{internalType:"contract IERC721DelegateRegister",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc721DelegationRegisterAddressLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAddresses1155",outputs:[{internalType:"address[]",name:"proxyAddresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAddresses20",outputs:[{internalType:"address[]",name:"proxyAddresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAddresses721",outputs:[{internalType:"address[]",name:"proxyAddresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAllAddresses",outputs:[{internalType:"address[]",name:"erc721Addresses_",type:"address[]"},{internalType:"address[]",name:"erc1155Addresses_",type:"address[]"},{internalType:"address[]",name:"erc20Addresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_receivedAddress",type:"address"}],name:"getColdAndDeliveryAddresses",outputs:[{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"bool",name:"isProxied",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"}],name:"getProxyRecordForAddress",outputs:[{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"},{internalType:"bool",name:"feePaid",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"}],name:"getProxyRecordForCold",outputs:[{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"},{internalType:"bool",name:"feePaid",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"}],name:"getProxyRecordForHot",outputs:[{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"},{internalType:"bool",name:"feePaid",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"}],name:"hotIsActiveOnRegister",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"}],name:"hotIsLive",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"hotToRecord",outputs:[{internalType:"uint64",name:"provider",type:"uint64"},{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"bool",name:"feePaid",type:"bool"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"},{internalType:"address",name:"cold_",type:"address"},{internalType:"address",name:"delivery_",type:"address"}],name:"isValidAddresses",outputs:[],stateMutability:"pure",type:"function"},{inputs:[],name:"lockERC1155DelegationRegisterAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockERC20DelegationRegisterAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockERC721DelegationRegisterAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockRewardRate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"}],internalType:"struct EPSRegister.MigratedRecord[]",name:"migratedRecords_",type:"tuple[]"}],name:"migration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"migrationComplete",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"},{internalType:"address",name:"delivery_",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"}],name:"nominate",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"sender_",type:"address"},{internalType:"uint256",name:"erc20Value_",type:"uint256"},{internalType:"bytes",name:"data_",type:"bytes"}],name:"onTokenTransfer",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxyRegisterFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC1155",name:"token_",type:"address"},{internalType:"uint256",name:"tokenId_",type:"uint256"}],name:"rescueERC1155",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"token_",type:"address"},{internalType:"uint256",name:"amount_",type:"uint256"}],name:"rescueERC20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC721",name:"token_",type:"address"},{internalType:"uint256",name:"tokenId_",type:"uint256"}],name:"rescueERC721",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"rewardRate",outputs:[{internalType:"uint88",name:"",type:"uint88"}],stateMutability:"view",type:"function"},{inputs:[],name:"rewardRateLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"rewardToken",outputs:[{internalType:"contract IOAT",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"deleteNominalEth_",type:"uint256"}],name:"setDeletionNominalEth",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"ensName_",type:"string"}],name:"setENSName",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"ensReverseRegistrar_",type:"address"}],name:"setENSReverseRegistrar",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc1155DelegationRegister_",type:"address"}],name:"setERC1155DelegationRegister",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc20DelegationRegister_",type:"address"}],name:"setERC20DelegationRegister",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc20_",type:"address"},{internalType:"uint256",name:"erc20Fee_",type:"uint256"}],name:"setERC20Fee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc721DelegationRegister_",type:"address"}],name:"setERC721DelegationRegister",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"count_",type:"uint256"},{internalType:"uint256",name:"air_",type:"uint256"}],name:"setNNumberOfEthAddressesAndAirdropAmount",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"registerFee_",type:"uint256"}],name:"setRegisterFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint88",name:"rewardRate_",type:"uint88"}],name:"setRewardRate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"rewardToken_",type:"address"}],name:"setRewardToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"treasuryAddress_",type:"address"}],name:"setTreasuryAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"treasury",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"delivery_",type:"address"},{internalType:"uint256",name:"provider_",type:"uint256"}],name:"updateDeliveryAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"token_",type:"address"},{internalType:"uint256",name:"amount_",type:"uint256"}],name:"withdrawERC20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount_",type:"uint256"}],name:"withdrawETH",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}]};function $j(n,e){return function(){return n.apply(e,arguments)}}const{toString:P4e}=Object.prototype,{getPrototypeOf:dU}=Object,ib=(n=>e=>{const t=P4e.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),pa=n=>(n=n.toLowerCase(),e=>ib(e)===n),sb=n=>e=>typeof e===n,{isArray:fp}=Array,s0=sb("undefined");function L4e(n){return n!==null&&!s0(n)&&n.constructor!==null&&!s0(n.constructor)&&Os(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const Zj=pa("ArrayBuffer");function D4e(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&Zj(n.buffer),e}const N4e=sb("string"),Os=sb("function"),Jj=sb("number"),ob=n=>n!==null&&typeof n=="object",O4e=n=>n===!0||n===!1,Gw=n=>{if(ib(n)!=="object")return!1;const e=dU(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},k4e=pa("Date"),Q4e=pa("File"),H4e=pa("Blob"),z4e=pa("FileList"),G4e=n=>ob(n)&&Os(n.pipe),V4e=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||Os(n.append)&&((e=ib(n))==="formdata"||e==="object"&&Os(n.toString)&&n.toString()==="[object FormData]"))},j4e=pa("URLSearchParams"),[W4e,K4e,X4e,Y4e]=["ReadableStream","Request","Response","Headers"].map(pa),$4e=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function O0(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let r,i;if(typeof n!="object"&&(n=[n]),fp(n))for(r=0,i=n.length;r0;)if(i=t[r],e===i.toLowerCase())return i;return null}const gu=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),eW=n=>!s0(n)&&n!==gu;function YT(){const{caseless:n}=eW(this)&&this||{},e={},t=(r,i)=>{const s=n&&qj(e,i)||i;Gw(e[s])&&Gw(r)?e[s]=YT(e[s],r):Gw(r)?e[s]=YT({},r):fp(r)?e[s]=r.slice():e[s]=r};for(let r=0,i=arguments.length;r(O0(e,(i,s)=>{t&&Os(i)?n[s]=$j(i,t):n[s]=i},{allOwnKeys:r}),n),J4e=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),q4e=(n,e,t,r)=>{n.prototype=Object.create(e.prototype,r),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},eQe=(n,e,t,r)=>{let i,s,o;const a={};if(e=e||{},n==null)return e;do{for(i=Object.getOwnPropertyNames(n),s=i.length;s-- >0;)o=i[s],(!r||r(o,n,e))&&!a[o]&&(e[o]=n[o],a[o]=!0);n=t!==!1&&dU(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},tQe=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const r=n.indexOf(e,t);return r!==-1&&r===t},nQe=n=>{if(!n)return null;if(fp(n))return n;let e=n.length;if(!Jj(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},rQe=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&dU(Uint8Array)),iQe=(n,e)=>{const r=(n&&n[Symbol.iterator]).call(n);let i;for(;(i=r.next())&&!i.done;){const s=i.value;e.call(n,s[0],s[1])}},sQe=(n,e)=>{let t;const r=[];for(;(t=n.exec(e))!==null;)r.push(t);return r},oQe=pa("HTMLFormElement"),aQe=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,i){return r.toUpperCase()+i}),E4=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),lQe=pa("RegExp"),tW=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),r={};O0(t,(i,s)=>{let o;(o=e(i,s,n))!==!1&&(r[s]=o||i)}),Object.defineProperties(n,r)},cQe=n=>{tW(n,(e,t)=>{if(Os(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const r=n[t];if(Os(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},AQe=(n,e)=>{const t={},r=i=>{i.forEach(s=>{t[s]=!0})};return fp(n)?r(n):r(String(n).split(e)),t},uQe=()=>{},fQe=(n,e)=>n!=null&&Number.isFinite(n=+n)?n:e,xM="abcdefghijklmnopqrstuvwxyz",B4="0123456789",nW={DIGIT:B4,ALPHA:xM,ALPHA_DIGIT:xM+xM.toUpperCase()+B4},hQe=(n=16,e=nW.ALPHA_DIGIT)=>{let t="";const{length:r}=e;for(;n--;)t+=e[Math.random()*r|0];return t};function dQe(n){return!!(n&&Os(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const pQe=n=>{const e=new Array(10),t=(r,i)=>{if(ob(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const s=fp(r)?[]:{};return O0(r,(o,a)=>{const l=t(o,i+1);!s0(l)&&(s[a]=l)}),e[i]=void 0,s}}return r};return t(n,0)},mQe=pa("AsyncFunction"),gQe=n=>n&&(ob(n)||Os(n))&&Os(n.then)&&Os(n.catch),rW=((n,e)=>n?setImmediate:e?((t,r)=>(gu.addEventListener("message",({source:i,data:s})=>{i===gu&&s===t&&r.length&&r.shift()()},!1),i=>{r.push(i),gu.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Os(gu.postMessage)),vQe=typeof queueMicrotask<"u"?queueMicrotask.bind(gu):typeof process<"u"&&process.nextTick||rW,Ie={isArray:fp,isArrayBuffer:Zj,isBuffer:L4e,isFormData:V4e,isArrayBufferView:D4e,isString:N4e,isNumber:Jj,isBoolean:O4e,isObject:ob,isPlainObject:Gw,isReadableStream:W4e,isRequest:K4e,isResponse:X4e,isHeaders:Y4e,isUndefined:s0,isDate:k4e,isFile:Q4e,isBlob:H4e,isRegExp:lQe,isFunction:Os,isStream:G4e,isURLSearchParams:j4e,isTypedArray:rQe,isFileList:z4e,forEach:O0,merge:YT,extend:Z4e,trim:$4e,stripBOM:J4e,inherits:q4e,toFlatObject:eQe,kindOf:ib,kindOfTest:pa,endsWith:tQe,toArray:nQe,forEachEntry:iQe,matchAll:sQe,isHTMLForm:oQe,hasOwnProperty:E4,hasOwnProp:E4,reduceDescriptors:tW,freezeMethods:cQe,toObjectSet:AQe,toCamelCase:aQe,noop:uQe,toFiniteNumber:fQe,findKey:qj,global:gu,isContextDefined:eW,ALPHABET:nW,generateString:hQe,isSpecCompliantForm:dQe,toJSONObject:pQe,isAsyncFn:mQe,isThenable:gQe,setImmediate:rW,asap:vQe};function bt(n,e,t,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}Ie.inherits(bt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ie.toJSONObject(this.config),code:this.code,status:this.status}}});const iW=bt.prototype,sW={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{sW[n]={value:n}});Object.defineProperties(bt,sW);Object.defineProperty(iW,"isAxiosError",{value:!0});bt.from=(n,e,t,r,i,s)=>{const o=Object.create(iW);return Ie.toFlatObject(n,o,function(l){return l!==Error.prototype},a=>a!=="isAxiosError"),bt.call(o,n.message,e,t,r,i),o.cause=n,o.name=n.name,s&&Object.assign(o,s),o};const yQe=null;function $T(n){return Ie.isPlainObject(n)||Ie.isArray(n)}function oW(n){return Ie.endsWith(n,"[]")?n.slice(0,-2):n}function M4(n,e,t){return n?n.concat(e).map(function(i,s){return i=oW(i),!t&&s?"["+i+"]":i}).join(t?".":""):e}function wQe(n){return Ie.isArray(n)&&!n.some($T)}const _Qe=Ie.toFlatObject(Ie,{},null,function(e){return/^is[A-Z]/.test(e)});function ab(n,e,t){if(!Ie.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=Ie.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,g){return!Ie.isUndefined(g[m])});const r=t.metaTokens,i=t.visitor||A,s=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&Ie.isSpecCompliantForm(e);if(!Ie.isFunction(i))throw new TypeError("visitor must be a function");function c(d){if(d===null)return"";if(Ie.isDate(d))return d.toISOString();if(!l&&Ie.isBlob(d))throw new bt("Blob is not supported. Use a Buffer instead.");return Ie.isArrayBuffer(d)||Ie.isTypedArray(d)?l&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function A(d,m,g){let p=d;if(d&&!g&&typeof d=="object"){if(Ie.endsWith(m,"{}"))m=r?m:m.slice(0,-2),d=JSON.stringify(d);else if(Ie.isArray(d)&&wQe(d)||(Ie.isFileList(d)||Ie.endsWith(m,"[]"))&&(p=Ie.toArray(d)))return m=oW(m),p.forEach(function(w,_){!(Ie.isUndefined(w)||w===null)&&e.append(o===!0?M4([m],_,s):o===null?m:m+"[]",c(w))}),!1}return $T(d)?!0:(e.append(M4(g,m,s),c(d)),!1)}const u=[],f=Object.assign(_Qe,{defaultVisitor:A,convertValue:c,isVisitable:$T});function h(d,m){if(!Ie.isUndefined(d)){if(u.indexOf(d)!==-1)throw Error("Circular reference detected in "+m.join("."));u.push(d),Ie.forEach(d,function(p,v){(!(Ie.isUndefined(p)||p===null)&&i.call(e,p,Ie.isString(v)?v.trim():v,m,f))===!0&&h(p,m?m.concat(v):[v])}),u.pop()}}if(!Ie.isObject(n))throw new TypeError("data must be an object");return h(n),e}function S4(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function pU(n,e){this._pairs=[],n&&ab(n,this,e)}const aW=pU.prototype;aW.append=function(e,t){this._pairs.push([e,t])};aW.toString=function(e){const t=e?function(r){return e.call(this,r,S4)}:S4;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function xQe(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function lW(n,e,t){if(!e)return n;const r=t&&t.encode||xQe,i=t&&t.serialize;let s;if(i?s=i(e,t):s=Ie.isURLSearchParams(e)?e.toString():new pU(e,t).toString(r),s){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}class bQe{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Ie.forEach(this.handlers,function(r){r!==null&&e(r)})}}const C4=bQe,cW={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},EQe=typeof URLSearchParams<"u"?URLSearchParams:pU,BQe=typeof FormData<"u"?FormData:null,MQe=typeof Blob<"u"?Blob:null,SQe={isBrowser:!0,classes:{URLSearchParams:EQe,FormData:BQe,Blob:MQe},protocols:["http","https","file","blob","url","data"]},mU=typeof window<"u"&&typeof document<"u",ZT=typeof navigator=="object"&&navigator||void 0,CQe=mU&&(!ZT||["ReactNative","NativeScript","NS"].indexOf(ZT.product)<0),TQe=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),IQe=mU&&window.location.href||"http://localhost",RQe=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:mU,hasStandardBrowserEnv:CQe,hasStandardBrowserWebWorkerEnv:TQe,navigator:ZT,origin:IQe},Symbol.toStringTag,{value:"Module"})),ls={...RQe,...SQe};function UQe(n,e){return ab(n,new ls.classes.URLSearchParams,Object.assign({visitor:function(t,r,i,s){return ls.isNode&&Ie.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function FQe(n){return Ie.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function PQe(n){const e={},t=Object.keys(n);let r;const i=t.length;let s;for(r=0;r=t.length;return o=!o&&Ie.isArray(i)?i.length:o,l?(Ie.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!a):((!i[o]||!Ie.isObject(i[o]))&&(i[o]=[]),e(t,r,i[o],s)&&Ie.isArray(i[o])&&(i[o]=PQe(i[o])),!a)}if(Ie.isFormData(n)&&Ie.isFunction(n.entries)){const t={};return Ie.forEachEntry(n,(r,i)=>{e(FQe(r),i,t,0)}),t}return null}function LQe(n,e,t){if(Ie.isString(n))try{return(e||JSON.parse)(n),Ie.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}const gU={transitional:cW,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,s=Ie.isObject(e);if(s&&Ie.isHTMLForm(e)&&(e=new FormData(e)),Ie.isFormData(e))return i?JSON.stringify(AW(e)):e;if(Ie.isArrayBuffer(e)||Ie.isBuffer(e)||Ie.isStream(e)||Ie.isFile(e)||Ie.isBlob(e)||Ie.isReadableStream(e))return e;if(Ie.isArrayBufferView(e))return e.buffer;if(Ie.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return UQe(e,this.formSerializer).toString();if((a=Ie.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return ab(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),LQe(e)):e}],transformResponse:[function(e){const t=this.transitional||gU.transitional,r=t&&t.forcedJSONParsing,i=this.responseType==="json";if(Ie.isResponse(e)||Ie.isReadableStream(e))return e;if(e&&Ie.isString(e)&&(r&&!this.responseType||i)){const o=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?bt.from(a,bt.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ls.classes.FormData,Blob:ls.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ie.forEach(["delete","get","head","post","put","patch"],n=>{gU.headers[n]={}});const vU=gU,DQe=Ie.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),NQe=n=>{const e={};let t,r,i;return n&&n.split(` +`).forEach(function(o){i=o.indexOf(":"),t=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!t||e[t]&&DQe[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)}),e},T4=Symbol("internals");function hm(n){return n&&String(n).trim().toLowerCase()}function Vw(n){return n===!1||n==null?n:Ie.isArray(n)?n.map(Vw):String(n)}function OQe(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=t.exec(n);)e[r[1]]=r[2];return e}const kQe=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function bM(n,e,t,r,i){if(Ie.isFunction(r))return r.call(this,e,t);if(i&&(e=t),!!Ie.isString(e)){if(Ie.isString(r))return e.indexOf(r)!==-1;if(Ie.isRegExp(r))return r.test(e)}}function QQe(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}function HQe(n,e){const t=Ie.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(n,r+t,{value:function(i,s,o){return this[r].call(this,e,i,s,o)},configurable:!0})})}class lb{constructor(e){e&&this.set(e)}set(e,t,r){const i=this;function s(a,l,c){const A=hm(l);if(!A)throw new Error("header name must be a non-empty string");const u=Ie.findKey(i,A);(!u||i[u]===void 0||c===!0||c===void 0&&i[u]!==!1)&&(i[u||l]=Vw(a))}const o=(a,l)=>Ie.forEach(a,(c,A)=>s(c,A,l));if(Ie.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(Ie.isString(e)&&(e=e.trim())&&!kQe(e))o(NQe(e),t);else if(Ie.isHeaders(e))for(const[a,l]of e.entries())s(l,a,r);else e!=null&&s(t,e,r);return this}get(e,t){if(e=hm(e),e){const r=Ie.findKey(this,e);if(r){const i=this[r];if(!t)return i;if(t===!0)return OQe(i);if(Ie.isFunction(t))return t.call(this,i,r);if(Ie.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=hm(e),e){const r=Ie.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||bM(this,this[r],r,t)))}return!1}delete(e,t){const r=this;let i=!1;function s(o){if(o=hm(o),o){const a=Ie.findKey(r,o);a&&(!t||bM(r,r[a],a,t))&&(delete r[a],i=!0)}}return Ie.isArray(e)?e.forEach(s):s(e),i}clear(e){const t=Object.keys(this);let r=t.length,i=!1;for(;r--;){const s=t[r];(!e||bM(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const t=this,r={};return Ie.forEach(this,(i,s)=>{const o=Ie.findKey(r,s);if(o){t[o]=Vw(i),delete t[s];return}const a=e?QQe(s):String(s).trim();a!==s&&delete t[s],t[a]=Vw(i),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Ie.forEach(this,(r,i)=>{r!=null&&r!==!1&&(t[i]=e&&Ie.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[T4]=this[T4]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=hm(o);r[a]||(HQe(i,o),r[a]=!0)}return Ie.isArray(e)?e.forEach(s):s(e),this}}lb.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ie.reduceDescriptors(lb.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}});Ie.freezeMethods(lb);const oa=lb;function EM(n,e){const t=this||vU,r=e||t,i=oa.from(r.headers);let s=r.data;return Ie.forEach(n,function(a){s=a.call(t,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function uW(n){return!!(n&&n.__CANCEL__)}function hp(n,e,t){bt.call(this,n??"canceled",bt.ERR_CANCELED,e,t),this.name="CanceledError"}Ie.inherits(hp,bt,{__CANCEL__:!0});function fW(n,e,t){const r=t.config.validateStatus;!t.status||!r||r(t.status)?n(t):e(new bt("Request failed with status code "+t.status,[bt.ERR_BAD_REQUEST,bt.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function zQe(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function GQe(n,e){n=n||10;const t=new Array(n),r=new Array(n);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),A=r[s];o||(o=c),t[i]=l,r[i]=c;let u=s,f=0;for(;u!==i;)f+=t[u++],u=u%n;if(i=(i+1)%n,i===s&&(s=(s+1)%n),c-o{t=A,i=null,s&&(clearTimeout(s),s=null),n.apply(null,c)};return[(...c)=>{const A=Date.now(),u=A-t;u>=r?o(c,A):(i=c,s||(s=setTimeout(()=>{s=null,o(i)},r-u)))},()=>i&&o(i)]}const Mx=(n,e,t=3)=>{let r=0;const i=GQe(50,250);return VQe(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,l=o-r,c=i(l),A=o<=a;r=o;const u={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&A?(a-o)/c:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};n(u)},t)},I4=(n,e)=>{const t=n!=null;return[r=>e[0]({lengthComputable:t,total:n,loaded:r}),e[1]]},R4=n=>(...e)=>Ie.asap(()=>n(...e)),jQe=ls.hasStandardBrowserEnv?function(){const e=ls.navigator&&/(msie|trident)/i.test(ls.navigator.userAgent),t=document.createElement("a");let r;function i(s){let o=s;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return r=i(window.location.href),function(o){const a=Ie.isString(o)?i(o):o;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}(),WQe=ls.hasStandardBrowserEnv?{write(n,e,t,r,i,s){const o=[n+"="+encodeURIComponent(e)];Ie.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),Ie.isString(r)&&o.push("path="+r),Ie.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(n){const e=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function KQe(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function XQe(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function hW(n,e){return n&&!KQe(e)?XQe(n,e):e}const U4=n=>n instanceof oa?{...n}:n;function Vu(n,e){e=e||{};const t={};function r(c,A,u){return Ie.isPlainObject(c)&&Ie.isPlainObject(A)?Ie.merge.call({caseless:u},c,A):Ie.isPlainObject(A)?Ie.merge({},A):Ie.isArray(A)?A.slice():A}function i(c,A,u){if(Ie.isUndefined(A)){if(!Ie.isUndefined(c))return r(void 0,c,u)}else return r(c,A,u)}function s(c,A){if(!Ie.isUndefined(A))return r(void 0,A)}function o(c,A){if(Ie.isUndefined(A)){if(!Ie.isUndefined(c))return r(void 0,c)}else return r(void 0,A)}function a(c,A,u){if(u in e)return r(c,A);if(u in n)return r(void 0,c)}const l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(c,A)=>i(U4(c),U4(A),!0)};return Ie.forEach(Object.keys(Object.assign({},n,e)),function(A){const u=l[A]||i,f=u(n[A],e[A],A);Ie.isUndefined(f)&&u!==a||(t[A]=f)}),t}const dW=n=>{const e=Vu({},n);let{data:t,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=oa.from(o),e.url=lW(hW(e.baseURL,e.url),n.params,n.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let l;if(Ie.isFormData(t)){if(ls.hasStandardBrowserEnv||ls.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((l=o.getContentType())!==!1){const[c,...A]=l?l.split(";").map(u=>u.trim()).filter(Boolean):[];o.setContentType([c||"multipart/form-data",...A].join("; "))}}if(ls.hasStandardBrowserEnv&&(r&&Ie.isFunction(r)&&(r=r(e)),r||r!==!1&&jQe(e.url))){const c=i&&s&&WQe.read(s);c&&o.set(i,c)}return e},YQe=typeof XMLHttpRequest<"u",$Qe=YQe&&function(n){return new Promise(function(t,r){const i=dW(n);let s=i.data;const o=oa.from(i.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:c}=i,A,u,f,h,d;function m(){h&&h(),d&&d(),i.cancelToken&&i.cancelToken.unsubscribe(A),i.signal&&i.signal.removeEventListener("abort",A)}let g=new XMLHttpRequest;g.open(i.method.toUpperCase(),i.url,!0),g.timeout=i.timeout;function p(){if(!g)return;const w=oa.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),x={data:!a||a==="text"||a==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:w,config:n,request:g};fW(function(B){t(B),m()},function(B){r(B),m()},x),g=null}"onloadend"in g?g.onloadend=p:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(p)},g.onabort=function(){g&&(r(new bt("Request aborted",bt.ECONNABORTED,n,g)),g=null)},g.onerror=function(){r(new bt("Network Error",bt.ERR_NETWORK,n,g)),g=null},g.ontimeout=function(){let _=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const x=i.transitional||cW;i.timeoutErrorMessage&&(_=i.timeoutErrorMessage),r(new bt(_,x.clarifyTimeoutError?bt.ETIMEDOUT:bt.ECONNABORTED,n,g)),g=null},s===void 0&&o.setContentType(null),"setRequestHeader"in g&&Ie.forEach(o.toJSON(),function(_,x){g.setRequestHeader(x,_)}),Ie.isUndefined(i.withCredentials)||(g.withCredentials=!!i.withCredentials),a&&a!=="json"&&(g.responseType=i.responseType),c&&([f,d]=Mx(c,!0),g.addEventListener("progress",f)),l&&g.upload&&([u,h]=Mx(l),g.upload.addEventListener("progress",u),g.upload.addEventListener("loadend",h)),(i.cancelToken||i.signal)&&(A=w=>{g&&(r(!w||w.type?new hp(null,n,g):w),g.abort(),g=null)},i.cancelToken&&i.cancelToken.subscribe(A),i.signal&&(i.signal.aborted?A():i.signal.addEventListener("abort",A)));const v=zQe(i.url);if(v&&ls.protocols.indexOf(v)===-1){r(new bt("Unsupported protocol "+v+":",bt.ERR_BAD_REQUEST,n));return}g.send(s||null)})},ZQe=(n,e)=>{const{length:t}=n=n?n.filter(Boolean):[];if(e||t){let r=new AbortController,i;const s=function(c){if(!i){i=!0,a();const A=c instanceof Error?c:this.reason;r.abort(A instanceof bt?A:new hp(A instanceof Error?A.message:A))}};let o=e&&setTimeout(()=>{o=null,s(new bt(`timeout ${e} of ms exceeded`,bt.ETIMEDOUT))},e);const a=()=>{n&&(o&&clearTimeout(o),o=null,n.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),n=null)};n.forEach(c=>c.addEventListener("abort",s));const{signal:l}=r;return l.unsubscribe=()=>Ie.asap(a),l}},JQe=ZQe,qQe=function*(n,e){let t=n.byteLength;if(!e||t{const i=eHe(n,e);let s=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:c,value:A}=await i.next();if(c){a(),l.close();return}let u=A.byteLength;if(t){let f=s+=u;t(f)}l.enqueue(new Uint8Array(A))}catch(c){throw a(c),c}},cancel(l){return a(l),i.return()}},{highWaterMark:2})},cb=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",pW=cb&&typeof ReadableStream=="function",nHe=cb&&(typeof TextEncoder=="function"?(n=>e=>n.encode(e))(new TextEncoder):async n=>new Uint8Array(await new Response(n).arrayBuffer())),mW=(n,...e)=>{try{return!!n(...e)}catch{return!1}},rHe=pW&&mW(()=>{let n=!1;const e=new Request(ls.origin,{body:new ReadableStream,method:"POST",get duplex(){return n=!0,"half"}}).headers.has("Content-Type");return n&&!e}),P4=64*1024,JT=pW&&mW(()=>Ie.isReadableStream(new Response("").body)),Sx={stream:JT&&(n=>n.body)};cb&&(n=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Sx[e]&&(Sx[e]=Ie.isFunction(n[e])?t=>t[e]():(t,r)=>{throw new bt(`Response type '${e}' is not supported`,bt.ERR_NOT_SUPPORT,r)})})})(new Response);const iHe=async n=>{if(n==null)return 0;if(Ie.isBlob(n))return n.size;if(Ie.isSpecCompliantForm(n))return(await new Request(ls.origin,{method:"POST",body:n}).arrayBuffer()).byteLength;if(Ie.isArrayBufferView(n)||Ie.isArrayBuffer(n))return n.byteLength;if(Ie.isURLSearchParams(n)&&(n=n+""),Ie.isString(n))return(await nHe(n)).byteLength},sHe=async(n,e)=>{const t=Ie.toFiniteNumber(n.getContentLength());return t??iHe(e)},oHe=cb&&(async n=>{let{url:e,method:t,data:r,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:l,responseType:c,headers:A,withCredentials:u="same-origin",fetchOptions:f}=dW(n);c=c?(c+"").toLowerCase():"text";let h=JQe([i,s&&s.toAbortSignal()],o),d;const m=h&&h.unsubscribe&&(()=>{h.unsubscribe()});let g;try{if(l&&rHe&&t!=="get"&&t!=="head"&&(g=await sHe(A,r))!==0){let x=new Request(e,{method:"POST",body:r,duplex:"half"}),b;if(Ie.isFormData(r)&&(b=x.headers.get("content-type"))&&A.setContentType(b),x.body){const[B,S]=I4(g,Mx(R4(l)));r=F4(x.body,P4,B,S)}}Ie.isString(u)||(u=u?"include":"omit");const p="credentials"in Request.prototype;d=new Request(e,{...f,signal:h,method:t.toUpperCase(),headers:A.normalize().toJSON(),body:r,duplex:"half",credentials:p?u:void 0});let v=await fetch(d);const w=JT&&(c==="stream"||c==="response");if(JT&&(a||w&&m)){const x={};["status","statusText","headers"].forEach(I=>{x[I]=v[I]});const b=Ie.toFiniteNumber(v.headers.get("content-length")),[B,S]=a&&I4(b,Mx(R4(a),!0))||[];v=new Response(F4(v.body,P4,B,()=>{S&&S(),m&&m()}),x)}c=c||"text";let _=await Sx[Ie.findKey(Sx,c)||"text"](v,n);return!w&&m&&m(),await new Promise((x,b)=>{fW(x,b,{data:_,headers:oa.from(v.headers),status:v.status,statusText:v.statusText,config:n,request:d})})}catch(p){throw m&&m(),p&&p.name==="TypeError"&&/fetch/i.test(p.message)?Object.assign(new bt("Network Error",bt.ERR_NETWORK,n,d),{cause:p.cause||p}):bt.from(p,p&&p.code,n,d)}}),qT={http:yQe,xhr:$Qe,fetch:oHe};Ie.forEach(qT,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const L4=n=>`- ${n}`,aHe=n=>Ie.isFunction(n)||n===null||n===!1,gW={getAdapter:n=>{n=Ie.isArray(n)?n:[n];const{length:e}=n;let t,r;const i={};for(let s=0;s`adapter ${a} `+(l===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : +`+s.map(L4).join(` +`):" "+L4(s[0]):"as no adapter specified";throw new bt("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:qT};function BM(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new hp(null,n)}function D4(n){return BM(n),n.headers=oa.from(n.headers),n.data=EM.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),gW.getAdapter(n.adapter||vU.adapter)(n).then(function(r){return BM(n),r.data=EM.call(n,n.transformResponse,r),r.headers=oa.from(r.headers),r},function(r){return uW(r)||(BM(n),r&&r.response&&(r.response.data=EM.call(n,n.transformResponse,r.response),r.response.headers=oa.from(r.response.headers))),Promise.reject(r)})}const vW="1.7.7",yU={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{yU[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});const N4={};yU.transitional=function(e,t,r){function i(s,o){return"[Axios v"+vW+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,a)=>{if(e===!1)throw new bt(i(o," has been removed"+(t?" in "+t:"")),bt.ERR_DEPRECATED);return t&&!N4[o]&&(N4[o]=!0,console.warn(i(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,o,a):!0}};function lHe(n,e,t){if(typeof n!="object")throw new bt("options must be an object",bt.ERR_BAD_OPTION_VALUE);const r=Object.keys(n);let i=r.length;for(;i-- >0;){const s=r[i],o=e[s];if(o){const a=n[s],l=a===void 0||o(a,s,n);if(l!==!0)throw new bt("option "+s+" must be "+l,bt.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new bt("Unknown option "+s,bt.ERR_BAD_OPTION)}}const eI={assertOptions:lHe,validators:yU},Fc=eI.validators;class Cx{constructor(e){this.defaults=e,this.interceptors={request:new C4,response:new C4}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+s):r.stack=s}catch{}}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Vu(this.defaults,t);const{transitional:r,paramsSerializer:i,headers:s}=t;r!==void 0&&eI.assertOptions(r,{silentJSONParsing:Fc.transitional(Fc.boolean),forcedJSONParsing:Fc.transitional(Fc.boolean),clarifyTimeoutError:Fc.transitional(Fc.boolean)},!1),i!=null&&(Ie.isFunction(i)?t.paramsSerializer={serialize:i}:eI.assertOptions(i,{encode:Fc.function,serialize:Fc.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&Ie.merge(s.common,s[t.method]);s&&Ie.forEach(["delete","get","head","post","put","patch","common"],d=>{delete s[d]}),t.headers=oa.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(t)===!1||(l=l&&m.synchronous,a.unshift(m.fulfilled,m.rejected))});const c=[];this.interceptors.response.forEach(function(m){c.push(m.fulfilled,m.rejected)});let A,u=0,f;if(!l){const d=[D4.bind(this),void 0];for(d.unshift.apply(d,a),d.push.apply(d,c),f=d.length,A=Promise.resolve(t);u{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{r.subscribe(a),s=a}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},e(function(s,o,a){r.reason||(r.reason=new hp(s,o,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=r=>{e.abort(r)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new wU(function(i){e=i}),cancel:e}}}const cHe=wU;function AHe(n){return function(t){return n.apply(null,t)}}function uHe(n){return Ie.isObject(n)&&n.isAxiosError===!0}const tI={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(tI).forEach(([n,e])=>{tI[e]=n});const fHe=tI;function yW(n){const e=new jw(n),t=$j(jw.prototype.request,e);return Ie.extend(t,jw.prototype,e,{allOwnKeys:!0}),Ie.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return yW(Vu(n,i))},t}const Cr=yW(vU);Cr.Axios=jw;Cr.CanceledError=hp;Cr.CancelToken=cHe;Cr.isCancel=uW;Cr.VERSION=vW;Cr.toFormData=ab;Cr.AxiosError=bt;Cr.Cancel=Cr.CanceledError;Cr.all=function(e){return Promise.all(e)};Cr.spread=AHe;Cr.isAxiosError=uHe;Cr.mergeConfig=Vu;Cr.AxiosHeaders=oa;Cr.formToJSON=n=>AW(Ie.isHTMLForm(n)?new FormData(n):n);Cr.getAdapter=gW.getAdapter;Cr.HttpStatusCode=fHe;Cr.default=Cr;const hHe=Cr,dHe={}.VITE_OPENSEA_KEY,pHe={}.VITE_PINATA_API_KEY,mHe={}.VITE_PINATA_API_SECRET,MM="0x89";let $y;async function gHe(){if($y!=null)return $y;const n=new tH("https://polygon-rpc.com/"),t=await new rb(Bx.address,Bx.abi,n).tokenPrice();return $y=je.from(t).mul(1),$y}function vHe(n,e){const t={method:"GET",headers:{accept:"application/json","x-api-key":dHe}};return console.log(t),new Promise((r,i)=>{fetch("https://api.opensea.io/api/v2/chain/ethereum/account/"+n+"/nfts?collection="+e,t).then(s=>{if(s.ok)return s.json();i("Failed to fetch data from Opensea API")}).then(s=>{r(s)}).catch(s=>{i(s)})})}async function _U(){if(window.ethereum)try{const n=await window.ethereum.request({method:"eth_chainId"});if(parseInt(n,16)==parseInt(MM,16)){const e=await window.ethereum.request({method:"eth_requestAccounts"});return e.length>0?e[0]:""}else try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:MM}]});const e=await window.ethereum.request({method:"eth_requestAccounts"});return e.length>0?e[0]:""}catch(e){console.log("polygon not find:",e);try{await window.ethereum.request({method:"wallet_addEthereumChain",params:[{chainId:"0x89",chainName:"Polygon Mainnet",rpcUrls:["https://polygon-rpc.com"],nativeCurrency:{name:"Matic",symbol:"MATIC",decimals:18},blockExplorerUrls:["https://polygonscan.com/"]}]}),await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:MM}]});const t=await window.ethereum.request({method:"eth_requestAccounts"});return t.length>0?t[0]:""}catch(t){console.log("Adding polygon chain failed",t)}}}catch{return""}else return""}async function SM(n,e){if(!n)return console.warn("Error saving to pinata: No file data");const t="https://api.pinata.cloud/pinning/pinFileToIPFS";let r=new FormData;return r.append("file",n,e),(await hHe.post(t,r,{maxContentLength:"Infinity",maxBodyLength:"Infinity",headers:{"Content-Type":`multipart/form-data; boundary=${r._boundary}`,pinata_api_key:pHe,pinata_secret_api_key:mHe}})).data}const yHe=n=>{let e=[];return Object.keys(n).map(t=>{Object.keys(n[t]).length!==0&&e.push({trait_type:t,value:n[t].name})}),e};async function wHe(n,e,t,r,i){if(!n)throw new Error("No avatar was provided");if(!e)throw new Error("No screenshot was provided");if(!t)throw new Error("No model was provided");const s=await _U();if(s=="")return"Please Connect Wallet";if(!i||await _He(s)){console.log("minting");let a="AvatarImage_"+Date.now()+".png",l=await(async()=>{for(let v=0;v<10;v++)try{return await SM(e,a).catch(_=>{console.error(v,"---",_)})}catch(w){return console.warn(w),w}return"Failed to upload screenshot"})();const c=await _0e(t,n,4096);let A;if(c){let v="AvatarGlb_"+Date.now()+".glb";A=await(async()=>{for(let w=0;w<10;w++)try{return await SM(c,v).catch(x=>(console.error(w,"---",x),"Couldn't save glb to pinata"))}catch(_){return console.warn(_),"Couldn't save glb to pinata"}return"Failed to upload glb"})()}else return"Unable to get glb";const u={name:r||"Avatars",description:"Character Studio Avatars.",image:`ipfs://${l.IpfsHash}`,animation_url:`ipfs://${A.IpfsHash}`,attributes:yHe(n)},f=JSON.stringify(u),d=`ipfs://${(await SM(new Blob([f]),"AvatarMetadata_"+Date.now()+".json")).IpfsHash}`;let m=await gHe();const g=new yI(window.ethereum).getSigner(),p=new rb(Bx.address,Bx.abi,g);try{const v={value:m,from:s};if((await(await p.mintToken(1,d,v)).wait()).transactionHash)return console.log("Mint success!"),"Mint success!"}catch{return"Public Mint failed."}}}const _He=async n=>{if(n){const e="0x6e58309CD851A5B124E3A56768a42d12f3B6D104",t=AY("mainnet",{alchemy:{}.VITE_ALCHEMY_API_KEY}),i=await new rb(b4.address,b4.abi,t).beneficiaryBalanceOf(e,F4e,1);return parseInt(i)>0?!0:(console.log(`Currently in alpha. You need a genesis pass to mint. + Will be public soon!`),!1)}else return console.log("Please connect your wallet"),!1};function xHe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=Z.useContext(us),{manifest:r,characterManager:i,animationManager:s,toggleDebugMode:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:c}=Z.useContext($n),[A,u]=be.useState(null),[f,h]=be.useState(""),{playSound:d}=Z.useContext(Co),{isMute:m}=Z.useContext(So);Z.useState(null);const[g,p]=Z.useState(null),[v,w]=Z.useState(""),_=()=>{!m&&d("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),o(!1),e(wt.LANDING)},x=()=>{const y=ze.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:Nn(ze.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Nn(ze.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Nn(ze.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Nn(ze.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:y===0||y==2,exportMtoonAtlas:y===1||y==2,ktxCompression:ze.merge_options_ktx_compression||!1,twoSidedMaterial:ze.mergeOptions_two_sided_mat||!1}},b=y=>{const E=g[y].manifestName;(async()=>{(ze.mergeOptions_download_vrm_preview==null?!0:ze.mergeOptions_download_vrm_preview)&&i.savePortraitScreenshot(E,512,1024,1.5,-.1),(ze.mergeOptions_download_vrm==null?!0:ze.mergeOptions_download_vrm)&&await i.downloadVRM(E,x());const z=new ep,j=c.parent;j.remove(c);const Q=ze.mergeOptions_download_lora==null?!0:ze.mergeOptions_download_lora;if(Q===!0){const W=r.loras.map(async ee=>a.createLoraData(ee,z));await Promise.all(W)}const C=ze.mergeOptions_download_sprites==null?!0:ze.mergeOptions_download_sprites;if(C===!0){const W=r.sprites.map(async ee=>l.createSpriteAtlas(ee,z));await Promise.all(W)}(Q===!0||C===!0)&&z.saveZip(g[y].manifestName),j.add(c),y{y==0?(console.log(r.loras[0]),b(y)):(await i.setManifest(g[y]),t(!0),i.loadInitialTraits().then(async()=>{await(R=>new Promise(F=>setTimeout(F,R)))(1),b(y)}))},S=()=>{t(!0),B(0)},{t:I}=be.useContext(fa),M=async y=>{if(i.getCurrentCharacterModel()){const R=Kl(y.name),F=URL.createObjectURL(y);await s.loadAnimation(F,!1,0,!0,"",R),w(s.getCurrentAnimationName()),URL.revokeObjectURL(F)}else console.warn("Please load a vrm model to test animations.")},L=async y=>{const E=URL.createObjectURL(y);await i.loadOptimizerCharacter(E),URL.revokeObjectURL(E);const R=Kl(y.name);h(R),u(i.getCurrentCharacterModel())},D=y=>{const E=Array.from(y),R=[],F=O=>new Promise((z,j)=>{if(O&&O.name.toLowerCase().endsWith(".json")){const Q=new FileReader,C=O.name.replace(/\.[^/.]+$/,"");Q.onload=function(W){try{const ee=JSON.parse(W.target.result),P=ee.thumbnail;ee.manifestName=C,R.push(ee),z()}catch(ee){console.error("Error parsing the JSON file:",ee),j(ee)}},Q.readAsText(O)}});Promise.all(E.map(F)).then(()=>{R.length>0&&(p(R),i.setManifest(R[0]),t(!0),i.loadInitialTraits().then(()=>{t(!1)}))}).catch(O=>{console.error("Error processing files:",O)})},T=async y=>{const E=y[0];E&&E.name.toLowerCase().endsWith(".fbx")&&M(E),E&&E.name.toLowerCase().endsWith(".vrm")&&L(E),E&&E.name.toLowerCase().endsWith(".json")&&D(y)};return k.jsxs("div",{className:Oi.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:"NFT Characters"}),k.jsx(S0,{onFilesDrop:T}),k.jsx(tb,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),k.jsx(fU,{model:A}),k.jsx(w2,{jsonSelectionArray:g,byManifest:!0}),(g==null?void 0:g.length)>0&&k.jsx(O1,{loadedAnimationName:v}),k.jsxs("div",{className:Oi.buttonContainer,children:[k.jsx(Bn,{theme:"light",text:I("callToAction.back"),size:14,className:Oi.buttonLeft,onClick:_}),(g==null?void 0:g.length)==1&&k.jsx(Bn,{theme:"light",text:"Download",size:14,className:Oi.buttonRight,onClick:S}),(g==null?void 0:g.length)>1&&k.jsx(Bn,{theme:"light",text:"Download All",size:14,className:Oi.buttonRight,onClick:S})]})]})}const bHe="_classdisabled_hpzv8_1",EHe="_container_hpzv8_6",BHe="_classContainer_hpzv8_14",MHe="_icon_hpzv8_39",SHe="_name_hpzv8_70",CHe="_description_hpzv8_79",THe="_classFrame_hpzv8_84",IHe="_frameContainer_hpzv8_104",RHe="_frame_hpzv8_104",UHe="_image_hpzv8_114",FHe="_lockedContainer_hpzv8_120",PHe="_locked_hpzv8_120",LHe="_buttonContainer_hpzv8_134",DHe="_buttonLeft_hpzv8_143",NHe="_buttonRight_hpzv8_147",OHe="_buttonCenter_hpzv8_151",kHe="_topLine_hpzv8_165",QHe="_bottomLine_hpzv8_191",ht={classdisabled:bHe,container:EHe,classContainer:BHe,class:"_class_hpzv8_1",icon:MHe,name:SHe,description:CHe,classFrame:THe,frameContainer:IHe,frame:RHe,image:UHe,lockedContainer:FHe,locked:PHe,buttonContainer:LHe,buttonLeft:DHe,buttonRight:NHe,buttonCenter:OHe,topLine:kHe,bottomLine:QHe};function HHe(){const{t:n}=be.useContext(fa),{setViewMode:e,setIsLoading:t,isLoading:r}=Z.useContext(us),{playSound:i}=Z.useContext(Co),{isMute:s}=Z.useContext(So),{manifest:o,characterManager:a}=Z.useContext($n),[l,c]=be.useState([]);be.useEffect(()=>{if((o==null?void 0:o.characters)!=null){const d=o.characters.map(m=>({name:m.name,image:m.portrait,description:m.description,manifest:m.manifest,icon:m.icon,format:m.format,disabled:!1}));c(d)}},[o]);const A=()=>{e(wt.LANDING),!s&&i("backNextButton")},u=async d=>{t(!0),a.loadManifest(o.characters[d].manifest).then(()=>{e(wt.BATCHDOWNLOAD),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},f=()=>{e(wt.BATCHMANIFEST)},h=()=>{!s&&i("classMouseOver")};return k.jsxs("div",{className:`${ht.container} horizontalScroll`,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),k.jsx("div",{className:ht.vrmOptimizerButton}),k.jsx("div",{className:ht.topLine}),k.jsxs("div",{className:ht.classContainer,children:[l.map((d,m)=>k.jsxs("div",{className:d.disabled?ht.classdisabled:ht.class,onClick:d.disabled?null:()=>u(m),onMouseOver:d.disabled?null:()=>h(),children:[k.jsxs("div",{className:ht.classFrame,style:{backgroundImage:`url(${d.image})`},children:[k.jsx("div",{className:ht.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ht.frame})}),k.jsx("div",{className:ht.lockedContainer,children:d.disabled&&k.jsx("img",{src:"./assets/icons/locked.svg",className:ht.locked})})]}),k.jsx("div",{className:ht.name,children:d.name}),k.jsx("div",{className:ht.description,children:d.description})]},m)),k.jsxs("div",{className:ht.class,onClick:()=>f(),onMouseOver:()=>h(),children:[k.jsx("div",{className:ht.classFrame,style:{backgroundImage:"url(./assets/media/disabled.png)"},children:k.jsx("div",{className:ht.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ht.frame})})}),k.jsx("div",{className:ht.name,children:"Manifest"}),k.jsx("div",{className:ht.description,children:"Load by manifest"})]},"manifest-load")]}),k.jsx("div",{className:ht.bottomLine}),k.jsx("div",{className:ht.buttonContainer,children:k.jsx(Bn,{theme:"light",text:n("callToAction.back"),size:14,className:ht.buttonLeft,onClick:A})})]})}function zHe(){const{t:n}=be.useContext(fa),{setViewMode:e,setIsLoading:t,isLoading:r}=Z.useContext(us),{playSound:i}=Z.useContext(Co),{isMute:s}=Z.useContext(So),{manifest:o,characterManager:a}=Z.useContext($n),[l,c]=be.useState([]);be.useEffect(()=>{if((o==null?void 0:o.characters)!=null){const h=o.characters.map(d=>({name:d.name,image:d.portrait,description:d.description,manifest:d.manifest,icon:d.icon,format:d.format,disabled:!1}));c(h)}},[o]);const A=()=>{e(wt.LANDING),!s&&i("backNextButton")},u=async h=>{t(!0),a.loadManifest(o.characters[h].manifest).then(()=>{e(wt.APPEARANCE),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},f=()=>{!s&&i("classMouseOver")};return k.jsxs("div",{className:`${ht.container} horizontalScroll`,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),k.jsx("div",{className:ht.vrmOptimizerButton}),k.jsx("div",{className:ht.topLine}),k.jsx("div",{className:ht.classContainer,children:l.map((h,d)=>k.jsxs("div",{className:h.disabled?ht.classdisabled:ht.class,onClick:h.disabled?null:()=>u(d),onMouseOver:h.disabled?null:()=>f(),children:[k.jsxs("div",{className:ht.classFrame,style:{backgroundImage:`url(${h.image})`},children:[k.jsx("div",{className:ht.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ht.frame})}),k.jsx("div",{className:ht.lockedContainer,children:h.disabled&&k.jsx("img",{src:"./assets/icons/locked.svg",className:ht.locked})})]}),k.jsx("div",{className:ht.name,children:h.name}),k.jsx("div",{className:ht.description,children:h.description})]},d))}),k.jsx("div",{className:ht.bottomLine}),k.jsx("div",{className:ht.buttonContainer,children:k.jsx(Bn,{theme:"light",text:n("callToAction.back"),size:14,className:ht.buttonLeft,onClick:A})})]})}const GHe="_buttonContainer_1ueuk_1",VHe="_button_1ueuk_1",Wf={buttonContainer:GHe,button:VHe},O4={}.VITE_OPENSEA_KEY;function jHe(){const{setViewMode:n}=Z.useContext(us),{playSound:e}=Z.useContext(Co),{isMute:t}=Z.useContext(So),{characterManager:r}=Z.useContext($n),i=()=>{n(wt.CREATE),!t&&e("backNextButton")},s=()=>{n(wt.CLAIM),!t&&e("backNextButton")},o=()=>{n(wt.OPTIMIZER),r.loadOptimizerManifest(),!t&&e("backNextButton")},a=async()=>{await _U()!=""&&n(wt.WALLET),!t&&e("backNextButton")};return k.jsx("div",{className:Wf.container,children:k.jsxs("div",{className:Wf.buttonContainer,children:[k.jsx("button",{className:Wf.button,onClick:i,children:k.jsx("img",{src:"./assets/media/btn_create_character.png"})}),k.jsx("button",{className:Wf.button,onClick:s,children:k.jsx("img",{src:"./assets/media/btn_batch_download_character.png"})}),k.jsx("button",{className:Wf.button,onClick:o,children:k.jsx("img",{src:"./assets/media/btn_optimize_character.png"})}),O4&&O4!=""&&k.jsx("button",{className:Wf.button,onClick:a,children:k.jsx("img",{src:"./assets/media/btn_optimize_character.png"})})]})})}const qA={};var xU={exports:{}},fd=typeof Reflect=="object"?Reflect:null,k4=fd&&typeof fd.apply=="function"?fd.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},Ww;fd&&typeof fd.ownKeys=="function"?Ww=fd.ownKeys:Object.getOwnPropertySymbols?Ww=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Ww=function(e){return Object.getOwnPropertyNames(e)};function WHe(n){console&&console.warn&&console.warn(n)}var wW=Number.isNaN||function(e){return e!==e};function gn(){gn.init.call(this)}xU.exports=gn;xU.exports.once=$He;gn.EventEmitter=gn;gn.prototype._events=void 0;gn.prototype._eventsCount=0;gn.prototype._maxListeners=void 0;var Q4=10;function Ab(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(gn,"defaultMaxListeners",{enumerable:!0,get:function(){return Q4},set:function(n){if(typeof n!="number"||n<0||wW(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");Q4=n}});gn.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};gn.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||wW(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function _W(n){return n._maxListeners===void 0?gn.defaultMaxListeners:n._maxListeners}gn.prototype.getMaxListeners=function(){return _W(this)};gn.prototype.emit=function(e){for(var t=[],r=1;r0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=s[e];if(l===void 0)return!1;if(typeof l=="function")k4(l,this,t);else for(var c=l.length,A=MW(l,c),r=0;r0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=n,a.type=e,a.count=o.length,WHe(a)}return n}gn.prototype.addListener=function(e,t){return xW(this,e,t,!1)};gn.prototype.on=gn.prototype.addListener;gn.prototype.prependListener=function(e,t){return xW(this,e,t,!0)};function KHe(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function bW(n,e,t){var r={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},i=KHe.bind(r);return i.listener=t,r.wrapFn=i,i}gn.prototype.once=function(e,t){return Ab(t),this.on(e,bW(this,e,t)),this};gn.prototype.prependOnceListener=function(e,t){return Ab(t),this.prependListener(e,bW(this,e,t)),this};gn.prototype.removeListener=function(e,t){var r,i,s,o,a;if(Ab(t),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===t||r.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if(typeof r!="function"){for(s=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,s=o;break}if(s<0)return this;s===0?r.shift():XHe(r,s),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};gn.prototype.off=gn.prototype.removeListener;gn.prototype.removeAllListeners=function(e){var t,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var s=Object.keys(r),o;for(i=0;i=0;i--)this.removeListener(e,t[i]);return this};function EW(n,e,t){var r=n._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?t?[i.listener||i]:[i]:t?YHe(i):MW(i,i.length)}gn.prototype.listeners=function(e){return EW(this,e,!0)};gn.prototype.rawListeners=function(e){return EW(this,e,!1)};gn.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):BW.call(n,e)};gn.prototype.listenerCount=BW;function BW(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}gn.prototype.eventNames=function(){return this._eventsCount>0?Ww(this._events):[]};function MW(n,e){for(var t=new Array(e),r=0;r"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Kw(n,e,t){return t5e()?Kw=Reflect.construct:Kw=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),c=new l;return o&&Tx(c,o.prototype),c},Kw.apply(null,arguments)}function n5e(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function Ix(n){var e=typeof Map=="function"?new Map:void 0;return Ix=function(r){if(r===null||!n5e(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return Kw(r,arguments,rI(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Tx(i,r)},Ix(n)}function Zy(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}typeof Symbol<"u"&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")));typeof Symbol<"u"&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));function Kf(n,e){try{var t=n()}catch(r){return e(r)}return t&&t.then?t.then(void 0,e):t}function Ea(n){return n.hasOwnProperty("result")?n.result:n}var CM=function(n){bU(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t.message="No Ethereum provider was found on window.ethereum.",t}return e}(Ix(Error)),r5e=function(n){bU(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t.message="The user rejected the request.",t}return e}(Ix(Error)),i5e=function(n){bU(e,n);function e(r){var i;return i=n.call(this,r)||this,i.handleNetworkChanged=i.handleNetworkChanged.bind(Zy(i)),i.handleChainChanged=i.handleChainChanged.bind(Zy(i)),i.handleAccountsChanged=i.handleAccountsChanged.bind(Zy(i)),i.handleClose=i.handleClose.bind(Zy(i)),i}var t=e.prototype;return t.handleChainChanged=function(i){this.emitUpdate({chainId:i,provider:window.ethereum})},t.handleAccountsChanged=function(i){i.length===0?this.emitDeactivate():this.emitUpdate({account:i[0]})},t.handleClose=function(i,s){this.emitDeactivate()},t.handleNetworkChanged=function(i){this.emitUpdate({chainId:i,provider:window.ethereum})},t.activate=function(){try{var i=function(A){if(s)return A;function u(){return nI({provider:window.ethereum},a?{account:a}:{})}var f=function(){if(!a)return Promise.resolve(window.ethereum.enable().then(function(h){return h&&Ea(h)[0]})).then(function(h){a=h})}();return f&&f.then?f.then(u):u(f)},s=!1,o=this;if(!window.ethereum)throw new CM;window.ethereum.on&&(window.ethereum.on("chainChanged",o.handleChainChanged),window.ethereum.on("accountsChanged",o.handleAccountsChanged),window.ethereum.on("close",o.handleClose),window.ethereum.on("networkChanged",o.handleNetworkChanged)),window.ethereum.isMetaMask&&(window.ethereum.autoRefreshOnNetworkChange=!1);var a,l=Kf(function(){return Promise.resolve(window.ethereum.send("eth_requestAccounts").then(function(c){return Ea(c)[0]})).then(function(c){a=c})},function(c){if(c.code===4001)throw new r5e});return Promise.resolve(l&&l.then?l.then(i):i(l))}catch(c){return Promise.reject(c)}},t.getProvider=function(){try{return Promise.resolve(window.ethereum)}catch(i){return Promise.reject(i)}},t.getChainId=function(){try{var i=function(){function l(){if(!s)try{s=Ea(window.ethereum.send({method:"net_version"}))}catch{}return s||(window.ethereum.isDapper?s=Ea(window.ethereum.cachedResults.net_version):s=window.ethereum.chainId||window.ethereum.netVersion||window.ethereum.networkVersion||window.ethereum._chainId),s}var c=function(){if(!s){var A=Kf(function(){return Promise.resolve(window.ethereum.send("net_version").then(Ea)).then(function(u){s=u})},function(){});if(A&&A.then)return A.then(function(){})}}();return c&&c.then?c.then(l):l(c)};if(!window.ethereum)throw new CM;var s,o=Kf(function(){return Promise.resolve(window.ethereum.send("eth_chainId").then(Ea)).then(function(a){s=a})},function(){});return Promise.resolve(o&&o.then?o.then(i):i(o))}catch(a){return Promise.reject(a)}},t.getAccount=function(){try{var i=function(){function l(){return s||(s=Ea(window.ethereum.send({method:"eth_accounts"}))[0]),s}var c=function(){if(!s){var A=Kf(function(){return Promise.resolve(window.ethereum.enable().then(function(u){return Ea(u)[0]})).then(function(u){s=u})},function(){});if(A&&A.then)return A.then(function(){})}}();return c&&c.then?c.then(l):l(c)};if(!window.ethereum)throw new CM;var s,o=Kf(function(){return Promise.resolve(window.ethereum.send("eth_accounts").then(function(a){return Ea(a)[0]})).then(function(a){s=a})},function(){});return Promise.resolve(o&&o.then?o.then(i):i(o))}catch(a){return Promise.reject(a)}},t.deactivate=function(){window.ethereum&&window.ethereum.removeListener&&(window.ethereum.removeListener("chainChanged",this.handleChainChanged),window.ethereum.removeListener("accountsChanged",this.handleAccountsChanged),window.ethereum.removeListener("close",this.handleClose),window.ethereum.removeListener("networkChanged",this.handleNetworkChanged))},t.isAuthorized=function(){try{return window.ethereum?Promise.resolve(Kf(function(){return Promise.resolve(window.ethereum.send("eth_accounts").then(function(i){return Ea(i).length>0}))},function(){return!1})):Promise.resolve(!1)}catch(i){return Promise.reject(i)}},e}(e5e);function s5e(){const{account:n,library:e,activate:t}=yY(),[r,i]=be.useState([]),{setViewMode:s}=Z.useContext(us),{playSound:o}=Z.useContext(Co),{isMute:a}=Z.useContext(So),l=new i5e({supportedChainIds:[137,1,3,4,5,42,97]});be.useEffect(()=>{if(n&&e){const f="0x69341F01C2113E2d09Cd4837bbF1786dfbBc41d7",h=["function balanceOf(address owner) external view returns (uint256)","function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256)","function tokenURI(uint256 tokenId) external view returns (string)"],d=new rb(f,h,e);d.balanceOf(n).then(m=>{const g=[];for(let p=0;p{const v=p.map(w=>d.tokenURI(w));Promise.all(v).then(w=>{i(w)})})})}},[n,e]);const c=()=>{t(l)},A=f=>{!a&&o("backNextButton"),s(wt.APPEARANCE)},u=()=>{s(wt.LANDING),!a&&o("backNextButton")};return k.jsxs("div",{className:qA.container,children:[!n&&k.jsxs("div",{className:qA.message,children:["Please connect your wallet to load your characters",k.jsx("button",{className:qA.button,onClick:()=>c(),children:"Connect"})]}),k.jsxs("div",{className:qA.characterContainer,children:[k.jsx("div",{className:qA.title,children:"Load Character"}),r.map((f,h)=>k.jsx("div",{className:qA.character,onClick:()=>{A()},children:JSON.stringify(f)},h))]}),k.jsx("button",{className:qA.button,onClick:()=>u(),children:"Back"})]})}const o5e="_container_q73cc_1",a5e="_mintContainer_q73cc_6",l5e="_mainTitleWrap_q73cc_33",c5e="_mainTitle_q73cc_33",A5e="_mintButtonContainer_q73cc_49",u5e="_mintButton_q73cc_49",f5e="_genesisText_q73cc_60",h5e="_required_q73cc_64",d5e="_divider_q73cc_68",p5e="_bottomContainer_q73cc_75",m5e="_mintInfo_q73cc_85",g5e="_topLine_q73cc_91",v5e="_bottomLine_q73cc_104",Wi={container:o5e,mintContainer:a5e,mainTitleWrap:l5e,mainTitle:c5e,mintButtonContainer:A5e,mintButton:u5e,genesisText:f5e,required:h5e,divider:d5e,bottomContainer:p5e,mintInfo:m5e,topLine:g5e,bottomLine:v5e};function y5e(){const{model:n,avatar:e}=Z.useContext($n),{setViewMode:t}=Z.useContext(us),{playSound:r}=Z.useContext(Co),{isMute:i}=Z.useContext(So),[s,o]=Z.useState(""),[a,l]=Z.useState(!1),c=()=>{t(wt.SAVE),!i&&r("backNextButton")};function A(){return k.jsxs("div",{className:Wi.mainTitleWrap,children:[k.jsx("div",{className:Wi.topLine}),k.jsx("div",{className:Wi.mainTitle,children:"Mint"})]})}async function u(){!i&&r("backNextButton"),l(!0),o("Please check your wallet");const d=await wHe(e,null,n,{name:"XXXRestore"}.name);o(d),l(!1),console.log(d)}return k.jsxs("div",{className:Wi.container,children:[k.jsx("div",{className:"sectionTitle",children:"Mint Your Character"}),k.jsxs("div",{className:Wi.mintContainer,children:[k.jsx(A,{}),k.jsxs("div",{className:Wi.mintButtonContainer,children:[k.jsx(Bn,{size:16,theme:"light",icon:"polygon",text:a?"Minting...":"Open Edition",className:Wi.mintButton,disabled:a,onClick:u,minWidth:220}),k.jsx("div",{className:Wi.divider}),k.jsx(Bn,{size:16,theme:"light",icon:"tokens",text:"Genesis Edition",className:Wi.mintButton,disabled:!0,minWidth:220}),k.jsxs("span",{className:Wi.genesisText,children:["(",k.jsx("span",{className:Wi.required,children:"Coming Soon!"}),")"]})]}),k.jsxs("span",{className:Wi.mintInfo,children:[s," "]})]}),k.jsx("div",{className:Wi.bottomContainer,children:k.jsx(Bn,{theme:"light",text:"Back",size:14,className:Wi.buttonLeft,onClick:c})})]})}function w5e(){const{isLoading:n,setViewMode:e}=Z.useContext(us),{manifest:t,characterManager:r,animationManager:i,sceneElements:s,loraDataGenerator:o,spriteAtlasGenerator:a}=Z.useContext($n),{playSound:l}=Z.useContext(Co),{isMute:c}=Z.useContext(So),[A,u]=be.useState(null),[f,h]=be.useState(""),[d,m]=be.useState([]),[g,p]=be.useState(0),[v,w]=Z.useState("T-Pose"),_=()=>{!c&&l("backNextButton"),r.removeCurrentCharacter(),r.removeCurrentManifest(),e(wt.LANDING)},x=()=>{const E=ze.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:Nn(ze.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Nn(ze.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Nn(ze.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Nn(ze.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:E===0||E==2,exportMtoonAtlas:E===1||E==2,ktxCompression:ze.merge_options_ktx_compression||!1,twoSidedMaterial:ze.mergeOptions_two_sided_mat||!1}},b=async()=>{for(let E=0;E{typeof E!="string"&&(E=f),await(async()=>{var W;(ze.mergeOptions_download_vrm_preview==null?!0:ze.mergeOptions_download_vrm_preview)&&r.savePortraitScreenshot(E+"_portrait",512,1024,1.5,-.1),(ze.mergeOptions_download_vrm==null?!0:ze.mergeOptions_download_vrm)&&await r.downloadVRM(E+"_merged",x());const z=new ep,j=s.parent;j.remove(s),(W=r.getCurrentOptimizerCharacterModel().data)==null||W.isVRM0;const Q=ze.mergeOptions_download_lora==null?!0:ze.mergeOptions_download_lora;if(Q===!0){const ee=t.loras.map(async P=>o.createLoraData(P,z));await Promise.all(ee)}const C=ze.mergeOptions_download_sprites==null?!0:ze.mergeOptions_download_sprites;if(C===!0){const ee=t.sprites.map(async P=>a.createSpriteAtlas(P,z));await Promise.all(ee)}(Q===!0||C===!0)&&z.saveZip(E),j.add(s)})()},{t:S}=be.useContext(fa),I=async E=>{if(r.getCurrentOptimizerCharacterModel()){const F=Kl(E.name),O=URL.createObjectURL(E);await i.loadAnimation(O,!1,0,!0,"",F),w(i.getCurrentAnimationName()),URL.revokeObjectURL(O)}else console.warn("Please load a vrm model to test animations.")},M=()=>{if(g===0)D(d[d.length-1]),p(d.length-1);else{const E=g-1;D(d[E]),p(E)}},L=()=>{if(g>=d.length-1)D(d[0]),p(0);else{const E=g+1;D(d[E]),p(E)}},D=async E=>{const R=URL.createObjectURL(E);await r.loadOptimizerCharacter(R),URL.revokeObjectURL(R);const F=Kl(E.name);h(F),u({...r.getCurrentCharacterModel()})},T=async E=>{D(E[0]);const R=[];for(let F=0;F{const R=E[0];R&&R.name.toLowerCase().endsWith(".fbx")&&I(R),R&&R.name.toLowerCase().endsWith(".vrm")&&T(E)};return k.jsxs("div",{className:Oi.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:"Optimize your character"}),k.jsx(S0,{onFilesDrop:y}),k.jsx(tb,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Optimizer Options"}),k.jsx(fU,{model:A,name:f,files:d,index:g,nextVrm:L,previousVrm:M}),k.jsx(O1,{loadedAnimationName:v}),k.jsxs("div",{className:Oi.buttonContainer,children:[k.jsx(Bn,{theme:"light",text:S("callToAction.back"),size:14,className:Oi.buttonLeft,onClick:_}),(d==null?void 0:d.length)>1!=""&&k.jsx(Bn,{theme:"light",text:"Download All",size:14,className:Oi.buttonRight,onClick:b}),A!=""&&k.jsx(Bn,{theme:"light",text:"Download",size:14,className:Oi.buttonRight,onClick:B})]})]})}const _5e="_buttonContainer_1fd4o_1",x5e="_buttonLeft_1fd4o_10",b5e="_buttonRight_1fd4o_14",E5e="_buttonCenter_1fd4o_18",Jy={buttonContainer:_5e,buttonLeft:x5e,buttonRight:b5e,buttonCenter:E5e},B5e="_button_13dfi_1",H4={button:B5e},M5e="Anon",S5e=()=>{be.useContext(fa);const[n]=Z.useState(localStorage.getItem("name")||M5e),{model:e,characterManager:t}=be.useContext($n),r=()=>{const o=ze.mergeOptions_sel_option||0;return{createTextureAtlas:ze.mergeOptions_create_atlas==null?!0:ze.mergeOptions_create_atlas,mToonAtlasSize:Nn(ze.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Nn(ze.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Nn(ze.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Nn(ze.mergeOptions_atlas_std_transp_size||6),ktxCompression:ze.merge_options_ktx_compression,exportStdAtlas:o===0||o==2,exportMtoonAtlas:o===1||o==2,twoSidedMaterial:ze.mergeOptions_two_sided_mat||!1}},i=o=>{const a=r();a.isVrm0=Object.values(t.avatar)[0].vrm.meta.metaVersion=="0",a.outputVRM0=o!==1,t.downloadVRM(n,a)},s=()=>{const o=r();t.downloadGLB(n,o)};return k.jsxs(Z.Fragment,{children:[k.jsx(Bn,{theme:"light",text:"GLB",icon:"download",size:14,className:H4.button,onClick:()=>{s()}}),k.jsx(Bn,{theme:"light",text:"VRM 0",icon:"download",size:14,className:H4.button,onClick:()=>i(0)})]})};function C5e(){const{t:n}=be.useContext(fa),{playSound:e}=Z.useContext(Co),{isMute:t}=Z.useContext(So),{setViewMode:r}=Z.useContext(us),i=()=>{r(wt.APPEARANCE),!t&&e("backNextButton")},s=()=>{r(wt.MINT),!t&&e("backNextButton")},o=async a=>{const l=a[0];l&&l.name.toLowerCase().endsWith(".json")};return k.jsxs("div",{className:Jy.container,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.saveCharacter")}),k.jsxs("div",{className:Jy.buttonContainer,children:[k.jsx(S0,{onFilesDrop:o}),k.jsx(Bn,{theme:"light",text:n("callToAction.back"),size:14,className:Jy.buttonLeft,onClick:i}),k.jsx(tb,{showCreateAtlas:!0,mergeMenuTitle:"Download Options"}),k.jsx(S5e,{}),k.jsx(Bn,{theme:"light",text:"mint",size:14,className:Jy.buttonRight,onClick:s})]})]})}function T5e(){const{t:n}=be.useContext(fa),{setViewMode:e,setIsLoading:t,isLoading:r}=Z.useContext(us),{playSound:i}=Z.useContext(Co),{isMute:s}=Z.useContext(So),{manifest:o,characterManager:a}=Z.useContext($n);be.useState([]);const[l,c]=be.useState([]);be.useEffect(()=>{A()},[]);const A=async()=>{const m=await _U();vHe(m,"the-anata-nft").then(g=>{c(g.nfts),console.log(g.nfts)})},u=()=>{e(wt.LANDING),!s&&i("backNextButton")},f=async m=>{t(!0),a.loadManifest(o[m].manifest).then(()=>{e(wt.APPEARANCE),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},h=()=>{console.log("ttt"),a.loadManifest(o[0].manifest).then(()=>{a.loadAppendManifest(o[1].manifest,!0).then(()=>{console.log(a.manifestData)})})},d=()=>{!s&&i("classMouseOver")};return k.jsxs("div",{className:`${ht.container} horizontalScroll`,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),k.jsx("div",{className:ht.vrmOptimizerButton}),k.jsx("div",{className:ht.topLine}),k.jsx("div",{className:ht.classContainer,children:l.map((m,g)=>k.jsxs("div",{className:ht.class,onClick:()=>f(g),onMouseOver:()=>d(),children:[k.jsx("div",{className:ht.classFrame,style:{backgroundImage:`url(${m.image_url})`},children:k.jsx("div",{className:ht.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ht.frame})})}),k.jsx("div",{className:ht.name,children:m.name})]},g))}),k.jsx("div",{className:ht.bottomLine}),k.jsxs("div",{className:ht.buttonContainer,children:[k.jsx(Bn,{theme:"light",text:n("callToAction.back"),size:14,className:ht.buttonLeft,onClick:u}),k.jsx(Bn,{theme:"light",text:"test",size:14,className:ht.buttonLeft,onClick:h})]})]})}const I5e=".//manifest.json",R5e=6,U5e=new $(0,.8,0);new $(-2.2367993753934425,1.1512971720174363,2.2612065299409223);async function F5e(n){try{const e=await fetch(n);if(!e.ok)throw new Error(`Failed to fetch manifest. Status: ${e.status}`);return await e.json()}catch(e){return console.error(`Error fetching manifest: ${e.message}`),[]}}async function P5e(){const n=await F5e(I5e),e=new nwe;return{initialManifest:n,effectManager:e}}const L5e=()=>{let n,e;const r=P5e().then(i=>{n="success",e=i},i=>{n="error",e=i});return{read(){if(n==="error")throw e;if(n==="success")return e;throw r}}},D5e=L5e();function N5e(){const{initialManifest:n,effectManager:e}=D5e.read(),[t,r]=be.useState(!1),{camera:i,controls:s,scene:o,moveCamera:a,setManifest:l,lookAtManager:c,showEnvironmentModels:A}=be.useContext($n),{viewMode:u}=be.useContext(us);e.camera=i,e.scene=o;const f=()=>{e.camera&&(a({targetX:0,targetY:U5e.y,targetZ:0,distance:R5e}),s&&([wt.APPEARANCE,wt.SAVE,wt.OPTIMIZER,wt.BATCHDOWNLOAD,wt.BATCHMANIFEST].includes(u)?s.enabled=!0:s.enabled=!1))},[h,d]=be.useState(!1),[m,g]=be.useState(""),[p,v]=be.useState([]),w=(b,B)=>{g(b),d(!0),v([B])},_={[wt.LANDING]:k.jsx(jHe,{}),[wt.APPEARANCE]:k.jsx(bke,{confirmDialog:w}),[wt.OPTIMIZER]:k.jsx(w5e,{}),[wt.CREATE]:k.jsx(zHe,{}),[wt.WALLET]:k.jsx(T5e,{}),[wt.CLAIM]:k.jsx(HHe,{}),[wt.BATCHMANIFEST]:k.jsx(xHe,{}),[wt.BATCHDOWNLOAD]:k.jsx(n4e,{}),[wt.LOAD]:k.jsx(s5e,{}),[wt.MINT]:k.jsx(y5e,{}),[wt.SAVE]:k.jsx(C5e,{})};let x=0;return be.useEffect(()=>{const b=B=>{const S=new Date().getTime(),I=S-x;I<300&&I>10&&B.target.id=="editor-scene"&&r(!t),x=S};return window.addEventListener("touchend",b),window.addEventListener("click",b),()=>{window.removeEventListener("touchend",b),window.removeEventListener("click",b)}},[t]),be.useEffect(()=>{if(c!=null)return f(),c.enabled=!0,[wt.LANDING,wt.CREATE,wt.CLAIM,wt.LOAD,wt.CLAIM,wt.CLAIM].includes(u)?A(!1):A(!0),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}},[u,c]),be.useEffect(()=>{l(n)},[n]),be.useContext(fa),k.jsxs(be.Fragment,{children:[k.jsx("div",{className:"generalTitle",children:"Character Studio"}),k.jsx(wwe,{confirmDialogText:m,confirmDialogCallback:p,confirmDialogWindow:h,setConfirmDialogWindow:d}),k.jsx(Ewe,{}),_[u]]})}const O5e=n=>{const e=new yI(n);return e.pollingInterval=12e3,e};kM.createRoot(document.getElementById("root")).render(k.jsx(Z.StrictMode,{children:k.jsx(gY,{getLibrary:O5e,children:k.jsx(CZ,{children:k.jsx(Pye,{children:k.jsx(MZ,{children:k.jsx(Ave,{children:k.jsx(lve,{children:k.jsx(wve,{children:k.jsx(be.Suspense,{children:k.jsx(N5e,{})})})})})})})})})}));export{ka as c,oc as g}; diff --git a/index.html b/index.html index 573486b2..de1f6730 100644 --- a/index.html +++ b/index.html @@ -7,8 +7,8 @@ Character Studio - - + +