@botuyo/chat-widget-standalone 1.0.37 → 1.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ShadowChatWidget.d.ts +25 -0
- package/dist/ShadowChatWidget.d.ts.map +1 -0
- package/dist/botuyo-chat.es.js +1 -1
- package/dist/botuyo-chat.umd.css +1 -0
- package/dist/botuyo-chat.umd.js +2 -0
- package/dist/botuyo-chat.umd.js.map +1 -0
- package/dist/{chunk-audio-DG3X3uze.js → chunk-audio-Bdq6NarX.js} +2 -2
- package/dist/{chunk-audio-DG3X3uze.js.map → chunk-audio-Bdq6NarX.js.map} +1 -1
- package/dist/{chunk-chat-ui-C0sPAQ4e.js → chunk-chat-ui-BUOt7M33.js} +13 -13
- package/dist/{chunk-chat-ui-C0sPAQ4e.js.map → chunk-chat-ui-BUOt7M33.js.map} +1 -1
- package/dist/{chunk-gallery-BDe3OAec.js → chunk-gallery-C_5eKbwu.js} +2 -2
- package/dist/{chunk-gallery-BDe3OAec.js.map → chunk-gallery-C_5eKbwu.js.map} +1 -1
- package/dist/src/chat-widget/ChatWidget.d.ts +5 -0
- package/dist/src/chat-widget/ChatWidget.d.ts.map +1 -0
- package/dist/src/chat-widget/ChatWidgetProvider.d.ts +81 -0
- package/dist/src/chat-widget/ChatWidgetProvider.d.ts.map +1 -0
- package/dist/src/chat-widget/components/AudioPlayer.d.ts +8 -0
- package/dist/src/chat-widget/components/AudioPlayer.d.ts.map +1 -0
- package/dist/src/chat-widget/components/AudioPlayer.stories.d.ts +37 -0
- package/dist/src/chat-widget/components/AudioPlayer.stories.d.ts.map +1 -0
- package/dist/src/chat-widget/components/Avatar3D.d.ts +23 -0
- package/dist/src/chat-widget/components/Avatar3D.d.ts.map +1 -0
- package/dist/src/chat-widget/components/ChatWindow.d.ts +35 -0
- package/dist/src/chat-widget/components/ChatWindow.d.ts.map +1 -0
- package/dist/src/chat-widget/components/ChatWindow.stories.d.ts +71 -0
- package/dist/src/chat-widget/components/ChatWindow.stories.d.ts.map +1 -0
- package/dist/src/chat-widget/components/ErrorBoundary.d.ts +36 -0
- package/dist/src/chat-widget/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/src/chat-widget/components/ErrorBoundary.stories.d.ts +29 -0
- package/dist/src/chat-widget/components/ErrorBoundary.stories.d.ts.map +1 -0
- package/dist/src/chat-widget/components/Gallery.d.ts +14 -0
- package/dist/src/chat-widget/components/Gallery.d.ts.map +1 -0
- package/dist/src/chat-widget/components/Gallery.stories.d.ts +33 -0
- package/dist/src/chat-widget/components/Gallery.stories.d.ts.map +1 -0
- package/dist/src/chat-widget/components/Icons.d.ts +10 -0
- package/dist/src/chat-widget/components/Icons.d.ts.map +1 -0
- package/dist/src/chat-widget/components/InputArea.d.ts +21 -0
- package/dist/src/chat-widget/components/InputArea.d.ts.map +1 -0
- package/dist/src/chat-widget/components/InputArea.stories.d.ts +62 -0
- package/dist/src/chat-widget/components/InputArea.stories.d.ts.map +1 -0
- package/dist/src/chat-widget/components/LanguageSelector.d.ts +25 -0
- package/dist/src/chat-widget/components/LanguageSelector.d.ts.map +1 -0
- package/dist/src/chat-widget/components/Launcher.d.ts +22 -0
- package/dist/src/chat-widget/components/Launcher.d.ts.map +1 -0
- package/dist/src/chat-widget/components/Launcher.stories.d.ts +75 -0
- package/dist/src/chat-widget/components/Launcher.stories.d.ts.map +1 -0
- package/dist/src/chat-widget/components/LiveCallInputArea.d.ts +29 -0
- package/dist/src/chat-widget/components/LiveCallInputArea.d.ts.map +1 -0
- package/dist/src/chat-widget/components/MessageBubble.d.ts +15 -0
- package/dist/src/chat-widget/components/MessageBubble.d.ts.map +1 -0
- package/dist/src/chat-widget/components/MessageBubble.stories.d.ts +71 -0
- package/dist/src/chat-widget/components/MessageBubble.stories.d.ts.map +1 -0
- package/dist/src/chat-widget/components/MessageList.d.ts +15 -0
- package/dist/src/chat-widget/components/MessageList.d.ts.map +1 -0
- package/dist/src/chat-widget/components/MessageList.stories.d.ts +52 -0
- package/dist/src/chat-widget/components/MessageList.stories.d.ts.map +1 -0
- package/dist/src/chat-widget/components/TypingIndicator.d.ts +2 -0
- package/dist/src/chat-widget/components/TypingIndicator.d.ts.map +1 -0
- package/dist/src/chat-widget/components/TypingIndicator.stories.d.ts +39 -0
- package/dist/src/chat-widget/components/TypingIndicator.stories.d.ts.map +1 -0
- package/dist/src/chat-widget/components/VoiceCallOverlay.d.ts +65 -0
- package/dist/src/chat-widget/components/VoiceCallOverlay.d.ts.map +1 -0
- package/dist/src/chat-widget/components/VoiceInputArea.d.ts +26 -0
- package/dist/src/chat-widget/components/VoiceInputArea.d.ts.map +1 -0
- package/dist/src/chat-widget/components/index.d.ts +16 -0
- package/dist/src/chat-widget/components/index.d.ts.map +1 -0
- package/dist/src/chat-widget/contexts/AnimationContext.d.ts +69 -0
- package/dist/src/chat-widget/contexts/AnimationContext.d.ts.map +1 -0
- package/dist/src/chat-widget/hooks/useAnalytics.d.ts +19 -0
- package/dist/src/chat-widget/hooks/useAnalytics.d.ts.map +1 -0
- package/dist/src/chat-widget/hooks/useChatSocket.d.ts +35 -0
- package/dist/src/chat-widget/hooks/useChatSocket.d.ts.map +1 -0
- package/dist/src/chat-widget/hooks/useChatState.d.ts +23 -0
- package/dist/src/chat-widget/hooks/useChatState.d.ts.map +1 -0
- package/dist/src/chat-widget/hooks/useChatWidget.d.ts +50 -0
- package/dist/src/chat-widget/hooks/useChatWidget.d.ts.map +1 -0
- package/dist/src/chat-widget/hooks/useDarkMode.d.ts +6 -0
- package/dist/src/chat-widget/hooks/useDarkMode.d.ts.map +1 -0
- package/dist/src/chat-widget/hooks/useDynamicHeight.d.ts +10 -0
- package/dist/src/chat-widget/hooks/useDynamicHeight.d.ts.map +1 -0
- package/dist/src/chat-widget/hooks/useFocusTrap.d.ts +34 -0
- package/dist/src/chat-widget/hooks/useFocusTrap.d.ts.map +1 -0
- package/dist/src/chat-widget/hooks/useHighContrast.d.ts +6 -0
- package/dist/src/chat-widget/hooks/useHighContrast.d.ts.map +1 -0
- package/dist/src/chat-widget/hooks/useIsMobile.d.ts +2 -0
- package/dist/src/chat-widget/hooks/useIsMobile.d.ts.map +1 -0
- package/dist/src/chat-widget/hooks/useNotifications.d.ts +23 -0
- package/dist/src/chat-widget/hooks/useNotifications.d.ts.map +1 -0
- package/dist/src/chat-widget/hooks/useRateLimit.d.ts +15 -0
- package/dist/src/chat-widget/hooks/useRateLimit.d.ts.map +1 -0
- package/dist/src/chat-widget/hooks/useSEOMetadata.d.ts +10 -0
- package/dist/src/chat-widget/hooks/useSEOMetadata.d.ts.map +1 -0
- package/dist/src/chat-widget/hooks/useWidgetTheme.d.ts +12 -0
- package/dist/src/chat-widget/hooks/useWidgetTheme.d.ts.map +1 -0
- package/dist/src/chat-widget/i18n/LanguageContext.d.ts +33 -0
- package/dist/src/chat-widget/i18n/LanguageContext.d.ts.map +1 -0
- package/dist/src/chat-widget/i18n/index.d.ts +8 -0
- package/dist/src/chat-widget/i18n/index.d.ts.map +1 -0
- package/dist/src/chat-widget/i18n/translations.d.ts +177 -0
- package/dist/src/chat-widget/i18n/translations.d.ts.map +1 -0
- package/dist/src/chat-widget/i18n/useTranslations.d.ts +27 -0
- package/dist/src/chat-widget/i18n/useTranslations.d.ts.map +1 -0
- package/dist/src/chat-widget/index.d.ts +11 -0
- package/dist/src/chat-widget/index.d.ts.map +1 -0
- package/dist/src/chat-widget/types/index.d.ts +328 -0
- package/dist/src/chat-widget/types/index.d.ts.map +1 -0
- package/dist/src/chat-widget/types/socket.d.ts +107 -0
- package/dist/src/chat-widget/types/socket.d.ts.map +1 -0
- package/dist/src/chat-widget/utils/dateUtils.d.ts +33 -0
- package/dist/src/chat-widget/utils/dateUtils.d.ts.map +1 -0
- package/dist/src/chat-widget/utils/defaultAssets.d.ts +20 -0
- package/dist/src/chat-widget/utils/defaultAssets.d.ts.map +1 -0
- package/dist/src/chat-widget/utils/deviceId.d.ts +18 -0
- package/dist/src/chat-widget/utils/deviceId.d.ts.map +1 -0
- package/dist/src/chat-widget/utils/fileValidation.d.ts +75 -0
- package/dist/src/chat-widget/utils/fileValidation.d.ts.map +1 -0
- package/dist/src/chat-widget/utils/logger.d.ts +31 -0
- package/dist/src/chat-widget/utils/logger.d.ts.map +1 -0
- package/dist/src/chat-widget/utils/performance.d.ts +50 -0
- package/dist/src/chat-widget/utils/performance.d.ts.map +1 -0
- package/dist/src/chat-widget/utils/storage.d.ts +25 -0
- package/dist/src/chat-widget/utils/storage.d.ts.map +1 -0
- package/dist/src/chat-widget/utils/theme.d.ts +122 -0
- package/dist/src/chat-widget/utils/theme.d.ts.map +1 -0
- package/dist/src/chat-widget/utils/theme.examples.d.ts +47 -0
- package/dist/src/chat-widget/utils/theme.examples.d.ts.map +1 -0
- package/dist/src/chat-widget/utils/themes/index.d.ts +12 -0
- package/dist/src/chat-widget/utils/themes/index.d.ts.map +1 -0
- package/dist/src/chat-widget/voice/components/CallButton.d.ts +12 -0
- package/dist/src/chat-widget/voice/components/CallButton.d.ts.map +1 -0
- package/dist/src/chat-widget/voice/components/LiveCallOverlay.d.ts +12 -0
- package/dist/src/chat-widget/voice/components/LiveCallOverlay.d.ts.map +1 -0
- package/dist/src/chat-widget/voice/components/VoiceButton.d.ts +13 -0
- package/dist/src/chat-widget/voice/components/VoiceButton.d.ts.map +1 -0
- package/dist/src/chat-widget/voice/components/VoiceChatOverlay.d.ts +12 -0
- package/dist/src/chat-widget/voice/components/VoiceChatOverlay.d.ts.map +1 -0
- package/dist/src/chat-widget/voice/components/WaveformVisualizer.d.ts +12 -0
- package/dist/src/chat-widget/voice/components/WaveformVisualizer.d.ts.map +1 -0
- package/dist/src/chat-widget/voice/components/index.d.ts +10 -0
- package/dist/src/chat-widget/voice/components/index.d.ts.map +1 -0
- package/dist/src/chat-widget/voice/index.d.ts +11 -0
- package/dist/src/chat-widget/voice/index.d.ts.map +1 -0
- package/dist/src/chat-widget/voice/types.d.ts +232 -0
- package/dist/src/chat-widget/voice/types.d.ts.map +1 -0
- package/dist/src/chat-widget/voice/useLiveCall.d.ts +13 -0
- package/dist/src/chat-widget/voice/useLiveCall.d.ts.map +1 -0
- package/dist/src/chat-widget/voice/useVoiceChat.d.ts +13 -0
- package/dist/src/chat-widget/voice/useVoiceChat.d.ts.map +1 -0
- package/dist/src/chat-widget/voice/useVoiceState.d.ts +38 -0
- package/dist/src/chat-widget/voice/useVoiceState.d.ts.map +1 -0
- package/dist/src/lib/utils.d.ts +3 -0
- package/dist/src/lib/utils.d.ts.map +1 -0
- package/dist/standalone.d.ts +113 -0
- package/dist/standalone.d.ts.map +1 -0
- package/dist/stats-umd.html +4949 -0
- package/dist/stats.html +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).BotUyoChat={})}(this,function(e){"use strict";function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,r,i={},o={exports:{}},a={},s={exports:{}},l={};function c(){if(n)return l;n=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),s=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.iterator;var f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m=Object.assign,g={};function v(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||f}function y(){}function b(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||f}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)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,e,t,"setState")},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},y.prototype=v.prototype;var x=b.prototype=new y;x.constructor=b,m(x,v.prototype),x.isPureReactComponent=!0;var _=Array.isArray,w=Object.prototype.hasOwnProperty,S={current:null},M={key:!0,ref:!0,__self:!0,__source:!0};function E(t,n,r){var i,o={},a=null,s=null;if(null!=n)for(i in void 0!==n.ref&&(s=n.ref),void 0!==n.key&&(a=""+n.key),n)w.call(n,i)&&!M.hasOwnProperty(i)&&(o[i]=n[i]);var l=arguments.length-2;if(1===l)o.children=r;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];o.children=c}if(t&&t.defaultProps)for(i in l=t.defaultProps)void 0===o[i]&&(o[i]=l[i]);return{$$typeof:e,type:t,key:a,ref:s,props:o,_owner:S.current}}function T(t){return"object"==typeof t&&null!==t&&t.$$typeof===e}var A=/\/+/g;function C(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function k(n,r,i,o,a){var s=typeof n;"undefined"!==s&&"boolean"!==s||(n=null);var l=!1;if(null===n)l=!0;else switch(s){case"string":case"number":l=!0;break;case"object":switch(n.$$typeof){case e:case t:l=!0}}if(l)return a=a(l=n),n=""===o?"."+C(l,0):o,_(a)?(i="",null!=n&&(i=n.replace(A,"$&/")+"/"),k(a,r,i,"",function(e){return e})):null!=a&&(T(a)&&(a=function(t,n){return{$$typeof:e,type:t.type,key:n,ref:t.ref,props:t.props,_owner:t._owner}}(a,i+(!a.key||l&&l.key===a.key?"":(""+a.key).replace(A,"$&/")+"/")+n)),r.push(a)),1;if(l=0,o=""===o?".":o+":",_(n))for(var c=0;c<n.length;c++){var u=o+C(s=n[c],c);l+=k(s,r,i,u,a)}else if(u=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=p&&e[p]||e["@@iterator"])?e:null}(n),"function"==typeof u)for(n=u.call(n),c=0;!(s=n.next()).done;)l+=k(s=s.value,r,i,u=o+C(s,c++),a);else if("object"===s)throw r=String(n),Error("Objects are not valid as a React child (found: "+("[object Object]"===r?"object with keys {"+Object.keys(n).join(", ")+"}":r)+"). If you meant to render a collection of children, use an array instead.");return l}function R(e,t,n){if(null==e)return e;var r=[],i=0;return k(e,r,"","",function(e){return t.call(n,e,i++)}),r}function P(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var I={current:null},L={transition:null},N={ReactCurrentDispatcher:I,ReactCurrentBatchConfig:L,ReactCurrentOwner:S};function O(){throw Error("act(...) is not supported in production builds of React.")}return l.Children={map:R,forEach:function(e,t,n){R(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return R(e,function(){t++}),t},toArray:function(e){return R(e,function(e){return e})||[]},only:function(e){if(!T(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},l.Component=v,l.Fragment=r,l.Profiler=o,l.PureComponent=b,l.StrictMode=i,l.Suspense=u,l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=N,l.act=O,l.cloneElement=function(t,n,r){if(null==t)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var i=m({},t.props),o=t.key,a=t.ref,s=t._owner;if(null!=n){if(void 0!==n.ref&&(a=n.ref,s=S.current),void 0!==n.key&&(o=""+n.key),t.type&&t.type.defaultProps)var l=t.type.defaultProps;for(c in n)w.call(n,c)&&!M.hasOwnProperty(c)&&(i[c]=void 0===n[c]&&void 0!==l?l[c]:n[c])}var c=arguments.length-2;if(1===c)i.children=r;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];i.children=l}return{$$typeof:e,type:t.type,key:o,ref:a,props:i,_owner:s}},l.createContext=function(e){return(e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:a,_context:e},e.Consumer=e},l.createElement=E,l.createFactory=function(e){var t=E.bind(null,e);return t.type=e,t},l.createRef=function(){return{current:null}},l.forwardRef=function(e){return{$$typeof:c,render:e}},l.isValidElement=T,l.lazy=function(e){return{$$typeof:h,_payload:{_status:-1,_result:e},_init:P}},l.memo=function(e,t){return{$$typeof:d,type:e,compare:void 0===t?null:t}},l.startTransition=function(e){var t=L.transition;L.transition={};try{e()}finally{L.transition=t}},l.unstable_act=O,l.useCallback=function(e,t){return I.current.useCallback(e,t)},l.useContext=function(e){return I.current.useContext(e)},l.useDebugValue=function(){},l.useDeferredValue=function(e){return I.current.useDeferredValue(e)},l.useEffect=function(e,t){return I.current.useEffect(e,t)},l.useId=function(){return I.current.useId()},l.useImperativeHandle=function(e,t,n){return I.current.useImperativeHandle(e,t,n)},l.useInsertionEffect=function(e,t){return I.current.useInsertionEffect(e,t)},l.useLayoutEffect=function(e,t){return I.current.useLayoutEffect(e,t)},l.useMemo=function(e,t){return I.current.useMemo(e,t)},l.useReducer=function(e,t,n){return I.current.useReducer(e,t,n)},l.useRef=function(e){return I.current.useRef(e)},l.useState=function(e){return I.current.useState(e)},l.useSyncExternalStore=function(e,t,n){return I.current.useSyncExternalStore(e,t,n)},l.useTransition=function(){return I.current.useTransition()},l.version="18.3.1",l}function u(){return r||(r=1,s.exports=c()),s.exports}var d,h,p,f,m,g={exports:{}},v={};function y(){return h||(h=1,g.exports=(d||(d=1,function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<i(o,t)))break e;e[r]=t,e[n]=o,n=r}}function n(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,a=o>>>1;r<a;){var s=2*(r+1)-1,l=e[s],c=s+1,u=e[c];if(0>i(l,n))c<o&&0>i(u,l)?(e[r]=u,e[c]=n,r=c):(e[r]=l,e[s]=n,r=s);else{if(!(c<o&&0>i(u,n)))break e;e[r]=u,e[c]=n,r=c}}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,s=a.now();e.unstable_now=function(){return a.now()-s}}var l=[],c=[],u=1,d=null,h=3,p=!1,f=!1,m=!1,g="function"==typeof setTimeout?setTimeout:null,v="function"==typeof clearTimeout?clearTimeout:null,y="undefined"!=typeof setImmediate?setImmediate:null;function b(e){for(var i=n(c);null!==i;){if(null===i.callback)r(c);else{if(!(i.startTime<=e))break;r(c),i.sortIndex=i.expirationTime,t(l,i)}i=n(c)}}function x(e){if(m=!1,b(e),!f)if(null!==n(l))f=!0,I(_);else{var t=n(c);null!==t&&L(x,t.startTime-e)}}function _(t,i){f=!1,m&&(m=!1,v(E),E=-1),p=!0;var o=h;try{for(b(i),d=n(l);null!==d&&(!(d.expirationTime>i)||t&&!C());){var a=d.callback;if("function"==typeof a){d.callback=null,h=d.priorityLevel;var s=a(d.expirationTime<=i);i=e.unstable_now(),"function"==typeof s?d.callback=s:d===n(l)&&r(l),b(i)}else r(l);d=n(l)}if(null!==d)var u=!0;else{var g=n(c);null!==g&&L(x,g.startTime-i),u=!1}return u}finally{d=null,h=o,p=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var w,S=!1,M=null,E=-1,T=5,A=-1;function C(){return!(e.unstable_now()-A<T)}function k(){if(null!==M){var t=e.unstable_now();A=t;var n=!0;try{n=M(!0,t)}finally{n?w():(S=!1,M=null)}}else S=!1}if("function"==typeof y)w=function(){y(k)};else if("undefined"!=typeof MessageChannel){var R=new MessageChannel,P=R.port2;R.port1.onmessage=k,w=function(){P.postMessage(null)}}else w=function(){g(k,0)};function I(e){M=e,S||(S=!0,w())}function L(t,n){E=g(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){f||p||(f=!0,I(_))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(e){switch(h){case 1:case 2:case 3:var t=3;break;default:t=h}var n=h;h=t;try{return e()}finally{h=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=h;h=e;try{return t()}finally{h=n}},e.unstable_scheduleCallback=function(r,i,o){var a=e.unstable_now();switch(o="object"==typeof o&&null!==o&&"number"==typeof(o=o.delay)&&0<o?a+o:a,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return r={id:u++,callback:i,priorityLevel:r,startTime:o,expirationTime:s=o+s,sortIndex:-1},o>a?(r.sortIndex=o,t(c,r),null===n(l)&&r===n(c)&&(m?(v(E),E=-1):m=!0,L(x,o-a))):(r.sortIndex=s,t(l,r),f||p||(f=!0,I(_))),r},e.unstable_shouldYield=C,e.unstable_wrapCallback=function(e){var t=h;return function(){var n=h;h=t;try{return e.apply(this,arguments)}finally{h=n}}}}(v)),v)),g.exports}function b(){if(p)return a;p=1;var e=u(),t=y();function n(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,i={};function o(e,t){s(e,t),s(e+"Capture",t)}function s(e,t){for(i[e]=t,e=0;e<t.length;e++)r.add(t[e])}var l=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),c=Object.prototype.hasOwnProperty,d=/^[: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]*$/,h={},f={};function m(e,t,n,r,i,o,a){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var g={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){g[e]=new m(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];g[t]=new m(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){g[e]=new m(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){g[e]=new m(e,2,!1,e,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(e){g[e]=new m(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){g[e]=new m(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){g[e]=new m(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){g[e]=new m(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){g[e]=new m(e,5,!1,e.toLowerCase(),null,!1,!1)});var v=/[\-:]([a-z])/g;function b(e){return e[1].toUpperCase()}function x(e,t,n,r){var i=g.hasOwnProperty(t)?g[t]:null;(null!==i?0!==i.type:r||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,n,r){if(null==t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,i,r)&&(n=null),r||null===i?function(e){return!!c.call(f,e)||!c.call(h,e)&&(d.test(e)?f[e]=!0:(h[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=null===n?3!==i.type&&"":n:(t=i.attributeName,r=i.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(i=i.type)||4===i&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(v,b);g[t]=new m(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(v,b);g[t]=new m(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(v,b);g[t]=new m(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){g[e]=new m(e,1,!1,e.toLowerCase(),null,!1,!1)}),g.xlinkHref=new m("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){g[e]=new m(e,1,!1,e.toLowerCase(),null,!0,!0)});var _=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,w=Symbol.for("react.element"),S=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),A=Symbol.for("react.provider"),C=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),N=Symbol.for("react.offscreen"),O=Symbol.iterator;function D(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=O&&e[O]||e["@@iterator"])?e:null}var U,F=Object.assign;function z(e){if(void 0===U)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);U=t&&t[1]||""}return"\n"+U+e}var B=!1;function V(e,t){if(!e||B)return"";B=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&"string"==typeof c.stack){for(var i=c.stack.split("\n"),o=r.stack.split("\n"),a=i.length-1,s=o.length-1;1<=a&&0<=s&&i[a]!==o[s];)s--;for(;1<=a&&0<=s;a--,s--)if(i[a]!==o[s]){if(1!==a||1!==s)do{if(a--,0>--s||i[a]!==o[s]){var l="\n"+i[a].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}}while(1<=a&&0<=s);break}}}finally{B=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?z(e):""}function j(e){switch(e.tag){case 5:return z(e.type);case 16:return z("Lazy");case 13:return z("Suspense");case 19:return z("SuspenseList");case 0:case 2:case 15:return e=V(e.type,!1);case 11:return e=V(e.type.render,!1);case 1:return e=V(e.type,!0);default:return""}}function H(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case M:return"Fragment";case S:return"Portal";case T:return"Profiler";case E:return"StrictMode";case R:return"Suspense";case P:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case C:return(e.displayName||"Context")+".Consumer";case A:return(e._context.displayName||"Context")+".Provider";case k:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case I:return null!==(t=e.displayName||null)?t:H(e.type)||"Memo";case L:t=e._payload,e=e._init;try{return H(e(t))}catch(n){}}return null}function W(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return H(t);case 8:return t===E?"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("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}function G(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function X(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function q(e){e._valueTracker||(e._valueTracker=function(e){var t=X(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function $(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=X(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function Y(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function Z(e,t){var n=t.checked;return F({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function J(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=G(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function K(e,t){null!=(t=t.checked)&&x(e,"checked",t,!1)}function Q(e,t){K(e,t);var n=G(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?te(e,t.type,n):t.hasOwnProperty("defaultValue")&&te(e,t.type,G(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function ee(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function te(e,t,n){"number"===t&&Y(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ne=Array.isArray;function re(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+G(n),t=null,i=0;i<e.length;i++){if(e[i].value===n)return e[i].selected=!0,void(r&&(e[i].defaultSelected=!0));null!==t||e[i].disabled||(t=e[i])}null!==t&&(t.selected=!0)}}function ie(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(n(91));return F({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function oe(e,t){var r=t.value;if(null==r){if(r=t.children,t=t.defaultValue,null!=r){if(null!=t)throw Error(n(92));if(ne(r)){if(1<r.length)throw Error(n(93));r=r[0]}t=r}null==t&&(t=""),r=t}e._wrapperState={initialValue:G(r)}}function ae(e,t){var n=G(t.value),r=G(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function se(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function le(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ce(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?le(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var ue,de,he=(de=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((ue=ue||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ue.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction(function(){return de(e,t)})}:de);function pe(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var fe={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},me=["Webkit","ms","Moz","O"];function ge(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||fe.hasOwnProperty(e)&&fe[e]?(""+t).trim():t+"px"}function ve(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),i=ge(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}Object.keys(fe).forEach(function(e){me.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),fe[t]=fe[e]})});var ye=F({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 be(e,t){if(t){if(ye[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(n(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(n(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(n(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(n(62))}}function xe(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){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 _e=null;function we(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Se=null,Me=null,Ee=null;function Te(e){if(e=xi(e)){if("function"!=typeof Se)throw Error(n(280));var t=e.stateNode;t&&(t=wi(t),Se(e.stateNode,e.type,t))}}function Ae(e){Me?Ee?Ee.push(e):Ee=[e]:Me=e}function Ce(){if(Me){var e=Me,t=Ee;if(Ee=Me=null,Te(e),t)for(e=0;e<t.length;e++)Te(t[e])}}function ke(e,t){return e(t)}function Re(){}var Pe=!1;function Ie(e,t,n){if(Pe)return e(t,n);Pe=!0;try{return ke(e,t,n)}finally{Pe=!1,(null!==Me||null!==Ee)&&(Re(),Ce())}}function Le(e,t){var r=e.stateNode;if(null===r)return null;var i=wi(r);if(null===i)return null;r=i[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(i=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!i;break e;default:e=!1}if(e)return null;if(r&&"function"!=typeof r)throw Error(n(231,t,typeof r));return r}var Ne=!1;if(l)try{var Oe={};Object.defineProperty(Oe,"passive",{get:function(){Ne=!0}}),window.addEventListener("test",Oe,Oe),window.removeEventListener("test",Oe,Oe)}catch(de){Ne=!1}function De(e,t,n,r,i,o,a,s,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(u){this.onError(u)}}var Ue=!1,Fe=null,ze=!1,Be=null,Ve={onError:function(e){Ue=!0,Fe=e}};function je(e,t,n,r,i,o,a,s,l){Ue=!1,Fe=null,De.apply(Ve,arguments)}function He(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function We(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function Ge(e){if(He(e)!==e)throw Error(n(188))}function Xe(e){return null!==(e=function(e){var t=e.alternate;if(!t){if(null===(t=He(e)))throw Error(n(188));return t!==e?null:e}for(var r=e,i=t;;){var o=r.return;if(null===o)break;var a=o.alternate;if(null===a){if(null!==(i=o.return)){r=i;continue}break}if(o.child===a.child){for(a=o.child;a;){if(a===r)return Ge(o),e;if(a===i)return Ge(o),t;a=a.sibling}throw Error(n(188))}if(r.return!==i.return)r=o,i=a;else{for(var s=!1,l=o.child;l;){if(l===r){s=!0,r=o,i=a;break}if(l===i){s=!0,i=o,r=a;break}l=l.sibling}if(!s){for(l=a.child;l;){if(l===r){s=!0,r=a,i=o;break}if(l===i){s=!0,i=a,r=o;break}l=l.sibling}if(!s)throw Error(n(189))}}if(r.alternate!==i)throw Error(n(190))}if(3!==r.tag)throw Error(n(188));return r.stateNode.current===r?e:t}(e))?qe(e):null}function qe(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=qe(e);if(null!==t)return t;e=e.sibling}return null}var $e=t.unstable_scheduleCallback,Ye=t.unstable_cancelCallback,Ze=t.unstable_shouldYield,Je=t.unstable_requestPaint,Ke=t.unstable_now,Qe=t.unstable_getCurrentPriorityLevel,et=t.unstable_ImmediatePriority,tt=t.unstable_UserBlockingPriority,nt=t.unstable_NormalPriority,rt=t.unstable_LowPriority,it=t.unstable_IdlePriority,ot=null,at=null;var st=Math.clz32?Math.clz32:function(e){return e>>>=0,0===e?32:31-(lt(e)/ct|0)|0},lt=Math.log,ct=Math.LN2;var ut=64,dt=4194304;function ht(e){switch(e&-e){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 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function pt(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,a=268435455&n;if(0!==a){var s=a&~i;0!==s?r=ht(s):0!==(o&=a)&&(r=ht(o))}else 0!==(a=n&~i)?r=ht(a):0!==o&&(r=ht(o));if(0===r)return 0;if(0!==t&&t!==r&&0===(t&i)&&((i=r&-r)>=(o=t&-t)||16===i&&4194240&o))return t;if(4&r&&(r|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)i=1<<(n=31-st(t)),r|=e[n],t&=~i;return r}function ft(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 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 t+5e3;default:return-1}}function mt(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function gt(){var e=ut;return!(4194240&(ut<<=1))&&(ut=64),e}function vt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function yt(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-st(t)]=n}function bt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-st(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var xt=0;function _t(e){return 1<(e&=-e)?4<e?268435455&e?16:536870912:4:1}var wt,St,Mt,Et,Tt,At=!1,Ct=[],kt=null,Rt=null,Pt=null,It=new Map,Lt=new Map,Nt=[],Ot="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Dt(e,t){switch(e){case"focusin":case"focusout":kt=null;break;case"dragenter":case"dragleave":Rt=null;break;case"mouseover":case"mouseout":Pt=null;break;case"pointerover":case"pointerout":It.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Lt.delete(t.pointerId)}}function Ut(e,t,n,r,i,o){return null===e||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[i]},null!==t&&(null!==(t=xi(t))&&St(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==i&&-1===t.indexOf(i)&&t.push(i),e)}function Ft(e){var t=bi(e.target);if(null!==t){var n=He(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=We(n)))return e.blockedOn=t,void Tt(e.priority,function(){Mt(n)})}else if(3===t&&n.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function zt(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=Zt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n)return null!==(t=xi(n))&&St(t),e.blockedOn=n,!1;var r=new(n=e.nativeEvent).constructor(n.type,n);_e=r,n.target.dispatchEvent(r),_e=null,t.shift()}return!0}function Bt(e,t,n){zt(e)&&n.delete(t)}function Vt(){At=!1,null!==kt&&zt(kt)&&(kt=null),null!==Rt&&zt(Rt)&&(Rt=null),null!==Pt&&zt(Pt)&&(Pt=null),It.forEach(Bt),Lt.forEach(Bt)}function jt(e,n){e.blockedOn===n&&(e.blockedOn=null,At||(At=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Vt)))}function Ht(e){function t(t){return jt(t,e)}if(0<Ct.length){jt(Ct[0],e);for(var n=1;n<Ct.length;n++){var r=Ct[n];r.blockedOn===e&&(r.blockedOn=null)}}for(null!==kt&&jt(kt,e),null!==Rt&&jt(Rt,e),null!==Pt&&jt(Pt,e),It.forEach(t),Lt.forEach(t),n=0;n<Nt.length;n++)(r=Nt[n]).blockedOn===e&&(r.blockedOn=null);for(;0<Nt.length&&null===(n=Nt[0]).blockedOn;)Ft(n),null===n.blockedOn&&Nt.shift()}var Wt=_.ReactCurrentBatchConfig,Gt=!0;function Xt(e,t,n,r){var i=xt,o=Wt.transition;Wt.transition=null;try{xt=1,$t(e,t,n,r)}finally{xt=i,Wt.transition=o}}function qt(e,t,n,r){var i=xt,o=Wt.transition;Wt.transition=null;try{xt=4,$t(e,t,n,r)}finally{xt=i,Wt.transition=o}}function $t(e,t,n,r){if(Gt){var i=Zt(e,t,n,r);if(null===i)Gr(e,t,r,Yt,n),Dt(e,r);else if(function(e,t,n,r,i){switch(t){case"focusin":return kt=Ut(kt,e,t,n,r,i),!0;case"dragenter":return Rt=Ut(Rt,e,t,n,r,i),!0;case"mouseover":return Pt=Ut(Pt,e,t,n,r,i),!0;case"pointerover":var o=i.pointerId;return It.set(o,Ut(It.get(o)||null,e,t,n,r,i)),!0;case"gotpointercapture":return o=i.pointerId,Lt.set(o,Ut(Lt.get(o)||null,e,t,n,r,i)),!0}return!1}(i,e,t,n,r))r.stopPropagation();else if(Dt(e,r),4&t&&-1<Ot.indexOf(e)){for(;null!==i;){var o=xi(i);if(null!==o&&wt(o),null===(o=Zt(e,t,n,r))&&Gr(e,t,r,Yt,n),o===i)break;i=o}null!==i&&r.stopPropagation()}else Gr(e,t,r,null,n)}}var Yt=null;function Zt(e,t,n,r){if(Yt=null,null!==(e=bi(e=we(r))))if(null===(t=He(e)))e=null;else if(13===(n=t.tag)){if(null!==(e=We(t)))return e;e=null}else if(3===n){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Yt=e,null}function Jt(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Qe()){case et:return 1;case tt:return 4;case nt:case rt:return 16;case it:return 536870912;default:return 16}default:return 16}}var Kt=null,Qt=null,en=null;function tn(){if(en)return en;var e,t,n=Qt,r=n.length,i="value"in Kt?Kt.value:Kt.textContent,o=i.length;for(e=0;e<r&&n[e]===i[e];e++);var a=r-e;for(t=1;t<=a&&n[r-t]===i[o-t];t++);return en=i.slice(e,1<t?1-t:void 0)}function nn(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function rn(){return!0}function on(){return!1}function an(e){function t(t,n,r,i,o){for(var a in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=o,this.currentTarget=null,e)e.hasOwnProperty(a)&&(t=e[a],this[a]=t?t(i):i[a]);return this.isDefaultPrevented=(null!=i.defaultPrevented?i.defaultPrevented:!1===i.returnValue)?rn:on,this.isPropagationStopped=on,this}return F(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=rn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=rn)},persist:function(){},isPersistent:rn}),t}var sn,ln,cn,un={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},dn=an(un),hn=F({},un,{view:0,detail:0}),pn=an(hn),fn=F({},hn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Tn,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==cn&&(cn&&"mousemove"===e.type?(sn=e.screenX-cn.screenX,ln=e.screenY-cn.screenY):ln=sn=0,cn=e),sn)},movementY:function(e){return"movementY"in e?e.movementY:ln}}),mn=an(fn),gn=an(F({},fn,{dataTransfer:0})),vn=an(F({},hn,{relatedTarget:0})),yn=an(F({},un,{animationName:0,elapsedTime:0,pseudoElement:0})),bn=F({},un,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),xn=an(bn),_n=an(F({},un,{data:0})),wn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Sn={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Mn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function En(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Mn[e])&&!!t[e]}function Tn(){return En}var An=F({},hn,{key:function(e){if(e.key){var t=wn[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=nn(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?Sn[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Tn,charCode:function(e){return"keypress"===e.type?nn(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?nn(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),Cn=an(An),kn=an(F({},fn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Rn=an(F({},hn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Tn})),Pn=an(F({},un,{propertyName:0,elapsedTime:0,pseudoElement:0})),In=F({},fn,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Ln=an(In),Nn=[9,13,27,32],On=l&&"CompositionEvent"in window,Dn=null;l&&"documentMode"in document&&(Dn=document.documentMode);var Un=l&&"TextEvent"in window&&!Dn,Fn=l&&(!On||Dn&&8<Dn&&11>=Dn),zn=String.fromCharCode(32),Bn=!1;function Vn(e,t){switch(e){case"keyup":return-1!==Nn.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jn(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Hn=!1;var Wn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Gn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Wn[e.type]:"textarea"===t}function Xn(e,t,n,r){Ae(r),0<(t=qr(t,"onChange")).length&&(n=new dn("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var qn=null,$n=null;function Yn(e){zr(e,0)}function Zn(e){if($(_i(e)))return e}function Jn(e,t){if("change"===e)return t}var Kn=!1;if(l){var Qn;if(l){var er="oninput"in document;if(!er){var tr=document.createElement("div");tr.setAttribute("oninput","return;"),er="function"==typeof tr.oninput}Qn=er}else Qn=!1;Kn=Qn&&(!document.documentMode||9<document.documentMode)}function nr(){qn&&(qn.detachEvent("onpropertychange",rr),$n=qn=null)}function rr(e){if("value"===e.propertyName&&Zn($n)){var t=[];Xn(t,$n,e,we(e)),Ie(Yn,t)}}function ir(e,t,n){"focusin"===e?(nr(),$n=n,(qn=t).attachEvent("onpropertychange",rr)):"focusout"===e&&nr()}function or(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Zn($n)}function ar(e,t){if("click"===e)return Zn(t)}function sr(e,t){if("input"===e||"change"===e)return Zn(t)}var lr="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function cr(e,t){if(lr(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!c.call(t,i)||!lr(e[i],t[i]))return!1}return!0}function ur(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function dr(e,t){var n,r=ur(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=ur(r)}}function hr(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?hr(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function pr(){for(var e=window,t=Y();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(r){n=!1}if(!n)break;t=Y((e=t.contentWindow).document)}return t}function fr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function mr(e){var t=pr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&hr(n.ownerDocument.documentElement,n)){if(null!==r&&fr(n))if(t=r.start,void 0===(e=r.end)&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if((e=(t=n.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=void 0===r.end?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=dr(n,o);var a=dr(n,r);i&&a&&(1!==e.rangeCount||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&((t=t.createRange()).setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof n.focus&&n.focus(),n=0;n<t.length;n++)(e=t[n]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var gr=l&&"documentMode"in document&&11>=document.documentMode,vr=null,yr=null,br=null,xr=!1;function _r(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;xr||null==vr||vr!==Y(r)||("selectionStart"in(r=vr)&&fr(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},br&&cr(br,r)||(br=r,0<(r=qr(yr,"onSelect")).length&&(t=new dn("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=vr)))}function wr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Sr={animationend:wr("Animation","AnimationEnd"),animationiteration:wr("Animation","AnimationIteration"),animationstart:wr("Animation","AnimationStart"),transitionend:wr("Transition","TransitionEnd")},Mr={},Er={};function Tr(e){if(Mr[e])return Mr[e];if(!Sr[e])return e;var t,n=Sr[e];for(t in n)if(n.hasOwnProperty(t)&&t in Er)return Mr[e]=n[t];return e}l&&(Er=document.createElement("div").style,"AnimationEvent"in window||(delete Sr.animationend.animation,delete Sr.animationiteration.animation,delete Sr.animationstart.animation),"TransitionEvent"in window||delete Sr.transitionend.transition);var Ar=Tr("animationend"),Cr=Tr("animationiteration"),kr=Tr("animationstart"),Rr=Tr("transitionend"),Pr=new Map,Ir="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Lr(e,t){Pr.set(e,t),o(t,[e])}for(var Nr=0;Nr<Ir.length;Nr++){var Or=Ir[Nr];Lr(Or.toLowerCase(),"on"+(Or[0].toUpperCase()+Or.slice(1)))}Lr(Ar,"onAnimationEnd"),Lr(Cr,"onAnimationIteration"),Lr(kr,"onAnimationStart"),Lr("dblclick","onDoubleClick"),Lr("focusin","onFocus"),Lr("focusout","onBlur"),Lr(Rr,"onTransitionEnd"),s("onMouseEnter",["mouseout","mouseover"]),s("onMouseLeave",["mouseout","mouseover"]),s("onPointerEnter",["pointerout","pointerover"]),s("onPointerLeave",["pointerout","pointerover"]),o("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),o("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),o("onBeforeInput",["compositionend","keypress","textInput","paste"]),o("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),o("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),o("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Dr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Ur=new Set("cancel close invalid load scroll toggle".split(" ").concat(Dr));function Fr(e,t,r){var i=e.type||"unknown-event";e.currentTarget=r,function(e,t,r,i,o,a,s,l,c){if(je.apply(this,arguments),Ue){if(!Ue)throw Error(n(198));var u=Fe;Ue=!1,Fe=null,ze||(ze=!0,Be=u)}}(i,t,void 0,e),e.currentTarget=null}function zr(e,t){t=!!(4&t);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var a=r.length-1;0<=a;a--){var s=r[a],l=s.instance,c=s.currentTarget;if(s=s.listener,l!==o&&i.isPropagationStopped())break e;Fr(i,s,c),o=l}else for(a=0;a<r.length;a++){if(l=(s=r[a]).instance,c=s.currentTarget,s=s.listener,l!==o&&i.isPropagationStopped())break e;Fr(i,s,c),o=l}}}if(ze)throw e=Be,ze=!1,Be=null,e}function Br(e,t){var n=t[gi];void 0===n&&(n=t[gi]=new Set);var r=e+"__bubble";n.has(r)||(Wr(t,e,2,!1),n.add(r))}function Vr(e,t,n){var r=0;t&&(r|=4),Wr(n,e,r,t)}var jr="_reactListening"+Math.random().toString(36).slice(2);function Hr(e){if(!e[jr]){e[jr]=!0,r.forEach(function(t){"selectionchange"!==t&&(Ur.has(t)||Vr(t,!1,e),Vr(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[jr]||(t[jr]=!0,Vr("selectionchange",!1,t))}}function Wr(e,t,n,r){switch(Jt(t)){case 1:var i=Xt;break;case 4:i=qt;break;default:i=$t}n=i.bind(null,t,n,e),i=void 0,!Ne||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(i=!0),r?void 0!==i?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):void 0!==i?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function Gr(e,t,n,r,i){var o=r;if(!(1&t||2&t||null===r))e:for(;;){if(null===r)return;var a=r.tag;if(3===a||4===a){var s=r.stateNode.containerInfo;if(s===i||8===s.nodeType&&s.parentNode===i)break;if(4===a)for(a=r.return;null!==a;){var l=a.tag;if((3===l||4===l)&&((l=a.stateNode.containerInfo)===i||8===l.nodeType&&l.parentNode===i))return;a=a.return}for(;null!==s;){if(null===(a=bi(s)))return;if(5===(l=a.tag)||6===l){r=o=a;continue e}s=s.parentNode}}r=r.return}Ie(function(){var r=o,i=we(n),a=[];e:{var s=Pr.get(e);if(void 0!==s){var l=dn,c=e;switch(e){case"keypress":if(0===nn(n))break e;case"keydown":case"keyup":l=Cn;break;case"focusin":c="focus",l=vn;break;case"focusout":c="blur",l=vn;break;case"beforeblur":case"afterblur":l=vn;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":l=mn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":l=gn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":l=Rn;break;case Ar:case Cr:case kr:l=yn;break;case Rr:l=Pn;break;case"scroll":l=pn;break;case"wheel":l=Ln;break;case"copy":case"cut":case"paste":l=xn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":l=kn}var u=!!(4&t),d=!u&&"scroll"===e,h=u?null!==s?s+"Capture":null:s;u=[];for(var p,f=r;null!==f;){var m=(p=f).stateNode;if(5===p.tag&&null!==m&&(p=m,null!==h&&(null!=(m=Le(f,h))&&u.push(Xr(f,m,p)))),d)break;f=f.return}0<u.length&&(s=new l(s,c,null,n,i),a.push({event:s,listeners:u}))}}if(!(7&t)){if(l="mouseout"===e||"pointerout"===e,(!(s="mouseover"===e||"pointerover"===e)||n===_e||!(c=n.relatedTarget||n.fromElement)||!bi(c)&&!c[mi])&&(l||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,l?(l=r,null!==(c=(c=n.relatedTarget||n.toElement)?bi(c):null)&&(c!==(d=He(c))||5!==c.tag&&6!==c.tag)&&(c=null)):(l=null,c=r),l!==c)){if(u=mn,m="onMouseLeave",h="onMouseEnter",f="mouse","pointerout"!==e&&"pointerover"!==e||(u=kn,m="onPointerLeave",h="onPointerEnter",f="pointer"),d=null==l?s:_i(l),p=null==c?s:_i(c),(s=new u(m,f+"leave",l,n,i)).target=d,s.relatedTarget=p,m=null,bi(i)===r&&((u=new u(h,f+"enter",c,n,i)).target=p,u.relatedTarget=d,m=u),d=m,l&&c)e:{for(h=c,f=0,p=u=l;p;p=$r(p))f++;for(p=0,m=h;m;m=$r(m))p++;for(;0<f-p;)u=$r(u),f--;for(;0<p-f;)h=$r(h),p--;for(;f--;){if(u===h||null!==h&&u===h.alternate)break e;u=$r(u),h=$r(h)}u=null}else u=null;null!==l&&Yr(a,s,l,u,!1),null!==c&&null!==d&&Yr(a,d,c,u,!0)}if("select"===(l=(s=r?_i(r):window).nodeName&&s.nodeName.toLowerCase())||"input"===l&&"file"===s.type)var g=Jn;else if(Gn(s))if(Kn)g=sr;else{g=or;var v=ir}else(l=s.nodeName)&&"input"===l.toLowerCase()&&("checkbox"===s.type||"radio"===s.type)&&(g=ar);switch(g&&(g=g(e,r))?Xn(a,g,n,i):(v&&v(e,s,r),"focusout"===e&&(v=s._wrapperState)&&v.controlled&&"number"===s.type&&te(s,"number",s.value)),v=r?_i(r):window,e){case"focusin":(Gn(v)||"true"===v.contentEditable)&&(vr=v,yr=r,br=null);break;case"focusout":br=yr=vr=null;break;case"mousedown":xr=!0;break;case"contextmenu":case"mouseup":case"dragend":xr=!1,_r(a,n,i);break;case"selectionchange":if(gr)break;case"keydown":case"keyup":_r(a,n,i)}var y;if(On)e:{switch(e){case"compositionstart":var b="onCompositionStart";break e;case"compositionend":b="onCompositionEnd";break e;case"compositionupdate":b="onCompositionUpdate";break e}b=void 0}else Hn?Vn(e,n)&&(b="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(b="onCompositionStart");b&&(Fn&&"ko"!==n.locale&&(Hn||"onCompositionStart"!==b?"onCompositionEnd"===b&&Hn&&(y=tn()):(Qt="value"in(Kt=i)?Kt.value:Kt.textContent,Hn=!0)),0<(v=qr(r,b)).length&&(b=new _n(b,e,null,n,i),a.push({event:b,listeners:v}),y?b.data=y:null!==(y=jn(n))&&(b.data=y))),(y=Un?function(e,t){switch(e){case"compositionend":return jn(t);case"keypress":return 32!==t.which?null:(Bn=!0,zn);case"textInput":return(e=t.data)===zn&&Bn?null:e;default:return null}}(e,n):function(e,t){if(Hn)return"compositionend"===e||!On&&Vn(e,t)?(e=tn(),en=Qt=Kt=null,Hn=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Fn&&"ko"!==t.locale?null:t.data}}(e,n))&&(0<(r=qr(r,"onBeforeInput")).length&&(i=new _n("onBeforeInput","beforeinput",null,n,i),a.push({event:i,listeners:r}),i.data=y))}zr(a,t)})}function Xr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function qr(e,t){for(var n=t+"Capture",r=[];null!==e;){var i=e,o=i.stateNode;5===i.tag&&null!==o&&(i=o,null!=(o=Le(e,n))&&r.unshift(Xr(e,o,i)),null!=(o=Le(e,t))&&r.push(Xr(e,o,i))),e=e.return}return r}function $r(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function Yr(e,t,n,r,i){for(var o=t._reactName,a=[];null!==n&&n!==r;){var s=n,l=s.alternate,c=s.stateNode;if(null!==l&&l===r)break;5===s.tag&&null!==c&&(s=c,i?null!=(l=Le(n,o))&&a.unshift(Xr(n,l,s)):i||null!=(l=Le(n,o))&&a.push(Xr(n,l,s))),n=n.return}0!==a.length&&e.push({event:t,listeners:a})}var Zr=/\r\n?/g,Jr=/\u0000|\uFFFD/g;function Kr(e){return("string"==typeof e?e:""+e).replace(Zr,"\n").replace(Jr,"")}function Qr(e,t,r){if(t=Kr(t),Kr(e)!==t&&r)throw Error(n(425))}function ei(){}var ti=null,ni=null;function ri(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var ii="function"==typeof setTimeout?setTimeout:void 0,oi="function"==typeof clearTimeout?clearTimeout:void 0,ai="function"==typeof Promise?Promise:void 0,si="function"==typeof queueMicrotask?queueMicrotask:void 0!==ai?function(e){return ai.resolve(null).then(e).catch(li)}:ii;function li(e){setTimeout(function(){throw e})}function ci(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&8===i.nodeType)if("/$"===(n=i.data)){if(0===r)return e.removeChild(i),void Ht(t);r--}else"$"!==n&&"$?"!==n&&"$!"!==n||r++;n=i}while(n);Ht(t)}function ui(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t)break;if("/$"===t)return null}}return e}function di(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var hi=Math.random().toString(36).slice(2),pi="__reactFiber$"+hi,fi="__reactProps$"+hi,mi="__reactContainer$"+hi,gi="__reactEvents$"+hi,vi="__reactListeners$"+hi,yi="__reactHandles$"+hi;function bi(e){var t=e[pi];if(t)return t;for(var n=e.parentNode;n;){if(t=n[mi]||n[pi]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=di(e);null!==e;){if(n=e[pi])return n;e=di(e)}return t}n=(e=n).parentNode}return null}function xi(e){return!(e=e[pi]||e[mi])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function _i(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(n(33))}function wi(e){return e[fi]||null}var Si=[],Mi=-1;function Ei(e){return{current:e}}function Ti(e){0>Mi||(e.current=Si[Mi],Si[Mi]=null,Mi--)}function Ai(e,t){Mi++,Si[Mi]=e.current,e.current=t}var Ci={},ki=Ei(Ci),Ri=Ei(!1),Pi=Ci;function Ii(e,t){var n=e.type.contextTypes;if(!n)return Ci;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in n)o[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Li(e){return null!=(e=e.childContextTypes)}function Ni(){Ti(Ri),Ti(ki)}function Oi(e,t,r){if(ki.current!==Ci)throw Error(n(168));Ai(ki,t),Ai(Ri,r)}function Di(e,t,r){var i=e.stateNode;if(t=t.childContextTypes,"function"!=typeof i.getChildContext)return r;for(var o in i=i.getChildContext())if(!(o in t))throw Error(n(108,W(e)||"Unknown",o));return F({},r,i)}function Ui(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ci,Pi=ki.current,Ai(ki,e),Ai(Ri,Ri.current),!0}function Fi(e,t,r){var i=e.stateNode;if(!i)throw Error(n(169));r?(e=Di(e,t,Pi),i.__reactInternalMemoizedMergedChildContext=e,Ti(Ri),Ti(ki),Ai(ki,e)):Ti(Ri),Ai(Ri,r)}var zi=null,Bi=!1,Vi=!1;function ji(e){null===zi?zi=[e]:zi.push(e)}function Hi(){if(!Vi&&null!==zi){Vi=!0;var e=0,t=xt;try{var n=zi;for(xt=1;e<n.length;e++){var r=n[e];do{r=r(!0)}while(null!==r)}zi=null,Bi=!1}catch(Dv){throw null!==zi&&(zi=zi.slice(e+1)),$e(et,Hi),Dv}finally{xt=t,Vi=!1}}return null}var Wi=[],Gi=0,Xi=null,qi=0,$i=[],Yi=0,Zi=null,Ji=1,Ki="";function Qi(e,t){Wi[Gi++]=qi,Wi[Gi++]=Xi,Xi=e,qi=t}function eo(e,t,n){$i[Yi++]=Ji,$i[Yi++]=Ki,$i[Yi++]=Zi,Zi=e;var r=Ji;e=Ki;var i=32-st(r)-1;r&=~(1<<i),n+=1;var o=32-st(t)+i;if(30<o){var a=i-i%5;o=(r&(1<<a)-1).toString(32),r>>=a,i-=a,Ji=1<<32-st(t)+i|n<<i|r,Ki=o+e}else Ji=1<<o|n<<i|r,Ki=e}function to(e){null!==e.return&&(Qi(e,1),eo(e,1,0))}function no(e){for(;e===Xi;)Xi=Wi[--Gi],Wi[Gi]=null,qi=Wi[--Gi],Wi[Gi]=null;for(;e===Zi;)Zi=$i[--Yi],$i[Yi]=null,Ki=$i[--Yi],$i[Yi]=null,Ji=$i[--Yi],$i[Yi]=null}var ro=null,io=null,oo=!1,ao=null;function so(e,t){var n=Ic(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,null===(t=e.deletions)?(e.deletions=[n],e.flags|=16):t.push(n)}function lo(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,ro=e,io=ui(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,ro=e,io=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(n=null!==Zi?{id:Ji,overflow:Ki}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},(n=Ic(18,null,null,0)).stateNode=t,n.return=e,e.child=n,ro=e,io=null,!0);default:return!1}}function co(e){return!(!(1&e.mode)||128&e.flags)}function uo(e){if(oo){var t=io;if(t){var r=t;if(!lo(e,t)){if(co(e))throw Error(n(418));t=ui(r.nextSibling);var i=ro;t&&lo(e,t)?so(i,r):(e.flags=-4097&e.flags|2,oo=!1,ro=e)}}else{if(co(e))throw Error(n(418));e.flags=-4097&e.flags|2,oo=!1,ro=e}}}function ho(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;ro=e}function po(e){if(e!==ro)return!1;if(!oo)return ho(e),oo=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!ri(e.type,e.memoizedProps)),t&&(t=io)){if(co(e))throw fo(),Error(n(418));for(;t;)so(e,t),t=ui(t.nextSibling)}if(ho(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(n(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var r=e.data;if("/$"===r){if(0===t){io=ui(e.nextSibling);break e}t--}else"$"!==r&&"$!"!==r&&"$?"!==r||t++}e=e.nextSibling}io=null}}else io=ro?ui(e.stateNode.nextSibling):null;return!0}function fo(){for(var e=io;e;)e=ui(e.nextSibling)}function mo(){io=ro=null,oo=!1}function go(e){null===ao?ao=[e]:ao.push(e)}var vo=_.ReactCurrentBatchConfig;function yo(e,t,r){if(null!==(e=r.ref)&&"function"!=typeof e&&"object"!=typeof e){if(r._owner){if(r=r._owner){if(1!==r.tag)throw Error(n(309));var i=r.stateNode}if(!i)throw Error(n(147,e));var o=i,a=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===a?t.ref:((t=function(e){var t=o.refs;null===e?delete t[a]:t[a]=e})._stringRef=a,t)}if("string"!=typeof e)throw Error(n(284));if(!r._owner)throw Error(n(290,e))}return e}function bo(e,t){throw e=Object.prototype.toString.call(t),Error(n(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function xo(e){return(0,e._init)(e._payload)}function _o(e){function t(t,n){if(e){var r=t.deletions;null===r?(t.deletions=[n],t.flags|=16):r.push(n)}}function r(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function i(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function o(e,t){return(e=Nc(e,t)).index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags|=2,n):r:(t.flags|=2,n):(t.flags|=1048576,n)}function s(t){return e&&null===t.alternate&&(t.flags|=2),t}function l(e,t,n,r){return null===t||6!==t.tag?((t=Fc(n,e.mode,r)).return=e,t):((t=o(t,n)).return=e,t)}function c(e,t,n,r){var i=n.type;return i===M?d(e,t,n.props.children,r,n.key):null!==t&&(t.elementType===i||"object"==typeof i&&null!==i&&i.$$typeof===L&&xo(i)===t.type)?((r=o(t,n.props)).ref=yo(e,t,n),r.return=e,r):((r=Oc(n.type,n.key,n.props,null,e.mode,r)).ref=yo(e,t,n),r.return=e,r)}function u(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=zc(n,e.mode,r)).return=e,t):((t=o(t,n.children||[])).return=e,t)}function d(e,t,n,r,i){return null===t||7!==t.tag?((t=Dc(n,e.mode,r,i)).return=e,t):((t=o(t,n)).return=e,t)}function h(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t)return(t=Fc(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case w:return(n=Oc(t.type,t.key,t.props,null,e.mode,n)).ref=yo(e,null,t),n.return=e,n;case S:return(t=zc(t,e.mode,n)).return=e,t;case L:return h(e,(0,t._init)(t._payload),n)}if(ne(t)||D(t))return(t=Dc(t,e.mode,n,null)).return=e,t;bo(e,t)}return null}function p(e,t,n,r){var i=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n)return null!==i?null:l(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case w:return n.key===i?c(e,t,n,r):null;case S:return n.key===i?u(e,t,n,r):null;case L:return p(e,t,(i=n._init)(n._payload),r)}if(ne(n)||D(n))return null!==i?null:d(e,t,n,r,null);bo(e,n)}return null}function f(e,t,n,r,i){if("string"==typeof r&&""!==r||"number"==typeof r)return l(t,e=e.get(n)||null,""+r,i);if("object"==typeof r&&null!==r){switch(r.$$typeof){case w:return c(t,e=e.get(null===r.key?n:r.key)||null,r,i);case S:return u(t,e=e.get(null===r.key?n:r.key)||null,r,i);case L:return f(e,t,n,(0,r._init)(r._payload),i)}if(ne(r)||D(r))return d(t,e=e.get(n)||null,r,i,null);bo(t,r)}return null}return function l(c,u,d,m){if("object"==typeof d&&null!==d&&d.type===M&&null===d.key&&(d=d.props.children),"object"==typeof d&&null!==d){switch(d.$$typeof){case w:e:{for(var g=d.key,v=u;null!==v;){if(v.key===g){if((g=d.type)===M){if(7===v.tag){r(c,v.sibling),(u=o(v,d.props.children)).return=c,c=u;break e}}else if(v.elementType===g||"object"==typeof g&&null!==g&&g.$$typeof===L&&xo(g)===v.type){r(c,v.sibling),(u=o(v,d.props)).ref=yo(c,v,d),u.return=c,c=u;break e}r(c,v);break}t(c,v),v=v.sibling}d.type===M?((u=Dc(d.props.children,c.mode,m,d.key)).return=c,c=u):((m=Oc(d.type,d.key,d.props,null,c.mode,m)).ref=yo(c,u,d),m.return=c,c=m)}return s(c);case S:e:{for(v=d.key;null!==u;){if(u.key===v){if(4===u.tag&&u.stateNode.containerInfo===d.containerInfo&&u.stateNode.implementation===d.implementation){r(c,u.sibling),(u=o(u,d.children||[])).return=c,c=u;break e}r(c,u);break}t(c,u),u=u.sibling}(u=zc(d,c.mode,m)).return=c,c=u}return s(c);case L:return l(c,u,(v=d._init)(d._payload),m)}if(ne(d))return function(n,o,s,l){for(var c=null,u=null,d=o,m=o=0,g=null;null!==d&&m<s.length;m++){d.index>m?(g=d,d=null):g=d.sibling;var v=p(n,d,s[m],l);if(null===v){null===d&&(d=g);break}e&&d&&null===v.alternate&&t(n,d),o=a(v,o,m),null===u?c=v:u.sibling=v,u=v,d=g}if(m===s.length)return r(n,d),oo&&Qi(n,m),c;if(null===d){for(;m<s.length;m++)null!==(d=h(n,s[m],l))&&(o=a(d,o,m),null===u?c=d:u.sibling=d,u=d);return oo&&Qi(n,m),c}for(d=i(n,d);m<s.length;m++)null!==(g=f(d,n,m,s[m],l))&&(e&&null!==g.alternate&&d.delete(null===g.key?m:g.key),o=a(g,o,m),null===u?c=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(n,e)}),oo&&Qi(n,m),c}(c,u,d,m);if(D(d))return function(o,s,l,c){var u=D(l);if("function"!=typeof u)throw Error(n(150));if(null==(l=u.call(l)))throw Error(n(151));for(var d=u=null,m=s,g=s=0,v=null,y=l.next();null!==m&&!y.done;g++,y=l.next()){m.index>g?(v=m,m=null):v=m.sibling;var b=p(o,m,y.value,c);if(null===b){null===m&&(m=v);break}e&&m&&null===b.alternate&&t(o,m),s=a(b,s,g),null===d?u=b:d.sibling=b,d=b,m=v}if(y.done)return r(o,m),oo&&Qi(o,g),u;if(null===m){for(;!y.done;g++,y=l.next())null!==(y=h(o,y.value,c))&&(s=a(y,s,g),null===d?u=y:d.sibling=y,d=y);return oo&&Qi(o,g),u}for(m=i(o,m);!y.done;g++,y=l.next())null!==(y=f(m,o,g,y.value,c))&&(e&&null!==y.alternate&&m.delete(null===y.key?g:y.key),s=a(y,s,g),null===d?u=y:d.sibling=y,d=y);return e&&m.forEach(function(e){return t(o,e)}),oo&&Qi(o,g),u}(c,u,d,m);bo(c,d)}return"string"==typeof d&&""!==d||"number"==typeof d?(d=""+d,null!==u&&6===u.tag?(r(c,u.sibling),(u=o(u,d)).return=c,c=u):(r(c,u),(u=Fc(d,c.mode,m)).return=c,c=u),s(c)):r(c,u)}}var wo=_o(!0),So=_o(!1),Mo=Ei(null),Eo=null,To=null,Ao=null;function Co(){Ao=To=Eo=null}function ko(e){var t=Mo.current;Ti(Mo),e._currentValue=t}function Ro(e,t,n){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==r&&(r.childLanes|=t)):null!==r&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Po(e,t){Eo=e,Ao=To=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(xs=!0),e.firstContext=null)}function Io(e){var t=e._currentValue;if(Ao!==e)if(e={context:e,memoizedValue:t,next:null},null===To){if(null===Eo)throw Error(n(308));To=e,Eo.dependencies={lanes:0,firstContext:e}}else To=To.next=e;return t}var Lo=null;function No(e){null===Lo?Lo=[e]:Lo.push(e)}function Oo(e,t,n,r){var i=t.interleaved;return null===i?(n.next=n,No(t)):(n.next=i.next,i.next=n),t.interleaved=n,Do(e,r)}function Do(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}var Uo=!1;function Fo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function zo(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Bo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Vo(e,t,n){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,2&kl){var i=r.pending;return null===i?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Do(e,n)}return null===(i=r.interleaved)?(t.next=t,No(r)):(t.next=i.next,i.next=t),r.interleaved=t,Do(e,n)}function jo(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,4194240&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,bt(e,n)}}function Ho(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var i=null,o=null;if(null!==(n=n.firstBaseUpdate)){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===o?i=o=a:o=o.next=a,n=n.next}while(null!==n);null===o?i=o=t:o=o.next=t}else i=o=t;return n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Wo(e,t,n,r){var i=e.updateQueue;Uo=!1;var o=i.firstBaseUpdate,a=i.lastBaseUpdate,s=i.shared.pending;if(null!==s){i.shared.pending=null;var l=s,c=l.next;l.next=null,null===a?o=c:a.next=c,a=l;var u=e.alternate;null!==u&&((s=(u=u.updateQueue).lastBaseUpdate)!==a&&(null===s?u.firstBaseUpdate=c:s.next=c,u.lastBaseUpdate=l))}if(null!==o){var d=i.baseState;for(a=0,u=c=l=null,s=o;;){var h=s.lane,p=s.eventTime;if((r&h)===h){null!==u&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var f=e,m=s;switch(h=t,p=n,m.tag){case 1:if("function"==typeof(f=m.payload)){d=f.call(p,d,h);break e}d=f;break e;case 3:f.flags=-65537&f.flags|128;case 0:if(null==(h="function"==typeof(f=m.payload)?f.call(p,d,h):f))break e;d=F({},d,h);break e;case 2:Uo=!0}}null!==s.callback&&0!==s.lane&&(e.flags|=64,null===(h=i.effects)?i.effects=[s]:h.push(s))}else p={eventTime:p,lane:h,tag:s.tag,payload:s.payload,callback:s.callback,next:null},null===u?(c=u=p,l=d):u=u.next=p,a|=h;if(null===(s=s.next)){if(null===(s=i.shared.pending))break;s=(h=s).next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}if(null===u&&(l=d),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=u,null!==(t=i.shared.interleaved)){i=t;do{a|=i.lane,i=i.next}while(i!==t)}else null===o&&(i.shared.lanes=0);Ul|=a,e.lanes=a,e.memoizedState=d}}function Go(e,t,r){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var i=e[t],o=i.callback;if(null!==o){if(i.callback=null,i=r,"function"!=typeof o)throw Error(n(191,o));o.call(i)}}}var Xo={},qo=Ei(Xo),$o=Ei(Xo),Yo=Ei(Xo);function Zo(e){if(e===Xo)throw Error(n(174));return e}function Jo(e,t){switch(Ai(Yo,t),Ai($o,e),Ai(qo,Xo),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ce(null,"");break;default:t=ce(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}Ti(qo),Ai(qo,t)}function Ko(){Ti(qo),Ti($o),Ti(Yo)}function Qo(e){Zo(Yo.current);var t=Zo(qo.current),n=ce(t,e.type);t!==n&&(Ai($o,e),Ai(qo,n))}function ea(e){$o.current===e&&(Ti(qo),Ti($o))}var ta=Ei(0);function na(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(128&t.flags)return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ra=[];function ia(){for(var e=0;e<ra.length;e++)ra[e]._workInProgressVersionPrimary=null;ra.length=0}var oa=_.ReactCurrentDispatcher,aa=_.ReactCurrentBatchConfig,sa=0,la=null,ca=null,ua=null,da=!1,ha=!1,pa=0,fa=0;function ma(){throw Error(n(321))}function ga(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!lr(e[n],t[n]))return!1;return!0}function va(e,t,r,i,o,a){if(sa=a,la=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,oa.current=null===e||null===e.memoizedState?es:ts,e=r(i,o),ha){a=0;do{if(ha=!1,pa=0,25<=a)throw Error(n(301));a+=1,ua=ca=null,t.updateQueue=null,oa.current=ns,e=r(i,o)}while(ha)}if(oa.current=Qa,t=null!==ca&&null!==ca.next,sa=0,ua=ca=la=null,da=!1,t)throw Error(n(300));return e}function ya(){var e=0!==pa;return pa=0,e}function ba(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===ua?la.memoizedState=ua=e:ua=ua.next=e,ua}function xa(){if(null===ca){var e=la.alternate;e=null!==e?e.memoizedState:null}else e=ca.next;var t=null===ua?la.memoizedState:ua.next;if(null!==t)ua=t,ca=e;else{if(null===e)throw Error(n(310));e={memoizedState:(ca=e).memoizedState,baseState:ca.baseState,baseQueue:ca.baseQueue,queue:ca.queue,next:null},null===ua?la.memoizedState=ua=e:ua=ua.next=e}return ua}function _a(e,t){return"function"==typeof t?t(e):t}function wa(e){var t=xa(),r=t.queue;if(null===r)throw Error(n(311));r.lastRenderedReducer=e;var i=ca,o=i.baseQueue,a=r.pending;if(null!==a){if(null!==o){var s=o.next;o.next=a.next,a.next=s}i.baseQueue=o=a,r.pending=null}if(null!==o){a=o.next,i=i.baseState;var l=s=null,c=null,u=a;do{var d=u.lane;if((sa&d)===d)null!==c&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),i=u.hasEagerState?u.eagerState:e(i,u.action);else{var h={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};null===c?(l=c=h,s=i):c=c.next=h,la.lanes|=d,Ul|=d}u=u.next}while(null!==u&&u!==a);null===c?s=i:c.next=l,lr(i,t.memoizedState)||(xs=!0),t.memoizedState=i,t.baseState=s,t.baseQueue=c,r.lastRenderedState=i}if(null!==(e=r.interleaved)){o=e;do{a=o.lane,la.lanes|=a,Ul|=a,o=o.next}while(o!==e)}else null===o&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function Sa(e){var t=xa(),r=t.queue;if(null===r)throw Error(n(311));r.lastRenderedReducer=e;var i=r.dispatch,o=r.pending,a=t.memoizedState;if(null!==o){r.pending=null;var s=o=o.next;do{a=e(a,s.action),s=s.next}while(s!==o);lr(a,t.memoizedState)||(xs=!0),t.memoizedState=a,null===t.baseQueue&&(t.baseState=a),r.lastRenderedState=a}return[a,i]}function Ma(){}function Ea(e,t){var r=la,i=xa(),o=t(),a=!lr(i.memoizedState,o);if(a&&(i.memoizedState=o,xs=!0),i=i.queue,Ua(Ca.bind(null,r,i,e),[e]),i.getSnapshot!==t||a||null!==ua&&1&ua.memoizedState.tag){if(r.flags|=2048,Ia(9,Aa.bind(null,r,i,o,t),void 0,null),null===Rl)throw Error(n(349));30&sa||Ta(r,t,o)}return o}function Ta(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=la.updateQueue)?(t={lastEffect:null,stores:null},la.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function Aa(e,t,n,r){t.value=n,t.getSnapshot=r,ka(t)&&Ra(e)}function Ca(e,t,n){return n(function(){ka(t)&&Ra(e)})}function ka(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!lr(e,n)}catch(r){return!0}}function Ra(e){var t=Do(e,1);null!==t&&rc(t,e,1,-1)}function Pa(e){var t=ba();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:_a,lastRenderedState:e},t.queue=e,e=e.dispatch=Ya.bind(null,la,e),[t.memoizedState,e]}function Ia(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=la.updateQueue)?(t={lastEffect:null,stores:null},la.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function La(){return xa().memoizedState}function Na(e,t,n,r){var i=ba();la.flags|=e,i.memoizedState=Ia(1|t,n,void 0,void 0===r?null:r)}function Oa(e,t,n,r){var i=xa();r=void 0===r?null:r;var o=void 0;if(null!==ca){var a=ca.memoizedState;if(o=a.destroy,null!==r&&ga(r,a.deps))return void(i.memoizedState=Ia(t,n,o,r))}la.flags|=e,i.memoizedState=Ia(1|t,n,o,r)}function Da(e,t){return Na(8390656,8,e,t)}function Ua(e,t){return Oa(2048,8,e,t)}function Fa(e,t){return Oa(4,2,e,t)}function za(e,t){return Oa(4,4,e,t)}function Ba(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Va(e,t,n){return n=null!=n?n.concat([e]):null,Oa(4,4,Ba.bind(null,t,e),n)}function ja(){}function Ha(e,t){var n=xa();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&ga(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Wa(e,t){var n=xa();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&ga(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Ga(e,t,n){return 21&sa?(lr(n,t)||(n=gt(),la.lanes|=n,Ul|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,xs=!0),e.memoizedState=n)}function Xa(e,t){var n=xt;xt=0!==n&&4>n?n:4,e(!0);var r=aa.transition;aa.transition={};try{e(!1),t()}finally{xt=n,aa.transition=r}}function qa(){return xa().memoizedState}function $a(e,t,n){var r=nc(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Za(e))Ja(t,n);else if(null!==(n=Oo(e,t,n,r))){rc(n,e,r,tc()),Ka(n,t,r)}}function Ya(e,t,n){var r=nc(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Za(e))Ja(t,i);else{var o=e.alternate;if(0===e.lanes&&(null===o||0===o.lanes)&&null!==(o=t.lastRenderedReducer))try{var a=t.lastRenderedState,s=o(a,n);if(i.hasEagerState=!0,i.eagerState=s,lr(s,a)){var l=t.interleaved;return null===l?(i.next=i,No(t)):(i.next=l.next,l.next=i),void(t.interleaved=i)}}catch(c){}null!==(n=Oo(e,t,i,r))&&(rc(n,e,r,i=tc()),Ka(n,t,r))}}function Za(e){var t=e.alternate;return e===la||null!==t&&t===la}function Ja(e,t){ha=da=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ka(e,t,n){if(4194240&n){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,bt(e,n)}}var Qa={readContext:Io,useCallback:ma,useContext:ma,useEffect:ma,useImperativeHandle:ma,useInsertionEffect:ma,useLayoutEffect:ma,useMemo:ma,useReducer:ma,useRef:ma,useState:ma,useDebugValue:ma,useDeferredValue:ma,useTransition:ma,useMutableSource:ma,useSyncExternalStore:ma,useId:ma,unstable_isNewReconciler:!1},es={readContext:Io,useCallback:function(e,t){return ba().memoizedState=[e,void 0===t?null:t],e},useContext:Io,useEffect:Da,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,Na(4194308,4,Ba.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Na(4194308,4,e,t)},useInsertionEffect:function(e,t){return Na(4,2,e,t)},useMemo:function(e,t){var n=ba();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ba();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=$a.bind(null,la,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},ba().memoizedState=e},useState:Pa,useDebugValue:ja,useDeferredValue:function(e){return ba().memoizedState=e},useTransition:function(){var e=Pa(!1),t=e[0];return e=Xa.bind(null,e[1]),ba().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var i=la,o=ba();if(oo){if(void 0===r)throw Error(n(407));r=r()}else{if(r=t(),null===Rl)throw Error(n(349));30&sa||Ta(i,t,r)}o.memoizedState=r;var a={value:r,getSnapshot:t};return o.queue=a,Da(Ca.bind(null,i,a,e),[e]),i.flags|=2048,Ia(9,Aa.bind(null,i,a,r,t),void 0,null),r},useId:function(){var e=ba(),t=Rl.identifierPrefix;if(oo){var n=Ki;t=":"+t+"R"+(n=(Ji&~(1<<32-st(Ji)-1)).toString(32)+n),0<(n=pa++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=fa++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},ts={readContext:Io,useCallback:Ha,useContext:Io,useEffect:Ua,useImperativeHandle:Va,useInsertionEffect:Fa,useLayoutEffect:za,useMemo:Wa,useReducer:wa,useRef:La,useState:function(){return wa(_a)},useDebugValue:ja,useDeferredValue:function(e){return Ga(xa(),ca.memoizedState,e)},useTransition:function(){return[wa(_a)[0],xa().memoizedState]},useMutableSource:Ma,useSyncExternalStore:Ea,useId:qa,unstable_isNewReconciler:!1},ns={readContext:Io,useCallback:Ha,useContext:Io,useEffect:Ua,useImperativeHandle:Va,useInsertionEffect:Fa,useLayoutEffect:za,useMemo:Wa,useReducer:Sa,useRef:La,useState:function(){return Sa(_a)},useDebugValue:ja,useDeferredValue:function(e){var t=xa();return null===ca?t.memoizedState=e:Ga(t,ca.memoizedState,e)},useTransition:function(){return[Sa(_a)[0],xa().memoizedState]},useMutableSource:Ma,useSyncExternalStore:Ea,useId:qa,unstable_isNewReconciler:!1};function rs(e,t){if(e&&e.defaultProps){for(var n in t=F({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}function is(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:F({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var os={isMounted:function(e){return!!(e=e._reactInternals)&&He(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=tc(),i=nc(e),o=Bo(r,i);o.payload=t,null!=n&&(o.callback=n),null!==(t=Vo(e,o,i))&&(rc(t,e,i,r),jo(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=tc(),i=nc(e),o=Bo(r,i);o.tag=1,o.payload=t,null!=n&&(o.callback=n),null!==(t=Vo(e,o,i))&&(rc(t,e,i,r),jo(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=tc(),r=nc(e),i=Bo(n,r);i.tag=2,null!=t&&(i.callback=t),null!==(t=Vo(e,i,r))&&(rc(t,e,r,n),jo(t,e,r))}};function as(e,t,n,r,i,o,a){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,o,a):!t.prototype||!t.prototype.isPureReactComponent||(!cr(n,r)||!cr(i,o))}function ss(e,t,n){var r=!1,i=Ci,o=t.contextType;return"object"==typeof o&&null!==o?o=Io(o):(i=Li(t)?Pi:ki.current,o=(r=null!=(r=t.contextTypes))?Ii(e,i):Ci),t=new t(n,o),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=os,e.stateNode=t,t._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=o),t}function ls(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&os.enqueueReplaceState(t,t.state,null)}function cs(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Fo(e);var o=t.contextType;"object"==typeof o&&null!==o?i.context=Io(o):(o=Li(t)?Pi:ki.current,i.context=Ii(e,o)),i.state=e.memoizedState,"function"==typeof(o=t.getDerivedStateFromProps)&&(is(e,t,o,n),i.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof i.getSnapshotBeforeUpdate||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||(t=i.state,"function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),t!==i.state&&os.enqueueReplaceState(i,i.state,null),Wo(e,n,i,r),i.state=e.memoizedState),"function"==typeof i.componentDidMount&&(e.flags|=4194308)}function us(e,t){try{var n="",r=t;do{n+=j(r),r=r.return}while(r);var i=n}catch(o){i="\nError generating stack: "+o.message+"\n"+o.stack}return{value:e,source:t,stack:i,digest:null}}function ds(e,t,n){return{value:e,source:null,stack:null!=n?n:null,digest:null!=t?t:null}}function hs(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var ps="function"==typeof WeakMap?WeakMap:Map;function fs(e,t,n){(n=Bo(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Gl||(Gl=!0,Xl=r),hs(0,t)},n}function ms(e,t,n){(n=Bo(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){hs(0,t)}}var o=e.stateNode;return null!==o&&"function"==typeof o.componentDidCatch&&(n.callback=function(){hs(0,t),"function"!=typeof r&&(null===ql?ql=new Set([this]):ql.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function gs(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new ps;var i=new Set;r.set(t,i)}else void 0===(i=r.get(t))&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=Tc.bind(null,e,t,n),t.then(e,e))}function vs(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function ys(e,t,n,r,i){return 1&e.mode?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=Bo(-1,1)).tag=2,Vo(n,t,1))),n.lanes|=1),e)}var bs=_.ReactCurrentOwner,xs=!1;function _s(e,t,n,r){t.child=null===e?So(t,null,n,r):wo(t,e.child,n,r)}function ws(e,t,n,r,i){n=n.render;var o=t.ref;return Po(t,i),r=va(e,t,n,r,o,i),n=ya(),null===e||xs?(oo&&n&&to(t),t.flags|=1,_s(e,t,r,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Gs(e,t,i))}function Ss(e,t,n,r,i){if(null===e){var o=n.type;return"function"!=typeof o||Lc(o)||void 0!==o.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Oc(n.type,null,r,t,t.mode,i)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,Ms(e,t,o,r,i))}if(o=e.child,0===(e.lanes&i)){var a=o.memoizedProps;if((n=null!==(n=n.compare)?n:cr)(a,r)&&e.ref===t.ref)return Gs(e,t,i)}return t.flags|=1,(e=Nc(o,r)).ref=t.ref,e.return=t,t.child=e}function Ms(e,t,n,r,i){if(null!==e){var o=e.memoizedProps;if(cr(o,r)&&e.ref===t.ref){if(xs=!1,t.pendingProps=r=o,0===(e.lanes&i))return t.lanes=e.lanes,Gs(e,t,i);131072&e.flags&&(xs=!0)}}return As(e,t,n,r,i)}function Es(e,t,n){var r=t.pendingProps,i=r.children,o=null!==e?e.memoizedState:null;if("hidden"===r.mode)if(1&t.mode){if(!(1073741824&n))return e=null!==o?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ai(Nl,Ll),Ll|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=null!==o?o.baseLanes:n,Ai(Nl,Ll),Ll|=r}else t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ai(Nl,Ll),Ll|=n;else null!==o?(r=o.baseLanes|n,t.memoizedState=null):r=n,Ai(Nl,Ll),Ll|=r;return _s(e,t,i,n),t.child}function Ts(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function As(e,t,n,r,i){var o=Li(n)?Pi:ki.current;return o=Ii(t,o),Po(t,i),n=va(e,t,n,r,o,i),r=ya(),null===e||xs?(oo&&r&&to(t),t.flags|=1,_s(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Gs(e,t,i))}function Cs(e,t,n,r,i){if(Li(n)){var o=!0;Ui(t)}else o=!1;if(Po(t,i),null===t.stateNode)Ws(e,t),ss(t,n,r),cs(t,n,r,i),r=!0;else if(null===e){var a=t.stateNode,s=t.memoizedProps;a.props=s;var l=a.context,c=n.contextType;"object"==typeof c&&null!==c?c=Io(c):c=Ii(t,c=Li(n)?Pi:ki.current);var u=n.getDerivedStateFromProps,d="function"==typeof u||"function"==typeof a.getSnapshotBeforeUpdate;d||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==r||l!==c)&&ls(t,a,r,c),Uo=!1;var h=t.memoizedState;a.state=h,Wo(t,r,a,i),l=t.memoizedState,s!==r||h!==l||Ri.current||Uo?("function"==typeof u&&(is(t,n,u,r),l=t.memoizedState),(s=Uo||as(t,n,s,r,h,l,c))?(d||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||("function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount()),"function"==typeof a.componentDidMount&&(t.flags|=4194308)):("function"==typeof a.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=c,r=s):("function"==typeof a.componentDidMount&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,zo(e,t),s=t.memoizedProps,c=t.type===t.elementType?s:rs(t.type,s),a.props=c,d=t.pendingProps,h=a.context,"object"==typeof(l=n.contextType)&&null!==l?l=Io(l):l=Ii(t,l=Li(n)?Pi:ki.current);var p=n.getDerivedStateFromProps;(u="function"==typeof p||"function"==typeof a.getSnapshotBeforeUpdate)||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==d||h!==l)&&ls(t,a,r,l),Uo=!1,h=t.memoizedState,a.state=h,Wo(t,r,a,i);var f=t.memoizedState;s!==d||h!==f||Ri.current||Uo?("function"==typeof p&&(is(t,n,p,r),f=t.memoizedState),(c=Uo||as(t,n,c,r,h,f,l)||!1)?(u||"function"!=typeof a.UNSAFE_componentWillUpdate&&"function"!=typeof a.componentWillUpdate||("function"==typeof a.componentWillUpdate&&a.componentWillUpdate(r,f,l),"function"==typeof a.UNSAFE_componentWillUpdate&&a.UNSAFE_componentWillUpdate(r,f,l)),"function"==typeof a.componentDidUpdate&&(t.flags|=4),"function"==typeof a.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=f),a.props=r,a.state=f,a.context=l,r=c):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return ks(e,t,n,r,o,i)}function ks(e,t,n,r,i,o){Ts(e,t);var a=!!(128&t.flags);if(!r&&!a)return i&&Fi(t,n,!1),Gs(e,t,o);r=t.stateNode,bs.current=t;var s=a&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&a?(t.child=wo(t,e.child,null,o),t.child=wo(t,null,s,o)):_s(e,t,s,o),t.memoizedState=r.state,i&&Fi(t,n,!0),t.child}function Rs(e){var t=e.stateNode;t.pendingContext?Oi(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Oi(0,t.context,!1),Jo(e,t.containerInfo)}function Ps(e,t,n,r,i){return mo(),go(i),t.flags|=256,_s(e,t,n,r),t.child}var Is,Ls,Ns,Os,Ds={dehydrated:null,treeContext:null,retryLane:0};function Us(e){return{baseLanes:e,cachePool:null,transitions:null}}function Fs(e,t,r){var i,o=t.pendingProps,a=ta.current,s=!1,l=!!(128&t.flags);if((i=l)||(i=(null===e||null!==e.memoizedState)&&!!(2&a)),i?(s=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(a|=1),Ai(ta,1&a),null===e)return uo(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(1&t.mode?"$!"===e.data?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(l=o.children,e=o.fallback,s?(o=t.mode,s=t.child,l={mode:"hidden",children:l},1&o||null===s?s=Uc(l,o,0,null):(s.childLanes=0,s.pendingProps=l),e=Dc(e,o,r,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Us(r),t.memoizedState=Ds,e):zs(t,l));if(null!==(a=e.memoizedState)&&null!==(i=a.dehydrated))return function(e,t,r,i,o,a,s){if(r)return 256&t.flags?(t.flags&=-257,Bs(e,t,s,i=ds(Error(n(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(a=i.fallback,o=t.mode,i=Uc({mode:"visible",children:i.children},o,0,null),(a=Dc(a,o,s,null)).flags|=2,i.return=t,a.return=t,i.sibling=a,t.child=i,1&t.mode&&wo(t,e.child,null,s),t.child.memoizedState=Us(s),t.memoizedState=Ds,a);if(!(1&t.mode))return Bs(e,t,s,null);if("$!"===o.data){if(i=o.nextSibling&&o.nextSibling.dataset)var l=i.dgst;return i=l,Bs(e,t,s,i=ds(a=Error(n(419)),i,void 0))}if(l=0!==(s&e.childLanes),xs||l){if(null!==(i=Rl)){switch(s&-s){case 4:o=2;break;case 16:o=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:o=32;break;case 536870912:o=268435456;break;default:o=0}0!==(o=0!==(o&(i.suspendedLanes|s))?0:o)&&o!==a.retryLane&&(a.retryLane=o,Do(e,o),rc(i,e,o,-1))}return gc(),Bs(e,t,s,i=ds(Error(n(421))))}return"$?"===o.data?(t.flags|=128,t.child=e.child,t=Cc.bind(null,e),o._reactRetry=t,null):(e=a.treeContext,io=ui(o.nextSibling),ro=t,oo=!0,ao=null,null!==e&&($i[Yi++]=Ji,$i[Yi++]=Ki,$i[Yi++]=Zi,Ji=e.id,Ki=e.overflow,Zi=t),t=zs(t,i.children),t.flags|=4096,t)}(e,t,l,o,i,a,r);if(s){s=o.fallback,l=t.mode,i=(a=e.child).sibling;var c={mode:"hidden",children:o.children};return 1&l||t.child===a?(o=Nc(a,c)).subtreeFlags=14680064&a.subtreeFlags:((o=t.child).childLanes=0,o.pendingProps=c,t.deletions=null),null!==i?s=Nc(i,s):(s=Dc(s,l,r,null)).flags|=2,s.return=t,o.return=t,o.sibling=s,t.child=o,o=s,s=t.child,l=null===(l=e.child.memoizedState)?Us(r):{baseLanes:l.baseLanes|r,cachePool:null,transitions:l.transitions},s.memoizedState=l,s.childLanes=e.childLanes&~r,t.memoizedState=Ds,o}return e=(s=e.child).sibling,o=Nc(s,{mode:"visible",children:o.children}),!(1&t.mode)&&(o.lanes=r),o.return=t,o.sibling=null,null!==e&&(null===(r=t.deletions)?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=o,t.memoizedState=null,o}function zs(e,t){return(t=Uc({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function Bs(e,t,n,r){return null!==r&&go(r),wo(t,e.child,null,n),(e=zs(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Vs(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),Ro(e.return,t,n)}function js(e,t,n,r,i){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i)}function Hs(e,t,n){var r=t.pendingProps,i=r.revealOrder,o=r.tail;if(_s(e,t,r.children,n),2&(r=ta.current))r=1&r|2,t.flags|=128;else{if(null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Vs(e,n,t);else if(19===e.tag)Vs(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Ai(ta,r),1&t.mode)switch(i){case"forwards":for(n=t.child,i=null;null!==n;)null!==(e=n.alternate)&&null===na(e)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),js(t,!1,i,n,o);break;case"backwards":for(n=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===na(e)){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}js(t,!0,n,null,o);break;case"together":js(t,!1,null,null,void 0);break;default:t.memoizedState=null}else t.memoizedState=null;return t.child}function Ws(e,t){!(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Gs(e,t,r){if(null!==e&&(t.dependencies=e.dependencies),Ul|=t.lanes,0===(r&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(n(153));if(null!==t.child){for(r=Nc(e=t.child,e.pendingProps),t.child=r,r.return=t;null!==e.sibling;)e=e.sibling,(r=r.sibling=Nc(e,e.pendingProps)).return=t;r.sibling=null}return t.child}function Xs(e,t){if(!oo)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function qs(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=14680064&i.subtreeFlags,r|=14680064&i.flags,i.return=e,i=i.sibling;else for(i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function $s(e,t,r){var o=t.pendingProps;switch(no(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qs(t),null;case 1:case 17:return Li(t.type)&&Ni(),qs(t),null;case 3:return o=t.stateNode,Ko(),Ti(Ri),Ti(ki),ia(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),null!==e&&null!==e.child||(po(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,null!==ao&&(sc(ao),ao=null))),Ls(e,t),qs(t),null;case 5:ea(t);var a=Zo(Yo.current);if(r=t.type,null!==e&&null!=t.stateNode)Ns(e,t,r,o,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!o){if(null===t.stateNode)throw Error(n(166));return qs(t),null}if(e=Zo(qo.current),po(t)){o=t.stateNode,r=t.type;var s=t.memoizedProps;switch(o[pi]=t,o[fi]=s,e=!!(1&t.mode),r){case"dialog":Br("cancel",o),Br("close",o);break;case"iframe":case"object":case"embed":Br("load",o);break;case"video":case"audio":for(a=0;a<Dr.length;a++)Br(Dr[a],o);break;case"source":Br("error",o);break;case"img":case"image":case"link":Br("error",o),Br("load",o);break;case"details":Br("toggle",o);break;case"input":J(o,s),Br("invalid",o);break;case"select":o._wrapperState={wasMultiple:!!s.multiple},Br("invalid",o);break;case"textarea":oe(o,s),Br("invalid",o)}for(var l in be(r,s),a=null,s)if(s.hasOwnProperty(l)){var c=s[l];"children"===l?"string"==typeof c?o.textContent!==c&&(!0!==s.suppressHydrationWarning&&Qr(o.textContent,c,e),a=["children",c]):"number"==typeof c&&o.textContent!==""+c&&(!0!==s.suppressHydrationWarning&&Qr(o.textContent,c,e),a=["children",""+c]):i.hasOwnProperty(l)&&null!=c&&"onScroll"===l&&Br("scroll",o)}switch(r){case"input":q(o),ee(o,s,!0);break;case"textarea":q(o),se(o);break;case"select":case"option":break;default:"function"==typeof s.onClick&&(o.onclick=ei)}o=a,t.updateQueue=o,null!==o&&(t.flags|=4)}else{l=9===a.nodeType?a:a.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=le(r)),"http://www.w3.org/1999/xhtml"===e?"script"===r?((e=l.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof o.is?e=l.createElement(r,{is:o.is}):(e=l.createElement(r),"select"===r&&(l=e,o.multiple?l.multiple=!0:o.size&&(l.size=o.size))):e=l.createElementNS(e,r),e[pi]=t,e[fi]=o,Is(e,t,!1,!1),t.stateNode=e;e:{switch(l=xe(r,o),r){case"dialog":Br("cancel",e),Br("close",e),a=o;break;case"iframe":case"object":case"embed":Br("load",e),a=o;break;case"video":case"audio":for(a=0;a<Dr.length;a++)Br(Dr[a],e);a=o;break;case"source":Br("error",e),a=o;break;case"img":case"image":case"link":Br("error",e),Br("load",e),a=o;break;case"details":Br("toggle",e),a=o;break;case"input":J(e,o),a=Z(e,o),Br("invalid",e);break;case"option":default:a=o;break;case"select":e._wrapperState={wasMultiple:!!o.multiple},a=F({},o,{value:void 0}),Br("invalid",e);break;case"textarea":oe(e,o),a=ie(e,o),Br("invalid",e)}for(s in be(r,a),c=a)if(c.hasOwnProperty(s)){var u=c[s];"style"===s?ve(e,u):"dangerouslySetInnerHTML"===s?null!=(u=u?u.__html:void 0)&&he(e,u):"children"===s?"string"==typeof u?("textarea"!==r||""!==u)&&pe(e,u):"number"==typeof u&&pe(e,""+u):"suppressContentEditableWarning"!==s&&"suppressHydrationWarning"!==s&&"autoFocus"!==s&&(i.hasOwnProperty(s)?null!=u&&"onScroll"===s&&Br("scroll",e):null!=u&&x(e,s,u,l))}switch(r){case"input":q(e),ee(e,o,!1);break;case"textarea":q(e),se(e);break;case"option":null!=o.value&&e.setAttribute("value",""+G(o.value));break;case"select":e.multiple=!!o.multiple,null!=(s=o.value)?re(e,!!o.multiple,s,!1):null!=o.defaultValue&&re(e,!!o.multiple,o.defaultValue,!0);break;default:"function"==typeof a.onClick&&(e.onclick=ei)}switch(r){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}}o&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return qs(t),null;case 6:if(e&&null!=t.stateNode)Os(e,t,e.memoizedProps,o);else{if("string"!=typeof o&&null===t.stateNode)throw Error(n(166));if(r=Zo(Yo.current),Zo(qo.current),po(t)){if(o=t.stateNode,r=t.memoizedProps,o[pi]=t,(s=o.nodeValue!==r)&&null!==(e=ro))switch(e.tag){case 3:Qr(o.nodeValue,r,!!(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Qr(o.nodeValue,r,!!(1&e.mode))}s&&(t.flags|=4)}else(o=(9===r.nodeType?r:r.ownerDocument).createTextNode(o))[pi]=t,t.stateNode=o}return qs(t),null;case 13:if(Ti(ta),o=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(oo&&null!==io&&1&t.mode&&!(128&t.flags))fo(),mo(),t.flags|=98560,s=!1;else if(s=po(t),null!==o&&null!==o.dehydrated){if(null===e){if(!s)throw Error(n(318));if(!(s=null!==(s=t.memoizedState)?s.dehydrated:null))throw Error(n(317));s[pi]=t}else mo(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;qs(t),s=!1}else null!==ao&&(sc(ao),ao=null),s=!0;if(!s)return 65536&t.flags?t:null}return 128&t.flags?(t.lanes=r,t):((o=null!==o)!==(null!==e&&null!==e.memoizedState)&&o&&(t.child.flags|=8192,1&t.mode&&(null===e||1&ta.current?0===Ol&&(Ol=3):gc())),null!==t.updateQueue&&(t.flags|=4),qs(t),null);case 4:return Ko(),Ls(e,t),null===e&&Hr(t.stateNode.containerInfo),qs(t),null;case 10:return ko(t.type._context),qs(t),null;case 19:if(Ti(ta),null===(s=t.memoizedState))return qs(t),null;if(o=!!(128&t.flags),null===(l=s.rendering))if(o)Xs(s,!1);else{if(0!==Ol||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(l=na(e))){for(t.flags|=128,Xs(s,!1),null!==(o=l.updateQueue)&&(t.updateQueue=o,t.flags|=4),t.subtreeFlags=0,o=r,r=t.child;null!==r;)e=o,(s=r).flags&=14680066,null===(l=s.alternate)?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=l.childLanes,s.lanes=l.lanes,s.child=l.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=l.memoizedProps,s.memoizedState=l.memoizedState,s.updateQueue=l.updateQueue,s.type=l.type,e=l.dependencies,s.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return Ai(ta,1&ta.current|2),t.child}e=e.sibling}null!==s.tail&&Ke()>Hl&&(t.flags|=128,o=!0,Xs(s,!1),t.lanes=4194304)}else{if(!o)if(null!==(e=na(l))){if(t.flags|=128,o=!0,null!==(r=e.updateQueue)&&(t.updateQueue=r,t.flags|=4),Xs(s,!0),null===s.tail&&"hidden"===s.tailMode&&!l.alternate&&!oo)return qs(t),null}else 2*Ke()-s.renderingStartTime>Hl&&1073741824!==r&&(t.flags|=128,o=!0,Xs(s,!1),t.lanes=4194304);s.isBackwards?(l.sibling=t.child,t.child=l):(null!==(r=s.last)?r.sibling=l:t.child=l,s.last=l)}return null!==s.tail?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Ke(),t.sibling=null,r=ta.current,Ai(ta,o?1&r|2:1&r),t):(qs(t),null);case 22:case 23:return hc(),o=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==o&&(t.flags|=8192),o&&1&t.mode?!!(1073741824&Ll)&&(qs(t),6&t.subtreeFlags&&(t.flags|=8192)):qs(t),null;case 24:case 25:return null}throw Error(n(156,t.tag))}function Ys(e,t){switch(no(t),t.tag){case 1:return Li(t.type)&&Ni(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return Ko(),Ti(Ri),Ti(ki),ia(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 5:return ea(t),null;case 13:if(Ti(ta),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(n(340));mo()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return Ti(ta),null;case 4:return Ko(),null;case 10:return ko(t.type._context),null;case 22:case 23:return hc(),null;default:return null}}Is=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Ls=function(){},Ns=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,Zo(qo.current);var a,s=null;switch(n){case"input":o=Z(e,o),r=Z(e,r),s=[];break;case"select":o=F({},o,{value:void 0}),r=F({},r,{value:void 0}),s=[];break;case"textarea":o=ie(e,o),r=ie(e,r),s=[];break;default:"function"!=typeof o.onClick&&"function"==typeof r.onClick&&(e.onclick=ei)}for(u in be(n,r),n=null,o)if(!r.hasOwnProperty(u)&&o.hasOwnProperty(u)&&null!=o[u])if("style"===u){var l=o[u];for(a in l)l.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else"dangerouslySetInnerHTML"!==u&&"children"!==u&&"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&"autoFocus"!==u&&(i.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var c=r[u];if(l=null!=o?o[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(null!=c||null!=l))if("style"===u)if(l){for(a in l)!l.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in c)c.hasOwnProperty(a)&&l[a]!==c[a]&&(n||(n={}),n[a]=c[a])}else n||(s||(s=[]),s.push(u,n)),n=c;else"dangerouslySetInnerHTML"===u?(c=c?c.__html:void 0,l=l?l.__html:void 0,null!=c&&l!==c&&(s=s||[]).push(u,c)):"children"===u?"string"!=typeof c&&"number"!=typeof c||(s=s||[]).push(u,""+c):"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&(i.hasOwnProperty(u)?(null!=c&&"onScroll"===u&&Br("scroll",e),s||l===c||(s=[])):(s=s||[]).push(u,c))}n&&(s=s||[]).push("style",n);var u=s;(t.updateQueue=u)&&(t.flags|=4)}},Os=function(e,t,n,r){n!==r&&(t.flags|=4)};var Zs=!1,Js=!1,Ks="function"==typeof WeakSet?WeakSet:Set,Qs=null;function el(e,t){var n=e.ref;if(null!==n)if("function"==typeof n)try{n(null)}catch(r){Ec(e,t,r)}else n.current=null}function tl(e,t,n){try{n()}catch(r){Ec(e,t,r)}}var nl=!1;function rl(e,t,n){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,void 0!==o&&tl(t,n,o)}i=i.next}while(i!==r)}}function il(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ol(e){var t=e.ref;if(null!==t){var n=e.stateNode;e.tag,e=n,"function"==typeof t?t(e):t.current=e}}function al(e){var t=e.alternate;null!==t&&(e.alternate=null,al(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&(delete t[pi],delete t[fi],delete t[gi],delete t[vi],delete t[yi])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function sl(e){return 5===e.tag||3===e.tag||4===e.tag}function ll(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||sl(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function cl(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=ei));else if(4!==r&&null!==(e=e.child))for(cl(e,t,n),e=e.sibling;null!==e;)cl(e,t,n),e=e.sibling}function ul(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&null!==(e=e.child))for(ul(e,t,n),e=e.sibling;null!==e;)ul(e,t,n),e=e.sibling}var dl=null,hl=!1;function pl(e,t,n){for(n=n.child;null!==n;)fl(e,t,n),n=n.sibling}function fl(e,t,n){if(at&&"function"==typeof at.onCommitFiberUnmount)try{at.onCommitFiberUnmount(ot,n)}catch(s){}switch(n.tag){case 5:Js||el(n,t);case 6:var r=dl,i=hl;dl=null,pl(e,t,n),hl=i,null!==(dl=r)&&(hl?(e=dl,n=n.stateNode,8===e.nodeType?e.parentNode.removeChild(n):e.removeChild(n)):dl.removeChild(n.stateNode));break;case 18:null!==dl&&(hl?(e=dl,n=n.stateNode,8===e.nodeType?ci(e.parentNode,n):1===e.nodeType&&ci(e,n),Ht(e)):ci(dl,n.stateNode));break;case 4:r=dl,i=hl,dl=n.stateNode.containerInfo,hl=!0,pl(e,t,n),dl=r,hl=i;break;case 0:case 11:case 14:case 15:if(!Js&&(null!==(r=n.updateQueue)&&null!==(r=r.lastEffect))){i=r=r.next;do{var o=i,a=o.destroy;o=o.tag,void 0!==a&&(2&o||4&o)&&tl(n,t,a),i=i.next}while(i!==r)}pl(e,t,n);break;case 1:if(!Js&&(el(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){Ec(n,t,s)}pl(e,t,n);break;case 21:pl(e,t,n);break;case 22:1&n.mode?(Js=(r=Js)||null!==n.memoizedState,pl(e,t,n),Js=r):pl(e,t,n);break;default:pl(e,t,n)}}function ml(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new Ks),t.forEach(function(t){var r=kc.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function gl(e,t){var r=t.deletions;if(null!==r)for(var i=0;i<r.length;i++){var o=r[i];try{var a=e,s=t,l=s;e:for(;null!==l;){switch(l.tag){case 5:dl=l.stateNode,hl=!1;break e;case 3:case 4:dl=l.stateNode.containerInfo,hl=!0;break e}l=l.return}if(null===dl)throw Error(n(160));fl(a,s,o),dl=null,hl=!1;var c=o.alternate;null!==c&&(c.return=null),o.return=null}catch(u){Ec(o,t,u)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)vl(t,e),t=t.sibling}function vl(e,t){var r=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(gl(t,e),yl(e),4&i){try{rl(3,e,e.return),il(3,e)}catch(g){Ec(e,e.return,g)}try{rl(5,e,e.return)}catch(g){Ec(e,e.return,g)}}break;case 1:gl(t,e),yl(e),512&i&&null!==r&&el(r,r.return);break;case 5:if(gl(t,e),yl(e),512&i&&null!==r&&el(r,r.return),32&e.flags){var o=e.stateNode;try{pe(o,"")}catch(g){Ec(e,e.return,g)}}if(4&i&&null!=(o=e.stateNode)){var a=e.memoizedProps,s=null!==r?r.memoizedProps:a,l=e.type,c=e.updateQueue;if(e.updateQueue=null,null!==c)try{"input"===l&&"radio"===a.type&&null!=a.name&&K(o,a),xe(l,s);var u=xe(l,a);for(s=0;s<c.length;s+=2){var d=c[s],h=c[s+1];"style"===d?ve(o,h):"dangerouslySetInnerHTML"===d?he(o,h):"children"===d?pe(o,h):x(o,d,h,u)}switch(l){case"input":Q(o,a);break;case"textarea":ae(o,a);break;case"select":var p=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!a.multiple;var f=a.value;null!=f?re(o,!!a.multiple,f,!1):p!==!!a.multiple&&(null!=a.defaultValue?re(o,!!a.multiple,a.defaultValue,!0):re(o,!!a.multiple,a.multiple?[]:"",!1))}o[fi]=a}catch(g){Ec(e,e.return,g)}}break;case 6:if(gl(t,e),yl(e),4&i){if(null===e.stateNode)throw Error(n(162));o=e.stateNode,a=e.memoizedProps;try{o.nodeValue=a}catch(g){Ec(e,e.return,g)}}break;case 3:if(gl(t,e),yl(e),4&i&&null!==r&&r.memoizedState.isDehydrated)try{Ht(t.containerInfo)}catch(g){Ec(e,e.return,g)}break;case 4:default:gl(t,e),yl(e);break;case 13:gl(t,e),yl(e),8192&(o=e.child).flags&&(a=null!==o.memoizedState,o.stateNode.isHidden=a,!a||null!==o.alternate&&null!==o.alternate.memoizedState||(jl=Ke())),4&i&&ml(e);break;case 22:if(d=null!==r&&null!==r.memoizedState,1&e.mode?(Js=(u=Js)||d,gl(t,e),Js=u):gl(t,e),yl(e),8192&i){if(u=null!==e.memoizedState,(e.stateNode.isHidden=u)&&!d&&1&e.mode)for(Qs=e,d=e.child;null!==d;){for(h=Qs=d;null!==Qs;){switch(f=(p=Qs).child,p.tag){case 0:case 11:case 14:case 15:rl(4,p,p.return);break;case 1:el(p,p.return);var m=p.stateNode;if("function"==typeof m.componentWillUnmount){i=p,r=p.return;try{t=i,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(g){Ec(i,r,g)}}break;case 5:el(p,p.return);break;case 22:if(null!==p.memoizedState){wl(h);continue}}null!==f?(f.return=p,Qs=f):wl(h)}d=d.sibling}e:for(d=null,h=e;;){if(5===h.tag){if(null===d){d=h;try{o=h.stateNode,u?"function"==typeof(a=o.style).setProperty?a.setProperty("display","none","important"):a.display="none":(l=h.stateNode,s=null!=(c=h.memoizedProps.style)&&c.hasOwnProperty("display")?c.display:null,l.style.display=ge("display",s))}catch(g){Ec(e,e.return,g)}}}else if(6===h.tag){if(null===d)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(g){Ec(e,e.return,g)}}else if((22!==h.tag&&23!==h.tag||null===h.memoizedState||h===e)&&null!==h.child){h.child.return=h,h=h.child;continue}if(h===e)break e;for(;null===h.sibling;){if(null===h.return||h.return===e)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:gl(t,e),yl(e),4&i&&ml(e);case 21:}}function yl(e){var t=e.flags;if(2&t){try{e:{for(var r=e.return;null!==r;){if(sl(r)){var i=r;break e}r=r.return}throw Error(n(160))}switch(i.tag){case 5:var o=i.stateNode;32&i.flags&&(pe(o,""),i.flags&=-33),ul(e,ll(e),o);break;case 3:case 4:var a=i.stateNode.containerInfo;cl(e,ll(e),a);break;default:throw Error(n(161))}}catch(s){Ec(e,e.return,s)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function bl(e,t,n){Qs=e,xl(e)}function xl(e,t,n){for(var r=!!(1&e.mode);null!==Qs;){var i=Qs,o=i.child;if(22===i.tag&&r){var a=null!==i.memoizedState||Zs;if(!a){var s=i.alternate,l=null!==s&&null!==s.memoizedState||Js;s=Zs;var c=Js;if(Zs=a,(Js=l)&&!c)for(Qs=i;null!==Qs;)l=(a=Qs).child,22===a.tag&&null!==a.memoizedState?Sl(i):null!==l?(l.return=a,Qs=l):Sl(i);for(;null!==o;)Qs=o,xl(o),o=o.sibling;Qs=i,Zs=s,Js=c}_l(e)}else 8772&i.subtreeFlags&&null!==o?(o.return=i,Qs=o):_l(e)}}function _l(e){for(;null!==Qs;){var t=Qs;if(8772&t.flags){var r=t.alternate;try{if(8772&t.flags)switch(t.tag){case 0:case 11:case 15:Js||il(5,t);break;case 1:var i=t.stateNode;if(4&t.flags&&!Js)if(null===r)i.componentDidMount();else{var o=t.elementType===t.type?r.memoizedProps:rs(t.type,r.memoizedProps);i.componentDidUpdate(o,r.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var a=t.updateQueue;null!==a&&Go(t,a,i);break;case 3:var s=t.updateQueue;if(null!==s){if(r=null,null!==t.child)switch(t.child.tag){case 5:case 1:r=t.child.stateNode}Go(t,s,r)}break;case 5:var l=t.stateNode;if(null===r&&4&t.flags){r=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&r.focus();break;case"img":c.src&&(r.src=c.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===t.memoizedState){var u=t.alternate;if(null!==u){var d=u.memoizedState;if(null!==d){var h=d.dehydrated;null!==h&&Ht(h)}}}break;default:throw Error(n(163))}Js||512&t.flags&&ol(t)}catch(Pv){Ec(t,t.return,Pv)}}if(t===e){Qs=null;break}if(null!==(r=t.sibling)){r.return=t.return,Qs=r;break}Qs=t.return}}function wl(e){for(;null!==Qs;){var t=Qs;if(t===e){Qs=null;break}var n=t.sibling;if(null!==n){n.return=t.return,Qs=n;break}Qs=t.return}}function Sl(e){for(;null!==Qs;){var t=Qs;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{il(4,t)}catch(l){Ec(t,n,l)}break;case 1:var r=t.stateNode;if("function"==typeof r.componentDidMount){var i=t.return;try{r.componentDidMount()}catch(l){Ec(t,i,l)}}var o=t.return;try{ol(t)}catch(l){Ec(t,o,l)}break;case 5:var a=t.return;try{ol(t)}catch(l){Ec(t,a,l)}}}catch(l){Ec(t,t.return,l)}if(t===e){Qs=null;break}var s=t.sibling;if(null!==s){s.return=t.return,Qs=s;break}Qs=t.return}}var Ml,El=Math.ceil,Tl=_.ReactCurrentDispatcher,Al=_.ReactCurrentOwner,Cl=_.ReactCurrentBatchConfig,kl=0,Rl=null,Pl=null,Il=0,Ll=0,Nl=Ei(0),Ol=0,Dl=null,Ul=0,Fl=0,zl=0,Bl=null,Vl=null,jl=0,Hl=1/0,Wl=null,Gl=!1,Xl=null,ql=null,$l=!1,Yl=null,Zl=0,Jl=0,Kl=null,Ql=-1,ec=0;function tc(){return 6&kl?Ke():-1!==Ql?Ql:Ql=Ke()}function nc(e){return 1&e.mode?2&kl&&0!==Il?Il&-Il:null!==vo.transition?(0===ec&&(ec=gt()),ec):0!==(e=xt)?e:e=void 0===(e=window.event)?16:Jt(e.type):1}function rc(e,t,r,i){if(50<Jl)throw Jl=0,Kl=null,Error(n(185));yt(e,r,i),2&kl&&e===Rl||(e===Rl&&(!(2&kl)&&(Fl|=r),4===Ol&&lc(e,Il)),ic(e,i),1===r&&0===kl&&!(1&t.mode)&&(Hl=Ke()+500,Bi&&Hi()))}function ic(e,t){var n=e.callbackNode;!function(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,o=e.pendingLanes;0<o;){var a=31-st(o),s=1<<a,l=i[a];-1===l?0!==(s&n)&&0===(s&r)||(i[a]=ft(s,t)):l<=t&&(e.expiredLanes|=s),o&=~s}}(e,t);var r=pt(e,e===Rl?Il:0);if(0===r)null!==n&&Ye(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(null!=n&&Ye(n),1===t)0===e.tag?function(e){Bi=!0,ji(e)}(cc.bind(null,e)):ji(cc.bind(null,e)),si(function(){!(6&kl)&&Hi()}),n=null;else{switch(_t(r)){case 1:n=et;break;case 4:n=tt;break;case 16:default:n=nt;break;case 536870912:n=it}n=Rc(n,oc.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function oc(e,t){if(Ql=-1,ec=0,6&kl)throw Error(n(327));var r=e.callbackNode;if(Sc()&&e.callbackNode!==r)return null;var i=pt(e,e===Rl?Il:0);if(0===i)return null;if(30&i||0!==(i&e.expiredLanes)||t)t=vc(e,i);else{t=i;var o=kl;kl|=2;var a=mc();for(Rl===e&&Il===t||(Wl=null,Hl=Ke()+500,pc(e,t));;)try{bc();break}catch(l){fc(e,l)}Co(),Tl.current=a,kl=o,null!==Pl?t=0:(Rl=null,Il=0,t=Ol)}if(0!==t){if(2===t&&(0!==(o=mt(e))&&(i=o,t=ac(e,o))),1===t)throw r=Dl,pc(e,0),lc(e,i),ic(e,Ke()),r;if(6===t)lc(e,i);else{if(o=e.current.alternate,!(30&i||function(e){for(var t=e;;){if(16384&t.flags){var n=t.updateQueue;if(null!==n&&null!==(n=n.stores))for(var r=0;r<n.length;r++){var i=n[r],o=i.getSnapshot;i=i.value;try{if(!lr(o(),i))return!1}catch(s){return!1}}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(o)||(t=vc(e,i),2===t&&(a=mt(e),0!==a&&(i=a,t=ac(e,a))),1!==t)))throw r=Dl,pc(e,0),lc(e,i),ic(e,Ke()),r;switch(e.finishedWork=o,e.finishedLanes=i,t){case 0:case 1:throw Error(n(345));case 2:case 5:wc(e,Vl,Wl);break;case 3:if(lc(e,i),(130023424&i)===i&&10<(t=jl+500-Ke())){if(0!==pt(e,0))break;if(((o=e.suspendedLanes)&i)!==i){tc(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=ii(wc.bind(null,e,Vl,Wl),t);break}wc(e,Vl,Wl);break;case 4:if(lc(e,i),(4194240&i)===i)break;for(t=e.eventTimes,o=-1;0<i;){var s=31-st(i);a=1<<s,(s=t[s])>o&&(o=s),i&=~a}if(i=o,10<(i=(120>(i=Ke()-i)?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*El(i/1960))-i)){e.timeoutHandle=ii(wc.bind(null,e,Vl,Wl),i);break}wc(e,Vl,Wl);break;default:throw Error(n(329))}}}return ic(e,Ke()),e.callbackNode===r?oc.bind(null,e):null}function ac(e,t){var n=Bl;return e.current.memoizedState.isDehydrated&&(pc(e,t).flags|=256),2!==(e=vc(e,t))&&(t=Vl,Vl=n,null!==t&&sc(t)),e}function sc(e){null===Vl?Vl=e:Vl.push.apply(Vl,e)}function lc(e,t){for(t&=~zl,t&=~Fl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-st(t),r=1<<n;e[n]=-1,t&=~r}}function cc(e){if(6&kl)throw Error(n(327));Sc();var t=pt(e,0);if(!(1&t))return ic(e,Ke()),null;var r=vc(e,t);if(0!==e.tag&&2===r){var i=mt(e);0!==i&&(t=i,r=ac(e,i))}if(1===r)throw r=Dl,pc(e,0),lc(e,t),ic(e,Ke()),r;if(6===r)throw Error(n(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,wc(e,Vl,Wl),ic(e,Ke()),null}function uc(e,t){var n=kl;kl|=1;try{return e(t)}finally{0===(kl=n)&&(Hl=Ke()+500,Bi&&Hi())}}function dc(e){null!==Yl&&0===Yl.tag&&!(6&kl)&&Sc();var t=kl;kl|=1;var n=Cl.transition,r=xt;try{if(Cl.transition=null,xt=1,e)return e()}finally{xt=r,Cl.transition=n,!(6&(kl=t))&&Hi()}}function hc(){Ll=Nl.current,Ti(Nl)}function pc(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,oi(n)),null!==Pl)for(n=Pl.return;null!==n;){var r=n;switch(no(r),r.tag){case 1:null!=(r=r.type.childContextTypes)&&Ni();break;case 3:Ko(),Ti(Ri),Ti(ki),ia();break;case 5:ea(r);break;case 4:Ko();break;case 13:case 19:Ti(ta);break;case 10:ko(r.type._context);break;case 22:case 23:hc()}n=n.return}if(Rl=e,Pl=e=Nc(e.current,null),Il=Ll=t,Ol=0,Dl=null,zl=Fl=Ul=0,Vl=Bl=null,null!==Lo){for(t=0;t<Lo.length;t++)if(null!==(r=(n=Lo[t]).interleaved)){n.interleaved=null;var i=r.next,o=n.pending;if(null!==o){var a=o.next;o.next=i,r.next=a}n.pending=r}Lo=null}return e}function fc(e,t){for(;;){var r=Pl;try{if(Co(),oa.current=Qa,da){for(var i=la.memoizedState;null!==i;){var o=i.queue;null!==o&&(o.pending=null),i=i.next}da=!1}if(sa=0,ua=ca=la=null,ha=!1,pa=0,Al.current=null,null===r||null===r.return){Ol=1,Dl=t,Pl=null;break}e:{var a=e,s=r.return,l=r,c=t;if(t=Il,l.flags|=32768,null!==c&&"object"==typeof c&&"function"==typeof c.then){var u=c,d=l,h=d.tag;if(!(1&d.mode||0!==h&&11!==h&&15!==h)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var f=vs(s);if(null!==f){f.flags&=-257,ys(f,s,l,0,t),1&f.mode&&gs(a,u,t),c=u;var m=(t=f).updateQueue;if(null===m){var g=new Set;g.add(c),t.updateQueue=g}else m.add(c);break e}if(!(1&t)){gs(a,u,t),gc();break e}c=Error(n(426))}else if(oo&&1&l.mode){var v=vs(s);if(null!==v){!(65536&v.flags)&&(v.flags|=256),ys(v,s,l,0,t),go(us(c,l));break e}}a=c=us(c,l),4!==Ol&&(Ol=2),null===Bl?Bl=[a]:Bl.push(a),a=s;do{switch(a.tag){case 3:a.flags|=65536,t&=-t,a.lanes|=t,Ho(a,fs(0,c,t));break e;case 1:l=c;var y=a.type,b=a.stateNode;if(!(128&a.flags||"function"!=typeof y.getDerivedStateFromError&&(null===b||"function"!=typeof b.componentDidCatch||null!==ql&&ql.has(b)))){a.flags|=65536,t&=-t,a.lanes|=t,Ho(a,ms(a,l,t));break e}}a=a.return}while(null!==a)}_c(r)}catch(x){t=x,Pl===r&&null!==r&&(Pl=r=r.return);continue}break}}function mc(){var e=Tl.current;return Tl.current=Qa,null===e?Qa:e}function gc(){0!==Ol&&3!==Ol&&2!==Ol||(Ol=4),null===Rl||!(268435455&Ul)&&!(268435455&Fl)||lc(Rl,Il)}function vc(e,t){var r=kl;kl|=2;var i=mc();for(Rl===e&&Il===t||(Wl=null,pc(e,t));;)try{yc();break}catch(Dv){fc(e,Dv)}if(Co(),kl=r,Tl.current=i,null!==Pl)throw Error(n(261));return Rl=null,Il=0,Ol}function yc(){for(;null!==Pl;)xc(Pl)}function bc(){for(;null!==Pl&&!Ze();)xc(Pl)}function xc(e){var t=Ml(e.alternate,e,Ll);e.memoizedProps=e.pendingProps,null===t?_c(e):Pl=t,Al.current=null}function _c(e){var t=e;do{var n=t.alternate;if(e=t.return,32768&t.flags){if(null!==(n=Ys(n,t)))return n.flags&=32767,void(Pl=n);if(null===e)return Ol=6,void(Pl=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}else if(null!==(n=$s(n,t,Ll)))return void(Pl=n);if(null!==(t=t.sibling))return void(Pl=t);Pl=t=e}while(null!==t);0===Ol&&(Ol=5)}function wc(e,t,r){var i=xt,o=Cl.transition;try{Cl.transition=null,xt=1,function(e,t,r,i){do{Sc()}while(null!==Yl);if(6&kl)throw Error(n(327));r=e.finishedWork;var o=e.finishedLanes;if(null===r)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(n(177));e.callbackNode=null,e.callbackPriority=0;var a=r.lanes|r.childLanes;if(function(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-st(n),o=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~o}}(e,a),e===Rl&&(Pl=Rl=null,Il=0),!(2064&r.subtreeFlags)&&!(2064&r.flags)||$l||($l=!0,Rc(nt,function(){return Sc(),null})),a=!!(15990&r.flags),!!(15990&r.subtreeFlags)||a){a=Cl.transition,Cl.transition=null;var s=xt;xt=1;var l=kl;kl|=4,Al.current=null,function(e,t){if(ti=Gt,fr(e=pr())){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{var i=(r=(r=e.ownerDocument)&&r.defaultView||window).getSelection&&r.getSelection();if(i&&0!==i.rangeCount){r=i.anchorNode;var o=i.anchorOffset,a=i.focusNode;i=i.focusOffset;try{r.nodeType,a.nodeType}catch(_){r=null;break e}var s=0,l=-1,c=-1,u=0,d=0,h=e,p=null;t:for(;;){for(var f;h!==r||0!==o&&3!==h.nodeType||(l=s+o),h!==a||0!==i&&3!==h.nodeType||(c=s+i),3===h.nodeType&&(s+=h.nodeValue.length),null!==(f=h.firstChild);)p=h,h=f;for(;;){if(h===e)break t;if(p===r&&++u===o&&(l=s),p===a&&++d===i&&(c=s),null!==(f=h.nextSibling))break;p=(h=p).parentNode}h=f}r=-1===l||-1===c?null:{start:l,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(ni={focusedElem:e,selectionRange:r},Gt=!1,Qs=t;null!==Qs;)if(e=(t=Qs).child,1028&t.subtreeFlags&&null!==e)e.return=t,Qs=e;else for(;null!==Qs;){t=Qs;try{var m=t.alternate;if(1024&t.flags)switch(t.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==m){var g=m.memoizedProps,v=m.memoizedState,y=t.stateNode,b=y.getSnapshotBeforeUpdate(t.elementType===t.type?g:rs(t.type,g),v);y.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var x=t.stateNode.containerInfo;1===x.nodeType?x.textContent="":9===x.nodeType&&x.documentElement&&x.removeChild(x.documentElement);break;default:throw Error(n(163))}}catch(_){Ec(t,t.return,_)}if(null!==(e=t.sibling)){e.return=t.return,Qs=e;break}Qs=t.return}m=nl,nl=!1}(e,r),vl(r,e),mr(ni),Gt=!!ti,ni=ti=null,e.current=r,bl(r),Je(),kl=l,xt=s,Cl.transition=a}else e.current=r;if($l&&($l=!1,Yl=e,Zl=o),a=e.pendingLanes,0===a&&(ql=null),function(e){if(at&&"function"==typeof at.onCommitFiberRoot)try{at.onCommitFiberRoot(ot,e,void 0,!(128&~e.current.flags))}catch(t){}}(r.stateNode),ic(e,Ke()),null!==t)for(i=e.onRecoverableError,r=0;r<t.length;r++)o=t[r],i(o.value,{componentStack:o.stack,digest:o.digest});if(Gl)throw Gl=!1,e=Xl,Xl=null,e;!!(1&Zl)&&0!==e.tag&&Sc(),a=e.pendingLanes,1&a?e===Kl?Jl++:(Jl=0,Kl=e):Jl=0,Hi()}(e,t,r,i)}finally{Cl.transition=o,xt=i}return null}function Sc(){if(null!==Yl){var e=_t(Zl),t=Cl.transition,r=xt;try{if(Cl.transition=null,xt=16>e?16:e,null===Yl)var i=!1;else{if(e=Yl,Yl=null,Zl=0,6&kl)throw Error(n(331));var o=kl;for(kl|=4,Qs=e.current;null!==Qs;){var a=Qs,s=a.child;if(16&Qs.flags){var l=a.deletions;if(null!==l){for(var c=0;c<l.length;c++){var u=l[c];for(Qs=u;null!==Qs;){var d=Qs;switch(d.tag){case 0:case 11:case 15:rl(8,d,a)}var h=d.child;if(null!==h)h.return=d,Qs=h;else for(;null!==Qs;){var p=(d=Qs).sibling,f=d.return;if(al(d),d===u){Qs=null;break}if(null!==p){p.return=f,Qs=p;break}Qs=f}}}var m=a.alternate;if(null!==m){var g=m.child;if(null!==g){m.child=null;do{var v=g.sibling;g.sibling=null,g=v}while(null!==g)}}Qs=a}}if(2064&a.subtreeFlags&&null!==s)s.return=a,Qs=s;else e:for(;null!==Qs;){if(2048&(a=Qs).flags)switch(a.tag){case 0:case 11:case 15:rl(9,a,a.return)}var y=a.sibling;if(null!==y){y.return=a.return,Qs=y;break e}Qs=a.return}}var b=e.current;for(Qs=b;null!==Qs;){var x=(s=Qs).child;if(2064&s.subtreeFlags&&null!==x)x.return=s,Qs=x;else e:for(s=b;null!==Qs;){if(2048&(l=Qs).flags)try{switch(l.tag){case 0:case 11:case 15:il(9,l)}}catch(w){Ec(l,l.return,w)}if(l===s){Qs=null;break e}var _=l.sibling;if(null!==_){_.return=l.return,Qs=_;break e}Qs=l.return}}if(kl=o,Hi(),at&&"function"==typeof at.onPostCommitFiberRoot)try{at.onPostCommitFiberRoot(ot,e)}catch(w){}i=!0}return i}finally{xt=r,Cl.transition=t}}return!1}function Mc(e,t,n){e=Vo(e,t=fs(0,t=us(n,t),1),1),t=tc(),null!==e&&(yt(e,1,t),ic(e,t))}function Ec(e,t,n){if(3===e.tag)Mc(e,e,n);else for(;null!==t;){if(3===t.tag){Mc(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===ql||!ql.has(r))){t=Vo(t,e=ms(t,e=us(n,e),1),1),e=tc(),null!==t&&(yt(t,1,e),ic(t,e));break}}t=t.return}}function Tc(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),t=tc(),e.pingedLanes|=e.suspendedLanes&n,Rl===e&&(Il&n)===n&&(4===Ol||3===Ol&&(130023424&Il)===Il&&500>Ke()-jl?pc(e,0):zl|=n),ic(e,t)}function Ac(e,t){0===t&&(1&e.mode?(t=dt,!(130023424&(dt<<=1))&&(dt=4194304)):t=1);var n=tc();null!==(e=Do(e,t))&&(yt(e,t,n),ic(e,n))}function Cc(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),Ac(e,n)}function kc(e,t){var r=0;switch(e.tag){case 13:var i=e.stateNode,o=e.memoizedState;null!==o&&(r=o.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(n(314))}null!==i&&i.delete(t),Ac(e,r)}function Rc(e,t){return $e(e,t)}function Pc(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,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 Ic(e,t,n,r){return new Pc(e,t,n,r)}function Lc(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Nc(e,t){var n=e.alternate;return null===n?((n=Ic(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Oc(e,t,r,i,o,a){var s=2;if(i=e,"function"==typeof e)Lc(e)&&(s=1);else if("string"==typeof e)s=5;else e:switch(e){case M:return Dc(r.children,o,a,t);case E:s=8,o|=8;break;case T:return(e=Ic(12,r,t,2|o)).elementType=T,e.lanes=a,e;case R:return(e=Ic(13,r,t,o)).elementType=R,e.lanes=a,e;case P:return(e=Ic(19,r,t,o)).elementType=P,e.lanes=a,e;case N:return Uc(r,o,a,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case A:s=10;break e;case C:s=9;break e;case k:s=11;break e;case I:s=14;break e;case L:s=16,i=null;break e}throw Error(n(130,null==e?e:typeof e,""))}return(t=Ic(s,r,t,o)).elementType=e,t.type=i,t.lanes=a,t}function Dc(e,t,n,r){return(e=Ic(7,e,r,t)).lanes=n,e}function Uc(e,t,n,r){return(e=Ic(22,e,r,t)).elementType=N,e.lanes=n,e.stateNode={isHidden:!1},e}function Fc(e,t,n){return(e=Ic(6,e,null,t)).lanes=n,e}function zc(e,t,n){return(t=Ic(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Bc(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=vt(0),this.expirationTimes=vt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=vt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Vc(e,t,n,r,i,o,a,s,l){return e=new Bc(e,t,n,s,l),1===t?(t=1,!0===o&&(t|=8)):t=0,o=Ic(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Fo(o),e}function jc(e){if(!e)return Ci;e:{if(He(e=e._reactInternals)!==e||1!==e.tag)throw Error(n(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Li(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(n(171))}if(1===e.tag){var r=e.type;if(Li(r))return Di(e,r,t)}return t}function Hc(e,t,n,r,i,o,a,s,l){return(e=Vc(n,r,!0,e,0,o,0,s,l)).context=jc(null),n=e.current,(o=Bo(r=tc(),i=nc(n))).callback=null!=t?t:null,Vo(n,o,i),e.current.lanes=i,yt(e,i,r),ic(e,r),e}function Wc(e,t,n,r){var i=t.current,o=tc(),a=nc(i);return n=jc(n),null===t.context?t.context=n:t.pendingContext=n,(t=Bo(o,a)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),null!==(e=Vo(i,t,a))&&(rc(e,i,a,o),jo(e,i,a)),a}function Gc(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function Xc(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function qc(e,t){Xc(e,t),(e=e.alternate)&&Xc(e,t)}Ml=function(e,t,r){if(null!==e)if(e.memoizedProps!==t.pendingProps||Ri.current)xs=!0;else{if(0===(e.lanes&r)&&!(128&t.flags))return xs=!1,function(e,t,n){switch(t.tag){case 3:Rs(t),mo();break;case 5:Qo(t);break;case 1:Li(t.type)&&Ui(t);break;case 4:Jo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Ai(Mo,r._currentValue),r._currentValue=i;break;case 13:if(null!==(r=t.memoizedState))return null!==r.dehydrated?(Ai(ta,1&ta.current),t.flags|=128,null):0!==(n&t.child.childLanes)?Fs(e,t,n):(Ai(ta,1&ta.current),null!==(e=Gs(e,t,n))?e.sibling:null);Ai(ta,1&ta.current);break;case 19:if(r=0!==(n&t.childLanes),128&e.flags){if(r)return Hs(e,t,n);t.flags|=128}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ai(ta,ta.current),r)break;return null;case 22:case 23:return t.lanes=0,Es(e,t,n)}return Gs(e,t,n)}(e,t,r);xs=!!(131072&e.flags)}else xs=!1,oo&&1048576&t.flags&&eo(t,qi,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;Ws(e,t),e=t.pendingProps;var o=Ii(t,ki.current);Po(t,r),o=va(null,t,i,e,o,r);var a=ya();return t.flags|=1,"object"==typeof o&&null!==o&&"function"==typeof o.render&&void 0===o.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Li(i)?(a=!0,Ui(t)):a=!1,t.memoizedState=null!==o.state&&void 0!==o.state?o.state:null,Fo(t),o.updater=os,t.stateNode=o,o._reactInternals=t,cs(t,i,e,r),t=ks(null,t,i,!0,a,r)):(t.tag=0,oo&&a&&to(t),_s(null,t,o,r),t=t.child),t;case 16:i=t.elementType;e:{switch(Ws(e,t),e=t.pendingProps,i=(o=i._init)(i._payload),t.type=i,o=t.tag=function(e){if("function"==typeof e)return Lc(e)?1:0;if(null!=e){if((e=e.$$typeof)===k)return 11;if(e===I)return 14}return 2}(i),e=rs(i,e),o){case 0:t=As(null,t,i,e,r);break e;case 1:t=Cs(null,t,i,e,r);break e;case 11:t=ws(null,t,i,e,r);break e;case 14:t=Ss(null,t,i,rs(i.type,e),r);break e}throw Error(n(306,i,""))}return t;case 0:return i=t.type,o=t.pendingProps,As(e,t,i,o=t.elementType===i?o:rs(i,o),r);case 1:return i=t.type,o=t.pendingProps,Cs(e,t,i,o=t.elementType===i?o:rs(i,o),r);case 3:e:{if(Rs(t),null===e)throw Error(n(387));i=t.pendingProps,o=(a=t.memoizedState).element,zo(e,t),Wo(t,i,null,r);var s=t.memoizedState;if(i=s.element,a.isDehydrated){if(a={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=a,t.memoizedState=a,256&t.flags){t=Ps(e,t,i,r,o=us(Error(n(423)),t));break e}if(i!==o){t=Ps(e,t,i,r,o=us(Error(n(424)),t));break e}for(io=ui(t.stateNode.containerInfo.firstChild),ro=t,oo=!0,ao=null,r=So(t,null,i,r),t.child=r;r;)r.flags=-3&r.flags|4096,r=r.sibling}else{if(mo(),i===o){t=Gs(e,t,r);break e}_s(e,t,i,r)}t=t.child}return t;case 5:return Qo(t),null===e&&uo(t),i=t.type,o=t.pendingProps,a=null!==e?e.memoizedProps:null,s=o.children,ri(i,o)?s=null:null!==a&&ri(i,a)&&(t.flags|=32),Ts(e,t),_s(e,t,s,r),t.child;case 6:return null===e&&uo(t),null;case 13:return Fs(e,t,r);case 4:return Jo(t,t.stateNode.containerInfo),i=t.pendingProps,null===e?t.child=wo(t,null,i,r):_s(e,t,i,r),t.child;case 11:return i=t.type,o=t.pendingProps,ws(e,t,i,o=t.elementType===i?o:rs(i,o),r);case 7:return _s(e,t,t.pendingProps,r),t.child;case 8:case 12:return _s(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(i=t.type._context,o=t.pendingProps,a=t.memoizedProps,s=o.value,Ai(Mo,i._currentValue),i._currentValue=s,null!==a)if(lr(a.value,s)){if(a.children===o.children&&!Ri.current){t=Gs(e,t,r);break e}}else for(null!==(a=t.child)&&(a.return=t);null!==a;){var l=a.dependencies;if(null!==l){s=a.child;for(var c=l.firstContext;null!==c;){if(c.context===i){if(1===a.tag){(c=Bo(-1,r&-r)).tag=2;var u=a.updateQueue;if(null!==u){var d=(u=u.shared).pending;null===d?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}a.lanes|=r,null!==(c=a.alternate)&&(c.lanes|=r),Ro(a.return,r,t),l.lanes|=r;break}c=c.next}}else if(10===a.tag)s=a.type===t.type?null:a.child;else if(18===a.tag){if(null===(s=a.return))throw Error(n(341));s.lanes|=r,null!==(l=s.alternate)&&(l.lanes|=r),Ro(s,r,t),s=a.sibling}else s=a.child;if(null!==s)s.return=a;else for(s=a;null!==s;){if(s===t){s=null;break}if(null!==(a=s.sibling)){a.return=s.return,s=a;break}s=s.return}a=s}_s(e,t,o.children,r),t=t.child}return t;case 9:return o=t.type,i=t.pendingProps.children,Po(t,r),i=i(o=Io(o)),t.flags|=1,_s(e,t,i,r),t.child;case 14:return o=rs(i=t.type,t.pendingProps),Ss(e,t,i,o=rs(i.type,o),r);case 15:return Ms(e,t,t.type,t.pendingProps,r);case 17:return i=t.type,o=t.pendingProps,o=t.elementType===i?o:rs(i,o),Ws(e,t),t.tag=1,Li(i)?(e=!0,Ui(t)):e=!1,Po(t,r),ss(t,i,o),cs(t,i,o,r),ks(null,t,i,!0,e,r);case 19:return Hs(e,t,r);case 22:return Es(e,t,r)}throw Error(n(156,t.tag))};var $c="function"==typeof reportError?reportError:function(e){console.error(e)};function Yc(e){this._internalRoot=e}function Zc(e){this._internalRoot=e}function Jc(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function Kc(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function Qc(){}function eu(e,t,n,r,i){var o=n._reactRootContainer;if(o){var a=o;if("function"==typeof i){var s=i;i=function(){var e=Gc(a);s.call(e)}}Wc(t,a,e,i)}else a=function(e,t,n,r,i){if(i){if("function"==typeof r){var o=r;r=function(){var e=Gc(a);o.call(e)}}var a=Hc(t,r,e,0,null,!1,0,"",Qc);return e._reactRootContainer=a,e[mi]=a.current,Hr(8===e.nodeType?e.parentNode:e),dc(),a}for(;i=e.lastChild;)e.removeChild(i);if("function"==typeof r){var s=r;r=function(){var e=Gc(l);s.call(e)}}var l=Vc(e,0,!1,null,0,!1,0,"",Qc);return e._reactRootContainer=l,e[mi]=l.current,Hr(8===e.nodeType?e.parentNode:e),dc(function(){Wc(t,l,n,r)}),l}(n,t,e,i,r);return Gc(a)}Zc.prototype.render=Yc.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(n(409));Wc(e,t,null,null)},Zc.prototype.unmount=Yc.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;dc(function(){Wc(null,e,null,null)}),t[mi]=null}},Zc.prototype.unstable_scheduleHydration=function(e){if(e){var t=Et();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Nt.length&&0!==t&&t<Nt[n].priority;n++);Nt.splice(n,0,e),0===n&&Ft(e)}},wt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=ht(t.pendingLanes);0!==n&&(bt(t,1|n),ic(t,Ke()),!(6&kl)&&(Hl=Ke()+500,Hi()))}break;case 13:dc(function(){var t=Do(e,1);if(null!==t){var n=tc();rc(t,e,1,n)}}),qc(e,1)}},St=function(e){if(13===e.tag){var t=Do(e,134217728);if(null!==t)rc(t,e,134217728,tc());qc(e,134217728)}},Mt=function(e){if(13===e.tag){var t=nc(e),n=Do(e,t);if(null!==n)rc(n,e,t,tc());qc(e,t)}},Et=function(){return xt},Tt=function(e,t){var n=xt;try{return xt=e,t()}finally{xt=n}},Se=function(e,t,r){switch(t){case"input":if(Q(e,r),t=r.name,"radio"===r.type&&null!=t){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var i=r[t];if(i!==e&&i.form===e.form){var o=wi(i);if(!o)throw Error(n(90));$(i),Q(i,o)}}}break;case"textarea":ae(e,r);break;case"select":null!=(t=r.value)&&re(e,!!r.multiple,t,!1)}},ke=uc,Re=dc;var tu={usingClientEntryPoint:!1,Events:[xi,_i,wi,Ae,Ce,uc]},nu={findFiberByHostInstance:bi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},ru={bundleType:nu.bundleType,version:nu.version,rendererPackageName:nu.rendererPackageName,rendererConfig:nu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:_.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=Xe(e))?null:e.stateNode},findFiberByHostInstance:nu.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var iu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!iu.isDisabled&&iu.supportsFiber)try{ot=iu.inject(ru),at=iu}catch(de){}}return a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=tu,a.createPortal=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!Jc(t))throw Error(n(200));return function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:S,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,r)},a.createRoot=function(e,t){if(!Jc(e))throw Error(n(299));var r=!1,i="",o=$c;return null!=t&&(!0===t.unstable_strictMode&&(r=!0),void 0!==t.identifierPrefix&&(i=t.identifierPrefix),void 0!==t.onRecoverableError&&(o=t.onRecoverableError)),t=Vc(e,1,!1,null,0,r,0,i,o),e[mi]=t.current,Hr(8===e.nodeType?e.parentNode:e),new Yc(t)},a.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(n(188));throw e=Object.keys(e).join(","),Error(n(268,e))}return e=null===(e=Xe(t))?null:e.stateNode},a.flushSync=function(e){return dc(e)},a.hydrate=function(e,t,r){if(!Kc(t))throw Error(n(200));return eu(null,e,t,!0,r)},a.hydrateRoot=function(e,t,r){if(!Jc(e))throw Error(n(405));var i=null!=r&&r.hydratedSources||null,o=!1,a="",s=$c;if(null!=r&&(!0===r.unstable_strictMode&&(o=!0),void 0!==r.identifierPrefix&&(a=r.identifierPrefix),void 0!==r.onRecoverableError&&(s=r.onRecoverableError)),t=Hc(t,null,e,1,null!=r?r:null,o,0,a,s),e[mi]=t.current,Hr(e),i)for(e=0;e<i.length;e++)o=(o=(r=i[e])._getVersion)(r._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[r,o]:t.mutableSourceEagerHydrationData.push(r,o);return new Zc(t)},a.render=function(e,t,r){if(!Kc(t))throw Error(n(200));return eu(null,e,t,!1,r)},a.unmountComponentAtNode=function(e){if(!Kc(e))throw Error(n(40));return!!e._reactRootContainer&&(dc(function(){eu(null,null,e,!1,function(){e._reactRootContainer=null,e[mi]=null})}),!0)},a.unstable_batchedUpdates=uc,a.unstable_renderSubtreeIntoContainer=function(e,t,r,i){if(!Kc(r))throw Error(n(200));if(null==e||void 0===e._reactInternals)throw Error(n(38));return eu(e,t,r,!1,i)},a.version="18.3.1-next-f1338f8080-20240426",a}function x(){if(f)return o.exports;return f=1,function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),o.exports=b(),o.exports}var _=function(){if(m)return i;m=1;var e=x();return i.createRoot=e.createRoot,i.hydrateRoot=e.hydrateRoot,i}(),w=u();const S=t(w);var M,E,T={exports:{}},A={};var C=(E||(E=1,T.exports=function(){if(M)return A;M=1;var e=u(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function a(e,n,a){var s,l={},c=null,u=null;for(s in void 0!==a&&(c=""+a),void 0!==n.key&&(c=""+n.key),void 0!==n.ref&&(u=n.ref),n)r.call(n,s)&&!o.hasOwnProperty(s)&&(l[s]=n[s]);if(e&&e.defaultProps)for(s in n=e.defaultProps)void 0===l[s]&&(l[s]=n[s]);return{$$typeof:t,type:e,key:c,ref:u,props:l,_owner:i.current}}return A.Fragment=n,A.jsx=a,A.jsxs=a,A}()),T.exports);const k={es:{online:"En línea",offline:"Desconectado",connecting:"Conectando...",con_amor_paseo_libre:"Con ❤️ por BotUyo",preview:"Vista previa",fotos:"Fotos",ubicacion:"Ubicación",input_placeholder:"Escribe un mensaje...",send:"Enviar",attach_photo:"Adjuntar foto",attach_location:"Compartir ubicación",recording:"Grabando...",rate_limit_exceeded:"Has enviado demasiados mensajes. Espera un momento.",connection_error:"Error de conexión",file_too_large:"Archivo demasiado grande",invalid_file:"Tipo de archivo no válido",extracted:{assistant:"Asistente",anterior:"Anterior",siguiente:"Siguiente",cerrar:"Cerrar",cerrar_chat:"Cerrar chat",abrir_chat:"Abrir chat",ver_ubicacion:"Ver ubicación"},accessibility:{closeChat:"Cerrar ventana de chat",closeChatHint:"Presiona Escape para cerrar",chatMessages:"Mensajes del chat",messageHistory:"Historial de mensajes",dialogDescription:"Ventana de chat con {{botName}}. Presiona Escape para cerrar. Usa Ctrl+Enter para enviar mensajes.",sendMessage:"Enviar mensaje",sendMessageHint:"Presiona Enter o Ctrl+Enter para enviar",typeMessage:"Escribe tu mensaje aquí",botMessage:"Mensaje del asistente",userMessage:"Tu mensaje",messageFrom:"Mensaje de {{sender}}",messageTime:"Enviado {{time}}",newMessage:"Nuevo mensaje recibido"}},en:{online:"Online",offline:"Offline",connecting:"Connecting...",con_amor_paseo_libre:"With ❤️ by BotUyo",preview:"Preview",fotos:"Photos",ubicacion:"Location",input_placeholder:"Type a message...",send:"Send",attach_photo:"Attach photo",attach_location:"Share location",recording:"Recording...",rate_limit_exceeded:"You have sent too many messages. Please wait.",connection_error:"Connection error",file_too_large:"File too large",invalid_file:"Invalid file type",extracted:{assistant:"Assistant",anterior:"Previous",siguiente:"Next",cerrar:"Close",cerrar_chat:"Close chat",abrir_chat:"Open chat",ver_ubicacion:"View location"},accessibility:{closeChat:"Close chat window",closeChatHint:"Press Escape to close",chatMessages:"Chat messages",messageHistory:"Message history",dialogDescription:"Chat window with {{botName}}. Press Escape to close. Use Ctrl+Enter to send messages.",sendMessage:"Send message",sendMessageHint:"Press Enter or Ctrl+Enter to send",typeMessage:"Type your message here",botMessage:"Assistant message",userMessage:"Your message",messageFrom:"Message from {{sender}}",messageTime:"Sent {{time}}",newMessage:"New message received"}},pt:{online:"Online",offline:"Desconectado",connecting:"Conectando...",con_amor_paseo_libre:"Com ❤️ por BotUyo",preview:"Visualizar",fotos:"Fotos",ubicacion:"Localização",input_placeholder:"Digite uma mensagem...",send:"Enviar",attach_photo:"Anexar foto",attach_location:"Compartilhar localização",recording:"Gravando...",rate_limit_exceeded:"Você enviou muitas mensagens. Aguarde um momento.",connection_error:"Erro de conexão",file_too_large:"Arquivo muito grande",invalid_file:"Tipo de arquivo inválido",extracted:{assistant:"Assistente",anterior:"Anterior",siguiente:"Próximo",cerrar:"Fechar",cerrar_chat:"Fechar chat",abrir_chat:"Abrir chat",ver_ubicacion:"Ver localização"},accessibility:{closeChat:"Fechar janela de chat",closeChatHint:"Pressione Escape para fechar",chatMessages:"Mensagens do chat",messageHistory:"Histórico de mensagens",dialogDescription:"Janela de chat com {{botName}}. Pressione Escape para fechar. Use Ctrl+Enter para enviar mensagens.",sendMessage:"Enviar mensagem",sendMessageHint:"Pressione Enter ou Ctrl+Enter para enviar",typeMessage:"Digite sua mensagem aqui",botMessage:"Mensagem do assistente",userMessage:"Sua mensagem",messageFrom:"Mensagem de {{sender}}",messageTime:"Enviado {{time}}",newMessage:"Nova mensagem recebida"}},fr:{online:"En ligne",offline:"Déconnecté",connecting:"Connexion...",con_amor_paseo_libre:"Avec ❤️ par BotUyo",preview:"Aperçu",fotos:"Photos",ubicacion:"Emplacement",input_placeholder:"Tapez un message...",send:"Envoyer",attach_photo:"Joindre une photo",attach_location:"Partager la localisation",recording:"Enregistrement...",rate_limit_exceeded:"Vous avez envoyé trop de messages. Veuillez patienter.",connection_error:"Erreur de connexion",file_too_large:"Fichier trop volumineux",invalid_file:"Type de fichier invalide",extracted:{assistant:"Assistant",anterior:"Précédent",siguiente:"Suivant",cerrar:"Fermer",cerrar_chat:"Fermer le chat",abrir_chat:"Ouvrir le chat",ver_ubicacion:"Voir l'emplacement"},accessibility:{closeChat:"Fermer la fenêtre de chat",closeChatHint:"Appuyez sur Échap pour fermer",chatMessages:"Messages du chat",messageHistory:"Historique des messages",dialogDescription:"Fenêtre de chat avec {{botName}}. Appuyez sur Échap pour fermer. Utilisez Ctrl+Entrée pour envoyer des messages.",sendMessage:"Envoyer un message",sendMessageHint:"Appuyez sur Entrée ou Ctrl+Entrée pour envoyer",typeMessage:"Tapez votre message ici",botMessage:"Message de l'assistant",userMessage:"Votre message",messageFrom:"Message de {{sender}}",messageTime:"Envoyé {{time}}",newMessage:"Nouveau message reçu"}}};function R(){if("undefined"==typeof navigator)return"es";const e=navigator.language.split("-")[0];return k[e]?e:"es"}const P={locale:R(),setLocale:()=>{}},I=w.createContext(P),L="botuyo-chat-locale";function N({children:e,defaultLocale:t}){const[n,r]=w.useState(()=>{if(t)return t;if("undefined"!=typeof window){const e=localStorage.getItem(L);if(e)return e}return R()});return w.useEffect(()=>{if("undefined"==typeof window||t)return;const e=()=>{localStorage.getItem(L)||r(R())};return window.addEventListener("languagechange",e),()=>window.removeEventListener("languagechange",e)},[t]),C.jsx(I.Provider,{value:{locale:n,setLocale:e=>{["es","en","pt","fr"].includes(e)?(r(e),"undefined"!=typeof window&&localStorage.setItem(L,e)):console.warn(`[BotUyo] Locale "${e}" no es soportado. Manteniendo "${n}"`)}},children:e})}function O(){return w.useContext(I)??P}const D='@layer properties{@supports ((-webkit-hyphens:none) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:host,:root{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-900:oklch(39.6% .141 25.723);--color-amber-500:oklch(76.9% .188 70.08);--color-yellow-50:oklch(98.7% .026 102.212);--color-yellow-200:oklch(94.5% .129 101.54);--color-yellow-300:oklch(90.5% .182 98.111);--color-yellow-700:oklch(55.4% .135 66.442);--color-yellow-800:oklch(47.6% .114 61.907);--color-yellow-900:oklch(42.1% .095 57.708);--color-green-50:oklch(98.2% .018 155.826);--color-green-200:oklch(92.5% .084 155.995);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-green-900:oklch(39.3% .095 152.535);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-800:oklch(43.2% .095 166.913);--color-emerald-900:oklch(37.8% .077 168.94);--color-emerald-950:oklch(26.2% .051 172.552);--color-teal-500:oklch(70.4% .14 182.503);--color-teal-600:oklch(60% .118 184.704);--color-blue-50:oklch(97% .014 254.604);--color-blue-200:oklch(88.2% .059 254.128);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-900:oklch(37.9% .146 265.522);--color-purple-500:oklch(62.7% .265 303.9);--color-purple-600:oklch(55.8% .288 302.321);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-2xl:42rem;--text-xs:.75rem;--text-xs--line-height:1.33333;--text-sm:.875rem;--text-sm--line-height:1.42857;--text-base:1rem;--text-base--line-height:1.5;--text-lg:1.125rem;--text-lg--line-height:1.55556;--text-xl:1.25rem;--text-xl--line-height:1.4;--text-2xl:1.5rem;--text-2xl--line-height:1.33333;--text-3xl:1.875rem;--text-3xl--line-height:1.2;--text-4xl:2.25rem;--text-4xl--line-height:1.11111;--text-6xl:3.75rem;--text-6xl--line-height:1;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-black:900;--tracking-tighter:-.05em;--tracking-tight:-.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-tight:1.25;--leading-relaxed:1.625;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--shadow-lg:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;--ease-out:cubic-bezier(0,0,.2,1);--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0,0,.2,1)infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--animate-bounce:bounce 1s infinite;--blur-sm:8px;--blur-md:12px;--blur-2xl:40px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,::backdrop,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}::file-selector-button{border:0 solid;box-sizing:border-box;margin:0;padding:0}:host,html{-webkit-text-size-adjust:100%;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}button,input,optgroup,select,textarea{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}::file-selector-button{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::-moz-placeholder{opacity:1}::placeholder{opacity:1}@supports (not (-webkit-appearance:-apple-pay-button)) or (contain-intrinsic-size:1px){::-moz-placeholder{color:currentColor}::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::-moz-placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{border-width:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.not-sr-only{clip-path:none;height:auto;margin:0;overflow:visible;padding:0;position:static;white-space:normal;width:auto}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-1{top:calc(var(--spacing)*-1)}.-top-1\\.5{top:calc(var(--spacing)*-1.5)}.top-0{top:calc(var(--spacing)*0)}.top-1{top:calc(var(--spacing)*1)}.top-1\\/2{top:50%}.top-2{top:calc(var(--spacing)*2)}.top-3{top:calc(var(--spacing)*3)}.top-4{top:calc(var(--spacing)*4)}.top-full{top:100%}.-right-0{right:calc(var(--spacing)*0)}.-right-0\\.5{right:calc(var(--spacing)*-.5)}.-right-1{right:calc(var(--spacing)*-1)}.-right-1\\.5{right:calc(var(--spacing)*-1.5)}.right-0{right:calc(var(--spacing)*0)}.right-2{right:calc(var(--spacing)*2)}.right-3{right:calc(var(--spacing)*3)}.right-4{right:calc(var(--spacing)*4)}.right-6{right:calc(var(--spacing)*6)}.-bottom-0{bottom:calc(var(--spacing)*0)}.-bottom-0\\.5{bottom:calc(var(--spacing)*-.5)}.-bottom-1{bottom:calc(var(--spacing)*-1)}.bottom-3{bottom:calc(var(--spacing)*3)}.bottom-4{bottom:calc(var(--spacing)*4)}.bottom-full{bottom:100%}.left-0{left:calc(var(--spacing)*0)}.left-1{left:calc(var(--spacing)*1)}.left-1\\/2{left:50%}.left-4{left:calc(var(--spacing)*4)}.left-6{left:calc(var(--spacing)*6)}.isolate{isolation:isolate}.isolation-auto{isolation:auto}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\\[60\\]{z-index:60}.z-\\[9999\\]{z-index:9999}.z-\\[100000\\]{z-index:100000}.float-left{float:left}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.m-0{margin:calc(var(--spacing)*0)}.m-1{margin:calc(var(--spacing)*1)}.m-2{margin:calc(var(--spacing)*2)}.m-3{margin:calc(var(--spacing)*3)}.m-4{margin:calc(var(--spacing)*4)}.m-5{margin:calc(var(--spacing)*5)}.mx-1{margin-inline:calc(var(--spacing)*1)}.mx-2{margin-inline:calc(var(--spacing)*2)}.mx-3{margin-inline:calc(var(--spacing)*3)}.mx-4{margin-inline:calc(var(--spacing)*4)}.mx-5{margin-inline:calc(var(--spacing)*5)}.mx-auto{margin-inline:auto}.my-1{margin-block:calc(var(--spacing)*1)}.my-2{margin-block:calc(var(--spacing)*2)}.my-3{margin-block:calc(var(--spacing)*3)}.my-4{margin-block:calc(var(--spacing)*4)}.my-5{margin-block:calc(var(--spacing)*5)}.my-8{margin-block:calc(var(--spacing)*8)}.mt-0{margin-top:calc(var(--spacing)*0)}.mt-0\\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-1\\.5{margin-top:calc(var(--spacing)*1.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-5{margin-top:calc(var(--spacing)*5)}.mt-6{margin-top:calc(var(--spacing)*6)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-2{margin-right:calc(var(--spacing)*2)}.mr-3{margin-right:calc(var(--spacing)*3)}.mr-4{margin-right:calc(var(--spacing)*4)}.mr-5{margin-right:calc(var(--spacing)*5)}.mr-auto{margin-right:auto}.mb-0{margin-bottom:calc(var(--spacing)*0)}.mb-0\\.5{margin-bottom:calc(var(--spacing)*.5)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.mb-12{margin-bottom:calc(var(--spacing)*12)}.ml-0{margin-left:calc(var(--spacing)*0)}.ml-0\\.5{margin-left:calc(var(--spacing)*.5)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-3{margin-left:calc(var(--spacing)*3)}.ml-4{margin-left:calc(var(--spacing)*4)}.ml-5{margin-left:calc(var(--spacing)*5)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.inline-table{display:inline-table}.list-item{display:list-item}.table{display:table}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-column{display:table-column}.table-column-group{display:table-column-group}.table-footer-group{display:table-footer-group}.table-header-group{display:table-header-group}.table-row{display:table-row}.table-row-group{display:table-row-group}.h-0{height:calc(var(--spacing)*0)}.h-1{height:calc(var(--spacing)*1)}.h-2{height:calc(var(--spacing)*2)}.h-2\\.5{height:calc(var(--spacing)*2.5)}.h-3{height:calc(var(--spacing)*3)}.h-3\\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-14{height:calc(var(--spacing)*14)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-32{height:calc(var(--spacing)*32)}.h-48{height:calc(var(--spacing)*48)}.h-56{height:calc(var(--spacing)*56)}.h-\\[44px\\]{height:44px}.h-auto{height:auto}.h-full{height:100%}.max-h-\\[90vh\\]{max-height:90vh}.max-h-\\[120px\\]{max-height:120px}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-\\[40px\\]{min-height:40px}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-0{width:calc(var(--spacing)*0)}.w-1{width:calc(var(--spacing)*1)}.w-2{width:calc(var(--spacing)*2)}.w-2\\.5{width:calc(var(--spacing)*2.5)}.w-3{width:calc(var(--spacing)*3)}.w-3\\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-14{width:calc(var(--spacing)*14)}.w-16{width:calc(var(--spacing)*16)}.w-20{width:calc(var(--spacing)*20)}.w-24{width:calc(var(--spacing)*24)}.w-\\[3px\\]{width:3px}.w-\\[350px\\]{width:350px}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.max-w-0{max-width:calc(var(--spacing)*0)}.max-w-2xl{max-width:var(--container-2xl)}.max-w-\\[60px\\]{max-width:60px}.max-w-\\[85\\%\\]{max-width:85%}.max-w-\\[90\\%\\]{max-width:90%}.max-w-\\[320px\\]{max-width:320px}.max-w-\\[350px\\]{max-width:350px}.max-w-full{max-width:100%}.max-w-md{max-width:var(--container-md)}.max-w-none{max-width:none}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-\\[200px\\]{min-width:200px}.min-w-\\[350px\\]{min-width:350px}.flex-1{flex:1}.flex-none{flex:none}.flex-shrink{flex-shrink:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.border-collapse{border-collapse:collapse}.origin-bottom{transform-origin:bottom}.origin-bottom-left{transform-origin:0 100%}.origin-bottom-right{transform-origin:100% 100%}.-translate-x-1{--tw-translate-x:calc(var(--spacing)*-1)}.-translate-x-1,.-translate-x-1\\/2{translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-x-1\\/2{--tw-translate-x:-50%}.-translate-x-4{--tw-translate-x:calc(var(--spacing)*-4)}.-translate-x-4,.-translate-x-6{translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-x-6{--tw-translate-x:calc(var(--spacing)*-6)}.translate-x-0{--tw-translate-x:calc(var(--spacing)*0)}.translate-x-0,.translate-x-4{translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-4{--tw-translate-x:calc(var(--spacing)*4)}.translate-x-6{--tw-translate-x:calc(var(--spacing)*6)}.-translate-y-1,.translate-x-6{translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1{--tw-translate-y:calc(var(--spacing)*-1)}.-translate-y-1\\/2{--tw-translate-y:-50%}.-translate-y-1\\/2,.translate-y-0{translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-0{--tw-translate-y:calc(var(--spacing)*0)}.translate-y-2{--tw-translate-y:calc(var(--spacing)*2)}.translate-y-2,.translate-y-8{translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-8{--tw-translate-y:calc(var(--spacing)*8)}.translate-y-full{--tw-translate-y:100%;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-none{translate:none}.scale-50{--tw-scale-x:50%;--tw-scale-y:50%;--tw-scale-z:50%}.scale-50,.scale-90{scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-90{--tw-scale-x:90%;--tw-scale-y:90%;--tw-scale-z:90%}.scale-95{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%}.scale-100,.scale-95{scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-100{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%}.scale-105{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%}.scale-105,.scale-110{scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-110{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%}.scale-3d{scale:var(--tw-scale-x)var(--tw-scale-y)var(--tw-scale-z)}.scale-\\[0\\.85\\]{scale:.85}.-rotate-90{rotate:-90deg}.rotate-0{rotate:none}.rotate-45{rotate:45deg}.rotate-90{rotate:90deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-bounce{animation:var(--animate-bounce)}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-wait{cursor:wait}.touch-pinch-zoom{--tw-pinch-zoom:pinch-zoom;touch-action:var(--tw-pan-x,)var(--tw-pan-y,)var(--tw-pinch-zoom,)}.resize{resize:both}.resize-none{resize:none}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-2\\.5{gap:calc(var(--spacing)*2.5)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}.gap-\\[2px\\]{gap:2px}.gap-\\[3px\\]{gap:3px}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-end:calc(var(--spacing)*1*(1 - var(--tw-space-y-reverse)));margin-block-start:calc(var(--spacing)*1*var(--tw-space-y-reverse))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-end:calc(var(--spacing)*2*(1 - var(--tw-space-y-reverse)));margin-block-start:calc(var(--spacing)*2*var(--tw-space-y-reverse))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-end:calc(var(--spacing)*3*(1 - var(--tw-space-y-reverse)));margin-block-start:calc(var(--spacing)*3*var(--tw-space-y-reverse))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-end:calc(var(--spacing)*4*(1 - var(--tw-space-y-reverse)));margin-block-start:calc(var(--spacing)*4*var(--tw-space-y-reverse))}:where(.space-y-reverse>:not(:last-child)){--tw-space-y-reverse:1}:where(.space-x-reverse>:not(:last-child)){--tw-space-x-reverse:1}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-end-width:calc(1px*(1 - var(--tw-divide-x-reverse)));border-inline-start-width:calc(1px*var(--tw-divide-x-reverse));border-inline-style:var(--tw-border-style)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-bottom-width:calc(1px*(1 - var(--tw-divide-y-reverse)));border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse))}:where(.divide-y-reverse>:not(:last-child)){--tw-divide-y-reverse:1}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.scroll-smooth{scroll-behavior:smooth}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-3xl{border-radius:var(--radius-3xl)}.rounded-\\[18px\\]{border-radius:18px}.rounded-\\[24px\\]{border-radius:24px}.rounded-\\[28px\\]{border-radius:28px}.rounded-\\[32px\\]{border-radius:32px}.rounded-full{border-radius:3.40282e+38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-none{border-radius:0}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s{border-end-start-radius:.25rem}.rounded-s,.rounded-ss{border-start-start-radius:.25rem}.rounded-e{border-end-end-radius:.25rem}.rounded-e,.rounded-se{border-start-end-radius:.25rem}.rounded-ee{border-end-end-radius:.25rem}.rounded-es{border-end-start-radius:.25rem}.rounded-t{border-top-right-radius:.25rem}.rounded-l,.rounded-t{border-top-left-radius:.25rem}.rounded-l{border-bottom-left-radius:.25rem}.rounded-l-\\[4px\\]{border-bottom-left-radius:4px;border-top-left-radius:4px}.rounded-tl{border-top-left-radius:.25rem}.rounded-tl-\\[4px\\]{border-top-left-radius:4px}.rounded-r{border-bottom-right-radius:.25rem;border-top-right-radius:.25rem}.rounded-r-\\[4px\\]{border-bottom-right-radius:4px;border-top-right-radius:4px}.rounded-tr{border-top-right-radius:.25rem}.rounded-tr-\\[4px\\]{border-top-right-radius:4px}.rounded-b{border-bottom-left-radius:.25rem}.rounded-b,.rounded-br{border-bottom-right-radius:.25rem}.rounded-br-\\[4px\\]{border-bottom-right-radius:4px}.rounded-bl{border-bottom-left-radius:.25rem}.rounded-bl-\\[4px\\]{border-bottom-left-radius:4px}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-\\[hsl\\(210\\,90\\%\\,50\\%\\)\\]{border-color:#0d80f2}.border-blue-200{border-color:var(--color-blue-200)}.border-emerald-200{border-color:var(--color-emerald-200)}.border-gray-200{border-color:var(--color-gray-200)}.border-green-200{border-color:var(--color-green-200)}.border-red-200{border-color:var(--color-red-200)}.border-yellow-200{border-color:var(--color-yellow-200)}.border-yellow-300{border-color:var(--color-yellow-300)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\\/20{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\\/5{background-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.bg-black\\/5{background-color:color-mix(in oklab,var(--color-black)5%,transparent)}}.bg-black\\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-black\\/70{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.bg-black\\/70{background-color:color-mix(in oklab,var(--color-black)70%,transparent)}}.bg-black\\/95{background-color:#000000f2}@supports (color:color-mix(in lab,red,red)){.bg-black\\/95{background-color:color-mix(in oklab,var(--color-black)95%,transparent)}}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-500\\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\\/20{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.bg-blue-600{background-color:var(--color-blue-600)}.bg-current,.bg-current\\/20{background-color:currentColor}@supports (color:color-mix(in lab,red,red)){.bg-current\\/20{background-color:color-mix(in oklab,currentcolor 20%,transparent)}}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-500\\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\\/10{background-color:color-mix(in oklab,var(--color-emerald-500)10%,transparent)}}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-500{background-color:var(--color-gray-500)}.bg-gray-500\\/20{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\\/20{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.bg-green-50{background-color:var(--color-green-50)}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\\/10{background-color:#00c7581a}@supports (color:color-mix(in lab,red,red)){.bg-green-500\\/10{background-color:color-mix(in oklab,var(--color-green-500)10%,transparent)}}.bg-green-500\\/20{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.bg-green-500\\/20{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.bg-purple-500{background-color:var(--color-purple-500)}.bg-red-50{background-color:var(--color-red-50)}.bg-red-100{background-color:var(--color-red-100)}.bg-red-500{background-color:var(--color-red-500)}.bg-red-500\\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.bg-red-500\\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.bg-white\\/80{background-color:#fffc}@supports (color:color-mix(in lab,red,red)){.bg-white\\/80{background-color:color-mix(in oklab,var(--color-white)80%,transparent)}}.bg-yellow-50{background-color:var(--color-yellow-50)}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab}.bg-gradient-to-b,.bg-gradient-to-br{background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab}.bg-gradient-to-r{--tw-gradient-position:to right in oklab}.bg-gradient-to-r,.bg-gradient-to-t{background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-t{--tw-gradient-position:to top in oklab}.from-black{--tw-gradient-from:var(--color-black);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-black\\/40{--tw-gradient-from:#0006}@supports (color:color-mix(in lab,red,red)){.from-black\\/40{--tw-gradient-from:color-mix(in oklab,var(--color-black)40%,transparent)}}.from-black\\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-black\\/60{--tw-gradient-from:#0009}@supports (color:color-mix(in lab,red,red)){.from-black\\/60{--tw-gradient-from:color-mix(in oklab,var(--color-black)60%,transparent)}}.from-black\\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-50{--tw-gradient-from:var(--color-blue-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-emerald-400{--tw-gradient-from:var(--color-emerald-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-emerald-500{--tw-gradient-from:var(--color-emerald-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-transparent{--tw-gradient-via:transparent;--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-black{--tw-gradient-to:var(--color-black);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-black\\/20{--tw-gradient-to:#0003}@supports (color:color-mix(in lab,red,red)){.to-black\\/20{--tw-gradient-to:color-mix(in oklab,var(--color-black)20%,transparent)}}.to-black\\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-green-50{--tw-gradient-to:var(--color-green-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-teal-500{--tw-gradient-to:var(--color-teal-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-teal-600{--tw-gradient-to:var(--color-teal-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.bg-repeat{background-repeat:repeat}.mask-no-clip{-webkit-mask-clip:no-clip;mask-clip:no-clip}.mask-repeat{-webkit-mask-repeat:repeat;mask-repeat:repeat}.fill-current{fill:currentColor}.stroke-\\[2\\.5\\]{stroke-width:2.5px}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-1{padding:calc(var(--spacing)*1)}.p-1\\.5{padding:calc(var(--spacing)*1.5)}.p-2{padding:calc(var(--spacing)*2)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.px-10{padding-inline:calc(var(--spacing)*10)}.py-0{padding-block:calc(var(--spacing)*0)}.py-0\\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-5{padding-block:calc(var(--spacing)*5)}.py-12{padding-block:calc(var(--spacing)*12)}.py-16{padding-block:calc(var(--spacing)*16)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pt-5{padding-top:calc(var(--spacing)*5)}.pr-1{padding-right:calc(var(--spacing)*1)}.pr-2{padding-right:calc(var(--spacing)*2)}.pr-3{padding-right:calc(var(--spacing)*3)}.pr-4{padding-right:calc(var(--spacing)*4)}.pr-5{padding-right:calc(var(--spacing)*5)}.pr-8{padding-right:calc(var(--spacing)*8)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pb-5{padding-bottom:calc(var(--spacing)*5)}.pl-1{padding-left:calc(var(--spacing)*1)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-3{padding-left:calc(var(--spacing)*3)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-5{padding-left:calc(var(--spacing)*5)}.text-center{text-align:center}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-6xl{font-size:var(--text-6xl);line-height:var(--tw-leading,var(--text-6xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\\[7px\\]{font-size:7px}.text-\\[8px\\]{font-size:8px}.text-\\[9px\\]{font-size:9px}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.text-\\[12px\\]{font-size:12px}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-black{--tw-font-weight:var(--font-weight-black);font-weight:var(--font-weight-black)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\\[0\\.1em\\]{--tw-tracking:.1em;letter-spacing:.1em}.tracking-\\[0\\.2em\\]{--tw-tracking:.2em;letter-spacing:.2em}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-tighter{--tw-tracking:var(--tracking-tighter);letter-spacing:var(--tracking-tighter)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.text-wrap{text-wrap:wrap}.break-words{overflow-wrap:break-word}.text-clip{text-overflow:clip}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.text-amber-500{color:var(--color-amber-500)}.text-blue-500{color:var(--color-blue-500)}.text-blue-700{color:var(--color-blue-700)}.text-blue-900{color:var(--color-blue-900)}.text-emerald-500{color:var(--color-emerald-500)}.text-emerald-600{color:var(--color-emerald-600)}.text-emerald-900{color:var(--color-emerald-900)}.text-gray-600{color:var(--color-gray-600)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-green-500{color:var(--color-green-500)}.text-green-600{color:var(--color-green-600)}.text-green-700{color:var(--color-green-700)}.text-green-900{color:var(--color-green-900)}.text-purple-500{color:var(--color-purple-500)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-red-900{color:var(--color-red-900)}.text-white{color:var(--color-white)}.text-yellow-700{color:var(--color-yellow-700)}.text-yellow-800{color:var(--color-yellow-800)}.text-yellow-900{color:var(--color-yellow-900)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.diagonal-fractions{--tw-numeric-fraction:diagonal-fractions}.diagonal-fractions,.lining-nums{font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.lining-nums{--tw-numeric-figure:lining-nums}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums}.oldstyle-nums,.ordinal{font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.ordinal{--tw-ordinal:ordinal}.proportional-nums{--tw-numeric-spacing:proportional-nums}.proportional-nums,.slashed-zero{font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero}.stacked-fractions{--tw-numeric-fraction:stacked-fractions}.stacked-fractions,.tabular-nums{font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums}.normal-nums{font-variant-numeric:normal}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.overline{text-decoration-line:overline}.underline{text-decoration-line:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.subpixel-antialiased{-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}.opacity-0{opacity:0}.opacity-20{opacity:.2}.opacity-25{opacity:.25}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a)}.shadow,.shadow-inner{box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-inner{--tw-shadow:inset 0 2px 4px 0 var(--tw-shadow-color,#0000000d)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a)}.shadow-lg,.shadow-md{box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a)}.shadow-sm,.shadow-xl{box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a)}.ring{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor)}.ring,.ring-2{box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor)}.inset-ring{--tw-inset-ring-shadow:inset 0 0 0 1px var(--tw-inset-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-\\[hsl\\(210\\,90\\%\\,50\\%\\)\\]\\/30{--tw-ring-color:oklab(60.6854% -.0507387 -.187037/.3)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px)}.blur,.blur-2xl{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.blur-2xl{--tw-blur:blur(var(--blur-2xl))}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a))drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a)drop-shadow(0 1px 1px #0000000f)}.drop-shadow,.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur{--tw-backdrop-blur:blur(8px)}.backdrop-blur,.backdrop-blur-md{-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md))}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm))}.backdrop-blur-sm,.backdrop-grayscale{-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-grayscale{--tw-backdrop-grayscale:grayscale(100%)}.backdrop-invert{--tw-backdrop-invert:invert(100%)}.backdrop-invert,.backdrop-sepia{-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-sepia{--tw-backdrop-sepia:sepia(100%)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))}.transition-all{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))}.transition-colors{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))}.transition-opacity{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))}.transition-transform{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-400{--tw-duration:.4s;transition-duration:.4s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.duration-700{--tw-duration:.7s;transition-duration:.7s}.duration-1000{--tw-duration:1s;transition-duration:1s}.ease-\\[cubic-bezier\\(0\\.16\\,1\\,0\\.3\\,1\\)\\]{--tw-ease:cubic-bezier(.16,1,.3,1);transition-timing-function:cubic-bezier(.16,1,.3,1)}.ease-\\[cubic-bezier\\(0\\.34\\,1\\.56\\,0\\.64\\,1\\)\\]{--tw-ease:cubic-bezier(.34,1.56,.64,1);transition-timing-function:cubic-bezier(.34,1.56,.64,1)}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.\\[animation-delay\\:-0\\.3s\\]{animation-delay:-.3s}.\\[animation-delay\\:-0\\.15s\\]{animation-delay:-.15s}:where(.divide-x-reverse>:not(:last-child)){--tw-divide-x-reverse:1}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\\:opacity-100:is(:where(.group):hover *){opacity:1}}.last\\:mb-0:last-child{margin-bottom:calc(var(--spacing)*0)}@media(hover:hover){.hover\\:-translate-y-1:hover{--tw-translate-y:calc(var(--spacing)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.hover\\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x)var(--tw-scale-y)}.hover\\:scale-110:hover{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x)var(--tw-scale-y)}.hover\\:scale-\\[1\\.02\\]:hover{scale:1.02}.hover\\:rotate-6:hover{rotate:6deg}.hover\\:border-\\[hsl\\(210\\,90\\%\\,70\\%\\)\\]:hover{border-color:#6eb3f7}.hover\\:bg-blue-600:hover{background-color:var(--color-blue-600)}.hover\\:bg-blue-700:hover{background-color:var(--color-blue-700)}.hover\\:bg-emerald-500\\/20:hover{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-emerald-500\\/20:hover{background-color:color-mix(in oklab,var(--color-emerald-500)20%,transparent)}}.hover\\:bg-gray-600:hover{background-color:var(--color-gray-600)}.hover\\:bg-green-600:hover{background-color:var(--color-green-600)}.hover\\:bg-purple-600:hover{background-color:var(--color-purple-600)}.hover\\:bg-red-500\\/30:hover{background-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-red-500\\/30:hover{background-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.hover\\:bg-red-600:hover{background-color:var(--color-red-600)}.hover\\:bg-white\\/20:hover{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-white\\/20:hover{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:opacity-90:hover{opacity:.9}.hover\\:opacity-100:hover{opacity:1}.hover\\:shadow-lg:hover{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus\\:underline:focus{text-decoration-line:underline}.focus\\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\\:ring-emerald-500:focus{--tw-ring-color:var(--color-emerald-500)}.focus\\:ring-red-500:focus{--tw-ring-color:var(--color-red-500)}.focus\\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.active\\:scale-90:active{--tw-scale-x:90%;--tw-scale-y:90%;--tw-scale-z:90%;scale:var(--tw-scale-x)var(--tw-scale-y)}.active\\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x)var(--tw-scale-y)}.disabled\\:opacity-30:disabled{opacity:.3}.disabled\\:opacity-50:disabled{opacity:.5}.disabled\\:grayscale:disabled{--tw-grayscale:grayscale(100%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}@media(min-width:40rem){.sm\\:h-8{height:calc(var(--spacing)*8)}.sm\\:h-16{height:calc(var(--spacing)*16)}.sm\\:w-8{width:calc(var(--spacing)*8)}.sm\\:w-16{width:calc(var(--spacing)*16)}.sm\\:w-auto{width:auto}}@media(prefers-color-scheme:dark){.dark\\:border-emerald-800{border-color:var(--color-emerald-800)}.dark\\:bg-black\\/80{background-color:#000c}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-black\\/80{background-color:color-mix(in oklab,var(--color-black)80%,transparent)}}.dark\\:bg-emerald-950{background-color:var(--color-emerald-950)}.dark\\:bg-white\\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-white\\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\\:text-emerald-50{color:var(--color-emerald-50)}}}#botuyo-chat-widget-root .sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}@media(prefers-contrast:high){#botuyo-chat-widget-root{--border-width:2px;--focus-ring-width:3px;--focus-ring-color:hsl(var(--primary))}#botuyo-chat-widget-root [role=button],#botuyo-chat-widget-root [role=dialog],#botuyo-chat-widget-root button,#botuyo-chat-widget-root input,#botuyo-chat-widget-root textarea{border-width:var(--border-width)!important}#botuyo-chat-widget-root :focus-visible{outline:var(--focus-ring-width)solid var(--focus-ring-color)!important;outline-offset:2px!important}#botuyo-chat-widget-root{--foreground:0 0% 0%;--background:0 0% 100%;--muted-foreground:0 0% 20%}#botuyo-chat-widget-root.dark{--foreground:0 0% 100%;--background:0 0% 0%;--muted-foreground:0 0% 80%}#botuyo-chat-widget-root [class*=opacity-],#botuyo-chat-widget-root [style*=opacity]{opacity:1!important}}@media(prefers-reduced-motion:reduce){#botuyo-chat-widget-root *,#botuyo-chat-widget-root :after,#botuyo-chat-widget-root :before{animation-duration:.01ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important;transition-duration:.01ms!important}#botuyo-chat-widget-root .animate-pulse,#botuyo-chat-widget-root [data-state=closed],#botuyo-chat-widget-root [data-state=open]{animation:none!important}#botuyo-chat-widget-root .scroll-smooth{scroll-behavior:auto!important}}#botuyo-chat-widget-root :focus-visible{border-radius:var(--radius,.5rem);outline:2px solid hsl(var(--primary));outline-offset:2px}#botuyo-chat-widget-root [role=button]:focus-visible,#botuyo-chat-widget-root button:focus-visible{box-shadow:0 0 0 4px hsl(var(--primary)/.1);outline:2px solid hsl(var(--primary));outline-offset:2px}#botuyo-chat-widget-root input:focus-visible,#botuyo-chat-widget-root textarea:focus-visible{border-color:hsl(var(--primary));box-shadow:0 0 0 3px hsl(var(--primary)/.1);outline:2px solid hsl(var(--primary));outline-offset:0}#botuyo-chat-widget-root .skip-link{background:hsl(var(--primary));border-radius:0 0 4px;color:hsl(var(--primary-foreground));left:0;padding:8px;position:absolute;text-decoration:none;top:-40px;z-index:100000}#botuyo-chat-widget-root .skip-link:focus{top:0}@media(prefers-color-scheme:dark)and (prefers-contrast:high){#botuyo-chat-widget-root{--primary:48 96% 89%;--destructive:0 84% 60%;--success:142 76% 36%}}#botuyo-chat-widget-root [data-state]:after{content:attr(data-state);clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}@media(min-resolution:192dpi){#botuyo-chat-widget-root{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility}}#botuyo-chat-widget-root [data-tooltip]:focus:after,#botuyo-chat-widget-root [data-tooltip]:hover:after{background:hsl(var(--popover));border-radius:4px;bottom:100%;color:hsl(var(--popover-foreground));content:attr(data-tooltip);font-size:12px;left:50%;padding:4px 8px;pointer-events:none;position:absolute;transform:translate(-50%);white-space:nowrap;z-index:1000}#botuyo-chat-widget-root [aria-live=assertive],#botuyo-chat-widget-root [aria-live=polite]{position:relative}@keyframes live-region-update{0%{opacity:.8}to{opacity:1}}#botuyo-chat-widget-root [aria-live]:not([aria-atomic=false]):has(:new){animation:live-region-update .2s ease-in-out}#botuyo-chat-widget-root .scrollbar-none{scrollbar-width:none;-ms-overflow-style:none}#botuyo-chat-widget-root .scrollbar-none::-webkit-scrollbar{display:none;height:0;width:0}#botuyo-chat-widget-root .scrollbar-thin{scrollbar-width:thin}#botuyo-chat-widget-root .scrollbar-thin::-webkit-scrollbar{height:4px;width:4px}#botuyo-chat-widget-root .scrollbar-thin::-webkit-scrollbar-track{background:0 0}#botuyo-chat-widget-root .scrollbar-thin::-webkit-scrollbar-thumb{background:hsl(var(--border));border-radius:2px}#botuyo-chat-widget-root .scrollbar-thin::-webkit-scrollbar-thumb:hover{background:hsl(var(--muted-foreground)/.5)}#botuyo-chat-widget-root .hidden{display:none!important}#botuyo-chat-widget-root .block{display:block!important}#botuyo-chat-widget-root .flex{display:flex!important}#botuyo-chat-widget-root .inline-flex{display:inline-flex!important}#botuyo-chat-widget-root .grid{display:grid!important}#botuyo-chat-widget-root .flex-row{flex-direction:row!important}#botuyo-chat-widget-root .flex-col{flex-direction:column!important}#botuyo-chat-widget-root .flex-1{flex:1!important}#botuyo-chat-widget-root .flex-none{flex:none!important}#botuyo-chat-widget-root .shrink-0{flex-shrink:0!important}#botuyo-chat-widget-root .grow{flex-grow:1!important}#botuyo-chat-widget-root .items-center{align-items:center!important}#botuyo-chat-widget-root .items-start{align-items:flex-start!important}#botuyo-chat-widget-root .items-end{align-items:flex-end!important}#botuyo-chat-widget-root .justify-center{justify-content:center!important}#botuyo-chat-widget-root .justify-between{justify-content:space-between!important}#botuyo-chat-widget-root .justify-end{justify-content:flex-end!important}#botuyo-chat-widget-root .relative{position:relative!important}#botuyo-chat-widget-root .absolute{position:absolute!important}#botuyo-chat-widget-root .fixed{position:fixed!important}#botuyo-chat-widget-root .inset-0{inset:0!important}#botuyo-chat-widget-root .w-full{width:100%!important}#botuyo-chat-widget-root .h-full{height:100%!important}#botuyo-chat-widget-root .w-fit{width:-moz-fit-content!important;width:fit-content!important}#botuyo-chat-widget-root .w-auto{width:auto!important}#botuyo-chat-widget-root .h-auto{height:auto!important}#botuyo-chat-widget-root .h-0{height:0!important}#botuyo-chat-widget-root .w-0{width:0!important}#botuyo-chat-widget-root .h-6{height:1.5rem!important}#botuyo-chat-widget-root .w-6{width:1.5rem!important}#botuyo-chat-widget-root .h-7{height:1.75rem!important}#botuyo-chat-widget-root .w-7{width:1.75rem!important}#botuyo-chat-widget-root .h-8{height:2rem!important}#botuyo-chat-widget-root .w-8{width:2rem!important}#botuyo-chat-widget-root .h-14{height:3.5rem!important}#botuyo-chat-widget-root .w-14{width:3.5rem!important}#botuyo-chat-widget-root .min-h-0{min-height:0!important}#botuyo-chat-widget-root .min-w-0{min-width:0!important}#botuyo-chat-widget-root .overflow-hidden{overflow:hidden!important}#botuyo-chat-widget-root .overflow-auto{overflow:auto!important}#botuyo-chat-widget-root .overflow-y-auto{overflow-y:auto!important}#botuyo-chat-widget-root .gap-1{gap:.25rem!important}#botuyo-chat-widget-root .gap-2{gap:.5rem!important}#botuyo-chat-widget-root .gap-3{gap:.75rem!important}#botuyo-chat-widget-root .gap-4{gap:1rem!important}#botuyo-chat-widget-root .p-1{padding:.25rem!important}#botuyo-chat-widget-root .p-2{padding:.5rem!important}#botuyo-chat-widget-root .p-3{padding:.75rem!important}#botuyo-chat-widget-root .p-4{padding:1rem!important}#botuyo-chat-widget-root .px-4{padding-left:1rem!important;padding-right:1rem!important}#botuyo-chat-widget-root .py-2{padding-bottom:.5rem!important;padding-top:.5rem!important}#botuyo-chat-widget-root .m-0{margin:0!important}#botuyo-chat-widget-root .mt-2{margin-top:.5rem!important}#botuyo-chat-widget-root .mt-4{margin-top:1rem!important}#botuyo-chat-widget-root .mb-2{margin-bottom:.5rem!important}#botuyo-chat-widget-root .ml-auto{margin-left:auto!important}#botuyo-chat-widget-root .rounded{border-radius:.25rem!important}#botuyo-chat-widget-root .rounded-lg{border-radius:.5rem!important}#botuyo-chat-widget-root .rounded-xl{border-radius:.75rem!important}#botuyo-chat-widget-root .rounded-2xl{border-radius:1rem!important}#botuyo-chat-widget-root .rounded-full{border-radius:9999px!important}#botuyo-chat-widget-root .text-xs{font-size:.75rem!important;line-height:1rem!important}#botuyo-chat-widget-root .text-sm{font-size:.875rem!important;line-height:1.25rem!important}#botuyo-chat-widget-root .text-base{font-size:1rem!important;line-height:1.5rem!important}#botuyo-chat-widget-root .text-lg{font-size:1.125rem!important;line-height:1.75rem!important}#botuyo-chat-widget-root .font-medium{font-weight:500!important}#botuyo-chat-widget-root .font-semibold{font-weight:600!important}#botuyo-chat-widget-root .font-bold{font-weight:700!important}#botuyo-chat-widget-root .font-black{font-weight:900!important}#botuyo-chat-widget-root .uppercase{text-transform:uppercase!important}#botuyo-chat-widget-root .truncate{overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important}#botuyo-chat-widget-root .text-foreground{color:hsl(var(--foreground))!important}#botuyo-chat-widget-root .text-muted-foreground{color:hsl(var(--muted-foreground))!important}#botuyo-chat-widget-root .text-primary{color:hsl(var(--primary))!important}#botuyo-chat-widget-root .text-primary-foreground{color:hsl(var(--primary-foreground))!important}#botuyo-chat-widget-root .text-destructive{color:hsl(var(--destructive))!important}#botuyo-chat-widget-root .text-white{color:#fff!important}#botuyo-chat-widget-root .bg-background{background-color:hsl(var(--background))!important}#botuyo-chat-widget-root .bg-muted{background-color:hsl(var(--muted))!important}#botuyo-chat-widget-root .bg-primary{background-color:hsl(var(--primary))!important}#botuyo-chat-widget-root .bg-card{background-color:hsl(var(--card))!important}#botuyo-chat-widget-root .bg-transparent{background-color:#0000!important}#botuyo-chat-widget-root .border{border-width:1px!important}#botuyo-chat-widget-root .border-2{border-width:2px!important}#botuyo-chat-widget-root .border-b{border-bottom-width:1px!important}#botuyo-chat-widget-root .border-t{border-top-width:1px!important}#botuyo-chat-widget-root .border-border{border-color:hsl(var(--border))!important}#botuyo-chat-widget-root .shadow{box-shadow:0 1px 3px #0000001a,0 1px 2px -1px #0000001a!important}#botuyo-chat-widget-root .shadow-lg{box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a!important}#botuyo-chat-widget-root .shadow-xl{box-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a!important}#botuyo-chat-widget-root .transition{transition-duration:.15s!important;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter!important;transition-timing-function:cubic-bezier(.4,0,.2,1)!important}#botuyo-chat-widget-root .transition-all{transition-duration:.15s!important;transition-property:all!important;transition-timing-function:cubic-bezier(.4,0,.2,1)!important}#botuyo-chat-widget-root .duration-300{transition-duration:.3s!important}#botuyo-chat-widget-root .duration-500{transition-duration:.5s!important}#botuyo-chat-widget-root .opacity-0{opacity:0!important}#botuyo-chat-widget-root .opacity-100{opacity:1!important}#botuyo-chat-widget-root .scale-95{transform:scale(.95)!important}#botuyo-chat-widget-root .scale-100{transform:scale(1)!important}#botuyo-chat-widget-root .translate-y-full{transform:translateY(100%)!important}#botuyo-chat-widget-root .z-10{z-index:10!important}#botuyo-chat-widget-root .z-20{z-index:20!important}#botuyo-chat-widget-root .z-50{z-index:50!important}#botuyo-chat-widget-root .pointer-events-none{pointer-events:none!important}#botuyo-chat-widget-root .pointer-events-auto{pointer-events:auto!important}#botuyo-chat-widget-root .cursor-pointer{cursor:pointer!important}#botuyo-chat-widget-root .select-none{-webkit-user-select:none!important;-moz-user-select:none!important;user-select:none!important}@keyframes spin{to{transform:rotate(1turn)}}#botuyo-chat-widget,#botuyo-chat-widget-root,:root{--background:0 0% 100%;--foreground:240 10% 3.9%;--card:0 0% 100%;--card-foreground:240 10% 3.9%;--popover:0 0% 100%;--popover-foreground:240 10% 3.9%;--primary:160 84% 39%;--primary-foreground:0 0% 100%;--muted:240 4.8% 95.9%;--muted-foreground:240 3.8% 46.1%;--accent:240 4.8% 95.9%;--accent-foreground:240 5.9% 10%;--destructive:0 84.2% 60.2%;--destructive-foreground:0 0% 98%;--border:240 5.9% 90%;--input:240 5.9% 90%;--ring:160 84% 39%;--radius:.5rem;--spacing1:.25rem;--spacing2:.5rem;--spacing3:.75rem;--spacing4:1rem;--spacing5:.75rem;--spacing6:1.5rem;--spacing8:2rem}#botuyo-chat-widget-root.dark,#botuyo-chat-widget.dark,.dark{--background:240 10% 3.9%;--foreground:0 0% 98%;--card:240 10% 3.9%;--card-foreground:0 0% 98%;--popover:240 10% 3.9%;--popover-foreground:0 0% 98%;--primary:160 84% 39%;--primary-foreground:0 0% 100%;--muted:240 3.7% 15.9%;--muted-foreground:240 5% 64.9%;--accent:240 3.7% 15.9%;--accent-foreground:0 0% 98%;--destructive:0 62.8% 30.6%;--destructive-foreground:0 0% 98%;--border:240 3.7% 15.9%;--input:240 3.7% 15.9%;--ring:160 84% 39%}#botuyo-chat-widget-root,#botuyo-chat-widget-root *{box-sizing:border-box;margin:0;padding:0}#botuyo-chat-widget-root{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:hsl(var(--foreground));font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;line-height:1.5}@keyframes slideInRight{0%{opacity:0;transform:translate(100%)}to{opacity:1;transform:translate(0)}}@keyframes slideOutRight{0%{opacity:1;transform:translate(0)}to{opacity:0;transform:translate(100%)}}@keyframes slideInUp{0%{opacity:0;transform:translateY(100%)}to{opacity:1;transform:translateY(0)}}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes pulse{50%{opacity:.5}}@keyframes bounce{0%,to{animation-timing-function:cubic-bezier(.8,0,1,1);transform:translateY(-25%)}50%{animation-timing-function:cubic-bezier(0,0,.2,1);transform:none}}#botuyo-chat-widget-root .chat-launcher{align-items:center;background-color:hsl(var(--primary));border-radius:50%;bottom:1.5rem;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;color:#fff;cursor:pointer;display:flex;height:60px;justify-content:center;position:fixed;right:1.5rem;transition:all .2s;width:60px;z-index:999999}#botuyo-chat-widget-root .chat-launcher:hover{box-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a;transform:scale(1.05)}#botuyo-chat-widget-root .chat-launcher.position-bottom-left{left:1.5rem;right:auto}#botuyo-chat-widget-root .chat-launcher.position-top-right{bottom:auto;top:1.5rem}#botuyo-chat-widget-root .chat-launcher.position-top-left{inset:1.5rem auto auto 1.5rem}#botuyo-chat-widget-root .chat-window{animation:slideInRight .3s ease-out;background-color:hsl(var(--background));border-radius:1rem;bottom:6rem;box-shadow:0 25px 50px -12px #00000040;display:flex;flex-direction:column;height:600px;max-height:calc(100vh - 8rem);overflow:hidden;position:fixed;right:1.5rem;width:400px;z-index:999999}#botuyo-chat-widget-root .chat-window.closing{animation:slideOutRight .2s ease-in}@media(max-width:640px){#botuyo-chat-widget-root .chat-window{animation:slideInUp .3s ease-out;border-radius:0;height:100%;inset:0;max-height:100vh;width:100%}}#botuyo-chat-widget-root .message-bubble{word-wrap:break-word;border-radius:1rem;max-width:80%;padding:.75rem 1rem}#botuyo-chat-widget-root .message-bubble.user{background-color:hsl(var(--primary));color:hsl(var(--primary-foreground));margin-left:auto}#botuyo-chat-widget-root .message-bubble.bot{background-color:hsl(var(--muted));color:hsl(var(--foreground))}#botuyo-chat-widget-root .chat-messages::-webkit-scrollbar{width:6px}#botuyo-chat-widget-root .chat-messages::-webkit-scrollbar-track{background:0 0}#botuyo-chat-widget-root .chat-messages::-webkit-scrollbar-thumb{background:hsl(var(--muted));border-radius:3px}#botuyo-chat-widget-root .chat-messages::-webkit-scrollbar-thumb:hover{background:hsl(var(--muted-foreground))}#botuyo-chat-widget-root .chat-input{background-color:hsl(var(--background));border:1px solid hsl(var(--border));border-radius:.5rem;color:hsl(var(--foreground));outline:none;padding:.75rem;transition:border-color .2s;width:100%}#botuyo-chat-widget-root .chat-input:focus{border-color:hsl(var(--primary));box-shadow:0 0 0 3px hsl(var(--primary)/.1)}@media(max-width:640px){#botuyo-chat-widget-root .chat-launcher{bottom:1rem;height:56px;right:1rem;width:56px}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}';let U=class extends w.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){console.error("[BotUyoWidget] Internal error:",e,t)}render(){return this.state.hasError?null:this.props.children}};const F={"--background":"240 10% 3.9%","--foreground":"0 0% 98%","--card":"240 10% 3.9%","--cardForeground":"0 0% 98%","--primary":"160 84% 39%","--primaryForeground":"0 0% 100%","--muted":"240 3.7% 15.9%","--mutedForeground":"240 5% 64.9%","--border":"240 3.7% 15.9%"};function z(){const e=document.documentElement.getAttribute("data-theme");return"dark"===e||"light"!==e&&window.matchMedia("(prefers-color-scheme: dark)").matches}const B=S.lazy(()=>Promise.resolve().then(()=>vv).then(e=>({default:e.ChatWidget})));function V(e){const{locale:t,setLocale:n}=O();return{t:w.useCallback(n=>{const r=e?`${e}.${n}`:n,i=(o=k[t],(a=r).split(".").reduce((e,t)=>e?.[t],o)||a);var o,a;return i||n},[t,e]),setLocale:n,currentLocale:t}}const j=(...e)=>e.filter((e,t,n)=>Boolean(e)&&n.indexOf(e)===t).join(" ");var H={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const W=w.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:o,iconNode:a,...s},l)=>w.createElement("svg",{ref:l,...H,width:t,height:t,stroke:e,strokeWidth:r?24*Number(n)/Number(t):n,className:j("lucide",i),...s},[...a.map(([e,t])=>w.createElement(e,t)),...Array.isArray(o)?o:[o]])),G=(e,t)=>{const n=w.forwardRef(({className:n,...r},i)=>{return w.createElement(W,{ref:i,iconNode:t,className:j(`lucide-${o=e,o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,n),...r});var o});return n.displayName=`${e}`,n},X=G("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),q=G("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]),$=G("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),Y=G("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),Z=G("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),J=G("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]),K=G("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),Q=G("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]),ee=G("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]),te=G("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),ne=G("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),re=G("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),ie=G("MapPin",[["path",{d:"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z",key:"2oe9fu"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]),oe=G("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]),ae=G("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]),se=G("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]),le=G("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]),ce=G("PhoneOff",[["path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91",key:"z86iuo"}],["line",{x1:"22",x2:"2",y1:"2",y2:"22",key:"11kh81"}]]),ue=G("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]),de=G("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]),he=G("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),pe=G("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]),fe=G("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]),me=G("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),ge=G("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),ve=G("Volume2",[["polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5",key:"16drj5"}],["path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",key:"ltjumu"}],["path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",key:"1kegas"}]]),ye=G("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),be=G("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);function xe(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=xe(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}const _e=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),we="-",Se=[],Me=e=>{const t=Ae(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return Te(e);const n=e.split(we),r=""===n[0]&&n.length>1?1:0;return Ee(n,r,t)},getConflictingClassGroupIds:(e,t)=>{if(t){const t=r[e],i=n[e];return t?i?((e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n})(i,t):t:i||Se}return n[e]||Se}}},Ee=(e,t,n)=>{if(0===e.length-t)return n.classGroupId;const r=e[t],i=n.nextPart.get(r);if(i){const n=Ee(e,t+1,i);if(n)return n}const o=n.validators;if(null===o)return;const a=0===t?e.join(we):e.slice(t).join(we),s=o.length;for(let l=0;l<s;l++){const e=o[l];if(e.validator(a))return e.classGroupId}},Te=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?"arbitrary.."+r:void 0})(),Ae=e=>{const{theme:t,classGroups:n}=e;return Ce(n,t)},Ce=(e,t)=>{const n=_e();for(const r in e){const i=e[r];ke(i,n,r,t)}return n},ke=(e,t,n,r)=>{const i=e.length;for(let o=0;o<i;o++){const i=e[o];Re(i,t,n,r)}},Re=(e,t,n,r)=>{"string"!=typeof e?"function"!=typeof e?Le(e,t,n,r):Ie(e,t,n,r):Pe(e,t,n)},Pe=(e,t,n)=>{(""===e?t:Ne(t,e)).classGroupId=n},Ie=(e,t,n,r)=>{Oe(e)?ke(e(r),t,n,r):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(n,e)))},Le=(e,t,n,r)=>{const i=Object.entries(e),o=i.length;for(let a=0;a<o;a++){const[e,o]=i[a];ke(o,Ne(t,e),n,r)}},Ne=(e,t)=>{let n=e;const r=t.split(we),i=r.length;for(let o=0;o<i;o++){const e=r[o];let t=n.nextPart.get(e);t||(t=_e(),n.nextPart.set(e,t)),n=t}return n},Oe=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,De=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const i=(i,o)=>{n[i]=o,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];return void 0!==t?t:void 0!==(t=r[e])?(i(e,t),t):void 0},set(e,t){e in n?n[e]=t:i(e,t)}}},Ue=[],Fe=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),ze=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=e=>{const t=[];let n,r=0,i=0,o=0;const a=e.length;for(let u=0;u<a;u++){const a=e[u];if(0===r&&0===i){if(":"===a){t.push(e.slice(o,u)),o=u+1;continue}if("/"===a){n=u;continue}}"["===a?r++:"]"===a?r--:"("===a?i++:")"===a&&i--}const s=0===t.length?e:e.slice(o);let l=s,c=!1;s.endsWith("!")?(l=s.slice(0,-1),c=!0):s.startsWith("!")&&(l=s.slice(1),c=!0);return Fe(t,c,l,n&&n>o?n-o:void 0)};if(t){const e=t+":",n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Fe(Ue,!1,t,void 0,!0)}if(n){const e=r;r=t=>n({className:t,parseClassName:e})}return r},Be=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{const n=[];let r=[];for(let i=0;i<e.length;i++){const o=e[i],a="["===o[0],s=t.has(o);a||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(o)):r.push(o)}return r.length>0&&(r.sort(),n.push(...r)),n}},Ve=/\s+/,je=e=>{if("string"==typeof e)return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=je(e[r]))&&(n&&(n+=" "),n+=t);return n},He=(e,...t)=>{let n,r,i,o;const a=e=>{const t=r(e);if(t)return t;const o=((e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:o}=t,a=[],s=e.trim().split(Ve);let l="";for(let c=s.length-1;c>=0;c-=1){const e=s[c],{isExternal:t,modifiers:u,hasImportantModifier:d,baseClassName:h,maybePostfixModifierPosition:p}=n(e);if(t){l=e+(l.length>0?" "+l:l);continue}let f=!!p,m=r(f?h.substring(0,p):h);if(!m){if(!f){l=e+(l.length>0?" "+l:l);continue}if(m=r(h),!m){l=e+(l.length>0?" "+l:l);continue}f=!1}const g=0===u.length?"":1===u.length?u[0]:o(u).join(":"),v=d?g+"!":g,y=v+m;if(a.indexOf(y)>-1)continue;a.push(y);const b=i(m,f);for(let n=0;n<b.length;++n){const e=b[n];a.push(v+e)}l=e+(l.length>0?" "+l:l)}return l})(e,n);return i(e,o),o};return o=s=>{const l=t.reduce((e,t)=>t(e),e());return n=(e=>({cache:De(e.cacheSize),parseClassName:ze(e),sortModifiers:Be(e),...Me(e)}))(l),r=n.cache.get,i=n.cache.set,o=a,a(s)},(...e)=>o(((...e)=>{let t,n,r=0,i="";for(;r<e.length;)(t=e[r++])&&(n=je(t))&&(i&&(i+=" "),i+=n);return i})(...e))},We=[],Ge=e=>{const t=t=>t[e]||We;return t.isThemeGetter=!0,t},Xe=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,qe=/^\((?:(\w[\w-]*):)?(.+)\)$/i,$e=/^\d+\/\d+$/,Ye=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ze=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Je=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ke=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Qe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,et=e=>$e.test(e),tt=e=>!!e&&!Number.isNaN(Number(e)),nt=e=>!!e&&Number.isInteger(Number(e)),rt=e=>e.endsWith("%")&&tt(e.slice(0,-1)),it=e=>Ye.test(e),ot=()=>!0,at=e=>Ze.test(e)&&!Je.test(e),st=()=>!1,lt=e=>Ke.test(e),ct=e=>Qe.test(e),ut=e=>!ht(e)&&!yt(e),dt=e=>Et(e,kt,st),ht=e=>Xe.test(e),pt=e=>Et(e,Rt,at),ft=e=>Et(e,Pt,tt),mt=e=>Et(e,At,st),gt=e=>Et(e,Ct,ct),vt=e=>Et(e,Lt,lt),yt=e=>qe.test(e),bt=e=>Tt(e,Rt),xt=e=>Tt(e,It),_t=e=>Tt(e,At),wt=e=>Tt(e,kt),St=e=>Tt(e,Ct),Mt=e=>Tt(e,Lt,!0),Et=(e,t,n)=>{const r=Xe.exec(e);return!!r&&(r[1]?t(r[1]):n(r[2]))},Tt=(e,t,n=!1)=>{const r=qe.exec(e);return!!r&&(r[1]?t(r[1]):n)},At=e=>"position"===e||"percentage"===e,Ct=e=>"image"===e||"url"===e,kt=e=>"length"===e||"size"===e||"bg-size"===e,Rt=e=>"length"===e,Pt=e=>"number"===e,It=e=>"family-name"===e,Lt=e=>"shadow"===e,Nt=He(()=>{const e=Ge("color"),t=Ge("font"),n=Ge("text"),r=Ge("font-weight"),i=Ge("tracking"),o=Ge("leading"),a=Ge("breakpoint"),s=Ge("container"),l=Ge("spacing"),c=Ge("radius"),u=Ge("shadow"),d=Ge("inset-shadow"),h=Ge("text-shadow"),p=Ge("drop-shadow"),f=Ge("blur"),m=Ge("perspective"),g=Ge("aspect"),v=Ge("ease"),y=Ge("animate"),b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",yt,ht],x=()=>[yt,ht,l],_=()=>[et,"full","auto",...x()],w=()=>[nt,"none","subgrid",yt,ht],S=()=>["auto",{span:["full",nt,yt,ht]},nt,yt,ht],M=()=>[nt,"auto",yt,ht],E=()=>["auto","min","max","fr",yt,ht],T=()=>["auto",...x()],A=()=>[et,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],C=()=>[e,yt,ht],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",_t,mt,{position:[yt,ht]}],R=()=>["auto","cover","contain",wt,dt,{size:[yt,ht]}],P=()=>[rt,bt,pt],I=()=>["","none","full",c,yt,ht],L=()=>["",tt,bt,pt],N=()=>[tt,rt,_t,mt],O=()=>["","none",f,yt,ht],D=()=>["none",tt,yt,ht],U=()=>["none",tt,yt,ht],F=()=>[tt,yt,ht],z=()=>[et,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[it],breakpoint:[it],color:[ot],container:[it],"drop-shadow":[it],ease:["in","out","in-out"],font:[ut],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[it],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[it],shadow:[it],spacing:["px",tt],text:[it],"text-shadow":[it],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",et,ht,yt,g]}],container:["container"],columns:[{columns:[tt,ht,yt,s]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:b()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:_()}],"inset-x":[{"inset-x":_()}],"inset-y":[{"inset-y":_()}],start:[{start:_()}],end:[{end:_()}],top:[{top:_()}],right:[{right:_()}],bottom:[{bottom:_()}],left:[{left:_()}],visibility:["visible","invisible","collapse"],z:[{z:[nt,"auto",yt,ht]}],basis:[{basis:[et,"full","auto",s,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[tt,et,"auto","initial","none",ht]}],grow:[{grow:["",tt,yt,ht]}],shrink:[{shrink:["",tt,yt,ht]}],order:[{order:[nt,"first","last","none",yt,ht]}],"grid-cols":[{"grid-cols":w()}],"col-start-end":[{col:S()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":w()}],"row-start-end":[{row:S()}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:T()}],mx:[{mx:T()}],my:[{my:T()}],ms:[{ms:T()}],me:[{me:T()}],mt:[{mt:T()}],mr:[{mr:T()}],mb:[{mb:T()}],ml:[{ml:T()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:A()}],w:[{w:[s,"screen",...A()]}],"min-w":[{"min-w":[s,"screen","none",...A()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[a]},...A()]}],h:[{h:["screen","lh",...A()]}],"min-h":[{"min-h":["screen","lh","none",...A()]}],"max-h":[{"max-h":["screen","lh",...A()]}],"font-size":[{text:["base",n,bt,pt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,yt,ft]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",rt,ht]}],"font-family":[{font:[xt,ht,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,yt,ht]}],"line-clamp":[{"line-clamp":[tt,"none",yt,ft]}],leading:[{leading:[o,...x()]}],"list-image":[{"list-image":["none",yt,ht]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",yt,ht]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:C()}],"text-color":[{text:C()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[tt,"from-font","auto",yt,pt]}],"text-decoration-color":[{decoration:C()}],"underline-offset":[{"underline-offset":[tt,"auto",yt,ht]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:x()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",yt,ht]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",yt,ht]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:k()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:R()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},nt,yt,ht],radial:["",yt,ht],conic:[nt,yt,ht]},St,gt]}],"bg-color":[{bg:C()}],"gradient-from-pos":[{from:P()}],"gradient-via-pos":[{via:P()}],"gradient-to-pos":[{to:P()}],"gradient-from":[{from:C()}],"gradient-via":[{via:C()}],"gradient-to":[{to:C()}],rounded:[{rounded:I()}],"rounded-s":[{"rounded-s":I()}],"rounded-e":[{"rounded-e":I()}],"rounded-t":[{"rounded-t":I()}],"rounded-r":[{"rounded-r":I()}],"rounded-b":[{"rounded-b":I()}],"rounded-l":[{"rounded-l":I()}],"rounded-ss":[{"rounded-ss":I()}],"rounded-se":[{"rounded-se":I()}],"rounded-ee":[{"rounded-ee":I()}],"rounded-es":[{"rounded-es":I()}],"rounded-tl":[{"rounded-tl":I()}],"rounded-tr":[{"rounded-tr":I()}],"rounded-br":[{"rounded-br":I()}],"rounded-bl":[{"rounded-bl":I()}],"border-w":[{border:L()}],"border-w-x":[{"border-x":L()}],"border-w-y":[{"border-y":L()}],"border-w-s":[{"border-s":L()}],"border-w-e":[{"border-e":L()}],"border-w-t":[{"border-t":L()}],"border-w-r":[{"border-r":L()}],"border-w-b":[{"border-b":L()}],"border-w-l":[{"border-l":L()}],"divide-x":[{"divide-x":L()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":L()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:C()}],"border-color-x":[{"border-x":C()}],"border-color-y":[{"border-y":C()}],"border-color-s":[{"border-s":C()}],"border-color-e":[{"border-e":C()}],"border-color-t":[{"border-t":C()}],"border-color-r":[{"border-r":C()}],"border-color-b":[{"border-b":C()}],"border-color-l":[{"border-l":C()}],"divide-color":[{divide:C()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[tt,yt,ht]}],"outline-w":[{outline:["",tt,bt,pt]}],"outline-color":[{outline:C()}],shadow:[{shadow:["","none",u,Mt,vt]}],"shadow-color":[{shadow:C()}],"inset-shadow":[{"inset-shadow":["none",d,Mt,vt]}],"inset-shadow-color":[{"inset-shadow":C()}],"ring-w":[{ring:L()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:C()}],"ring-offset-w":[{"ring-offset":[tt,pt]}],"ring-offset-color":[{"ring-offset":C()}],"inset-ring-w":[{"inset-ring":L()}],"inset-ring-color":[{"inset-ring":C()}],"text-shadow":[{"text-shadow":["none",h,Mt,vt]}],"text-shadow-color":[{"text-shadow":C()}],opacity:[{opacity:[tt,yt,ht]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[tt]}],"mask-image-linear-from-pos":[{"mask-linear-from":N()}],"mask-image-linear-to-pos":[{"mask-linear-to":N()}],"mask-image-linear-from-color":[{"mask-linear-from":C()}],"mask-image-linear-to-color":[{"mask-linear-to":C()}],"mask-image-t-from-pos":[{"mask-t-from":N()}],"mask-image-t-to-pos":[{"mask-t-to":N()}],"mask-image-t-from-color":[{"mask-t-from":C()}],"mask-image-t-to-color":[{"mask-t-to":C()}],"mask-image-r-from-pos":[{"mask-r-from":N()}],"mask-image-r-to-pos":[{"mask-r-to":N()}],"mask-image-r-from-color":[{"mask-r-from":C()}],"mask-image-r-to-color":[{"mask-r-to":C()}],"mask-image-b-from-pos":[{"mask-b-from":N()}],"mask-image-b-to-pos":[{"mask-b-to":N()}],"mask-image-b-from-color":[{"mask-b-from":C()}],"mask-image-b-to-color":[{"mask-b-to":C()}],"mask-image-l-from-pos":[{"mask-l-from":N()}],"mask-image-l-to-pos":[{"mask-l-to":N()}],"mask-image-l-from-color":[{"mask-l-from":C()}],"mask-image-l-to-color":[{"mask-l-to":C()}],"mask-image-x-from-pos":[{"mask-x-from":N()}],"mask-image-x-to-pos":[{"mask-x-to":N()}],"mask-image-x-from-color":[{"mask-x-from":C()}],"mask-image-x-to-color":[{"mask-x-to":C()}],"mask-image-y-from-pos":[{"mask-y-from":N()}],"mask-image-y-to-pos":[{"mask-y-to":N()}],"mask-image-y-from-color":[{"mask-y-from":C()}],"mask-image-y-to-color":[{"mask-y-to":C()}],"mask-image-radial":[{"mask-radial":[yt,ht]}],"mask-image-radial-from-pos":[{"mask-radial-from":N()}],"mask-image-radial-to-pos":[{"mask-radial-to":N()}],"mask-image-radial-from-color":[{"mask-radial-from":C()}],"mask-image-radial-to-color":[{"mask-radial-to":C()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[tt]}],"mask-image-conic-from-pos":[{"mask-conic-from":N()}],"mask-image-conic-to-pos":[{"mask-conic-to":N()}],"mask-image-conic-from-color":[{"mask-conic-from":C()}],"mask-image-conic-to-color":[{"mask-conic-to":C()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:k()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",yt,ht]}],filter:[{filter:["","none",yt,ht]}],blur:[{blur:O()}],brightness:[{brightness:[tt,yt,ht]}],contrast:[{contrast:[tt,yt,ht]}],"drop-shadow":[{"drop-shadow":["","none",p,Mt,vt]}],"drop-shadow-color":[{"drop-shadow":C()}],grayscale:[{grayscale:["",tt,yt,ht]}],"hue-rotate":[{"hue-rotate":[tt,yt,ht]}],invert:[{invert:["",tt,yt,ht]}],saturate:[{saturate:[tt,yt,ht]}],sepia:[{sepia:["",tt,yt,ht]}],"backdrop-filter":[{"backdrop-filter":["","none",yt,ht]}],"backdrop-blur":[{"backdrop-blur":O()}],"backdrop-brightness":[{"backdrop-brightness":[tt,yt,ht]}],"backdrop-contrast":[{"backdrop-contrast":[tt,yt,ht]}],"backdrop-grayscale":[{"backdrop-grayscale":["",tt,yt,ht]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[tt,yt,ht]}],"backdrop-invert":[{"backdrop-invert":["",tt,yt,ht]}],"backdrop-opacity":[{"backdrop-opacity":[tt,yt,ht]}],"backdrop-saturate":[{"backdrop-saturate":[tt,yt,ht]}],"backdrop-sepia":[{"backdrop-sepia":["",tt,yt,ht]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":x()}],"border-spacing-x":[{"border-spacing-x":x()}],"border-spacing-y":[{"border-spacing-y":x()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",yt,ht]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[tt,"initial",yt,ht]}],ease:[{ease:["linear","initial",v,yt,ht]}],delay:[{delay:[tt,yt,ht]}],animate:[{animate:["none",y,yt,ht]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,yt,ht]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:D()}],"rotate-x":[{"rotate-x":D()}],"rotate-y":[{"rotate-y":D()}],"rotate-z":[{"rotate-z":D()}],scale:[{scale:U()}],"scale-x":[{"scale-x":U()}],"scale-y":[{"scale-y":U()}],"scale-z":[{"scale-z":U()}],"scale-3d":["scale-3d"],skew:[{skew:F()}],"skew-x":[{"skew-x":F()}],"skew-y":[{"skew-y":F()}],transform:[{transform:[yt,ht,"","none","gpu","cpu"]}],"transform-origin":[{origin:b()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:z()}],"translate-x":[{"translate-x":z()}],"translate-y":[{"translate-y":z()}],"translate-z":[{"translate-z":z()}],"translate-none":["translate-none"],accent:[{accent:C()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:C()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",yt,ht]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",yt,ht]}],fill:[{fill:["none",...C()]}],"stroke-w":[{stroke:[tt,bt,pt,ft]}],stroke:[{stroke:["none",...C()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function Ot(...e){return Nt(function(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=xe(e))&&(r&&(r+=" "),r+=t);return r}(e))}const Dt={background:"0 0% 100%",foreground:"240 10% 3.9%",card:"0 0% 100%",cardForeground:"240 10% 3.9%",primary:"160 84% 39%",primaryForeground:"0 0% 100%",muted:"240 4.8% 95.9%",mutedForeground:"240 3.8% 46.1%",border:"240 5.9% 90%",destructive:"0 84.2% 60.2%",radius:"0.5rem",spacing1:"0.25rem",spacing2:"0.5rem",spacing3:"0.75rem",spacing4:"1rem",spacing5:"0.75rem",spacing6:"1.5rem",spacing8:"2rem"},Ut="hsl(160, 84%, 39%)",Ft="BotUyo",zt="",Bt="bottom-right",Vt="¡Hola! ¿En qué puedo ayudarte?",jt="Escribe un mensaje...";function Ht(e){return e.primaryColor||Ut}const Wt={enabled:!0,messageEntry:"spring",typingIndicator:"wave",buttonEffects:!0,smoothScroll:!0,speedMultiplier:1,staggerDelay:50,windowTransitions:!0,launcherPulse:!0},Gt={glassmorphism:!0,gradients:!0,softShadows:!0,glowEffects:!0,particles:!1,soundEffects:!1,hapticFeedback:!0,shimmerLoading:!0,hoverLift:!0},Xt=w.createContext(Wt),qt=w.createContext(Gt);function $t({children:e,animations:t,effects:n}){const r=w.useMemo(()=>({...Wt,...t}),[t]),i=w.useMemo(()=>({...Gt,...n}),[n]);return C.jsx(Xt.Provider,{value:r,children:C.jsx(qt.Provider,{value:i,children:e})})}function Yt(){return"undefined"!=typeof window&&!!window.DEBUG}const Zt=(e,...t)=>{Yt()&&console.warn(`[BotUyo] ${e}`,...t)},Jt=(e,...t)=>{console.error(`[BotUyo] ${e}`,...t)},Kt=(e,...t)=>{Yt()&&console.debug(`[BotUyo] ${e}`,...t)},Qt=(e,...t)=>{Yt()&&console.info(`[BotUyo] ${e}`,...t)},en=`data:image/svg+xml,${encodeURIComponent('\n<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">\n <defs>\n <linearGradient id="bg" x1="0%" y1="0%" x2="100%" y2="100%">\n <stop offset="0%" style="stop-color:#10b981"/>\n <stop offset="100%" style="stop-color:#059669"/>\n </linearGradient>\n </defs>\n <circle cx="32" cy="32" r="32" fill="url(#bg)"/>\n <rect x="16" y="20" width="32" height="24" rx="4" fill="white"/>\n <circle cx="24" cy="30" r="3" fill="#10b981"/>\n <circle cx="40" cy="30" r="3" fill="#10b981"/>\n <rect x="22" y="36" width="20" height="3" rx="1.5" fill="#10b981"/>\n <rect x="28" y="12" width="8" height="8" rx="2" fill="white"/>\n</svg>\n')}`,tn=function(){const e=8e3,t=Math.floor(1200),n=2*t,r=44+n,i=new ArrayBuffer(r),o=new DataView(i);nn(o,0,"RIFF"),o.setUint32(4,r-8,!0),nn(o,8,"WAVE"),nn(o,12,"fmt "),o.setUint32(16,16,!0),o.setUint16(20,1,!0),o.setUint16(22,1,!0),o.setUint32(24,e,!0),o.setUint32(28,16e3,!0),o.setUint16(32,2,!0),o.setUint16(34,16,!0),nn(o,36,"data"),o.setUint32(40,n,!0);for(let l=0;l<t;l++){const n=l/e,r=1-l/t,i=Math.sin(2*Math.PI*880*n)*r*.5*32767;o.setInt16(44+2*l,i,!0)}const a=new Uint8Array(i);let s="";for(let l=0;l<a.length;l++)s+=String.fromCharCode(a[l]);return`data:audio/wav;base64,${btoa(s)}`}();function nn(e,t,n){for(let r=0;r<n.length;r++)e.setUint8(t+r,n.charCodeAt(r))}function rn({isOpen:e,onClick:t,unreadCount:n=0,primaryColor:r,logoUrl:i,starterPrompt:o,position:a="bottom-right",emotion:s="default",avatars:l={},styles:c,promptPersistence:u="session",avatarScale:d=1,showPromptAvatar:h=!1}){const{t:p}=V("extracted"),f=Ht({primaryColor:r}),m=c?.launcher?.bg,g=w.useContext(Xt),{triggerHaptic:v,getGlowClass:y}=function(){const e=w.useContext(qt);return{getGlassClass:()=>e.glassmorphism?"backdrop-blur-md bg-white/80 dark:bg-black/80":"",getShadowClass:()=>e.softShadows?"shadow-soft-xl":"shadow-md",getGlowClass:()=>e.glowEffects?"hover:shadow-primary/20":"",getHoverLiftClass:()=>e.hoverLift?"hover:-translate-y-1 hover:shadow-lg transition-all":"",getGradientClass:()=>e.gradients?"bg-gradient-to-br from-primary/10 to-transparent":"",getShimmerClass:()=>e.shimmerLoading?"animate-shimmer":"animate-pulse",triggerHaptic:()=>{e.hapticFeedback&&"vibrate"in navigator&&navigator.vibrate(10)},playSound:t=>{e.soundEffects&&console.log(`[Sound] ${t}`)},triggerParticles:t=>{e.particles&&console.log("[Particles] triggered on",t)}}}(),b=g.launcherPulse&&!1!==c?.launcher?.pulse,[x,_]=w.useState(!1),[S,M]=w.useState(!1),[E,T]=w.useState(!1),[A,k]=w.useState(!1),R="bottom-right"===a,P="chat_launcher_prompt_state",I=w.useMemo(()=>l[s]||l.default||i||en,[s,l,i]);w.useEffect(()=>{k(!1)},[I]),w.useEffect(()=>{const e=Object.values(l).filter(e=>!!e);i&&e.push(i),e.forEach(e=>{(new Image).src=e})},[l,i]),w.useEffect(()=>{"forever"===u&&"dismissed"===localStorage.getItem(P)&&T(!0)},[u]);const L=w.useCallback(()=>{M(!0),setTimeout(()=>_(!1),500),"always"!==u&&(T(!0),"forever"===u&&localStorage.setItem(P,"dismissed"))},[u]);w.useEffect(()=>{if("always"!==u&&E||!o||e)return void _(!1);const t=setTimeout(()=>{_(!0),M(!1)},2e3),n=setTimeout(()=>L(),12e3);return()=>{clearTimeout(t),clearTimeout(n)}},[o,e,E,u,L]);const N=()=>{Kt("Launcher handleMainAction called, isOpen:",e),v(),T(!0),"forever"===u&&localStorage.setItem(P,"dismissed"),t()};return C.jsxs("div",{className:Ot("flex items-center w-fit transition-all duration-500",R?"flex-row ml-auto":"flex-row-reverse mr-auto"),children:[C.jsx("div",{className:Ot("transition-all duration-700 ease-[cubic-bezier(0.34,1.56,0.64,1)] flex items-end",x?Ot("opacity-100 translate-x-0 translate-y-0 w-auto max-w-[320px]",R?"mr-3":"ml-3"):Ot("opacity-0 w-0 max-w-0 overflow-hidden pointer-events-none",R?"translate-x-6 translate-y-2":"-translate-x-6 translate-y-2")),children:C.jsxs("div",{className:Ot("relative cursor-pointer group",S&&"opacity-0 scale-90 transition-all duration-400",!x&&"hidden"),onClick:N,children:[C.jsxs("div",{style:{position:"relative",maxWidth:"290px",padding:"14px 40px 14px 18px",borderRadius:R?"20px 20px 8px 20px":"20px 20px 20px 8px",backgroundColor:"hsl(var(--background) / 0.95)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",color:"hsl(var(--foreground))",boxShadow:"0 8px 32px -8px rgba(0,0,0,0.15), 0 4px 12px -4px rgba(0,0,0,0.08), 0 0 0 1px hsl(var(--border) / 0.4), inset 0 1px 0 hsl(var(--background) / 0.8)",borderLeft:R?`3px solid ${f||"hsl(160,84%,39%)"}`:"none",borderRight:R?"none":`3px solid ${f||"hsl(160,84%,39%)"}`},children:[C.jsx("div",{style:{position:"absolute",bottom:"12px",[R?"right":"left"]:"-7px",width:"14px",height:"14px",backgroundColor:"hsl(var(--background) / 0.95)",transform:"rotate(45deg)",borderRadius:"2px",boxShadow:R?"4px 4px 8px -4px rgba(0,0,0,0.08), 1px 0 0 hsl(var(--border) / 0.4)":"-4px 4px 8px -4px rgba(0,0,0,0.08), 0 1px 0 hsl(var(--border) / 0.4)"}}),C.jsx("span",{style:{display:"block",fontSize:"14px",fontWeight:500,lineHeight:1.5,letterSpacing:"-0.01em",whiteSpace:"normal",wordBreak:"break-word"},children:o})]}),C.jsx("button",{onClick:e=>{e.stopPropagation(),L()},className:"opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",top:"6px",right:"8px",width:"22px",height:"22px",borderRadius:"50%",backgroundColor:"transparent",border:"none",boxShadow:"none",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",color:"hsl(var(--muted-foreground))",padding:0,transition:"all 0.15s"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="hsl(var(--muted) / 0.5)",e.currentTarget.style.color="hsl(var(--foreground))"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent",e.currentTarget.style.color="hsl(var(--muted-foreground))"},"aria-label":"Cerrar",children:C.jsx(ye,{className:"h-3 w-3",style:{strokeWidth:2.5}})})]})}),C.jsxs("div",{className:"relative flex items-center justify-center shrink-0",children:[!e&&b&&C.jsx("span",{className:"absolute inset-0 flex items-center justify-center",children:C.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full opacity-20",style:{backgroundColor:f}})}),C.jsxs("button",{type:"button",onClick:N,className:Ot("relative z-10 h-14 w-14 sm:h-16 sm:w-16","flex items-center justify-center text-white transition-all duration-500","hover:scale-110 active:scale-95 shadow-soft-xl cursor-pointer",!e&&"hover:rotate-6",!e&&g.enabled&&"animate-glow-pulse",c?.radius?.button||"rounded-full",m,y()),style:{backgroundColor:m?f||"hsl(160, 84%, 39%)":"transparent","--primary-glow":`${f}66`},"aria-label":e?"Cerrar chat":"Abrir chat",children:[C.jsxs("div",{className:"relative h-full w-full flex items-center justify-center overflow-hidden rounded-inherit",children:[C.jsx("div",{className:Ot("absolute inset-0 transition-all duration-500 flex items-center justify-center",e?"opacity-0 scale-50 rotate-90":"opacity-100 scale-100 rotate-0"),children:I&&!A?C.jsx("img",{src:I,alt:p("assistant"),className:"w-full h-full object-cover",style:{transform:`scale(${d})`},onError:()=>k(!0)},I):C.jsx(oe,{className:"h-7 w-7 sm:h-8 sm:w-8 fill-current"})}),C.jsx("div",{className:Ot("absolute inset-0 transition-all duration-500 flex items-center justify-center bg-black/5 dark:bg-white/10",e?"opacity-100 scale-100 rotate-0":"opacity-0 scale-50 -rotate-90"),children:C.jsx(ye,{className:"h-7 w-7 sm:h-8 sm:w-8 stroke-[2.5]"})})]}),!e&&n>0&&C.jsx("div",{className:"absolute -top-1 -right-1 z-20 flex h-6 w-6 items-center justify-center bg-destructive text-destructive-foreground rounded-full border-2 border-background text-[10px] font-black shadow-soft-md tabular-nums",children:n>9?"9+":n})]})]})]})}var on=x();function an(e,t,n){let r,i=n.initialDeps??[],o=!0;function a(){var a,s,l;let c;n.key&&(null==(a=n.debug)?void 0:a.call(n))&&(c=Date.now());const u=e();if(!(u.length!==i.length||u.some((e,t)=>i[t]!==e)))return r;let d;if(i=u,n.key&&(null==(s=n.debug)?void 0:s.call(n))&&(d=Date.now()),r=t(...u),n.key&&(null==(l=n.debug)?void 0:l.call(n))){const e=Math.round(100*(Date.now()-c))/100,t=Math.round(100*(Date.now()-d))/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,null==n?void 0:n.key)}return!(null==n?void 0:n.onChange)||o&&n.skipInitialOnChange||n.onChange(r),o=!1,r}return a.updateDeps=e=>{i=e},a}function sn(e,t){if(void 0===e)throw new Error("Unexpected undefined");return e}const ln=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},cn=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},un=e=>e,dn=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let i=t;i<=n;i++)r.push(i);return r},hn=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const i=e=>{const{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(cn(n)),!r.ResizeObserver)return()=>{};const o=new r.ResizeObserver(t=>{const r=()=>{const e=t[0];if(null==e?void 0:e.borderBoxSize){const t=e.borderBoxSize[0];if(t)return void i({width:t.inlineSize,height:t.blockSize})}i(cn(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},pn={passive:!0},fn="undefined"==typeof window||"onscrollend"in window,mn=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let i=0;const o=e.options.useScrollendEvent&&fn?()=>{}:ln(r,()=>{t(i,!1)},e.options.isScrollingResetDelay),a=r=>()=>{const{horizontal:a,isRtl:s}=e.options;i=a?n.scrollLeft*(s?-1:1):n.scrollTop,o(),t(i,r)},s=a(!0),l=a(!1);n.addEventListener("scroll",s,pn);const c=e.options.useScrollendEvent&&fn;return c&&n.addEventListener("scrollend",l,pn),()=>{n.removeEventListener("scroll",s),c&&n.removeEventListener("scrollend",l)}},gn=(e,t,n)=>{if(null==t?void 0:t.borderBoxSize){const e=t.borderBoxSize[0];if(e){return Math.round(e[n.options.horizontal?"inlineSize":"blockSize"])}}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},vn=(e,{adjustments:t=0,behavior:n},r)=>{var i,o;const a=e+t;null==(o=null==(i=r.scrollElement)?void 0:i.scrollTo)||o.call(i,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class yn{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.currentScrollToIndex=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let e=null;const t=()=>e||(this.targetWindow&&this.targetWindow.ResizeObserver?e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{const t=()=>{this._measureElement(e.target,e)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}):null);return{disconnect:()=>{var n;null==(n=t())||n.disconnect(),e=null},observe:e=>{var n;return null==(n=t())?void 0:n.observe(e,{box:"border-box"})},unobserve:e=>{var n;return null==(n=t())?void 0:n.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([t,n])=>{void 0===n&&delete e[t]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:un,rangeExtractor:dn,onChange:()=>{},measureElement:gn,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}},this.notify=e=>{var t,n;null==(n=(t=this.options).onChange)||n.call(t,this,e)},this.maybeNotify=an(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const t=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==t){if(this.cleanup(),!t)return void this.maybeNotify();this.scrollElement=t,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(e=this.scrollElement)?void 0:e.window)??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?"forward":"backward":null,this.scrollOffset=e,this.isScrolling=t,this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,t)=>{const n=new Map,r=new Map;for(let i=t-1;i>=0;i--){const t=e[i];if(n.has(t.lane))continue;const o=r.get(t.lane);if(null==o||t.end>o.end?r.set(t.lane,t):t.end<o.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurementOptions=an(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(e,t,n,r,i,o)=>(void 0!==this.prevLanes&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:o}),{key:!1}),this.getMeasurements=an(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:o},a)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(const u of this.laneAssignments.keys())u>=e&&this.laneAssignments.delete(u);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),0!==this.measurementsCache.length||this.lanesSettling||(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));const s=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);const l=this.measurementsCache.slice(0,s),c=new Array(o).fill(void 0);for(let u=0;u<s;u++){const e=l[u];e&&(c[e.lane]=u)}for(let u=s;u<e;u++){const e=r(u),i=this.laneAssignments.get(u);let o,s;if(void 0!==i&&this.options.lanes>1){o=i;const e=c[o],r=void 0!==e?l[e]:void 0;s=r?r.end+this.options.gap:t+n}else{const e=1===this.options.lanes?l[u-1]:this.getFurthestMeasurement(l,u);s=e?e.end+this.options.gap:t+n,o=e?e.lane:u%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(u,o)}const d=a.get(e),h="number"==typeof d?d:this.options.estimateSize(u),p=s+h;l[u]={index:u,start:s,size:h,end:p,key:e,lane:o},c[o]=u}return this.measurementsCache=l,l},{key:!1,debug:()=>this.options.debug}),this.calculateRange=an(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>this.range=e.length>0&&t>0?function({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const i=e.length-1,o=t=>e[t].start;if(e.length<=r)return{startIndex:0,endIndex:i};let a=bn(0,i,o,n),s=a;if(1===r)for(;s<i&&e[s].end<n+t;)s++;else if(r>1){const o=Array(r).fill(0);for(;s<i&&o.some(e=>e<n+t);){const t=e[s];o[t.lane]=t.end,s++}const l=Array(r).fill(n+t);for(;a>=0&&l.some(e=>e>=n);){const t=e[a];l[t.lane]=t.start,a--}a=Math.max(0,a-a%r),s=Math.min(i,s+(r-1-s%r))}return{startIndex:a,endIndex:s}}({measurements:e,outerSize:t,scrollOffset:n,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=an(()=>{let e=null,t=null;const n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>null===r||null===i?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this._measureElement=(e,t)=>{const n=this.indexFromElement(e),r=this.measurementsCache[n];if(!r)return;const i=r.key,o=this.elementsCache.get(i);o!==e&&(o&&this.observer.unobserve(o),this.observer.observe(e),this.elementsCache.set(i,e)),e.isConnected&&this.resizeItem(n,this.options.measureElement(e,t,this))},this.resizeItem=(e,t)=>{const n=this.measurementsCache[e];if(!n)return;const r=t-(this.itemSizeCache.get(n.key)??n.size);0!==r&&((void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(n,r,this):n.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,t)),this.notify(!1))},this.measureElement=e=>{e?this._measureElement(e,void 0):this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))})},this.getVirtualItems=an(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{const n=[];for(let r=0,i=e.length;r<i;r++){const i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const t=this.getMeasurements();if(0!==t.length)return sn(t[bn(0,t.length-1,e=>sn(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;const r=this.getSize(),i=this.getScrollOffset();"auto"===t&&(t=e>=i+r?"end":"start"),"center"===t?e+=(n-r)/2:"end"===t&&(e-=r);const o=this.getMaxScrollOffset();return Math.max(Math.min(o,e),0)},this.getOffsetForIndex=(e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const n=this.measurementsCache[e];if(!n)return;const r=this.getSize(),i=this.getScrollOffset();if("auto"===t)if(n.end>=i+r-this.options.scrollPaddingEnd)t="end";else{if(!(n.start<=i+this.options.scrollPaddingStart))return[i,t];t="start"}if("end"===t&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];const o="end"===t?n.end+this.options.scrollPaddingEnd:n.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,t,n.size),t]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(e,{align:t="start",behavior:n}={})=>{"smooth"===n&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,t),{adjustments:void 0,behavior:n})},this.scrollToIndex=(e,{align:t="auto",behavior:n}={})=>{"smooth"===n&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1)),this.currentScrollToIndex=e;let r=0;const i=t=>{if(!this.targetWindow)return;const r=this.getOffsetForIndex(e,t);if(!r)return void console.warn("Failed to get offset for index:",e);const[i,a]=r;this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.targetWindow.requestAnimationFrame(()=>{const t=()=>{if(this.currentScrollToIndex!==e)return;const t=this.getScrollOffset(),n=this.getOffsetForIndex(e,a);var r,i;n?(r=n[0],i=t,Math.abs(r-i)<1.01||o(a)):console.warn("Failed to get offset for index:",e)};this.isDynamicMode()?this.targetWindow.requestAnimationFrame(t):t()})},o=t=>{this.targetWindow&&this.currentScrollToIndex===e&&(r++,r<10?this.targetWindow.requestAnimationFrame(()=>i(t)):console.warn(`Failed to scroll to index ${e} after 10 attempts.`))};i(t)},this.scrollBy=(e,{behavior:t}={})=>{"smooth"===t&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:t})},this.getTotalSize=()=>{var e;const t=this.getMeasurements();let n;if(0===t.length)n=this.options.paddingStart;else if(1===this.options.lanes)n=(null==(e=t[t.length-1])?void 0:e.end)??0;else{const e=Array(this.options.lanes).fill(null);let r=t.length-1;for(;r>=0&&e.some(e=>null===e);){const n=t[r];null===e[n.lane]&&(e[n.lane]=n.end),r--}n=Math.max(...e.filter(e=>null!==e))}return Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}}const bn=(e,t,n,r)=>{for(;e<=t;){const i=(e+t)/2|0,o=n(i);if(o<r)e=i+1;else{if(!(o>r))return i;t=i-1}}return e>0?e-1:0};const xn="undefined"!=typeof document?w.useLayoutEffect:w.useEffect;function _n(e){return function({useFlushSync:e=!0,...t}){const n=w.useReducer(()=>({}),{})[1],r={...t,onChange:(r,i)=>{var o;e&&i?on.flushSync(n):n(),null==(o=t.onChange)||o.call(t,r,i)}},[i]=w.useState(()=>new yn(r));return i.setOptions(r),xn(()=>i._didMount(),[]),xn(()=>i._willUpdate()),i}({observeElementRect:hn,observeElementOffset:mn,scrollToFn:vn,...e})}function wn(){}function Sn(){}const Mn=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,En=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Tn={};function An(e,t){return(Tn.jsx?En:Mn).test(e)}const Cn=/[ \t\n\f\r]/g;function kn(e){return""===e.replace(Cn,"")}class Rn{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function Pn(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Rn(n,r,t)}function In(e){return e.toLowerCase()}Rn.prototype.normal={},Rn.prototype.property={},Rn.prototype.space=void 0;class Ln{constructor(e,t){this.attribute=t,this.property=e}}Ln.prototype.attribute="",Ln.prototype.booleanish=!1,Ln.prototype.boolean=!1,Ln.prototype.commaOrSpaceSeparated=!1,Ln.prototype.commaSeparated=!1,Ln.prototype.defined=!1,Ln.prototype.mustUseProperty=!1,Ln.prototype.number=!1,Ln.prototype.overloadedBoolean=!1,Ln.prototype.property="",Ln.prototype.spaceSeparated=!1,Ln.prototype.space=void 0;let Nn=0;const On=jn(),Dn=jn(),Un=jn(),Fn=jn(),zn=jn(),Bn=jn(),Vn=jn();function jn(){return 2**++Nn}const Hn=Object.freeze(Object.defineProperty({__proto__:null,boolean:On,booleanish:Dn,commaOrSpaceSeparated:Vn,commaSeparated:Bn,number:Fn,overloadedBoolean:Un,spaceSeparated:zn},Symbol.toStringTag,{value:"Module"})),Wn=Object.keys(Hn);class Gn extends Ln{constructor(e,t,n,r){let i=-1;if(super(e,t),Xn(this,"space",r),"number"==typeof n)for(;++i<Wn.length;){const e=Wn[i];Xn(this,Wn[i],(n&Hn[e])===Hn[e])}}}function Xn(e,t,n){n&&(e[t]=n)}function qn(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new Gn(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[In(r)]=r,n[In(o.attribute)]=r}return new Rn(t,n,e.space)}Gn.prototype.defined=!0;const $n=qn({properties:{ariaActiveDescendant:null,ariaAtomic:Dn,ariaAutoComplete:null,ariaBusy:Dn,ariaChecked:Dn,ariaColCount:Fn,ariaColIndex:Fn,ariaColSpan:Fn,ariaControls:zn,ariaCurrent:null,ariaDescribedBy:zn,ariaDetails:null,ariaDisabled:Dn,ariaDropEffect:zn,ariaErrorMessage:null,ariaExpanded:Dn,ariaFlowTo:zn,ariaGrabbed:Dn,ariaHasPopup:null,ariaHidden:Dn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:zn,ariaLevel:Fn,ariaLive:null,ariaModal:Dn,ariaMultiLine:Dn,ariaMultiSelectable:Dn,ariaOrientation:null,ariaOwns:zn,ariaPlaceholder:null,ariaPosInSet:Fn,ariaPressed:Dn,ariaReadOnly:Dn,ariaRelevant:null,ariaRequired:Dn,ariaRoleDescription:zn,ariaRowCount:Fn,ariaRowIndex:Fn,ariaRowSpan:Fn,ariaSelected:Dn,ariaSetSize:Fn,ariaSort:null,ariaValueMax:Fn,ariaValueMin:Fn,ariaValueNow:Fn,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function Yn(e,t){return t in e?e[t]:t}function Zn(e,t){return Yn(e,t.toLowerCase())}const Jn=qn({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Bn,acceptCharset:zn,accessKey:zn,action:null,allow:null,allowFullScreen:On,allowPaymentRequest:On,allowUserMedia:On,alt:null,as:null,async:On,autoCapitalize:null,autoComplete:zn,autoFocus:On,autoPlay:On,blocking:zn,capture:null,charSet:null,checked:On,cite:null,className:zn,cols:Fn,colSpan:null,content:null,contentEditable:Dn,controls:On,controlsList:zn,coords:Fn|Bn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:On,defer:On,dir:null,dirName:null,disabled:On,download:Un,draggable:Dn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:On,formTarget:null,headers:zn,height:Fn,hidden:Un,high:Fn,href:null,hrefLang:null,htmlFor:zn,httpEquiv:zn,id:null,imageSizes:null,imageSrcSet:null,inert:On,inputMode:null,integrity:null,is:null,isMap:On,itemId:null,itemProp:zn,itemRef:zn,itemScope:On,itemType:zn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:On,low:Fn,manifest:null,max:null,maxLength:Fn,media:null,method:null,min:null,minLength:Fn,multiple:On,muted:On,name:null,nonce:null,noModule:On,noValidate:On,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:On,optimum:Fn,pattern:null,ping:zn,placeholder:null,playsInline:On,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:On,referrerPolicy:null,rel:zn,required:On,reversed:On,rows:Fn,rowSpan:Fn,sandbox:zn,scope:null,scoped:On,seamless:On,selected:On,shadowRootClonable:On,shadowRootDelegatesFocus:On,shadowRootMode:null,shape:null,size:Fn,sizes:null,slot:null,span:Fn,spellCheck:Dn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Fn,step:null,style:null,tabIndex:Fn,target:null,title:null,translate:null,type:null,typeMustMatch:On,useMap:null,value:Dn,width:Fn,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:zn,axis:null,background:null,bgColor:null,border:Fn,borderColor:null,bottomMargin:Fn,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:On,declare:On,event:null,face:null,frame:null,frameBorder:null,hSpace:Fn,leftMargin:Fn,link:null,longDesc:null,lowSrc:null,marginHeight:Fn,marginWidth:Fn,noResize:On,noHref:On,noShade:On,noWrap:On,object:null,profile:null,prompt:null,rev:null,rightMargin:Fn,rules:null,scheme:null,scrolling:Dn,standby:null,summary:null,text:null,topMargin:Fn,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Fn,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:On,disableRemotePlayback:On,prefix:null,property:null,results:Fn,security:null,unselectable:null},space:"html",transform:Zn}),Kn=qn({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Vn,accentHeight:Fn,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Fn,amplitude:Fn,arabicForm:null,ascent:Fn,attributeName:null,attributeType:null,azimuth:Fn,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Fn,by:null,calcMode:null,capHeight:Fn,className:zn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Fn,diffuseConstant:Fn,direction:null,display:null,dur:null,divisor:Fn,dominantBaseline:null,download:On,dx:null,dy:null,edgeMode:null,editable:null,elevation:Fn,enableBackground:null,end:null,event:null,exponent:Fn,externalResourcesRequired:null,fill:null,fillOpacity:Fn,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Bn,g2:Bn,glyphName:Bn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Fn,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Fn,horizOriginX:Fn,horizOriginY:Fn,id:null,ideographic:Fn,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Fn,k:Fn,k1:Fn,k2:Fn,k3:Fn,k4:Fn,kernelMatrix:Vn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Fn,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Fn,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Fn,overlineThickness:Fn,paintOrder:null,panose1:null,path:null,pathLength:Fn,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:zn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Fn,pointsAtY:Fn,pointsAtZ:Fn,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Vn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Vn,rev:Vn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Vn,requiredFeatures:Vn,requiredFonts:Vn,requiredFormats:Vn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Fn,specularExponent:Fn,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Fn,strikethroughThickness:Fn,string:null,stroke:null,strokeDashArray:Vn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Fn,strokeOpacity:Fn,strokeWidth:null,style:null,surfaceScale:Fn,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Vn,tabIndex:Fn,tableValues:null,target:null,targetX:Fn,targetY:Fn,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Vn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Fn,underlineThickness:Fn,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Fn,values:null,vAlphabetic:Fn,vMathematical:Fn,vectorEffect:null,vHanging:Fn,vIdeographic:Fn,version:null,vertAdvY:Fn,vertOriginX:Fn,vertOriginY:Fn,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Fn,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Yn}),Qn=qn({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),er=qn({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Zn}),tr=qn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),nr={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},rr=/[A-Z]/g,ir=/-[a-z]/g,or=/^data[-\w.:]+$/i;function ar(e){return"-"+e.toLowerCase()}function sr(e){return e.charAt(1).toUpperCase()}const lr=Pn([$n,Jn,Qn,er,tr],"html"),cr=Pn([$n,Kn,Qn,er,tr],"svg");var ur,dr,hr,pr={};function fr(){if(hr)return pr;hr=1;var e=pr&&pr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(pr,"__esModule",{value:!0}),pr.default=function(e,n){let r=null;if(!e||"string"!=typeof e)return r;const i=(0,t.default)(e),o="function"==typeof n;return i.forEach(e=>{if("declaration"!==e.type)return;const{property:t,value:i}=e;o?n(t,i,e):i&&(r=r||{},r[t]=i)}),r};const t=e(function(){if(dr)return ur;dr=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,s=/^\s+|\s+$/g,l="";function c(e){return e?e.replace(s,l):l}return ur=function(s,u){if("string"!=typeof s)throw new TypeError("First argument must be a string");if(!s)return[];u=u||{};var d=1,h=1;function p(e){var n=e.match(t);n&&(d+=n.length);var r=e.lastIndexOf("\n");h=~r?e.length-r:h+e.length}function f(){var e={line:d,column:h};return function(t){return t.position=new m(e),y(),t}}function m(e){this.start=e,this.end={line:d,column:h},this.source=u.source}function g(e){var t=new Error(u.source+":"+d+":"+h+": "+e);if(t.reason=e,t.filename=u.source,t.line=d,t.column=h,t.source=s,!u.silent)throw t}function v(e){var t=e.exec(s);if(t){var n=t[0];return p(n),s=s.slice(n.length),t}}function y(){v(n)}function b(e){var t;for(e=e||[];t=x();)!1!==t&&e.push(t);return e}function x(){var e=f();if("/"==s.charAt(0)&&"*"==s.charAt(1)){for(var t=2;l!=s.charAt(t)&&("*"!=s.charAt(t)||"/"!=s.charAt(t+1));)++t;if(t+=2,l===s.charAt(t-1))return g("End of comment missing");var n=s.slice(2,t-2);return h+=2,p(n),s=s.slice(t),h+=2,e({type:"comment",comment:n})}}function _(){var t=f(),n=v(r);if(n){if(x(),!v(i))return g("property missing ':'");var s=v(o),u=t({type:"declaration",property:c(n[0].replace(e,l)),value:s?c(s[0].replace(e,l)):l});return v(a),u}}return m.prototype.content=s,y(),function(){var e,t=[];for(b(t);e=_();)!1!==e&&(t.push(e),b(t));return t}()}}());return pr}var mr,gr,vr,yr={};function br(){if(mr)return yr;mr=1,Object.defineProperty(yr,"__esModule",{value:!0}),yr.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(e,t){return t.toUpperCase()},a=function(e,t){return"".concat(t,"-")};return yr.camelCase=function(s,l){return void 0===l&&(l={}),function(t){return!t||n.test(t)||e.test(t)}(s)?s:(s=s.toLowerCase(),(s=l.reactCompat?s.replace(i,a):s.replace(r,a)).replace(t,o))},yr}const xr=t(function(){if(vr)return gr;vr=1;var e=(gr&&gr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(fr()),t=br();function n(n,r){var i={};return n&&"string"==typeof n?((0,e.default)(n,function(e,n){e&&n&&(i[(0,t.camelCase)(e,r)]=n)}),i):i}return n.default=n,gr=n}()),_r=Sr("end"),wr=Sr("start");function Sr(e){return function(t){const n=t&&t.position&&t.position[e]||{};if("number"==typeof n.line&&n.line>0&&"number"==typeof n.column&&n.column>0)return{line:n.line,column:n.column,offset:"number"==typeof n.offset&&n.offset>-1?n.offset:void 0}}}function Mr(e){const t=wr(e),n=_r(e);if(t&&n)return{start:t,end:n}}function Er(e){return e&&"object"==typeof e?"position"in e||"type"in e?Ar(e.position):"start"in e||"end"in e?Ar(e):"line"in e||"column"in e?Tr(e):"":""}function Tr(e){return Cr(e&&e.line)+":"+Cr(e&&e.column)}function Ar(e){return Tr(e&&e.start)+"-"+Tr(e&&e.end)}function Cr(e){return e&&"number"==typeof e?e:1}class kr extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",i={},o=!1;if(t&&(i="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!i.cause&&e&&(o=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){const e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}const a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=a?a.line:void 0,this.name=Er(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&"string"==typeof i.cause.stack?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}kr.prototype.file="",kr.prototype.name="",kr.prototype.reason="",kr.prototype.message="",kr.prototype.stack="",kr.prototype.column=void 0,kr.prototype.line=void 0,kr.prototype.ancestors=void 0,kr.prototype.cause=void 0,kr.prototype.fatal=void 0,kr.prototype.place=void 0,kr.prototype.ruleId=void 0,kr.prototype.source=void 0;const Rr={}.hasOwnProperty,Pr=new Map,Ir=/[A-Z]/g,Lr=new Set(["table","tbody","thead","tfoot","tr"]),Nr=new Set(["td","th"]),Or="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Dr(e,t){if(!t||void 0===t.Fragment)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if("function"!=typeof t.jsxDEV)throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=function(e,t){return n;function n(n,r,i,o){const a=Array.isArray(i.children),s=wr(n);return t(r,i,o,a,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}(n,t.jsxDEV)}else{if("function"!=typeof t.jsx)throw new TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw new TypeError("Expected `jsxs` in production options");r=function(e,t,n){return r;function r(e,r,i,o){const a=Array.isArray(i.children)?n:t;return o?a(r,i,o):a(r,i)}}(0,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?cr:lr,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},o=Ur(i,e,void 0);return o&&"string"!=typeof o?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function Ur(e,t,n){return"element"===t.type?function(e,t,n){const r=e.schema;let i=r;"svg"===t.tagName.toLowerCase()&&"html"===r.space&&(i=cr,e.schema=i);e.ancestors.push(t);const o=jr(e,t.tagName,!1),a=function(e,t){const n={};let r,i;for(i in t.properties)if("children"!==i&&Rr.call(t.properties,i)){const o=Vr(e,i,t.properties[i]);if(o){const[i,a]=o;e.tableCellAlignToStyle&&"align"===i&&"string"==typeof a&&Nr.has(t.tagName)?r=a:n[i]=a}}if(r){(n.style||(n.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=r}return n}(e,t);let s=Br(e,t);Lr.has(t.tagName)&&(s=s.filter(function(e){return"string"!=typeof e||!("object"==typeof(t=e)?"text"===t.type&&kn(t.value):kn(t));var t}));return Fr(e,a,o,t),zr(a,s),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}(e,t,n):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Hr(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?function(e,t,n){const r=e.schema;let i=r;"svg"===t.name&&"html"===r.space&&(i=cr,e.schema=i);e.ancestors.push(t);const o=null===t.name?e.Fragment:jr(e,t.name,!0),a=function(e,t){const n={};for(const r of t.attributes)if("mdxJsxExpressionAttribute"===r.type)if(r.data&&r.data.estree&&e.evaluater){const t=r.data.estree.body[0];wn(t.type);const i=t.expression;wn(i.type);const o=i.properties[0];wn(o.type),Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else Hr(e,t.position);else{const i=r.name;let o;if(r.value&&"object"==typeof r.value)if(r.value.data&&r.value.data.estree&&e.evaluater){const t=r.value.data.estree.body[0];wn(t.type),o=e.evaluater.evaluateExpression(t.expression)}else Hr(e,t.position);else o=null===r.value||r.value;n[i]=o}return n}(e,t),s=Br(e,t);return Fr(e,a,o,t),zr(a,s),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}(e,t,n):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Hr(e,t.position)}(e,t):"root"===t.type?function(e,t,n){const r={};return zr(r,Br(e,t)),e.create(t,e.Fragment,r,n)}(e,t,n):"text"===t.type?function(e,t){return t.value}(0,t):void 0}function Fr(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function zr(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Br(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:Pr;for(;++r<t.children.length;){const o=t.children[r];let a;if(e.passKeys){const e="element"===o.type?o.tagName:"mdxJsxFlowElement"===o.type||"mdxJsxTextElement"===o.type?o.name:void 0;if(e){const t=i.get(e)||0;a=e+"-"+t,i.set(e,t+1)}}const s=Ur(e,o,a);void 0!==s&&n.push(s)}return n}function Vr(e,t,n){const r=function(e,t){const n=In(t);let r=t,i=Ln;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&or.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(ir,sr);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!ir.test(e)){let n=e.replace(rr,ar);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}i=Gn}return new i(r,t)}(e.schema,t);if(!(null==n||"number"==typeof n&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?function(e){const t={};return(""===e[e.length-1]?[...e,""]:e).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()}(n):n.join(" ").trim()),"style"===r.property){let t="object"==typeof n?n:function(e,t){try{return xr(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const t=n,r=new kr("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:t,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=Or+"#cannot-parse-style-attribute",r}}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){const t={};let n;for(n in e)Rr.call(e,n)&&(t[Wr(n)]=e[n]);return t}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&r.space?nr[r.property]||r.property:r.attribute,n]}}function jr(e,t,n){let r;if(n)if(t.includes(".")){const e=t.split(".");let n,i=-1;for(;++i<e.length;){const t=An(e[i])?{type:"Identifier",name:e[i]}:{type:"Literal",value:e[i]};n=n?{type:"MemberExpression",object:n,property:t,computed:Boolean(i&&"Literal"===t.type),optional:!1}:t}r=n}else r=An(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else r={type:"Literal",value:t};if("Literal"===r.type){const t=r.value;return Rr.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Hr(e)}function Hr(e,t){const n=new kr("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Or+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Wr(e){let t=e.replace(Ir,Gr);return"ms-"===t.slice(0,3)&&(t="-"+t),t}function Gr(e){return"-"+e.toLowerCase()}const Xr={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},qr={};function $r(e,t){return Yr(e,"boolean"!=typeof qr.includeImageAlt||qr.includeImageAlt,"boolean"!=typeof qr.includeHtml||qr.includeHtml)}function Yr(e,t,n){if(function(e){return Boolean(e&&"object"==typeof e)}(e)){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Zr(e.children,t,n)}return Array.isArray(e)?Zr(e,t,n):""}function Zr(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=Yr(e[i],t,n);return r.join("")}const Jr=document.createElement("i");function Kr(e){const t="&"+e+";";Jr.innerHTML=t;const n=Jr.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&(n!==t&&n)}function Qr(e,t,n,r){const i=e.length;let o,a=0;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function ei(e,t){return e.length>0?(Qr(e,e.length,0,t),e):t}const ti={}.hasOwnProperty;function ni(e){const t={};let n=-1;for(;++n<e.length;)ri(t,e[n]);return t}function ri(e,t){let n;for(n in t){const r=(ti.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){ti.call(r,o)||(r[o]=[]);const e=i[o];ii(r[o],Array.isArray(e)?e:e?[e]:[])}}}function ii(e,t){let n=-1;const r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);Qr(e,0,0,r)}function oi(e,t){const n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||65534==(65535&n)||n>1114111?"�":String.fromCodePoint(n)}function ai(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const si=bi(/[A-Za-z]/),li=bi(/[\dA-Za-z]/),ci=bi(/[#-'*+\--9=?A-Z^-~]/);function ui(e){return null!==e&&(e<32||127===e)}const di=bi(/\d/),hi=bi(/[\dA-Fa-f]/),pi=bi(/[!-/:-@[-`{-~]/);function fi(e){return null!==e&&e<-2}function mi(e){return null!==e&&(e<0||32===e)}function gi(e){return-2===e||-1===e||32===e}const vi=bi(new RegExp("\\p{P}|\\p{S}","u")),yi=bi(/\s/);function bi(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xi(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let a="";if(37===o&&li(e.charCodeAt(n+1))&&li(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(a=String.fromCharCode(o));else if(o>55295&&o<57344){const t=e.charCodeAt(n+1);o<56320&&t>56319&&t<57344?(a=String.fromCharCode(o,t),i=1):a="�"}else a=String.fromCharCode(o);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function _i(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return function(r){if(gi(r))return e.enter(n),a(r);return t(r)};function a(r){return gi(r)&&o++<i?(e.consume(r),a):(e.exit(n),t(r))}}const wi={tokenize:function(e){const t=e.attempt(this.parser.constructs.contentInitial,function(n){if(null===n)return void e.consume(n);return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),_i(e,t,"linePrefix")},function(t){return e.enter("paragraph"),r(t)});let n;return t;function r(t){const r=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=r),n=r,i(t)}function i(t){return null===t?(e.exit("chunkText"),e.exit("paragraph"),void e.consume(t)):fi(t)?(e.consume(t),e.exit("chunkText"),r):(e.consume(t),i)}}};const Si={tokenize:function(e){const t=this,n=[];let r,i,o,a=0;return s;function s(r){if(a<n.length){const i=n[a];return t.containerState=i[1],e.attempt(i[0].continuation,l,c)(r)}return c(r)}function l(e){if(a++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&y();const n=t.events.length;let i,o=n;for(;o--;)if("exit"===t.events[o][0]&&"chunkFlow"===t.events[o][1].type){i=t.events[o][1].end;break}v(a);let s=n;for(;s<t.events.length;)t.events[s][1].end={...i},s++;return Qr(t.events,o+1,0,t.events.slice(n)),t.events.length=s,c(e)}return s(e)}function c(i){if(a===n.length){if(!r)return h(i);if(r.currentConstruct&&r.currentConstruct.concrete)return f(i);t.interrupt=Boolean(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Mi,u,d)(i)}function u(e){return r&&y(),v(a),h(e)}function d(e){return t.parser.lazy[t.now().line]=a!==n.length,o=t.now().offset,f(e)}function h(n){return t.containerState={},e.attempt(Mi,p,f)(n)}function p(e){return a++,n.push([t.currentConstruct,t.containerState]),h(e)}function f(n){return null===n?(r&&y(),v(0),void e.consume(n)):(r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:i}),m(n))}function m(n){return null===n?(g(e.exit("chunkFlow"),!0),v(0),void e.consume(n)):fi(n)?(e.consume(n),g(e.exit("chunkFlow")),a=0,t.interrupt=void 0,s):(e.consume(n),m)}function g(e,n){const s=t.sliceStream(e);if(n&&s.push(null),e.previous=i,i&&(i.next=e),i=e,r.defineSkip(e.start),r.write(s),t.parser.lazy[e.start.line]){let e=r.events.length;for(;e--;)if(r.events[e][1].start.offset<o&&(!r.events[e][1].end||r.events[e][1].end.offset>o))return;const n=t.events.length;let i,s,l=n;for(;l--;)if("exit"===t.events[l][0]&&"chunkFlow"===t.events[l][1].type){if(i){s=t.events[l][1].end;break}i=!0}for(v(a),e=n;e<t.events.length;)t.events[e][1].end={...s},e++;Qr(t.events,l+1,0,t.events.slice(n)),t.events.length=e}}function v(r){let i=n.length;for(;i-- >r;){const r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function y(){r.write([null]),i=void 0,r=void 0,t.containerState._closeFlow=void 0}}},Mi={tokenize:function(e,t,n){return _i(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function Ei(e){return null===e||mi(e)||yi(e)?1:vi(e)?2:void 0}function Ti(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const Ai={name:"attention",resolveAll:function(e,t){let n,r,i,o,a,s,l,c,u=-1;for(;++u<e.length;)if("enter"===e[u][0]&&"attentionSequence"===e[u][1].type&&e[u][1]._close)for(n=u;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[u][1]).charCodeAt(0)){if((e[n][1]._close||e[u][1]._open)&&(e[u][1].end.offset-e[u][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[u][1].end.offset-e[u][1].start.offset)%3))continue;s=e[n][1].end.offset-e[n][1].start.offset>1&&e[u][1].end.offset-e[u][1].start.offset>1?2:1;const d={...e[n][1].end},h={...e[u][1].start};Ci(d,-s),Ci(h,s),o={type:s>1?"strongSequence":"emphasisSequence",start:d,end:{...e[n][1].end}},a={type:s>1?"strongSequence":"emphasisSequence",start:{...e[u][1].start},end:h},i={type:s>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[u][1].start}},r={type:s>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[n][1].end={...o.start},e[u][1].start={...a.end},l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=ei(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=ei(l,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",i,t]]),l=ei(l,Ti(t.parser.constructs.insideSpan.null,e.slice(n+1,u),t)),l=ei(l,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",r,t]]),e[u][1].end.offset-e[u][1].start.offset?(c=2,l=ei(l,[["enter",e[u][1],t],["exit",e[u][1],t]])):c=0,Qr(e,n-1,u-n+3,l),u=n+l.length-c-2;break}u=-1;for(;++u<e.length;)"attentionSequence"===e[u][1].type&&(e[u][1].type="data");return e},tokenize:function(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Ei(r);let o;return function(t){return o=t,e.enter("attentionSequence"),a(t)};function a(s){if(s===o)return e.consume(s),a;const l=e.exit("attentionSequence"),c=Ei(s),u=!c||2===c&&i||n.includes(s),d=!i||2===i&&c||n.includes(r);return l._open=Boolean(42===o?u:u&&(i||!d)),l._close=Boolean(42===o?d:d&&(c||!u)),t(s)}}};function Ci(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const ki={name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i};function i(t){return si(t)?(e.consume(t),o):64===t?n(t):l(t)}function o(e){return 43===e||45===e||46===e||li(e)?(r=1,a(e)):l(e)}function a(t){return 58===t?(e.consume(t),r=0,s):(43===t||45===t||46===t||li(t))&&r++<32?(e.consume(t),a):(r=0,l(t))}function s(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||ui(r)?n(r):(e.consume(r),s)}function l(t){return 64===t?(e.consume(t),c):ci(t)?(e.consume(t),l):n(t)}function c(e){return li(e)?u(e):n(e)}function u(n){return 46===n?(e.consume(n),r=0,c):62===n?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):d(n)}function d(t){if((45===t||li(t))&&r++<63){const n=45===t?d:u;return e.consume(t),n}return n(t)}}};const Ri={partial:!0,tokenize:function(e,t,n){return function(t){return gi(t)?_i(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||fi(e)?t(e):n(e)}}};const Pi={continuation:{tokenize:function(e,t,n){const r=this;return function(t){if(gi(t))return _i(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t);return i(t)};function i(r){return e.attempt(Pi,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){const r=this;return function(t){if(62===t){const n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),i}return n(t)};function i(n){return gi(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}};const Ii={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return pi(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}};const Li={name:"characterReference",tokenize:function(e,t,n){const r=this;let i,o,a=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),s};function s(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),i=31,o=li,c(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=hi,c):(e.enter("characterReferenceValue"),i=7,o=di,c(t))}function c(s){if(59===s&&a){const i=e.exit("characterReferenceValue");return o!==li||Kr(r.sliceSerialize(i))?(e.enter("characterReferenceMarker"),e.consume(s),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(s)}return o(s)&&a++<i?(e.consume(s),c):n(s)}}};const Ni={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){if(null===t)return n(t);return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},Oi={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){const r=this,i={partial:!0,tokenize:function(e,t,n){let i=0;return a;function a(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),l}function l(t){return e.enter("codeFencedFence"),gi(t)?_i(e,c,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):c(t)}function c(t){return t===o?(e.enter("codeFencedFenceSequence"),u(t)):n(t)}function u(t){return t===o?(i++,e.consume(t),u):i>=s?(e.exit("codeFencedFenceSequence"),gi(t)?_i(e,d,"whitespace")(t):d(t)):n(t)}function d(r){return null===r||fi(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}};let o,a=0,s=0;return function(t){return function(t){const n=r.events[r.events.length-1];return a=n&&"linePrefix"===n[1].type?n[2].sliceSerialize(n[1],!0).length:0,o=t,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),l(t)}(t)};function l(t){return t===o?(s++,e.consume(t),l):s<3?n(t):(e.exit("codeFencedFenceSequence"),gi(t)?_i(e,c,"whitespace")(t):c(t))}function c(n){return null===n||fi(n)?(e.exit("codeFencedFence"),r.interrupt?t(n):e.check(Ni,p,y)(n)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),u(n))}function u(t){return null===t||fi(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(t)):gi(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),_i(e,d,"whitespace")(t)):96===t&&t===o?n(t):(e.consume(t),u)}function d(t){return null===t||fi(t)?c(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),h(t))}function h(t){return null===t||fi(t)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(t)):96===t&&t===o?n(t):(e.consume(t),h)}function p(t){return e.attempt(i,y,f)(t)}function f(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),m}function m(t){return a>0&&gi(t)?_i(e,g,"linePrefix",a+1)(t):g(t)}function g(t){return null===t||fi(t)?e.check(Ni,p,y)(t):(e.enter("codeFlowValue"),v(t))}function v(t){return null===t||fi(t)?(e.exit("codeFlowValue"),g(t)):(e.consume(t),v)}function y(n){return e.exit("codeFenced"),t(n)}}};const Di={name:"codeIndented",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("codeIndented"),_i(e,i,"linePrefix",5)(t)};function i(e){const t=r.events[r.events.length-1];return t&&"linePrefix"===t[1].type&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return null===t?s(t):fi(t)?e.attempt(Ui,o,s)(t):(e.enter("codeFlowValue"),a(t))}function a(t){return null===t||fi(t)?(e.exit("codeFlowValue"),o(t)):(e.consume(t),a)}function s(n){return e.exit("codeIndented"),t(n)}}},Ui={partial:!0,tokenize:function(e,t,n){const r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):fi(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):_i(e,o,"linePrefix",5)(t)}function o(e){const o=r.events[r.events.length-1];return o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?t(e):fi(e)?i(e):n(e)}}};const Fi={name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,i=3;if(!("lineEnding"!==e[i][1].type&&"space"!==e[i][1].type||"lineEnding"!==e[r][1].type&&"space"!==e[r][1].type))for(t=i;++t<r;)if("codeTextData"===e[t][1].type){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}t=i-1,r++;for(;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):t!==r&&"lineEnding"!==e[t][1].type||(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let r,i,o=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),a(t)};function a(t){return 96===t?(e.consume(t),o++,a):(e.exit("codeTextSequence"),s(t))}function s(t){return null===t?n(t):32===t?(e.enter("space"),e.consume(t),e.exit("space"),s):96===t?(i=e.enter("codeTextSequence"),r=0,c(t)):fi(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),s):(e.enter("codeTextData"),l(t))}function l(t){return null===t||32===t||96===t||fi(t)?(e.exit("codeTextData"),s(t)):(e.consume(t),l)}function c(n){return 96===n?(e.consume(n),r++,c):r===o?(e.exit("codeTextSequence"),e.exit("codeText"),t(n)):(i.type="codeTextData",l(n))}}};class zi{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){const n=null==t?Number.POSITIVE_INFINITY:t;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){const r=t||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return n&&Bi(this.left,n),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Bi(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Bi(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&0===this.right.length||e<0&&0===this.left.length))if(e<this.left.length){const t=this.left.splice(e,Number.POSITIVE_INFINITY);Bi(this.right,t.reverse())}else{const t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Bi(this.left,t.reverse())}}}function Bi(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Vi(e){const t={};let n,r,i,o,a,s,l,c=-1;const u=new zi(e);for(;++c<u.length;){for(;c in t;)c=t[c];if(n=u.get(c),c&&"chunkFlow"===n[1].type&&"listItemPrefix"===u.get(c-1)[1].type&&(s=n[1]._tokenizer.events,i=0,i<s.length&&"lineEndingBlank"===s[i][1].type&&(i+=2),i<s.length&&"content"===s[i][1].type))for(;++i<s.length&&"content"!==s[i][1].type;)"chunkText"===s[i][1].type&&(s[i][1]._isInFirstContentOfListItem=!0,i++);if("enter"===n[0])n[1].contentType&&(Object.assign(t,ji(u,c)),c=t[c],l=!0);else if(n[1]._container){for(i=c,r=void 0;i--;)if(o=u.get(i),"lineEnding"===o[1].type||"lineEndingBlank"===o[1].type)"enter"===o[0]&&(r&&(u.get(r)[1].type="lineEndingBlank"),o[1].type="lineEnding",r=i);else if("linePrefix"!==o[1].type&&"listItemIndent"!==o[1].type)break;r&&(n[1].end={...u.get(r)[1].start},a=u.slice(r,c),a.unshift(n),u.splice(r,c-r+1,a))}}return Qr(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!l}function ji(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const s=a.events,l=[],c={};let u,d,h=-1,p=n,f=0,m=0;const g=[m];for(;p;){for(;e.get(++i)[1]!==p;);o.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&a.defineSkip(p.start),p._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(u),p._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++h<s.length;)"exit"===s[h][0]&&"enter"===s[h-1][0]&&s[h][1].type===s[h-1][1].type&&s[h][1].start.line!==s[h][1].end.line&&(m=h+1,g.push(m),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(a.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),h=g.length;h--;){const t=s.slice(g[h],g[h+1]),n=o.pop();l.push([n,n+t.length-1]),e.splice(n,2,t)}for(l.reverse(),h=-1;++h<l.length;)c[f+l[h][0]]=f+l[h][1],f+=l[h][1]-l[h][0]-1;return c}const Hi={resolve:function(e){return Vi(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?i(t):fi(t)?e.check(Wi,o,i)(t):(e.consume(t),r)}function i(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function o(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}},Wi={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),_i(e,i,"linePrefix")};function i(i){if(null===i||fi(i))return n(i);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}};function Gi(e,t,n,r,i,o,a,s,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return function(t){if(60===t)return e.enter(r),e.enter(i),e.enter(o),e.consume(t),e.exit(o),d;if(null===t||32===t||41===t||ui(t))return n(t);return e.enter(r),e.enter(a),e.enter(s),e.enter("chunkString",{contentType:"string"}),f(t)};function d(n){return 62===n?(e.enter(o),e.consume(n),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),h(n))}function h(t){return 62===t?(e.exit("chunkString"),e.exit(s),d(t)):null===t||60===t||fi(t)?n(t):(e.consume(t),92===t?p:h)}function p(t){return 60===t||62===t||92===t?(e.consume(t),h):h(t)}function f(i){return u||null!==i&&41!==i&&!mi(i)?u<c&&40===i?(e.consume(i),u++,f):41===i?(e.consume(i),u--,f):null===i||32===i||40===i||ui(i)?n(i):(e.consume(i),92===i?m:f):(e.exit("chunkString"),e.exit(s),e.exit(a),e.exit(r),t(i))}function m(t){return 40===t||41===t||92===t?(e.consume(t),f):f(t)}}function Xi(e,t,n,r,i,o){const a=this;let s,l=0;return function(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(o),c};function c(d){return l>999||null===d||91===d||93===d&&!s||94===d&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(d):93===d?(e.exit(o),e.enter(i),e.consume(d),e.exit(i),e.exit(r),t):fi(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),u(d))}function u(t){return null===t||91===t||93===t||fi(t)||l++>999?(e.exit("chunkString"),c(t)):(e.consume(t),s||(s=!gi(t)),92===t?d:u)}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,u):u(t)}}function qi(e,t,n,r,i,o){let a;return function(t){if(34===t||39===t||40===t)return e.enter(r),e.enter(i),e.consume(t),e.exit(i),a=40===t?41:t,s;return n(t)};function s(n){return n===a?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(o),l(n))}function l(t){return t===a?(e.exit(o),s(a)):null===t?n(t):fi(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),_i(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(t))}function c(t){return t===a||null===t||fi(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return t===a||92===t?(e.consume(t),c):c(t)}}function $i(e,t){let n;return function r(i){if(fi(i))return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r;if(gi(i))return _i(e,r,n?"linePrefix":"lineSuffix")(i);return t(i)}}const Yi={name:"definition",tokenize:function(e,t,n){const r=this;let i;return function(t){return e.enter("definition"),function(t){return Xi.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(t)}(t)};function o(t){return i=ai(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),a):n(t)}function a(t){return mi(t)?$i(e,s)(t):s(t)}function s(t){return Gi(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(Zi,c,c)(t)}function c(t){return gi(t)?_i(e,u,"whitespace")(t):u(t)}function u(o){return null===o||fi(o)?(e.exit("definition"),r.parser.defined.push(i),t(o)):n(o)}}},Zi={partial:!0,tokenize:function(e,t,n){return function(t){return mi(t)?$i(e,r)(t):n(t)};function r(t){return qi(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function i(t){return gi(t)?_i(e,o,"whitespace")(t):o(t)}function o(e){return null===e||fi(e)?t(e):n(e)}}};const Ji={name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return fi(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}};const Ki={name:"headingAtx",resolve:function(e,t){let n,r,i=e.length-2,o=3;"whitespace"===e[o][1].type&&(o+=2);i-2>o&&"whitespace"===e[i][1].type&&(i-=2);"atxHeadingSequence"===e[i][1].type&&(o===i-1||i-4>o&&"whitespace"===e[i-2][1].type)&&(i-=o+1===i?2:4);i>o&&(n={type:"atxHeadingText",start:e[o][1].start,end:e[i][1].end},r={type:"chunkText",start:e[o][1].start,end:e[i][1].end,contentType:"text"},Qr(e,o,i-o+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]]));return e},tokenize:function(e,t,n){let r=0;return function(t){return e.enter("atxHeading"),function(t){return e.enter("atxHeadingSequence"),i(t)}(t)};function i(t){return 35===t&&r++<6?(e.consume(t),i):null===t||mi(t)?(e.exit("atxHeadingSequence"),o(t)):n(t)}function o(n){return 35===n?(e.enter("atxHeadingSequence"),a(n)):null===n||fi(n)?(e.exit("atxHeading"),t(n)):gi(n)?_i(e,o,"whitespace")(n):(e.enter("atxHeadingText"),s(n))}function a(t){return 35===t?(e.consume(t),a):(e.exit("atxHeadingSequence"),o(t))}function s(t){return null===t||35===t||mi(t)?(e.exit("atxHeadingText"),o(t)):(e.consume(t),s)}}};const Qi=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],eo=["pre","script","style","textarea"],to={concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2));return e},tokenize:function(e,t,n){const r=this;let i,o,a,s,l;return function(t){return function(t){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(t),c}(t)};function c(s){return 33===s?(e.consume(s),u):47===s?(e.consume(s),o=!0,p):63===s?(e.consume(s),i=3,r.interrupt?t:N):si(s)?(e.consume(s),a=String.fromCharCode(s),f):n(s)}function u(o){return 45===o?(e.consume(o),i=2,d):91===o?(e.consume(o),i=5,s=0,h):si(o)?(e.consume(o),i=4,r.interrupt?t:N):n(o)}function d(i){return 45===i?(e.consume(i),r.interrupt?t:N):n(i)}function h(i){const o="CDATA[";return i===o.charCodeAt(s++)?(e.consume(i),6===s?r.interrupt?t:T:h):n(i)}function p(t){return si(t)?(e.consume(t),a=String.fromCharCode(t),f):n(t)}function f(s){if(null===s||47===s||62===s||mi(s)){const l=47===s,c=a.toLowerCase();return l||o||!eo.includes(c)?Qi.includes(a.toLowerCase())?(i=6,l?(e.consume(s),m):r.interrupt?t(s):T(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):o?g(s):v(s)):(i=1,r.interrupt?t(s):T(s))}return 45===s||li(s)?(e.consume(s),a+=String.fromCharCode(s),f):n(s)}function m(i){return 62===i?(e.consume(i),r.interrupt?t:T):n(i)}function g(t){return gi(t)?(e.consume(t),g):M(t)}function v(t){return 47===t?(e.consume(t),M):58===t||95===t||si(t)?(e.consume(t),y):gi(t)?(e.consume(t),v):M(t)}function y(t){return 45===t||46===t||58===t||95===t||li(t)?(e.consume(t),y):b(t)}function b(t){return 61===t?(e.consume(t),x):gi(t)?(e.consume(t),b):v(t)}function x(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),l=t,_):gi(t)?(e.consume(t),x):w(t)}function _(t){return t===l?(e.consume(t),l=null,S):null===t||fi(t)?n(t):(e.consume(t),_)}function w(t){return null===t||34===t||39===t||47===t||60===t||61===t||62===t||96===t||mi(t)?b(t):(e.consume(t),w)}function S(e){return 47===e||62===e||gi(e)?v(e):n(e)}function M(t){return 62===t?(e.consume(t),E):n(t)}function E(t){return null===t||fi(t)?T(t):gi(t)?(e.consume(t),E):n(t)}function T(t){return 45===t&&2===i?(e.consume(t),R):60===t&&1===i?(e.consume(t),P):62===t&&4===i?(e.consume(t),O):63===t&&3===i?(e.consume(t),N):93===t&&5===i?(e.consume(t),L):!fi(t)||6!==i&&7!==i?null===t||fi(t)?(e.exit("htmlFlowData"),A(t)):(e.consume(t),T):(e.exit("htmlFlowData"),e.check(no,D,A)(t))}function A(t){return e.check(ro,C,D)(t)}function C(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),k}function k(t){return null===t||fi(t)?A(t):(e.enter("htmlFlowData"),T(t))}function R(t){return 45===t?(e.consume(t),N):T(t)}function P(t){return 47===t?(e.consume(t),a="",I):T(t)}function I(t){if(62===t){const n=a.toLowerCase();return eo.includes(n)?(e.consume(t),O):T(t)}return si(t)&&a.length<8?(e.consume(t),a+=String.fromCharCode(t),I):T(t)}function L(t){return 93===t?(e.consume(t),N):T(t)}function N(t){return 62===t?(e.consume(t),O):45===t&&2===i?(e.consume(t),N):T(t)}function O(t){return null===t||fi(t)?(e.exit("htmlFlowData"),D(t)):(e.consume(t),O)}function D(n){return e.exit("htmlFlow"),t(n)}}},no={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(Ri,t,n)}}},ro={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){if(fi(t))return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i;return n(t)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}};const io={name:"htmlText",tokenize:function(e,t,n){const r=this;let i,o,a;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),s};function s(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),x):63===t?(e.consume(t),y):si(t)?(e.consume(t),S):n(t)}function l(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),o=0,p):si(t)?(e.consume(t),v):n(t)}function c(t){return 45===t?(e.consume(t),h):n(t)}function u(t){return null===t?n(t):45===t?(e.consume(t),d):fi(t)?(a=u,I(t)):(e.consume(t),u)}function d(t){return 45===t?(e.consume(t),h):u(t)}function h(e){return 62===e?P(e):45===e?d(e):u(e)}function p(t){const r="CDATA[";return t===r.charCodeAt(o++)?(e.consume(t),6===o?f:p):n(t)}function f(t){return null===t?n(t):93===t?(e.consume(t),m):fi(t)?(a=f,I(t)):(e.consume(t),f)}function m(t){return 93===t?(e.consume(t),g):f(t)}function g(t){return 62===t?P(t):93===t?(e.consume(t),g):f(t)}function v(t){return null===t||62===t?P(t):fi(t)?(a=v,I(t)):(e.consume(t),v)}function y(t){return null===t?n(t):63===t?(e.consume(t),b):fi(t)?(a=y,I(t)):(e.consume(t),y)}function b(e){return 62===e?P(e):y(e)}function x(t){return si(t)?(e.consume(t),_):n(t)}function _(t){return 45===t||li(t)?(e.consume(t),_):w(t)}function w(t){return fi(t)?(a=w,I(t)):gi(t)?(e.consume(t),w):P(t)}function S(t){return 45===t||li(t)?(e.consume(t),S):47===t||62===t||mi(t)?M(t):n(t)}function M(t){return 47===t?(e.consume(t),P):58===t||95===t||si(t)?(e.consume(t),E):fi(t)?(a=M,I(t)):gi(t)?(e.consume(t),M):P(t)}function E(t){return 45===t||46===t||58===t||95===t||li(t)?(e.consume(t),E):T(t)}function T(t){return 61===t?(e.consume(t),A):fi(t)?(a=T,I(t)):gi(t)?(e.consume(t),T):M(t)}function A(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),i=t,C):fi(t)?(a=A,I(t)):gi(t)?(e.consume(t),A):(e.consume(t),k)}function C(t){return t===i?(e.consume(t),i=void 0,R):null===t?n(t):fi(t)?(a=C,I(t)):(e.consume(t),C)}function k(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||mi(t)?M(t):(e.consume(t),k)}function R(e){return 47===e||62===e||mi(e)?M(e):n(e)}function P(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function I(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),L}function L(t){return gi(t)?_i(e,N,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):N(t)}function N(t){return e.enter("htmlTextData"),a(t)}}};const oo={name:"labelEnd",resolveAll:function(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){const e="labelImage"===r.type?4:2;r.type="data",t+=e}}e.length!==n.length&&Qr(e,0,e.length,n);return e},resolveTo:function(e,t){let n,r,i,o,a=e.length,s=0;for(;a--;)if(n=e[a][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[a][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(i){if("enter"===e[a][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=a,"labelLink"!==n.type)){s=2;break}}else"labelEnd"===n.type&&(i=a);const l={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[r][1].start},end:{...e[i][1].end}},u={type:"labelText",start:{...e[r+s+2][1].end},end:{...e[i-2][1].start}};return o=[["enter",l,t],["enter",c,t]],o=ei(o,e.slice(r+1,r+s+3)),o=ei(o,[["enter",u,t]]),o=ei(o,Ti(t.parser.constructs.insideSpan.null,e.slice(r+s+4,i-3),t)),o=ei(o,[["exit",u,t],e[i-2],e[i-1],["exit",c,t]]),o=ei(o,e.slice(i+1)),o=ei(o,[["exit",l,t]]),Qr(e,r,e.length,o),e},tokenize:function(e,t,n){const r=this;let i,o,a=r.events.length;for(;a--;)if(("labelImage"===r.events[a][1].type||"labelLink"===r.events[a][1].type)&&!r.events[a][1]._balanced){i=r.events[a][1];break}return function(t){if(!i)return n(t);if(i._inactive)return u(t);return o=r.parser.defined.includes(ai(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),s};function s(t){return 40===t?e.attempt(ao,c,o?c:u)(t):91===t?e.attempt(so,c,o?l:u)(t):o?c(t):u(t)}function l(t){return e.attempt(lo,c,u)(t)}function c(e){return t(e)}function u(e){return i._balanced=!0,n(e)}}},ao={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return mi(t)?$i(e,i)(t):i(t)}function i(t){return 41===t?c(t):Gi(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function o(t){return mi(t)?$i(e,s)(t):c(t)}function a(e){return n(e)}function s(t){return 34===t||39===t||40===t?qi(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function l(t){return mi(t)?$i(e,c)(t):c(t)}function c(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},so={tokenize:function(e,t,n){const r=this;return function(t){return Xi.call(r,e,i,o,"reference","referenceMarker","referenceString")(t)};function i(e){return r.parser.defined.includes(ai(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}},lo={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}};const co={name:"labelStartImage",resolveAll:oo.resolveAll,tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),i};function i(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),o):n(t)}function o(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}};const uo={name:"labelStartLink",resolveAll:oo.resolveAll,tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),i};function i(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}};const ho={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),_i(e,t,"linePrefix")}}};const po={name:"thematicBreak",tokenize:function(e,t,n){let r,i=0;return function(t){return e.enter("thematicBreak"),function(e){return r=e,o(e)}(t)};function o(o){return o===r?(e.enter("thematicBreakSequence"),a(o)):i>=3&&(null===o||fi(o))?(e.exit("thematicBreak"),t(o)):n(o)}function a(t){return t===r?(e.consume(t),i++,a):(e.exit("thematicBreakSequence"),gi(t)?_i(e,o,"whitespace")(t):o(t))}}};const fo={continuation:{tokenize:function(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Ri,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,_i(e,t,"listItemIndent",r.containerState.size+1)(n)},function(n){if(r.containerState.furtherBlankLines||!gi(n))return r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(n);return r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(go,t,i)(n)});function i(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,_i(e,e.attempt(fo,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,a=0;return function(t){const i=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===i?!r.containerState.marker||t===r.containerState.marker:di(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),"listUnordered"===i)return e.enter("listItemPrefix"),42===t||45===t?e.check(po,n,l)(t):l(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),s(t)}return n(t)};function s(t){return di(t)&&++a<10?(e.consume(t),s):(!r.interrupt||a<2)&&(r.containerState.marker?t===r.containerState.marker:41===t||46===t)?(e.exit("listItemValue"),l(t)):n(t)}function l(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(Ri,r.interrupt?n:c,e.attempt(mo,d,u))}function c(e){return r.containerState.initialBlankLine=!0,o++,d(e)}function u(t){return gi(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),d):n(t)}function d(n){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},mo={partial:!0,tokenize:function(e,t,n){const r=this;return _i(e,function(e){const i=r.events[r.events.length-1];return!gi(e)&&i&&"listItemPrefixWhitespace"===i[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},go={partial:!0,tokenize:function(e,t,n){const r=this;return _i(e,function(e){const i=r.events[r.events.length-1];return i&&"listItemIndent"===i[1].type&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}};const vo={name:"setextUnderline",resolveTo:function(e,t){let n,r,i,o=e.length;for(;o--;)if("enter"===e[o][0]){if("content"===e[o][1].type){n=o;break}"paragraph"===e[o][1].type&&(r=o)}else"content"===e[o][1].type&&e.splice(o,1),i||"definition"!==e[o][1].type||(i=o);const a={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",a,t]),e.splice(i+1,0,["exit",e[n][1],t]),e[n][1].end={...e[i][1].end}):e[n][1]=a;return e.push(["exit",a,t]),e},tokenize:function(e,t,n){const r=this;let i;return function(t){let a,s=r.events.length;for(;s--;)if("lineEnding"!==r.events[s][1].type&&"linePrefix"!==r.events[s][1].type&&"content"!==r.events[s][1].type){a="paragraph"===r.events[s][1].type;break}if(!r.parser.lazy[r.now().line]&&(r.interrupt||a))return e.enter("setextHeadingLine"),i=t,function(t){return e.enter("setextHeadingLineSequence"),o(t)}(t);return n(t)};function o(t){return t===i?(e.consume(t),o):(e.exit("setextHeadingLineSequence"),gi(t)?_i(e,a,"lineSuffix")(t):a(t))}function a(r){return null===r||fi(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};const yo={tokenize:function(e){const t=this,n=e.attempt(Ri,function(r){if(null===r)return void e.consume(r);return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n},e.attempt(this.parser.constructs.flowInitial,r,_i(e,e.attempt(this.parser.constructs.flow,r,e.attempt(Hi,r)),"linePrefix")));return n;function r(r){if(null!==r)return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n;e.consume(r)}}};const bo={resolveAll:So()},xo=wo("string"),_o=wo("text");function wo(e){return{resolveAll:So("text"===e?Mo:void 0),tokenize:function(t){const n=this,r=this.parser.constructs[e],i=t.attempt(r,o,a);return o;function o(e){return l(e)?i(e):a(e)}function a(e){if(null!==e)return t.enter("data"),t.consume(e),s;t.consume(e)}function s(e){return l(e)?(t.exit("data"),i(e)):(t.consume(e),s)}function l(e){if(null===e)return!0;const t=r[e];let i=-1;if(t)for(;++i<t.length;){const e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function So(e){return function(t,n){let r,i=-1;for(;++i<=t.length;)void 0===r?t[i]&&"data"===t[i][1].type&&(r=i,i++):t[i]&&"data"===t[i][1].type||(i!==r+2&&(t[r][1].end=t[i-1][1].end,t.splice(r+2,i-r-2),i=r+2),r=void 0);return e?e(t,n):t}}function Mo(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){const r=e[n-1][1],i=t.sliceStream(r);let o,a=i.length,s=-1,l=0;for(;a--;){const e=i[a];if("string"==typeof e){for(s=e.length;32===e.charCodeAt(s-1);)l++,s--;if(s)break;s=-1}else if(-2===e)o=!0,l++;else if(-1!==e){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const i={type:n===e.length||o||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?s:r.start._bufferIndex+s,_index:r.start._index+a,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,["enter",i,t],["exit",i,t]),n+=2)}n++}return e}const Eo={42:fo,43:fo,45:fo,48:fo,49:fo,50:fo,51:fo,52:fo,53:fo,54:fo,55:fo,56:fo,57:fo,62:Pi},To={91:Yi},Ao={[-2]:Di,[-1]:Di,32:Di},Co={35:Ki,42:po,45:[vo,po],60:to,61:vo,95:po,96:Oi,126:Oi},ko={38:Li,92:Ii},Ro={[-5]:ho,[-4]:ho,[-3]:ho,33:co,38:Li,42:Ai,60:[ki,io],91:uo,92:[Ji,Ii],93:oo,95:Ai,96:Fi},Po={null:[Ai,bo]},Io=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:To,disable:{null:[]},document:Eo,flow:Co,flowInitial:Ao,insideSpan:Po,string:ko,text:Ro},Symbol.toStringTag,{value:"Module"}));function Lo(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},o=[];let a=[],s=[];const l={attempt:g(function(e,t){v(e,t.from)}),check:g(m),consume:function(e){fi(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,y()):-1!==e&&(r.column++,r.offset++);r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++));c.previous=e},enter:function(e,t){const n=t||{};return n.type=e,n.start=h(),c.events.push(["enter",n,c]),s.push(n),n},exit:function(e){const t=s.pop();return t.end=h(),c.events.push(["exit",t,c]),t},interrupt:g(m,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,y()},events:[],now:h,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let a;if("string"==typeof o)a=o;else switch(o){case-5:a="\r";break;case-4:a="\n";break;case-3:a="\r\n";break;case-2:a=t?" ":"\t";break;case-1:if(!t&&i)continue;a=" ";break;default:a=String.fromCharCode(o)}i=-2===o,r.push(a)}return r.join("")}(d(e),t)},sliceStream:d,write:function(e){if(a=ei(a,e),p(),null!==a[a.length-1])return[];return v(t,0),c.events=Ti(o,c.events,c),c.events}};let u=t.tokenize.call(c,l);return t.resolveAll&&o.push(t),c;function d(e){return function(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let a;if(n===i)a=[e[n].slice(r,o)];else{if(a=e.slice(n,i),r>-1){const e=a[0];"string"==typeof e?a[0]=e.slice(r):a.shift()}o>0&&a.push(e[i].slice(0,o))}return a}(a,e)}function h(){const{_bufferIndex:e,_index:t,line:n,column:i,offset:o}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:o}}function p(){let e;for(;r._index<a.length;){const t=a[r._index];if("string"==typeof t)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)f(t.charCodeAt(r._bufferIndex));else f(t)}}function f(e){u=u(e)}function m(e,t){t.restore()}function g(e,t){return function(n,i,o){let a,u,d,p;return Array.isArray(n)?f(n):"tokenize"in n?f([n]):function(e){return t;function t(t){const n=null!==t&&e[t],r=null!==t&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}(n);function f(e){return a=e,u=0,0===e.length?o:m(e[u])}function m(e){return function(n){p=function(){const e=h(),t=c.previous,n=c.currentConstruct,i=c.events.length,o=Array.from(s);return{from:i,restore:a};function a(){r=e,c.previous=t,c.currentConstruct=n,c.events.length=i,s=o,y()}}(),d=e,e.partial||(c.currentConstruct=e);if(e.name&&c.parser.constructs.disable.null.includes(e.name))return v();return e.tokenize.call(t?Object.assign(Object.create(c),t):c,l,g,v)(n)}}function g(t){return e(d,p),i}function v(e){return p.restore(),++u<a.length?m(a[u]):o}}}function v(e,t){e.resolveAll&&!o.includes(e)&&o.push(e),e.resolve&&Qr(c.events,t,c.events.length-t,e.resolve(c.events.slice(t),c)),e.resolveTo&&(c.events=e.resolveTo(c.events,c))}function y(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}const No=/[\0\t\n\r]/g;const Oo=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Do(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){const e=n.charCodeAt(1),t=120===e||88===e;return oi(n.slice(t?2:1),t?16:10)}return Kr(n)||e}const Uo={}.hasOwnProperty;function Fo(e,t,n){return"string"!=typeof t&&(n=t,t=void 0),function(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(te),autolinkProtocol:E,autolinkEmail:E,atxHeading:o(J),blockQuote:o(X),characterEscape:E,characterReference:E,codeFenced:o(q),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:o(q,a),codeText:o($,a),codeTextData:E,data:E,codeFlowValue:E,definition:o(Y),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:o(Z),hardBreakEscape:o(K),hardBreakTrailing:o(K),htmlFlow:o(Q,a),htmlFlowData:E,htmlText:o(Q,a),htmlTextData:E,image:o(ee),label:a,link:o(te),listItem:o(re),listItemValue:h,listOrdered:o(ne,d),listUnordered:o(ne),paragraph:o(ie),reference:z,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(J),strong:o(oe),thematicBreak:o(se)},exit:{atxHeading:l(),atxHeadingSequence:_,autolink:l(),autolinkEmail:G,autolinkProtocol:W,blockQuote:l(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:V,characterReferenceMarkerNumeric:V,characterReferenceValue:j,characterReference:H,codeFenced:l(g),codeFencedFence:m,codeFencedFenceInfo:p,codeFencedFenceMeta:f,codeFlowValue:T,codeIndented:l(v),codeText:l(P),codeTextData:T,data:T,definition:l(),definitionDestinationString:x,definitionLabelString:y,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(C),hardBreakTrailing:l(C),htmlFlow:l(k),htmlFlowData:T,htmlText:l(R),htmlTextData:T,image:l(L),label:O,labelText:N,lineEnding:A,link:l(I),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:B,resourceDestinationString:D,resourceTitleString:U,resource:F,setextHeading:l(M),setextHeadingLineSequence:S,setextHeadingText:w,strong:l(),thematicBreak:l()}};Bo(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(e){let r={type:"root",children:[]};const o={stack:[r],tokenStack:[],config:t,enter:s,exit:c,buffer:a,resume:u,data:n},l=[];let d=-1;for(;++d<e.length;)if("listOrdered"===e[d][1].type||"listUnordered"===e[d][1].type)if("enter"===e[d][0])l.push(d);else{d=i(e,l.pop(),d)}for(d=-1;++d<e.length;){const n=t[e[d][0]];Uo.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},o),e[d][1])}if(o.tokenStack.length>0){const e=o.tokenStack[o.tokenStack.length-1];(e[1]||jo).call(o,void 0,e[0])}for(r.position={start:zo(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:zo(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r,i,o,a,s=t-1,l=-1,c=!1;for(;++s<=n;){const t=e[s];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,a=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!r||a||l||o||(o=s),a=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:a=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let a=s;for(i=void 0;a--;){const t=e[a];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;i&&(e[i][1].type="lineEndingBlank",c=!0),t[1].type="lineEnding",i=a}else if("linePrefix"!==t[1].type&&"blockQuotePrefix"!==t[1].type&&"blockQuotePrefixWhitespace"!==t[1].type&&"blockQuoteMarker"!==t[1].type&&"listItemIndent"!==t[1].type)break}o&&(!i||o<i)&&(r._spread=!0),r.end=Object.assign({},i?e[i][1].start:t[1].end),e.splice(i||s,0,["exit",r,t[2]]),s++,n++}if("listItemPrefix"===t[1].type){const i={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};r=i,e.splice(s,0,["enter",i,t[2]]),s++,n++,o=void 0,a=!0}}}return e[t][1]._spread=c,n}function o(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function a(){this.stack.push({type:"fragment",children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:zo(t.start),end:void 0}}function l(e){return t;function t(t){e&&e.call(this,t),c.call(this,t)}}function c(e,t){const n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw new Error("Cannot close `"+e.type+"` ("+Er({start:e.start,end:e.end})+"): it’s not open");if(r[0].type!==e.type)if(t)t.call(this,e,r[0]);else{(r[1]||jo).call(this,e,r[0])}n.position.end=zo(e.end)}function u(){return $r(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function h(e){if(this.data.expectingFirstListItemValue){this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){const e=this.resume();this.stack[this.stack.length-1].lang=e}function f(){const e=this.resume();this.stack[this.stack.length-1].meta=e}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}function y(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=ai(this.sliceSerialize(e)).toLowerCase()}function b(){const e=this.resume();this.stack[this.stack.length-1].title=e}function x(){const e=this.resume();this.stack[this.stack.length-1].url=e}function _(e){const t=this.stack[this.stack.length-1];if(!t.depth){const n=this.sliceSerialize(e).length;t.depth=n}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function S(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2}function M(){this.data.setextHeadingSlurpLineEnding=void 0}function E(e){const t=this.stack[this.stack.length-1].children;let n=t[t.length-1];n&&"text"===n.type||(n=ae(),n.position={start:zo(e.start),end:void 0},t.push(n)),this.stack.push(n)}function T(e){const t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=zo(e.end)}function A(e){const n=this.stack[this.stack.length-1];if(this.data.atHardBreak){return n.children[n.children.length-1].position.end=zo(e.end),void(this.data.atHardBreak=void 0)}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(E.call(this,e),T.call(this,e))}function C(){this.data.atHardBreak=!0}function k(){const e=this.resume();this.stack[this.stack.length-1].value=e}function R(){const e=this.resume();this.stack[this.stack.length-1].value=e}function P(){const e=this.resume();this.stack[this.stack.length-1].value=e}function I(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function L(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(e){const t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=function(e){return e.replace(Oo,Do)}(t),n.identifier=ai(t).toLowerCase()}function O(){const e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];if(this.data.inReference=!0,"link"===n.type){const t=e.children;n.children=t}else n.alt=t}function D(){const e=this.resume();this.stack[this.stack.length-1].url=e}function U(){const e=this.resume();this.stack[this.stack.length-1].title=e}function F(){this.data.inReference=void 0}function z(){this.data.referenceType="collapsed"}function B(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=ai(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"}function V(e){this.data.characterReferenceType=e.type}function j(e){const t=this.sliceSerialize(e),n=this.data.characterReferenceType;let r;if(n)r=oi(t,"characterReferenceMarkerNumeric"===n?10:16),this.data.characterReferenceType=void 0;else{r=Kr(t)}this.stack[this.stack.length-1].value+=r}function H(e){this.stack.pop().position.end=zo(e.end)}function W(e){T.call(this,e);this.stack[this.stack.length-1].url=this.sliceSerialize(e)}function G(e){T.call(this,e);this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)}function X(){return{type:"blockquote",children:[]}}function q(){return{type:"code",lang:null,meta:null,value:""}}function $(){return{type:"inlineCode",value:""}}function Y(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Z(){return{type:"emphasis",children:[]}}function J(){return{type:"heading",depth:0,children:[]}}function K(){return{type:"break"}}function Q(){return{type:"html",value:""}}function ee(){return{type:"image",title:null,url:"",alt:null}}function te(){return{type:"link",title:null,url:"",children:[]}}function ne(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}function re(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}function ie(){return{type:"paragraph",children:[]}}function oe(){return{type:"strong",children:[]}}function ae(){return{type:"text",value:""}}function se(){return{type:"thematicBreak"}}}(n)(function(e){for(;!Vi(e););return e}(function(e){const t={constructs:ni([Io,...(e||{}).extensions||[]]),content:n(wi),defined:[],document:n(Si),flow:n(yo),lazy:{},string:n(xo),text:n(_o)};return t;function n(e){return function(n){return Lo(t,e,n)}}}(n).document().write(function(){let e,t=1,n="",r=!0;return function(i,o,a){const s=[];let l,c,u,d,h;for(i=n+("string"==typeof i?i.toString():new TextDecoder(o||void 0).decode(i)),u=0,n="",r&&(65279===i.charCodeAt(0)&&u++,r=void 0);u<i.length;){if(No.lastIndex=u,l=No.exec(i),d=l&&void 0!==l.index?l.index:i.length,h=i.charCodeAt(d),!l){n=i.slice(u);break}if(10===h&&u===d&&e)s.push(-3),e=void 0;else switch(e&&(s.push(-5),e=void 0),u<d&&(s.push(i.slice(u,d)),t+=d-u),h){case 0:s.push(65533),t++;break;case 9:for(c=4*Math.ceil(t/4),s.push(-2);t++<c;)s.push(-1);break;case 10:s.push(-4),t=1;break;default:e=!0,t=1}u=d+1}return a&&(e&&s.push(-5),n&&s.push(n),s.push(null)),s}}()(e,t,!0))))}function zo(e){return{line:e.line,column:e.column,offset:e.offset}}function Bo(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Bo(e,r):Vo(e,r)}}function Vo(e,t){let n;for(n in t)if(Uo.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function jo(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Er({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Er({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Er({start:t.start,end:t.end})+") is still open")}function Ho(e){const t=this;t.parser=function(n){return Fo(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Wo(e,t){const n=t.referenceType;let r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),o=i[0];o&&"text"===o.type?o.value="["+o.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&"text"===a.type?a.value+=r:i.push({type:"text",value:r}),i}function Go(e){const t=e.spread;return null==t?e.children.length>1:t}function Xo(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const o=[];for(;r;)o.push(qo(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(qo(t.slice(i),i>0,!1)),o.join("")}function qo(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;9===t||32===t;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}const $o={blockquote:function(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)},break:function(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){const n=t.value?t.value+"\n":"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o},delete:function(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function(e,t){const n="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=xi(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let a,s=e.footnoteCounts.get(r);void 0===s?(s=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=o+1,s+=1,e.footnoteCounts.set(r,s);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)},heading:function(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Wo(e,t);const i={src:xi(r.url||""),alt:t.alt};null!==r.title&&void 0!==r.title&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)},image:function(e,t){const n={src:xi(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)},linkReference:function(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Wo(e,t);const i={href:xi(r.url||"")};null!==r.title&&void 0!==r.title&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)},link:function(e,t){const n={href:xi(t.url)};null!==t.title&&void 0!==t.title&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},listItem:function(e,t,n){const r=e.all(t),i=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=Go(n[r])}return t}(n):Go(t),o={},a=[];if("boolean"==typeof t.checked){const e=r[0];let n;e&&"element"===e.type&&"p"===e.tagName?n=e:(n={type:"element",tagName:"p",properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:"text",value:" "}),n.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let s=-1;for(;++s<r.length;){const e=r[s];(i||0!==s||"element"!==e.type||"p"!==e.tagName)&&a.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||i?a.push(e):a.push(...e.children)}const l=r[r.length-1];l&&(i||"element"!==l.type||"p"!==l.tagName)&&a.push({type:"text",value:"\n"});const c={type:"element",tagName:"li",properties:o,children:a};return e.patch(t,c),e.applyData(t,c)},list:function(e,t){const n={},r=e.all(t);let i=-1;for("number"==typeof t.start&&1!==t.start&&(n.start=t.start);++i<r.length;){const e=r[i];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)},paragraph:function(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},root:function(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)},strong:function(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},table:function(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const n={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){const r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=wr(t.children[1]),a=_r(t.children[t.children.length-1]);o&&a&&(r.position={start:o,end:a}),i.push(r)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)},tableCell:function(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){const r=n?n.children:void 0,i=0===(r?r.indexOf(t):1)?"th":"td",o=n&&"table"===n.type?n.align:void 0,a=o?o.length:t.children.length;let s=-1;const l=[];for(;++s<a;){const n=t.children[s],r={},a=o?o[s]:void 0;a&&(r.align=a);let c={type:"element",tagName:i,properties:r,children:[]};n&&(c.children=e.all(n),e.patch(n,c),c=e.applyData(n,c)),l.push(c)}const c={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,c),e.applyData(t,c)},text:function(e,t){const n={type:"text",value:Xo(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:Yo,yaml:Yo,definition:Yo,footnoteDefinition:Yo};function Yo(){}const Zo="object"==typeof self?self:globalThis,Jo=e=>((e,t)=>{const n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);const[o,a]=t[i];switch(o){case 0:case-1:return n(a,i);case 1:{const e=n([],i);for(const t of a)e.push(r(t));return e}case 2:{const e=n({},i);for(const[t,n]of a)e[r(t)]=r(n);return e}case 3:return n(new Date(a),i);case 4:{const{source:e,flags:t}=a;return n(new RegExp(e,t),i)}case 5:{const e=n(new Map,i);for(const[t,n]of a)e.set(r(t),r(n));return e}case 6:{const e=n(new Set,i);for(const t of a)e.add(r(t));return e}case 7:{const{name:e,message:t}=a;return n(new Zo[e](t),i)}case 8:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:e}=new Uint8Array(a);return n(new DataView(e),a)}}return n(new Zo[o](a),i)};return r})(new Map,e)(0),Ko="",{toString:Qo}={},{keys:ea}=Object,ta=e=>{const t=typeof e;if("object"!==t||!e)return[0,t];const n=Qo.call(e).slice(8,-1);switch(n){case"Array":return[1,Ko];case"Object":return[2,Ko];case"Date":return[3,Ko];case"RegExp":return[4,Ko];case"Map":return[5,Ko];case"Set":return[6,Ko];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},na=([e,t])=>0===e&&("function"===t||"symbol"===t),ra=(e,{json:t,lossy:n}={})=>{const r=[];return((e,t,n,r)=>{const i=(e,t)=>{const i=r.push(e)-1;return n.set(t,i),i},o=r=>{if(n.has(r))return n.get(r);let[a,s]=ta(r);switch(a){case 0:{let t=r;switch(s){case"bigint":a=8,t=r.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+s);t=null;break;case"undefined":return i([-1],r)}return i([a,t],r)}case 1:{if(s){let e=r;return"DataView"===s?e=new Uint8Array(r.buffer):"ArrayBuffer"===s&&(e=new Uint8Array(r)),i([s,[...e]],r)}const e=[],t=i([a,e],r);for(const n of r)e.push(o(n));return t}case 2:{if(s)switch(s){case"BigInt":return i([s,r.toString()],r);case"Boolean":case"Number":case"String":return i([s,r.valueOf()],r)}if(t&&"toJSON"in r)return o(r.toJSON());const n=[],l=i([a,n],r);for(const t of ea(r))!e&&na(ta(r[t]))||n.push([o(t),o(r[t])]);return l}case 3:return i([a,r.toISOString()],r);case 4:{const{source:e,flags:t}=r;return i([a,{source:e,flags:t}],r)}case 5:{const t=[],n=i([a,t],r);for(const[i,a]of r)(e||!na(ta(i))&&!na(ta(a)))&&t.push([o(i),o(a)]);return n}case 6:{const t=[],n=i([a,t],r);for(const i of r)!e&&na(ta(i))||t.push(o(i));return n}}const{message:l}=r;return i([a,{name:s,message:l}],r)};return o})(!(t||n),!!t,new Map,r)(e),r},ia="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?Jo(ra(e,t)):structuredClone(e):(e,t)=>Jo(ra(e,t));function oa(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function aa(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}const sa=function(e){if(null==e)return ca;if("function"==typeof e)return la(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=sa(e[n]);return la(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}(e):function(e){const t=e;return la(n);function n(n){const r=n;let i;for(i in e)if(r[i]!==t[i])return!1;return!0}}(e);if("string"==typeof e)return function(e){return la(t);function t(t){return t&&t.type===e}}(e);throw new Error("Expected function, string, or object as test")};function la(e){return function(t,n,r){return Boolean(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function ca(){return!0}const ua=[],da=!0,ha=!1;function pa(e,t,n,r){let i;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):i=t;const o=sa(i),a=r?-1:1;!function e(i,s,l){const c=i&&"object"==typeof i?i:{};if("string"==typeof c.type){const e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(u,"name",{value:"node ("+i.type+(e?"<"+e+">":"")+")"})}return u;function u(){let c,u,d,h=ua;if((!t||o(i,s,l[l.length-1]||void 0))&&(h=function(e){if(Array.isArray(e))return e;if("number"==typeof e)return[da,e];return null==e?ua:[e]}(n(i,l)),h[0]===ha))return h;if("children"in i&&i.children){const t=i;if(t.children&&"skip"!==h[0])for(u=(r?t.children.length:-1)+a,d=l.concat(t);u>-1&&u<t.children.length;){const n=t.children[u];if(c=e(n,u,d)(),c[0]===ha)return c;u="number"==typeof c[1]?c[1]:u+a}}return h}}(e,void 0,[])()}function fa(e,t,n,r){let i,o,a;"function"==typeof t&&"function"!=typeof n?(o=void 0,a=t,i=n):(o=t,a=n,i=r),pa(e,o,function(e,t){const n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return a(e,r,n)},i)}const ma={}.hasOwnProperty,ga={};function va(e,t){e.position&&(t.position=Mr(e))}function ya(e,t){let n=t;if(e&&e.data){const t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;if("string"==typeof t)if("element"===n.type)n.tagName=t;else{n={type:"element",tagName:t,properties:{},children:"children"in n?n.children:[n]}}"element"===n.type&&i&&Object.assign(n.properties,ia(i)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function ba(e,t){const n=t.data||{},r=!("value"in t)||ma.call(n,"hProperties")||ma.call(n,"hChildren")?{type:"element",tagName:"div",properties:{},children:e.all(t)}:{type:"text",value:t.value};return e.patch(t,r),e.applyData(t,r)}function xa(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function _a(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function wa(e,t){const n=function(e,t){const n=t||ga,r=new Map,i=new Map,o=new Map,a={...$o,...n.handlers},s={all:function(e){const t=[];if("children"in e){const n=e.children;let r=-1;for(;++r<n.length;){const i=s.one(n[r],e);if(i){if(r&&"break"===n[r-1].type&&(Array.isArray(i)||"text"!==i.type||(i.value=_a(i.value)),!Array.isArray(i)&&"element"===i.type)){const e=i.children[0];e&&"text"===e.type&&(e.value=_a(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t},applyData:ya,definitionById:r,footnoteById:i,footnoteCounts:o,footnoteOrder:[],handlers:a,one:function(e,t){const n=e.type,r=s.handlers[n];if(ma.call(s.handlers,n)&&r)return r(s,e,t);if(s.options.passThrough&&s.options.passThrough.includes(n)){if("children"in e){const{children:t,...n}=e,r=ia(n);return r.children=s.all(e),r}return ia(e)}return(s.options.unknownHandler||ba)(s,e,t)},options:n,patch:va,wrap:xa};return fa(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){const t="definition"===e.type?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),s}(e,t),r=n.one(e,void 0),i=function(e){const t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||oa,r=e.options.footnoteBackLabel||aa,i=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[];let l=-1;for(;++l<e.footnoteOrder.length;){const i=e.footnoteById.get(e.footnoteOrder[l]);if(!i)continue;const o=e.all(i),a=String(i.identifier).toUpperCase(),c=xi(a.toLowerCase());let u=0;const d=[],h=e.footnoteCounts.get(a);for(;void 0!==h&&++u<=h;){d.length>0&&d.push({type:"text",value:" "});let e="string"==typeof n?n:n(l,u);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+c+(u>1?"-"+u:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(l,u),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}const p=o[o.length-1];if(p&&"element"===p.type&&"p"===p.tagName){const e=p.children[p.children.length-1];e&&"text"===e.type?e.value+=" ":p.children.push({type:"text",value:" "}),p.children.push(...d)}else o.push(...d);const f={type:"element",tagName:"li",properties:{id:t+"fn-"+c},children:e.wrap(o,!0)};e.patch(i,f),s.push(f)}if(0!==s.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...ia(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!0)},{type:"text",value:"\n"}]}}(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:"\n"},i),o}function Sa(e,t){return e&&"run"in e?async function(n,r){const i=wa(n,{file:r,...t});await e.run(i,r)}:function(n,r){return wa(n,{file:r,...e||t})}}function Ma(e){if(e)throw e}var Ea,Ta;var Aa=function(){if(Ta)return Ea;Ta=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===t.call(e)},o=function(n){if(!n||"[object Object]"!==t.call(n))return!1;var r,i=e.call(n,"constructor"),o=n.constructor&&n.constructor.prototype&&e.call(n.constructor.prototype,"isPrototypeOf");if(n.constructor&&!i&&!o)return!1;for(r in n);return void 0===r||e.call(n,r)},a=function(e,t){n&&"__proto__"===t.name?n(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},s=function(t,n){if("__proto__"===n){if(!e.call(t,n))return;if(r)return r(t,n).value}return t[n]};return Ea=function e(){var t,n,r,l,c,u,d=arguments[0],h=1,p=arguments.length,f=!1;for("boolean"==typeof d&&(f=d,d=arguments[1]||{},h=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});h<p;++h)if(null!=(t=arguments[h]))for(n in t)r=s(d,n),d!==(l=s(t,n))&&(f&&l&&(o(l)||(c=i(l)))?(c?(c=!1,u=r&&i(r)?r:[]):u=r&&o(r)?r:{},a(d,{name:n,newValue:e(f,u,l)})):void 0!==l&&a(d,{name:n,newValue:l}));return d},Ea}();const Ca=t(Aa);function ka(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}function Ra(){const e=[],t={run:function(...t){let n=-1;const r=t.pop();if("function"!=typeof r)throw new TypeError("Expected function as last argument, not "+r);!function i(o,...a){const s=e[++n];let l=-1;if(o)r(o);else{for(;++l<t.length;)null!==a[l]&&void 0!==a[l]||(a[l]=t[l]);t=a,s?function(e,t){let n;return r;function r(...t){const r=e.length>t.length;let s;r&&t.push(i);try{s=e.apply(this,t)}catch(o){if(r&&n)throw o;return i(o)}r||(s&&s.then&&"function"==typeof s.then?s.then(a,i):s instanceof Error?i(s):a(s))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}(s,i)(...a):r(null,...a)}}(null,...t)},use:function(n){if("function"!=typeof n)throw new TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}const Pa={basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');Ia(e);let n,r=0,i=-1,o=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;o--;)if(47===e.codePointAt(o)){if(n){r=o+1;break}}else i<0&&(n=!0,i=o+1);return i<0?"":e.slice(r,i)}if(t===e)return"";let a=-1,s=t.length-1;for(;o--;)if(47===e.codePointAt(o)){if(n){r=o+1;break}}else a<0&&(n=!0,a=o+1),s>-1&&(e.codePointAt(o)===t.codePointAt(s--)?s<0&&(i=o):(s=-1,i=a));r===i?i=a:i<0&&(i=e.length);return e.slice(r,i)},dirname:function(e){if(Ia(e),0===e.length)return".";let t,n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},extname:function(e){Ia(e);let t,n=e.length,r=-1,i=0,o=-1,a=0;for(;n--;){const s=e.codePointAt(n);if(47!==s)r<0&&(t=!0,r=n+1),46===s?o<0?o=n:1!==a&&(a=1):o>-1&&(a=-1);else if(t){i=n+1;break}}if(o<0||r<0||0===a||1===a&&o===r-1&&o===i+1)return"";return e.slice(o,r)},join:function(...e){let t,n=-1;for(;++n<e.length;)Ia(e[n]),e[n]&&(t=void 0===t?e[n]:t+"/"+e[n]);return void 0===t?".":function(e){Ia(e);const t=47===e.codePointAt(0);let n=function(e,t){let n,r,i="",o=0,a=-1,s=0,l=-1;for(;++l<=e.length;){if(l<e.length)n=e.codePointAt(l);else{if(47===n)break;n=47}if(47===n){if(a===l-1||1===s);else if(a!==l-1&&2===s){if(i.length<2||2!==o||46!==i.codePointAt(i.length-1)||46!==i.codePointAt(i.length-2))if(i.length>2){if(r=i.lastIndexOf("/"),r!==i.length-1){r<0?(i="",o=0):(i=i.slice(0,r),o=i.length-1-i.lastIndexOf("/")),a=l,s=0;continue}}else if(i.length>0){i="",o=0,a=l,s=0;continue}t&&(i=i.length>0?i+"/..":"..",o=2)}else i.length>0?i+="/"+e.slice(a+1,l):i=e.slice(a+1,l),o=l-a-1;a=l,s=0}else 46===n&&s>-1?s++:s=-1}return i}(e,!t);0!==n.length||t||(n=".");n.length>0&&47===e.codePointAt(e.length-1)&&(n+="/");return t?"/"+n:n}(t)},sep:"/"};function Ia(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const La={cwd:function(){return"/"}};function Na(e){return Boolean(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}function Oa(e){if("string"==typeof e)e=new URL(e);else if(!Na(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){const e=new TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}const t=e.pathname;let n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){const e=t.codePointAt(n+2);if(70===e||102===e){const e=new TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}const Da=["history","path","basename","stem","extname","dirname"];class Ua{constructor(e){let t;t=e?Na(e)?{path:e}:"string"==typeof e||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":La.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n,r=-1;for(;++r<Da.length;){const e=Da[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)Da.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?Pa.basename(this.path):void 0}set basename(e){za(e,"basename"),Fa(e,"basename"),this.path=Pa.join(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?Pa.dirname(this.path):void 0}set dirname(e){Ba(this.basename,"dirname"),this.path=Pa.join(e||"",this.basename)}get extname(){return"string"==typeof this.path?Pa.extname(this.path):void 0}set extname(e){if(Fa(e,"extname"),Ba(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Pa.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Na(e)&&(e=Oa(e)),za(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?Pa.basename(this.path,this.extname):void 0}set stem(e){za(e,"stem"),Fa(e,"stem"),this.path=Pa.join(this.dirname||"",e+(this.extname||""))}fail(e,t,n){const r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){const r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){const r=new kr(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){if(void 0===this.value)return"";if("string"==typeof this.value)return this.value;return new TextDecoder(e||void 0).decode(this.value)}}function Fa(e,t){if(e&&e.includes(Pa.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Pa.sep+"`")}function za(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Ba(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}const Va=function(e){const t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},ja={}.hasOwnProperty;class Ha extends Va{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Ra()}copy(){const e=new Ha;let t=-1;for(;++t<this.attachers.length;){const n=this.attachers[t];e.use(...n)}return e.data(Ca(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2===arguments.length?(qa("data",this.frozen),this.namespace[e]=t,this):ja.call(this.namespace,e)&&this.namespace[e]||void 0:e?(qa("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...n]=this.attachers[this.freezeIndex];if(!1===n[0])continue;!0===n[0]&&(n[0]=void 0);const r=t.call(e,...n);"function"==typeof r&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const t=Za(e),n=this.parser||this.Parser;return Ga("parse",n),n(String(t),t)}process(e,t){const n=this;return this.freeze(),Ga("process",this.parser||this.Parser),Xa("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){const o=Za(e),a=n.parse(o);function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}n.run(a,o,function(e,t,r){if(e||!t||!r)return s(e);const i=t,o=n.stringify(i,r);var a;"string"==typeof(a=o)||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(a)?r.value=o:r.result=o,s(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),Ga("processSync",this.parser||this.Parser),Xa("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,Ma(e),t=r}),Ya("processSync","process",n),t}run(e,t,n){$a(e),this.freeze();const r=this.transformers;return n||"function"!=typeof t||(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,o){const a=Za(t);r.run(e,a,function(t,r,a){const s=r||e;t?o(t):i?i(s):n(void 0,s,a)})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){Ma(e),n=t,r=!0}),Ya("runSync","run",r),n}stringify(e,t){this.freeze();const n=Za(t),r=this.compiler||this.Compiler;return Xa("stringify",r),$a(e),r(e,n)}use(e,...t){const n=this.attachers,r=this.namespace;if(qa("use",this.frozen),null==e);else if("function"==typeof e)s(e,t);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?a(e):o(e)}return this;function i(e){if("function"==typeof e)s(e,[]);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");if(Array.isArray(e)){const[t,...n]=e;s(t,n)}else o(e)}}function o(e){if(!("plugins"in e)&&!("settings"in e))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(e.plugins),e.settings&&(r.settings=Ca(!0,r.settings,e.settings))}function a(e){let t=-1;if(null==e);else{if(!Array.isArray(e))throw new TypeError("Expected a list of plugins, not `"+e+"`");for(;++t<e.length;){i(e[t])}}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(-1===i)n.push([e,...t]);else if(t.length>0){let[r,...o]=t;const a=n[i][1];ka(a)&&ka(r)&&(r=Ca(!0,a,r)),n[i]=[e,r,...o]}}}}const Wa=(new Ha).freeze();function Ga(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `parser`")}function Xa(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `compiler`")}function qa(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function $a(e){if(!ka(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function Ya(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Za(e){return function(e){return Boolean(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new Ua(e)}const Ja=[],Ka={allowDangerousHtml:!0},Qa=/^(https?|ircs?|mailto|xmpp)$/i,es=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function ts(e){const t=function(e){const t=e.rehypePlugins||Ja,n=e.remarkPlugins||Ja,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ka}:Ka,i=Wa().use(Ho).use(n).use(Sa,r).use(t);return i}(e),n=function(e){const t=e.children||"",n=new Ua;"string"==typeof t&&(n.value=t);return n}(e);return function(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,o=t.disallowedElements,a=t.skipHtml,s=t.unwrapDisallowed,l=t.urlTransform||ns;for(const u of es)Object.hasOwn(t,u.from)&&Sn((u.from,u.to&&u.to,u.id));return fa(e,c),Dr(e,{Fragment:C.Fragment,components:i,ignoreInvalidStyle:!0,jsx:C.jsx,jsxs:C.jsxs,passKeys:!0,passNode:!0});function c(e,t,i){if("raw"===e.type&&i&&"number"==typeof t)return a?i.children.splice(t,1):i.children[t]={type:"text",value:e.value},t;if("element"===e.type){let t;for(t in Xr)if(Object.hasOwn(Xr,t)&&Object.hasOwn(e.properties,t)){const n=e.properties[t],r=Xr[t];(null===r||r.includes(e.tagName))&&(e.properties[t]=l(String(n||""),t,e))}}if("element"===e.type){let a=n?!n.includes(e.tagName):!!o&&o.includes(e.tagName);if(!a&&r&&"number"==typeof t&&(a=!r(e,t,i)),a&&i&&"number"==typeof t)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}(t.runSync(t.parse(n),n),e)}function ns(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return-1===t||-1!==i&&t>i||-1!==n&&t>n||-1!==r&&t>r||Qa.test(e.slice(0,t))?e:""}function rs(e,t){const n=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;-1!==i;)r++,i=n.indexOf(t,i+t.length);return r}function is(e,t,n){const r=sa((n||{}).ignore||[]),i=function(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const e=n[r];t.push([os(e[0]),as(e[1])])}return t}(t);let o=-1;for(;++o<i.length;)pa(e,"text",a);function a(e,t){let n,a=-1;for(;++a<t.length;){const e=t[a],i=n?n.children:void 0;if(r(e,i?i.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){const n=t[t.length-1],r=i[o][0],a=i[o][1];let s=0;const l=n.children.indexOf(e);let c=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){const n=d.index,i={index:d.index,input:d.input,stack:[...t,e]};let o=a(...d,i);if("string"==typeof o&&(o=o.length>0?{type:"text",value:o}:void 0),!1===o?r.lastIndex=n+1:(s!==n&&u.push({type:"text",value:e.value.slice(s,n)}),Array.isArray(o)?u.push(...o):o&&u.push(o),s=n+d[0].length,c=!0),!r.global)break;d=r.exec(e.value)}c?(s<e.value.length&&u.push({type:"text",value:e.value.slice(s)}),n.children.splice(l,1,...u)):u=[e];return l+u.length}(e,t)}}function os(e){return"string"==typeof e?new RegExp(function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(e),"g"):e}function as(e){return"function"==typeof e?e:function(){return e}}const ss="phrasing",ls=["autolink","link","image","label"];function cs(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function us(e){this.config.enter.autolinkProtocol.call(this,e)}function ds(e){this.config.exit.autolinkProtocol.call(this,e)}function hs(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function ps(e){this.config.exit.autolinkEmail.call(this,e)}function fs(e){this.exit(e)}function ms(e){is(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,gs],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),vs]],{ignore:["link","linkReference"]})}function gs(e,t,n,r,i){let o="";if(!ys(i))return!1;if(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!function(e){const t=e.split(".");if(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))return!1;return!0}(n))return!1;const a=function(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=rs(e,"(");let o=rs(e,")");for(;-1!==r&&i>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}(n+r);if(!a[0])return!1;const s={type:"link",title:null,url:o+t+a[0],children:[{type:"text",value:t+a[0]}]};return a[1]?[s,{type:"text",value:a[1]}]:s}function vs(e,t,n,r){return!(!ys(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function ys(e,t){const n=e.input.charCodeAt(e.index-1);return(0===e.index||yi(n)||vi(n))&&(!t||47!==n)}function bs(){this.buffer()}function xs(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function _s(){this.buffer()}function ws(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Ss(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ai(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Ms(e){this.exit(e)}function Es(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ai(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Ts(e){this.exit(e)}function As(e,t,n,r){const i=n.createTracker(r);let o=i.move("[^");const a=n.enter("footnoteReference"),s=n.enter("reference");return o+=i.move(n.safe(n.associationId(e),{after:"]",before:o})),s(),a(),o+=i.move("]"),o}function Cs(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:function(e,n,r,i){const o=r.createTracker(i);let a=o.move("[^");const s=r.enter("footnoteDefinition"),l=r.enter("label");a+=o.move(r.safe(r.associationId(e),{before:a,after:"]"})),l(),a+=o.move("]:"),e.children&&e.children.length>0&&(o.shift(4),a+=o.move((t?"\n":" ")+r.indentLines(r.containerFlow(e,o.current()),t?Rs:ks)));return s(),a},footnoteReference:As},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}}function ks(e,t,n){return 0===t?e:Rs(e,t,n)}function Rs(e,t,n){return(n?"":" ")+e}As.peek=function(){return"["};const Ps=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function Is(e){this.enter({type:"delete",children:[]},e)}function Ls(e){this.exit(e)}function Ns(e,t,n,r){const i=n.createTracker(r),o=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(e,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),o(),a}function Os(e){return e.length}function Ds(e){return null==e?"":String(e)}function Us(e){const t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:82===t||114===t?114:0}function Fs(e,t,n){return">"+(n?"":" ")+e}function zs(e,t){return Bs(e,t.inConstruct,!0)&&!Bs(e,t.notInConstruct,!1)}function Bs(e,t,n){if("string"==typeof t&&(t=[t]),!t||0===t.length)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Vs(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if("\n"===n.unsafe[i].character&&zs(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return"\\\n"}function js(e,t,n){return(n?"":" ")+e}function Hs(e){const t=e.options.quote||'"';if('"'!==t&&"'"!==t)throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Ws(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Gs(e,t,n){const r=Ei(e),i=Ei(t);return void 0===r?void 0===i?"_"===n?{inside:!0,outside:!0}:{inside:!1,outside:!1}:1===i?{inside:!0,outside:!0}:{inside:!1,outside:!0}:1===r?void 0===i?{inside:!1,outside:!1}:1===i?{inside:!0,outside:!0}:{inside:!1,outside:!1}:void 0===i?{inside:!1,outside:!1}:1===i?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function Xs(e,t,n,r){const i=function(e){const t=e.options.emphasis||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}(n),o=n.enter("emphasis"),a=n.createTracker(r),s=a.move(i);let l=a.move(n.containerPhrasing(e,{after:i,before:s,...a.current()}));const c=l.charCodeAt(0),u=Gs(r.before.charCodeAt(r.before.length-1),c,i);u.inside&&(l=Ws(c)+l.slice(1));const d=l.charCodeAt(l.length-1),h=Gs(r.after.charCodeAt(0),d,i);h.inside&&(l=l.slice(0,-1)+Ws(d));const p=a.move(i);return o(),n.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},s+l+p}function qs(e){return e.value||""}function $s(e,t,n,r){const i=Hs(n),o='"'===i?"Quote":"Apostrophe",a=n.enter("image");let s=n.enter("label");const l=n.createTracker(r);let c=l.move("![");return c+=l.move(n.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(s=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),s(),e.title&&(s=n.enter(`title${o}`),c+=l.move(" "+i),c+=l.move(n.safe(e.title,{before:c,after:i,...l.current()})),c+=l.move(i),s()),c+=l.move(")"),a(),c}function Ys(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let a=n.enter("label");const s=n.createTracker(r);let l=s.move("![");const c=n.safe(e.alt,{before:l,after:"]",...s.current()});l+=s.move(c+"]["),a();const u=n.stack;n.stack=[],a=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...s.current()});return a(),n.stack=u,o(),"full"!==i&&c&&c===d?"shortcut"===i?l=l.slice(0,-1):l+=s.move("]"):l+=s.move(d+"]"),l}function Zs(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const e=n.unsafe[o],t=n.compilePattern(e);let i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;10===r.charCodeAt(e)&&13===r.charCodeAt(e-1)&&e--,r=r.slice(0,e)+" "+r.slice(i.index+1)}}return i+r+i}function Js(e,t){const n=$r(e);return Boolean(!t.options.resourceLink&&e.url&&!e.title&&e.children&&1===e.children.length&&"text"===e.children[0].type&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}function Ks(e,t,n,r){const i=Hs(n),o='"'===i?"Quote":"Apostrophe",a=n.createTracker(r);let s,l;if(Js(e,n)){const t=n.stack;n.stack=[],s=n.enter("autolink");let r=a.move("<");return r+=a.move(n.containerPhrasing(e,{before:r,after:">",...a.current()})),r+=a.move(">"),s(),n.stack=t,r}s=n.enter("link"),l=n.enter("label");let c=a.move("[");return c+=a.move(n.containerPhrasing(e,{before:c,after:"](",...a.current()})),c+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(n.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=n.enter("destinationRaw"),c+=a.move(n.safe(e.url,{before:c,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=n.enter(`title${o}`),c+=a.move(" "+i),c+=a.move(n.safe(e.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),c+=a.move(")"),s(),c}function Qs(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let a=n.enter("label");const s=n.createTracker(r);let l=s.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...s.current()});l+=s.move(c+"]["),a();const u=n.stack;n.stack=[],a=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...s.current()});return a(),n.stack=u,o(),"full"!==i&&c&&c===d?"shortcut"===i?l=l.slice(0,-1):l+=s.move("]"):l+=s.move(d+"]"),l}function el(e){const t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function tl(e){const t=e.options.rule||"*";if("*"!==t&&"-"!==t&&"_"!==t)throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}Ns.peek=function(){return"~"},Xs.peek=function(e,t,n){return n.options.emphasis||"*"},qs.peek=function(){return"<"},$s.peek=function(){return"!"},Ys.peek=function(){return"!"},Zs.peek=function(){return"`"},Ks.peek=function(e,t,n){return Js(e,n)?"<":"["},Qs.peek=function(){return"["};const nl=sa(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function rl(e,t,n,r){const i=function(e){const t=e.options.strong||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}(n),o=n.enter("strong"),a=n.createTracker(r),s=a.move(i+i);let l=a.move(n.containerPhrasing(e,{after:i,before:s,...a.current()}));const c=l.charCodeAt(0),u=Gs(r.before.charCodeAt(r.before.length-1),c,i);u.inside&&(l=Ws(c)+l.slice(1));const d=l.charCodeAt(l.length-1),h=Gs(r.after.charCodeAt(0),d,i);h.inside&&(l=l.slice(0,-1)+Ws(d));const p=a.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},s+l+p}rl.peek=function(e,t,n){return n.options.strong||"*"};const il={blockquote:function(e,t,n,r){const i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const a=n.indentLines(n.containerFlow(e,o.current()),Fs);return i(),a},break:Vs,code:function(e,t,n,r){const i=function(e){const t=e.options.fence||"`";if("`"!==t&&"~"!==t)throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}(n),o=e.value||"",a="`"===i?"GraveAccent":"Tilde";if(function(e,t){return Boolean(!1===t.options.fences&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}(e,n)){const e=n.enter("codeIndented"),t=n.indentLines(o,js);return e(),t}const s=n.createTracker(r),l=i.repeat(Math.max(function(e,t){const n=String(e);let r=n.indexOf(t),i=r,o=0,a=0;if("string"!=typeof t)throw new TypeError("Expected substring");for(;-1!==r;)r===i?++o>a&&(a=o):o=1,i=r+t.length,r=n.indexOf(t,i);return a}(o,i)+1,3)),c=n.enter("codeFenced");let u=s.move(l);if(e.lang){const t=n.enter(`codeFencedLang${a}`);u+=s.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){const t=n.enter(`codeFencedMeta${a}`);u+=s.move(" "),u+=s.move(n.safe(e.meta,{before:u,after:"\n",encode:["`"],...s.current()})),t()}return u+=s.move("\n"),o&&(u+=s.move(o+"\n")),u+=s.move(l),c(),u},definition:function(e,t,n,r){const i=Hs(n),o='"'===i?"Quote":"Apostrophe",a=n.enter("definition");let s=n.enter("label");const l=n.createTracker(r);let c=l.move("[");return c+=l.move(n.safe(n.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(s=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":"\n",...l.current()}))),s(),e.title&&(s=n.enter(`title${o}`),c+=l.move(" "+i),c+=l.move(n.safe(e.title,{before:c,after:i,...l.current()})),c+=l.move(i),s()),a(),c},emphasis:Xs,hardBreak:Vs,heading:function(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(function(e,t){let n=!1;return fa(e,function(e){if("value"in e&&/\r?\n|\r/.test(e.value)||"break"===e.type)return n=!0,ha}),Boolean((!e.depth||e.depth<3)&&$r(e)&&(t.options.setext||n))}(e,n)){const t=n.enter("headingSetext"),r=n.enter("phrasing"),a=n.containerPhrasing(e,{...o.current(),before:"\n",after:"\n"});return r(),t(),a+"\n"+(1===i?"=":"-").repeat(a.length-(Math.max(a.lastIndexOf("\r"),a.lastIndexOf("\n"))+1))}const a="#".repeat(i),s=n.enter("headingAtx"),l=n.enter("phrasing");o.move(a+" ");let c=n.containerPhrasing(e,{before:"# ",after:"\n",...o.current()});return/^[\t ]/.test(c)&&(c=Ws(c.charCodeAt(0))+c.slice(1)),c=c?a+" "+c:a,n.options.closeAtx&&(c+=" "+a),l(),s(),c},html:qs,image:$s,imageReference:Ys,inlineCode:Zs,link:Ks,linkReference:Qs,list:function(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let a=e.ordered?function(e){const t=e.options.bulletOrdered||".";if("."!==t&&")"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}(n):el(n);const s=e.ordered?"."===a?")":".":function(e){const t=el(e),n=e.options.bulletOther;if(!n)return"*"===t?"-":"*";if("*"!==n&&"+"!==n&&"-"!==n)throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}(n);let l=!(!t||!n.bulletLastUsed)&&a===n.bulletLastUsed;if(!e.ordered){const t=e.children?e.children[0]:void 0;if("*"!==a&&"-"!==a||!t||t.children&&t.children[0]||"list"!==n.stack[n.stack.length-1]||"listItem"!==n.stack[n.stack.length-2]||"list"!==n.stack[n.stack.length-3]||"listItem"!==n.stack[n.stack.length-4]||0!==n.indexStack[n.indexStack.length-1]||0!==n.indexStack[n.indexStack.length-2]||0!==n.indexStack[n.indexStack.length-3]||(l=!0),tl(n)===a&&t){let t=-1;for(;++t<e.children.length;){const n=e.children[t];if(n&&"listItem"===n.type&&n.children&&n.children[0]&&"thematicBreak"===n.children[0].type){l=!0;break}}}}l&&(a=s),n.bulletCurrent=a;const c=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=o,i(),c},listItem:function(e,t,n,r){const i=function(e){const t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n);let o=n.bulletCurrent||el(n);t&&"list"===t.type&&t.ordered&&(o=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+o);let a=o.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(a=4*Math.ceil(a/4));const s=n.createTracker(r);s.move(o+" ".repeat(a-o.length)),s.shift(a);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,s.current()),function(e,t,n){if(t)return(n?"":" ".repeat(a))+e;return(n?o:o+" ".repeat(a-o.length))+e});return l(),c},paragraph:function(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),a=n.containerPhrasing(e,r);return o(),i(),a},root:function(e,t,n,r){return(e.children.some(function(e){return nl(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)},strong:rl,text:function(e,t,n,r){return n.safe(e.value,r)},thematicBreak:function(e,t,n){const r=(tl(n)+(n.options.ruleSpaces?" ":"")).repeat(function(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}(n));return n.options.ruleSpaces?r.slice(0,-1):r}};function ol(e){const t=e._align;this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function al(e){this.exit(e),this.data.inTable=void 0}function sl(e){this.enter({type:"tableRow",children:[]},e)}function ll(e){this.exit(e)}function cl(e){this.enter({type:"tableCell",children:[]},e)}function ul(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,dl));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function dl(e,t){return"|"===t?t:e}function hl(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[\t :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=il.inlineCode(e,t,n);n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&"));return r},table:function(e,t,n,r){return s(function(e,t,n){const r=e.children;let i=-1;const o=[],a=t.enter("table");for(;++i<r.length;)o[i]=l(r[i],t,n);return a(),o}(e,n,r),e.align)},tableCell:a,tableRow:function(e,t,n,r){const i=s([l(e,n,r)]);return i.slice(0,i.indexOf("\n"))}}};function a(e,t,n,r){const i=n.enter("tableCell"),a=n.enter("phrasing"),s=n.containerPhrasing(e,{...r,before:o,after:o});return a(),i(),s}function s(e,t){return function(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Os,o=[],a=[],s=[],l=[];let c=0,u=-1;for(;++u<e.length;){const t=[],r=[];let o=-1;for(e[u].length>c&&(c=e[u].length);++o<e[u].length;){const a=Ds(e[u][o]);if(!1!==n.alignDelimiters){const e=i(a);r[o]=e,(void 0===l[o]||e>l[o])&&(l[o]=e)}t.push(a)}a[u]=t,s[u]=r}let d=-1;if("object"==typeof r&&"length"in r)for(;++d<c;)o[d]=Us(r[d]);else{const e=Us(r);for(;++d<c;)o[d]=e}d=-1;const h=[],p=[];for(;++d<c;){const e=o[d];let t="",r="";99===e?(t=":",r=":"):108===e?t=":":114===e&&(r=":");let i=!1===n.alignDelimiters?1:Math.max(1,l[d]-t.length-r.length);const a=t+"-".repeat(i)+r;!1!==n.alignDelimiters&&(i=t.length+i+r.length,i>l[d]&&(l[d]=i),p[d]=i),h[d]=a}a.splice(1,0,h),s.splice(1,0,p),u=-1;const f=[];for(;++u<a.length;){const e=a[u],t=s[u];d=-1;const r=[];for(;++d<c;){const i=e[d]||"";let a="",s="";if(!1!==n.alignDelimiters){const e=l[d]-(t[d]||0),n=o[d];114===n?a=" ".repeat(e):99===n?e%2?(a=" ".repeat(e/2+.5),s=" ".repeat(e/2-.5)):(a=" ".repeat(e/2),s=a):s=" ".repeat(e)}!1===n.delimiterStart||d||r.push("|"),!1===n.padding||!1===n.alignDelimiters&&""===i||!1===n.delimiterStart&&!d||r.push(" "),!1!==n.alignDelimiters&&r.push(a),r.push(i),!1!==n.alignDelimiters&&r.push(s),!1!==n.padding&&r.push(" "),!1===n.delimiterEnd&&d===c-1||r.push("|")}f.push(!1===n.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return f.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function l(e,t,n){const r=e.children;let i=-1;const o=[],s=t.enter("tableRow");for(;++i<r.length;)o[i]=a(r[i],0,t,n);return s(),o}}function pl(e){const t=this.stack[this.stack.length-2];t.type,t.checked="taskListCheckValueChecked"===e.type}function fl(e){const t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){const e=this.stack[this.stack.length-1];e.type;const n=e.children[0];if(n&&"text"===n.type){const r=t.children;let i,o=-1;for(;++o<r.length;){const e=r[o];if("paragraph"===e.type){i=e;break}}i===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function ml(e,t,n,r){const i=e.children[0],o="boolean"==typeof e.checked&&i&&"paragraph"===i.type,a="["+(e.checked?"x":" ")+"] ",s=n.createTracker(r);o&&s.move(a);let l=il.listItem(e,t,n,{...r,...s.current()});return o&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+a})),l}const gl={tokenize:function(e,t,n){let r=0;return function t(o){if((87===o||119===o)&&r<3)return r++,e.consume(o),t;if(46===o&&3===r)return e.consume(o),i;return n(o)};function i(e){return null===e?n(e):t(e)}},partial:!0},vl={tokenize:function(e,t,n){let r,i,o;return a;function a(t){return 46===t||95===t?e.check(bl,l,s)(t):null===t||mi(t)||yi(t)||45!==t&&vi(t)?l(t):(o=!0,e.consume(t),a)}function s(t){return 95===t?r=!0:(i=r,r=void 0),e.consume(t),a}function l(e){return i||r||!o?n(e):t(e)}},partial:!0},yl={tokenize:function(e,t){let n=0,r=0;return i;function i(a){return 40===a?(n++,e.consume(a),i):41===a&&r<n?o(a):33===a||34===a||38===a||39===a||41===a||42===a||44===a||46===a||58===a||59===a||60===a||63===a||93===a||95===a||126===a?e.check(bl,t,o)(a):null===a||mi(a)||yi(a)?t(a):(e.consume(a),i)}function o(t){return 41===t&&r++,e.consume(t),i}},partial:!0},bl={tokenize:function(e,t,n){return r;function r(a){return 33===a||34===a||39===a||41===a||42===a||44===a||46===a||58===a||59===a||63===a||95===a||126===a?(e.consume(a),r):38===a?(e.consume(a),o):93===a?(e.consume(a),i):60===a||null===a||mi(a)||yi(a)?t(a):n(a)}function i(e){return null===e||40===e||91===e||mi(e)||yi(e)?t(e):r(e)}function o(e){return si(e)?a(e):n(e)}function a(t){return 59===t?(e.consume(t),r):si(t)?(e.consume(t),a):n(t)}},partial:!0},xl={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return li(e)?n(e):t(e)}},partial:!0},_l={name:"wwwAutolink",tokenize:function(e,t,n){const r=this;return function(t){if(87!==t&&119!==t||!Tl.call(r,r.previous)||Rl(r.events))return n(t);return e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(gl,e.attempt(vl,e.attempt(yl,i),n),n)(t)};function i(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:Tl},wl={name:"protocolAutolink",tokenize:function(e,t,n){const r=this;let i="",o=!1;return function(t){if((72===t||104===t)&&Al.call(r,r.previous)&&!Rl(r.events))return e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(t),e.consume(t),a;return n(t)};function a(t){if(si(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),a;if(58===t){const n=i.toLowerCase();if("http"===n||"https"===n)return e.consume(t),s}return n(t)}function s(t){return 47===t?(e.consume(t),o?l:(o=!0,s)):n(t)}function l(t){return null===t||ui(t)||mi(t)||yi(t)||vi(t)?n(t):e.attempt(vl,e.attempt(yl,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:Al},Sl={name:"emailAutolink",tokenize:function(e,t,n){const r=this;let i,o;return function(t){if(!kl(t)||!Cl.call(r,r.previous)||Rl(r.events))return n(t);return e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(t)};function a(t){return kl(t)?(e.consume(t),a):64===t?(e.consume(t),s):n(t)}function s(t){return 46===t?e.check(xl,c,l)(t):45===t||95===t||li(t)?(o=!0,e.consume(t),s):c(t)}function l(t){return e.consume(t),i=!0,s}function c(a){return o&&i&&si(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(a)):n(a)}},previous:Cl},Ml={};let El=48;for(;El<123;)Ml[El]=Sl,El++,58===El?El=65:91===El&&(El=97);function Tl(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||mi(e)}function Al(e){return!si(e)}function Cl(e){return!(47===e||kl(e))}function kl(e){return 43===e||45===e||46===e||95===e||li(e)}function Rl(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}Ml[43]=Sl,Ml[45]=Sl,Ml[46]=Sl,Ml[95]=Sl,Ml[72]=[Sl,wl],Ml[104]=[Sl,wl],Ml[87]=[Sl,_l],Ml[119]=[Sl,_l];const Pl={tokenize:function(e,t,n){const r=this;return _i(e,function(e){const i=r.events[r.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?t(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function Il(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const e=r.events[i][1];if("labelImage"===e.type){a=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(i){if(!a||!a._balanced)return n(i);const s=ai(r.sliceSerialize({start:a.end,end:r.now()}));if(94!==s.codePointAt(0)||!o.includes(s.slice(1)))return n(i);return e.enter("gfmFootnoteCallLabelMarker"),e.consume(i),e.exit("gfmFootnoteCallLabelMarker"),t(i)}}function Ll(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},s=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",a,t],["exit",a,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...s),e}function Nl(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,a=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),s};function s(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(s){if(a>999||93===s&&!o||null===s||91===s||mi(s))return n(s);if(93===s){e.exit("chunkString");const o=e.exit("gfmFootnoteCallString");return i.includes(ai(r.sliceSerialize(o)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(s)}return mi(s)||(o=!0),a++,e.consume(s),92===s?c:l}function c(t){return 91===t||92===t||93===t?(e.consume(t),a++,l):l(t)}}function Ol(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,a,s=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(t)}function c(t){if(s>999||93===t&&!a||null===t||91===t||mi(t))return n(t);if(93===t){e.exit("chunkString");const n=e.exit("gfmFootnoteDefinitionLabelString");return o=ai(r.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return mi(t)||(a=!0),s++,e.consume(t),92===t?u:c}function u(t){return 91===t||92===t||93===t?(e.consume(t),s++,c):c(t)}function d(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),i.includes(o)||i.push(o),_i(e,h,"gfmFootnoteDefinitionWhitespace")):n(t)}function h(e){return t(e)}}function Dl(e,t,n){return e.check(Ri,t,e.attempt(Pl,t,n))}function Ul(e){e.exit("gfmFootnoteDefinition")}function Fl(e){let t=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:function(e,n,r){const i=this.previous,o=this.events;let a=0;return function(t){if(126===i&&"characterEscape"!==o[o.length-1][1].type)return r(t);return e.enter("strikethroughSequenceTemporary"),s(t)};function s(o){const l=Ei(i);if(126===o)return a>1?r(o):(e.consume(o),a++,s);if(a<2&&!t)return r(o);const c=e.exit("strikethroughSequenceTemporary"),u=Ei(o);return c._open=!u||2===u&&Boolean(l),c._close=!l||2===l&&Boolean(u),n(o)}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";const i={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},o={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},a=[["enter",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",o,t]],s=t.parser.constructs.insideSpan.null;s&&Qr(a,a.length,0,Ti(s,e.slice(r+1,n),t)),Qr(a,a.length,0,[["exit",o,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",i,t]]),Qr(e,r-1,n-r+3,a),n=r+a.length-2;break}}n=-1;for(;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}};return null==t&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}}class zl{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let i=0;if(0===n&&0===r.length)return;for(;i<e.map.length;){if(e.map[i][0]===t)return e.map[i][1]+=n,void e.map[i][2].push(...r);i+=1}e.map.push([t,n,r])}(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length;const n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(const t of r)e.push(t);r=n.pop()}this.map.length=0}}function Bl(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if("enter"===i[0])"tableContent"===i[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===i[1].type){if("tableDelimiterMarker"===e[t-1][1].type){const e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===i[1].type)break}else"enter"===i[0]&&"tableDelimiterRow"===i[1].type&&(n=!0);t+=1}return r}function Vl(e,t,n){const r=this;let i,o=0,a=0;return function(e){let t=r.events.length-1;for(;t>-1;){const e=r.events[t][1].type;if("lineEnding"!==e&&"linePrefix"!==e)break;t--}const i=t>-1?r.events[t][1].type:null,o="tableHead"===i||"tableRow"===i?x:s;if(o===x&&r.parser.lazy[r.now().line])return n(e);return o(e)};function s(t){return e.enter("tableHead"),e.enter("tableRow"),function(e){if(124===e)return l(e);return i=!0,a+=1,l(e)}(t)}function l(t){return null===t?n(t):fi(t)?a>1?(a=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):n(t):gi(t)?_i(e,l,"whitespace")(t):(a+=1,i&&(i=!1,o+=1),124===t?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),i=!0,l):(e.enter("data"),c(t)))}function c(t){return null===t||124===t||mi(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return 92===t||124===t?(e.consume(t),c):c(t)}function d(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter("tableDelimiterRow"),i=!1,gi(t)?_i(e,h,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):h(t))}function h(t){return 45===t||58===t?f(t):124===t?(i=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),p):b(t)}function p(t){return gi(t)?_i(e,f,"whitespace")(t):f(t)}function f(t){return 58===t?(a+=1,i=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),m):45===t?(a+=1,m(t)):null===t||fi(t)?y(t):b(t)}function m(t){return 45===t?(e.enter("tableDelimiterFiller"),g(t)):b(t)}function g(t){return 45===t?(e.consume(t),g):58===t?(i=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),v):(e.exit("tableDelimiterFiller"),v(t))}function v(t){return gi(t)?_i(e,y,"whitespace")(t):y(t)}function y(n){return 124===n?h(n):(null===n||fi(n))&&i&&o===a?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(n)):b(n)}function b(e){return n(e)}function x(t){return e.enter("tableRow"),_(t)}function _(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),_):null===n||fi(n)?(e.exit("tableRow"),t(n)):gi(n)?_i(e,_,"whitespace")(n):(e.enter("data"),w(n))}function w(t){return null===t||124===t||mi(t)?(e.exit("data"),_(t)):(e.consume(t),92===t?S:w)}function S(t){return 92===t||124===t?(e.consume(t),w):w(t)}}function jl(e,t){let n,r,i,o=-1,a=!0,s=0,l=[0,0,0,0],c=[0,0,0,0],u=!1,d=0;const h=new zl;for(;++o<e.length;){const p=e[o],f=p[1];"enter"===p[0]?"tableHead"===f.type?(u=!1,0!==d&&(Wl(h,t,d,n,r),r=void 0,d=0),n={type:"table",start:Object.assign({},f.start),end:Object.assign({},f.end)},h.add(o,0,[["enter",n,t]])):"tableRow"===f.type||"tableDelimiterRow"===f.type?(a=!0,i=void 0,l=[0,0,0,0],c=[0,o+1,0,0],u&&(u=!1,r={type:"tableBody",start:Object.assign({},f.start),end:Object.assign({},f.end)},h.add(o,0,[["enter",r,t]])),s="tableDelimiterRow"===f.type?2:r?3:1):!s||"data"!==f.type&&"tableDelimiterMarker"!==f.type&&"tableDelimiterFiller"!==f.type?"tableCellDivider"===f.type&&(a?a=!1:(0!==l[1]&&(c[0]=c[1],i=Hl(h,t,l,s,void 0,i)),l=c,c=[l[1],o,0,0])):(a=!1,0===c[2]&&(0!==l[1]&&(c[0]=c[1],i=Hl(h,t,l,s,void 0,i),l=[0,0,0,0]),c[2]=o)):"tableHead"===f.type?(u=!0,d=o):"tableRow"===f.type||"tableDelimiterRow"===f.type?(d=o,0!==l[1]?(c[0]=c[1],i=Hl(h,t,l,s,o,i)):0!==c[1]&&(i=Hl(h,t,c,s,o,i)),s=0):!s||"data"!==f.type&&"tableDelimiterMarker"!==f.type&&"tableDelimiterFiller"!==f.type||(c[3]=o)}for(0!==d&&Wl(h,t,d,n,r),h.consume(t.events),o=-1;++o<t.events.length;){const e=t.events[o];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=Bl(t.events,o))}return e}function Hl(e,t,n,r,i,o){const a=1===r?"tableHeader":2===r?"tableDelimiter":"tableData";0!==n[0]&&(o.end=Object.assign({},Gl(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const s=Gl(t.events,n[1]);if(o={type:a,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[["enter",o,t]]),0!==n[2]){const i=Gl(t.events,n[2]),o=Gl(t.events,n[3]),a={type:"tableContent",start:Object.assign({},i),end:Object.assign({},o)};if(e.add(n[2],0,[["enter",a,t]]),2!==r){const r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){const t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",a,t]])}return void 0!==i&&(o.end=Object.assign({},Gl(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function Wl(e,t,n,r,i){const o=[],a=Gl(t.events,n);i&&(i.end=Object.assign({},a),o.push(["exit",i,t])),r.end=Object.assign({},a),o.push(["exit",r,t]),e.add(n+1,0,o)}function Gl(e,t){const n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}const Xl={name:"tasklistCheck",tokenize:function(e,t,n){const r=this;return function(t){if(null!==r.previous||!r._gfmTasklistFirstContentOfListItem)return n(t);return e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),i};function i(t){return mi(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),o):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),o):n(t)}function o(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(t)}function a(r){return fi(r)?t(r):gi(r)?e.check({tokenize:ql},t,n)(r):n(r)}}};function ql(e,t,n){return _i(e,function(e){return null===e?n(e):t(e)},"whitespace")}const $l={};function Yl(e){const t=e||$l,n=this.data(),r=n.micromarkExtensions||(n.micromarkExtensions=[]),i=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);r.push(function(e){return ni([{text:Ml},{document:{91:{name:"gfmFootnoteDefinition",tokenize:Ol,continuation:{tokenize:Dl},exit:Ul}},text:{91:{name:"gfmFootnoteCall",tokenize:Nl},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Il,resolveTo:Ll}}},Fl(e),{flow:{null:{name:"table",tokenize:Vl,resolveAll:jl}}},{text:{91:Xl}}])}(t)),i.push([{transforms:[ms],enter:{literalAutolink:cs,literalAutolinkEmail:us,literalAutolinkHttp:us,literalAutolinkWww:us},exit:{literalAutolink:fs,literalAutolinkEmail:ps,literalAutolinkHttp:ds,literalAutolinkWww:hs}},{enter:{gfmFootnoteCallString:bs,gfmFootnoteCall:xs,gfmFootnoteDefinitionLabelString:_s,gfmFootnoteDefinition:ws},exit:{gfmFootnoteCallString:Ss,gfmFootnoteCall:Ms,gfmFootnoteDefinitionLabelString:Es,gfmFootnoteDefinition:Ts}},{canContainEols:["delete"],enter:{strikethrough:Is},exit:{strikethrough:Ls}},{enter:{table:ol,tableData:cl,tableHeader:cl,tableRow:sl},exit:{codeText:ul,table:al,tableData:ll,tableHeader:ll,tableRow:ll}},{exit:{taskListCheckValueChecked:pl,taskListCheckValueUnchecked:pl,paragraph:fl}}]),o.push(function(e){return{extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:ss,notInConstruct:ls},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:ss,notInConstruct:ls},{character:":",before:"[ps]",after:"\\/",inConstruct:ss,notInConstruct:ls}]},Cs(e),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Ps}],handlers:{delete:Ns}},hl(e),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:ml}}]}}(t))}const Zl=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],Jl={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...Zl,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...Zl],h2:[["className","sr-only"]],img:[...Zl,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...Zl,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...Zl],table:[...Zl],ul:[...Zl,["className","contains-task-list"]],"*":["abbr","accept","acceptCharset","accessKey","action","align","alt","axis","border","cellPadding","cellSpacing","char","charOff","charSet","checked","clear","colSpan","color","cols","compact","coords","dateTime","dir","encType","frame","hSpace","headers","height","hrefLang","htmlFor","id","isMap","itemProp","label","lang","maxLength","media","method","multiple","name","noHref","noShade","noWrap","open","prompt","readOnly","rev","rowSpan","rows","rules","scope","selected","shape","size","span","start","summary","tabIndex","title","useMap","vAlign","value","width"]},clobber:["ariaDescribedBy","ariaLabelledBy","id","name"],clobberPrefix:"user-content-",protocols:{cite:["http","https"],href:["http","https","irc","ircs","mailto","xmpp"],longDesc:["http","https"],src:["http","https"]},required:{input:{disabled:!0,type:"checkbox"}},strip:["script"],tagNames:["a","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","ol","p","picture","pre","q","rp","rt","ruby","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var"]},Kl={}.hasOwnProperty;function Ql(e,t){if(t&&"object"==typeof t){const n=t;switch("string"==typeof n.type?n.type:""){case"comment":return function(e,t){if(e.schema.allowComments){const e="string"==typeof t.value?t.value:"",n=e.indexOf("--\x3e"),r={type:"comment",value:n<0?e:e.slice(0,n)};return rc(r,t),r}}(e,n);case"doctype":return function(e,t){if(e.schema.allowDoctypes){const e={type:"doctype"};return rc(e,t),e}}(e,n);case"element":return function(e,t){const n="string"==typeof t.tagName?t.tagName:"";e.stack.push(n);const r=ec(e,t.children),i=function(e,t){const n=e.stack[e.stack.length-1],r=e.schema.attributes,i=e.schema.required,o=r&&Kl.call(r,n)?r[n]:void 0,a=r&&Kl.call(r,"*")?r["*"]:void 0,s=t&&"object"==typeof t?t:{},l={};let c;for(c in s)if(Kl.call(s,c)){const t=s[c];let n=tc(e,ic(o,c),c,t);null==n&&(n=tc(e,ic(a,c),c,t)),null!=n&&(l[c]=n)}if(i&&Kl.call(i,n)){const e=i[n];for(c in e)Kl.call(e,c)&&!Kl.call(l,c)&&(l[c]=e[c])}return l}(e,t.properties);e.stack.pop();let o=!1;if(n&&"*"!==n&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(o=!0,e.schema.ancestors&&Kl.call(e.schema.ancestors,n))){const t=e.schema.ancestors[n];let r=-1;for(o=!1;++r<t.length;)e.stack.includes(t[r])&&(o=!0)}if(!o)return e.schema.strip&&!e.schema.strip.includes(n)?r:void 0;const a={type:"element",tagName:n,properties:i,children:r};return rc(a,t),a}(e,n);case"root":return function(e,t){const n=ec(e,t.children),r={type:"root",children:n};return rc(r,t),r}(e,n);case"text":return function(e,t){const n="string"==typeof t.value?t.value:"",r={type:"text",value:n};return rc(r,t),r}(0,n)}}}function ec(e,t){const n=[];if(Array.isArray(t)){const r=t;let i=-1;for(;++i<r.length;){const t=Ql(e,r[i]);t&&(Array.isArray(t)?n.push(...t):n.push(t))}}return n}function tc(e,t,n,r){return t?Array.isArray(r)?function(e,t,n,r){let i=-1;const o=[];for(;++i<r.length;){const a=nc(e,t,n,r[i]);"number"!=typeof a&&"string"!=typeof a||o.push(a)}return o}(e,t,n,r):nc(e,t,n,r):void 0}function nc(e,t,n,r){if(("boolean"==typeof r||"number"==typeof r||"string"==typeof r)&&function(e,t,n){const r=e.schema.protocols&&Kl.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!r||0===r.length)return!0;const i=String(n),o=i.indexOf(":"),a=i.indexOf("?"),s=i.indexOf("#"),l=i.indexOf("/");if(o<0||l>-1&&o>l||a>-1&&o>a||s>-1&&o>s)return!0;let c=-1;for(;++c<r.length;){const e=r[c];if(o===e.length&&i.slice(0,e.length)===e)return!0}return!1}(e,n,r)){if("object"==typeof t&&t.length>1){let e=!1,n=0;for(;++n<t.length;){const i=t[n];if(i&&"object"==typeof i&&"flags"in i){if(i.test(String(r))){e=!0;break}}else if(i===r){e=!0;break}}if(!e)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+r:r}}function rc(e,t){const n=Mr(t);t.data&&(e.data=ia(t.data)),n&&(e.position=n)}function ic(e,t){let n,r=-1;if(e)for(;++r<e.length;){const i=e[r],o="string"==typeof i?i:i[0];if(o===t)return i;"data*"===o&&(n=i)}if(t.length>4&&"data"===t.slice(0,4).toLowerCase())return n}function oc(e){return function(t){const n=function(e,t){let n={type:"root",children:[]};const r=Ql({schema:t?{...Jl,...t}:Jl,stack:[]},e);return r&&(Array.isArray(r)?1===r.length?n=r[0]:n.children=r:n=r),n}(t,e);return n}}const ac=w.lazy(()=>Promise.resolve().then(()=>Ev).then(e=>({default:e.AudioPlayer}))),sc=w.lazy(()=>Promise.resolve().then(()=>Cv).then(e=>({default:e.Gallery}))),lc=w.memo(function({message:e,primaryColor:t,botAvatar:n,botName:r="BotUyo",avatars:i,isFirst:o=!0,isLast:a=!0,index:s=0}){const{t:l}=V("extracted"),c="user"===e.sender,u="system"===e.type||"system"===e.sender,d=!c&&!u,h=Ht({primaryColor:t}),p=function(){const e=w.useContext(Xt);return e.enabled&&"none"!==e.messageEntry?{slide:"animate-message-slide",fade:"animate-message-fade",scale:"animate-message-scale",spring:"animate-message-spring"}[e.messageEntry]||"animate-message-spring":""}(),f=w.useMemo(()=>{if(c)return null;if("text"===e.type){const t=e;if(t.emotion&&i?.[t.emotion])return i[t.emotion]}return n},[e,i,n,c]),m=({href:e,children:t})=>{if(!e)return null;const n=String(t).toLowerCase(),r=n.includes("reservar")||n.includes("ver")||n.includes("pagar");return e.includes("maps.google")||e.includes("goo.gl")?C.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"block my-2 no-underline group",children:C.jsxs("span",{className:"flex items-center gap-3 p-3 border rounded-xl shadow-sm group-hover:border-primary/30 transition-all",style:{backgroundColor:"hsl(var(--card))",borderColor:"hsl(var(--border))"},children:[C.jsx("span",{className:"flex-shrink-0 p-2 rounded-full",style:{backgroundColor:`${h}1a`,color:h},children:C.jsx(ie,{size:16,strokeWidth:2.5})}),C.jsx("span",{className:"flex flex-col min-w-0 flex-1 text-[11px] font-bold text-foreground leading-tight uppercase tracking-tight",children:l("ver_ubicacion")}),C.jsx(K,{size:12,className:"text-muted-foreground/40 group-hover:text-primary"})]})}):r?C.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center gap-2 px-5 py-2.5 mt-2 text-[11px] font-black w-full sm:w-auto rounded-xl shadow-md uppercase tracking-widest transition-transform active:scale-95 text-white",style:{backgroundColor:h},children:[t," ",C.jsx(X,{size:14})]}):C.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"font-bold underline decoration-primary/30 hover:decoration-primary transition-all",style:{color:c?"inherit":h},children:t})},g=({src:e,alt:t})=>e?C.jsx(w.Suspense,{fallback:C.jsx("div",{className:"my-3 animate-pulse",children:C.jsx("div",{className:"w-full h-48 bg-muted rounded-xl"})}),children:C.jsx(sc,{images:[{src:e,alt:t}],radius:"rounded-xl"})}):null;return u?C.jsx("div",{className:"flex justify-center my-4 animate-in fade-in zoom-in-95 w-full",children:C.jsx("span",{className:"px-3 py-1 border rounded-full text-[9px] font-black uppercase tracking-widest",style:{backgroundColor:"hsl(var(--muted))",borderColor:"hsl(var(--border))",color:"hsl(var(--muted-foreground))"},children:e.content})}):C.jsxs("div",{className:Ot("flex w-full mb-0.5 group",p,c?"justify-end":"justify-start gap-3",o&&"mt-3",a&&"mb-3"),style:{animationDelay:50*s+"ms"},children:[!c&&C.jsx("div",{className:"w-9 shrink-0 flex flex-col justify-end pb-1",children:a?C.jsx("div",{className:"h-9 w-9 rounded-full overflow-hidden border shadow-sm",style:{borderColor:"hsl(var(--border))",backgroundColor:"hsl(var(--background))"},children:f?C.jsx("img",{src:f,alt:r,className:"h-full w-full object-cover"}):C.jsx("div",{className:"h-full w-full flex items-center justify-center text-white text-[10px] font-black uppercase",style:{backgroundColor:h},children:r.charAt(0)})}):C.jsx("div",{className:"w-9"})}),C.jsxs("div",{className:Ot("max-w-[85%] shadow-sm transition-all duration-300 relative",c?"text-primary-foreground":"border",c?Ot("rounded-[18px]",o&&"rounded-tr-[4px]",!a&&"rounded-br-[4px]",!o&&!a&&"rounded-r-[4px]"):Ot("rounded-[18px]",o&&"rounded-tl-[4px]",!a&&"rounded-bl-[4px]",!o&&!a&&"rounded-l-[4px]")),style:c?{padding:"var(--spacing-4) var(--spacing-5)",backgroundColor:h,boxShadow:a?`0 8px 20px -6px ${h}33`:"none"}:{padding:"var(--spacing-4) var(--spacing-5)",backgroundColor:"hsl(var(--card))",borderColor:"hsl(var(--border) / 0.6)",color:"hsl(var(--foreground))"},children:[(()=>{switch(e.type){case"audio":return C.jsx(w.Suspense,{fallback:C.jsxs("div",{className:"flex items-center gap-3 py-1 min-w-[200px] animate-pulse",children:[C.jsx("div",{className:"w-8 h-8 rounded-full bg-muted"}),C.jsx("div",{className:"flex-1 space-y-1",children:C.jsx("div",{className:"h-1 w-full bg-muted rounded-full"})})]}),children:C.jsx(ac,{url:e.content,isBot:d,primaryColor:t})});case"image":{const t=e;return C.jsx(w.Suspense,{fallback:C.jsx("div",{className:"my-3 animate-pulse",children:C.jsx("div",{className:"w-full h-48 bg-muted rounded-xl"})}),children:C.jsx(sc,{images:[{src:t.imageUrl||t.content,alt:t.altText||"Imagen"}],radius:"rounded-xl"})})}case"location":{const t=e;return C.jsx(m,{href:`https://www.google.com/maps/search/?api=1&query=${t.latitude},${t.longitude}`,children:"Ver ubicación"})}case"file":{const t=e,n=t.fileName?.split(".").pop()?.toLowerCase()||"",r=t.fileSize?`${(t.fileSize/1024/1024).toFixed(2)} MB`:"";return C.jsxs("a",{href:t.fileUrl,download:t.fileName,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 p-3 border rounded-xl transition-all hover:scale-[1.02] group",style:{backgroundColor:c?"rgba(255,255,255,0.1)":"hsl(var(--muted))",borderColor:c?"rgba(255,255,255,0.2)":"hsl(var(--border))"},children:[C.jsx("div",{className:"flex items-center justify-center w-10 h-10 rounded-lg shrink-0",style:{backgroundColor:c?"rgba(255,255,255,0.2)":`${h}1a`,color:c?"white":h},children:C.jsx(Q,{size:20,strokeWidth:2.5})}),C.jsxs("div",{className:"flex-1 min-w-0",children:[C.jsx("p",{className:"text-sm font-bold truncate",children:t.fileName}),r&&C.jsxs("p",{className:"text-xs opacity-60 mt-0.5",children:[n?.toUpperCase()," • ",r]})]}),C.jsx(J,{size:18,className:"shrink-0 opacity-60 group-hover:opacity-100 transition-opacity"})]})}default:return C.jsx("div",{className:Ot("prose prose-sm max-w-none break-words leading-relaxed dark:prose-invert",c?"text-primary-foreground prose-p:text-white":"text-foreground"),children:C.jsx(ts,{remarkPlugins:[Yl],rehypePlugins:[[oc,{tagNames:["p","a","img","strong","em","ul","ol","li","br","span"],attributes:{a:["href","target","rel"],img:["src","alt"],span:["className"]},protocols:{a:{href:["http","https","mailto","tel"]},img:{src:["http","https","data"]}}}]],components:{a:m,img:g,p:({children:e})=>C.jsx("p",{className:"mb-0 last:mb-0",children:e})},children:e.content||""})})}})(),a&&C.jsxs("div",{className:Ot("flex items-center gap-1 mt-1.5 opacity-50 select-none text-[9px]",c?"justify-end":"justify-start"),children:[C.jsx("span",{className:"font-bold tabular-nums uppercase tracking-tighter",children:(e=>{const t=new Date(e);return isNaN(t.getTime())?"":t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})})(e.timestamp)}),c&&C.jsx(q,{className:"h-2.5 w-2.5"})]})]})]})},(e,t)=>e.message.id===t.message.id&&(e.message.timestamp===t.message.timestamp&&(e.primaryColor===t.primaryColor&&(e.botAvatar===t.botAvatar&&(e.botName===t.botName&&(e.isFirst===t.isFirst&&(e.isLast===t.isLast&&JSON.stringify(e.styles)===JSON.stringify(t.styles)))))))),cc=w.memo(function(){return C.jsx("div",{style:{display:"flex",alignItems:"center",alignSelf:"flex-start",maxWidth:"85%",animation:"message-fade 0.2s ease-out forwards"},children:C.jsx("div",{style:{backgroundColor:"hsl(var(--card, 0 0% 100%))",border:"1px solid hsl(var(--border, 0 0% 90%))",borderRadius:"18px",borderTopLeftRadius:"4px",padding:"14px 20px",boxShadow:"0 1px 3px rgba(0,0,0,0.06)"},children:C.jsx("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[0,1,2].map(e=>C.jsx("span",{className:"animate-typing-dots",style:{display:"inline-block",height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"hsl(var(--primary, 250 84% 54%) / 0.6)",animationDelay:200*e+"ms"}},e))})})})});function uc(e,t){const n=e.getTime()-t.getTime();return Math.floor(n/1e3/60)}function dc(e){return new Intl.DateTimeFormat("es-ES",{hour:"2-digit",minute:"2-digit"}).format(e)}function hc(e){return function(e){const t=new Date;return e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}(e)?`Hoy, ${dc(e)}`:function(e){const t=new Date;return t.setDate(t.getDate()-1),e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}(e)?`Ayer, ${dc(e)}`:function(e){return new Intl.DateTimeFormat("es-ES",{day:"numeric",month:"long",hour:"2-digit",minute:"2-digit"}).format(e)}(e)}const pc=w.memo(function({messages:e,isTyping:t,welcomeMessage:n="¡Hola! ¿En qué puedo ayudarte?",primaryColor:r,logoUrl:i,botName:o="BotUyo",bubbleStyles:a,avatars:s}){const l=w.useRef(null),c=w.useRef(null),[u,d]=w.useState(!1),[h,p]=w.useState(!1),f=Ht({primaryColor:r}),m=e.length>100,g=_n({count:e.length,getScrollElement:()=>c.current,estimateSize:()=>80,overscan:5,enabled:m});w.useEffect(()=>{d(!0)},[]),w.useEffect(()=>{if(u&&(e.length>0||t)){const t=setTimeout(()=>{m?g.scrollToIndex(e.length-1,{align:"end",behavior:e.length<=1?"auto":"smooth"}):l.current?.scrollIntoView({behavior:e.length<=1?"auto":"smooth",block:"end"})},100);return()=>clearTimeout(t)}},[e.length,t,u,m,g]);const v=e=>{const t=new Date(e);return isNaN(t.getTime())?"":hc(t)};return u?m?C.jsxs("div",{ref:c,className:"flex-1 overflow-y-auto scroll-smooth bg-background/50 scrollbar-none",style:{padding:"var(--spacing-5)"},children:[C.jsx("div",{style:{height:`${g.getTotalSize()}px`,width:"100%",position:"relative"},children:g.getVirtualItems().map(t=>{const n=e[t.index],l=t.index,c=e[l-1],u=e[l+1],d=c&&uc(new Date(n.timestamp),new Date(c.timestamp))>15,h=c&&c.sender===n.sender&&uc(new Date(n.timestamp),new Date(c.timestamp))<5&&!d,p=u&&u.sender===n.sender&&uc(new Date(u.timestamp),new Date(n.timestamp))<5;return C.jsxs("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${t.start}px)`},children:[d&&C.jsx("div",{className:"flex justify-center my-8 animate-in fade-in zoom-in-95",children:C.jsx("span",{className:"px-4 py-1.5 bg-muted/40 backdrop-blur-md rounded-full text-[10px] font-black text-muted-foreground uppercase tracking-[0.2em] border border-border/50 shadow-sm",children:v(n.timestamp)})}),C.jsx(lc,{message:n,primaryColor:r,botAvatar:i,botName:o,styles:a,avatars:s,isFirst:!h,isLast:!p})]},t.key)})}),t&&C.jsxs("div",{className:"flex items-end gap-3 mt-4 mb-2 animate-in fade-in slide-in-from-left-4 duration-500",children:[C.jsx("div",{className:"w-8 h-8 rounded-xl bg-muted/60 border border-border/50 flex items-center justify-center shrink-0 shadow-soft-sm",children:C.jsxs("div",{className:"flex gap-[2px]",children:[C.jsx("span",{className:"w-1 h-1 bg-primary/50 rounded-full animate-bounce [animation-delay:-0.3s]"}),C.jsx("span",{className:"w-1 h-1 bg-primary/50 rounded-full animate-bounce [animation-delay:-0.15s]"}),C.jsx("span",{className:"w-1 h-1 bg-primary/50 rounded-full animate-bounce"})]})}),C.jsx(cc,{})]})]}):C.jsxs("div",{ref:c,className:"flex-1 overflow-y-auto scroll-smooth p-4 bg-background/50 scrollbar-none",children:[C.jsxs("div",{className:"min-h-full flex flex-col justify-end",children:[0===e.length&&C.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center py-16 text-center animate-in fade-in zoom-in-95 duration-1000",children:[C.jsxs("div",{className:"relative h-24 w-24 mb-6",children:[C.jsx("div",{className:"absolute inset-0 bg-primary/20 rounded-full animate-pulse blur-2xl"}),C.jsx("div",{className:"relative h-full w-full rounded-[28px] border-2 border-primary/20 overflow-hidden bg-card shadow-soft-2xl transition-transform hover:scale-105 duration-500",children:h?C.jsx("div",{className:"h-full w-full flex items-center justify-center text-3xl",style:{backgroundColor:f},children:"👋"}):i?C.jsx("img",{src:i,className:"object-cover h-full w-full",alt:o,onError:()=>p(!0)}):C.jsx("div",{className:"h-full w-full flex items-center justify-center text-3xl",style:{backgroundColor:f},children:"👋"})})]}),C.jsxs("div",{className:"space-y-2",children:[C.jsx("h3",{className:"font-black text-xl text-foreground uppercase tracking-tighter italic",children:o}),C.jsxs("p",{className:"text-[12px] font-bold text-muted-foreground italic px-10 leading-relaxed opacity-60",children:['"',n,'"']})]})]}),C.jsx("div",{className:"flex flex-col",style:{gap:"var(--spacing-3)"},children:e.map((t,n)=>{const l=e[n-1],c=e[n+1],u=l&&uc(new Date(t.timestamp),new Date(l.timestamp))>15,d=l&&l.sender===t.sender&&uc(new Date(t.timestamp),new Date(l.timestamp))<5&&!u,h=c&&c.sender===t.sender&&uc(new Date(c.timestamp),new Date(t.timestamp))<5;return C.jsxs(S.Fragment,{children:[u&&C.jsx("div",{className:"flex justify-center my-8 animate-in fade-in zoom-in-95",children:C.jsx("span",{className:"px-4 py-1.5 bg-muted/40 backdrop-blur-md rounded-full text-[10px] font-black text-muted-foreground uppercase tracking-[0.2em] border border-border/50 shadow-sm",children:v(t.timestamp)})}),C.jsx(lc,{message:t,primaryColor:r,botAvatar:i,botName:o,styles:a,avatars:s,isFirst:!d,isLast:!h})]},t.id||`msg-${n}`)})}),C.jsx("div",{ref:l,className:"h-6 shrink-0"})]}),t&&C.jsxs("div",{className:"flex items-end gap-3 mt-4 mb-2 animate-in fade-in slide-in-from-left-4 duration-500",children:[C.jsx("div",{className:"w-8 h-8 rounded-xl bg-muted/60 border border-border/50 flex items-center justify-center shrink-0 shadow-soft-sm",children:C.jsxs("div",{className:"flex gap-[2px]",children:[C.jsx("span",{className:"w-1 h-1 bg-primary/50 rounded-full animate-bounce [animation-delay:-0.3s]"}),C.jsx("span",{className:"w-1 h-1 bg-primary/50 rounded-full animate-bounce [animation-delay:-0.15s]"}),C.jsx("span",{className:"w-1 h-1 bg-primary/50 rounded-full animate-bounce"})]})}),C.jsx(cc,{})]})]}):C.jsx("div",{className:"flex-1 bg-background"})},(e,t)=>{if(e.messages.length!==t.messages.length)return!1;if(e.isTyping!==t.isTyping)return!1;if(e.primaryColor!==t.primaryColor)return!1;if(e.botName!==t.botName)return!1;if(e.logoUrl!==t.logoUrl)return!1;const n=e.messages[e.messages.length-1],r=t.messages[t.messages.length-1];return n?.id===r?.id}),fc={"image/jpeg":[255,216,255],"image/png":[137,80,78,71,13,10,26,10],"image/webp":[82,73,70,70],"image/gif":[71,73,70,56],"audio/mpeg":[255,251],"audio/wav":[82,73,70,70],"audio/webm":[26,69,223,163],"audio/ogg":[79,103,103,83]};async function mc(e,t={}){const{maxSizeMB:n=10,allowedExtensions:r,checkMagicBytes:i=!0}=t;if(!function(e,t=10){const n=1024*t*1024;return e.size<=n}(e,n))return{valid:!1,error:`El archivo es demasiado grande. Máximo ${n}MB`};if(r&&!function(e,t){const n=e.name.split(".").pop()?.toLowerCase();return!!n&&t.includes(n)}(e,r))return{valid:!1,error:`Extensión no permitida. Solo: ${r.join(", ")}`};if(i){const t=await async function(e){try{const t=fc[e.type];if(!t)return!0;const n=await e.slice(0,12).arrayBuffer(),r=new Uint8Array(n);return t.every((e,t)=>r[t]===e)}catch(t){return console.error("File validation error:",t),!1}}(e);if(!t)return{valid:!1,error:"El archivo está corrupto o no es del tipo indicado"}}return{valid:!0}}const gc=1e3,vc={enableImages:!0,enableAudio:!0,enableFiles:!0,enableLocation:!0,allowedFileTypes:["jpg","jpeg","png","webp","gif","pdf","doc","docx","txt","zip"],maxFileSizeMB:10};function yc({isConnected:e,placeholder:t="Escribe un mensaje...",primaryColor:n,mediaConfig:r,onSendMessage:i,onSendAttachment:o,onSendLocation:a,onVoiceCall:s}){const{t:l}=V(),[c,u]=w.useState(""),[d,h]=w.useState(!1),[p,f]=w.useState(!1),[m,g]=w.useState(0),[v,y]=w.useState(null),[b,x]=w.useState(!1),[_,S]=w.useState(!1),M=w.useRef(null),E=w.useRef(null),T=w.useRef(null),A=w.useRef(null),k=w.useRef([]),R=w.useRef(null),P=Ht({primaryColor:n}),I=w.useMemo(()=>({...vc,...r}),[r]),L=w.useMemo(()=>I.enableImages||I.enableAudio||I.enableFiles||I.enableLocation,[I]),N=()=>{const t=c.trim();v?(o?.(v.file,v.type),y(null),u("")):t&&e&&(i(t),u("")),M.current&&(M.current.style.height="40px",requestAnimationFrame(()=>M.current?.focus()))},O=async e=>{const t=e.target.files?.[0];if(!t)return;h(!1);const n=await mc(t,{maxSizeMB:I.maxFileSizeMB||10,allowedExtensions:I.allowedFileTypes||["jpg","jpeg","png","webp","gif","pdf","doc","docx","txt","zip"],checkMagicBytes:!0});if(n.valid)if(t.type.startsWith("image/")&&I.enableImages){x(!0);try{const{default:e}=await Promise.resolve().then(()=>dy),n={maxSizeMB:.8,maxWidthOrHeight:1200,useWebWorker:!0},r=await e(t,n);y({type:"image",file:r,previewUrl:URL.createObjectURL(r)})}catch(r){Jt("Image compression failed:",r),y({type:"image",file:t,previewUrl:URL.createObjectURL(t)})}finally{x(!1)}}else y({type:"file",file:t,previewUrl:""});else alert(n.error||"Archivo no válido")},D=async e=>{if(A.current&&(e||(A.current.onstop=null),A.current.stop(),A.current.stream.getTracks().forEach(e=>e.stop())),R.current&&clearInterval(R.current),f(!1),g(0),e&&k.current.length>0){const e=new Blob(k.current,{type:"audio/webm"}),t=new File([e],`audio-${Date.now()}.webm`,{type:"audio/webm"}),n=await mc(t,{maxSizeMB:10});if(!n.valid)return Jt("Audio validation failed:",n.error),alert(n.error),void(k.current=[]);o?.(t,"audio"),k.current=[]}};return C.jsxs("div",{className:"relative",children:[(v||b)&&C.jsx("div",{className:"absolute bottom-full left-0 mb-2 p-2 rounded-2xl border shadow-soft-2xl animate-in slide-in-from-bottom-2 z-50",style:{backgroundColor:"hsl(var(--card))",borderColor:"hsl(var(--border))"},children:C.jsx("div",{className:"relative w-16 h-16",children:b?C.jsx("div",{className:"w-full h-full flex flex-col items-center justify-center bg-muted rounded-xl",children:C.jsx(re,{className:"animate-spin text-primary h-5 w-5"})}):"image"===v?.type?C.jsxs(C.Fragment,{children:[C.jsx("img",{src:v?.previewUrl,className:"w-full h-full object-cover rounded-xl border",alt:l("preview")}),C.jsx("button",{onClick:()=>y(null),className:"absolute -top-1.5 -right-1.5 bg-destructive text-white rounded-full p-1 shadow-md hover:scale-105",children:C.jsx(ye,{size:10,strokeWidth:3})})]}):C.jsxs(C.Fragment,{children:[C.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center bg-muted rounded-xl border",children:[C.jsx(Q,{className:"text-primary h-6 w-6"}),C.jsx("span",{className:"text-[8px] mt-1 font-bold truncate max-w-[60px]",children:v?.file.name})]}),C.jsx("button",{onClick:()=>y(null),className:"absolute -top-1.5 -right-1.5 bg-destructive text-white rounded-full p-1 shadow-md hover:scale-105",children:C.jsx(ye,{size:10,strokeWidth:3})})]})})}),C.jsx("input",{type:"file",accept:"image/*",className:"hidden",ref:T,onChange:O}),C.jsx("input",{type:"file",accept:I.allowedFileTypes?.map(e=>`.${e}`).join(","),className:"hidden",ref:E,onChange:O}),C.jsxs("div",{className:"flex items-center max-w-full",style:{gap:"var(--spacing-3)"},children:[L&&o&&C.jsxs("div",{className:"relative shrink-0",children:[d&&C.jsxs("div",{className:"absolute bottom-full left-0 flex flex-col animate-in fade-in slide-in-from-bottom-2 duration-300 z-[60]",style:{marginBottom:"var(--spacing-2)",gap:"var(--spacing-2)"},children:[I.enableImages&&C.jsxs("button",{onClick:()=>T.current?.click(),className:"flex items-center border shadow-soft-2xl rounded-2xl transition-colors text-[10px] font-black uppercase tracking-widest",style:{gap:"var(--spacing-3)",padding:"var(--spacing-3) var(--spacing-5)",backgroundColor:"hsl(var(--card))",borderColor:"hsl(var(--border))",color:"hsl(var(--card-foreground))"},children:[C.jsx(te,{size:18,className:"text-blue-500"})," ",l("fotos")]}),I.enableFiles&&C.jsxs("button",{onClick:()=>E.current?.click(),className:"flex items-center border shadow-soft-2xl rounded-2xl transition-colors text-[10px] font-black uppercase tracking-widest",style:{gap:"var(--spacing-3)",padding:"var(--spacing-3) var(--spacing-5)",backgroundColor:"hsl(var(--card))",borderColor:"hsl(var(--border))",color:"hsl(var(--card-foreground))"},children:[C.jsx(Q,{size:18,className:"text-purple-500"})," Archivos"]}),I.enableLocation&&a&&C.jsxs("button",{onClick:()=>{S(!0),navigator.geolocation.getCurrentPosition(e=>{a?.({latitude:e.coords.latitude,longitude:e.coords.longitude}),S(!1),h(!1)},()=>S(!1))},className:"flex items-center border shadow-soft-2xl rounded-2xl transition-colors text-[10px] font-black uppercase tracking-widest",style:{gap:"var(--spacing-3)",padding:"var(--spacing-3) var(--spacing-5)",backgroundColor:"hsl(var(--card))",borderColor:"hsl(var(--border))",color:"hsl(var(--card-foreground))"},children:[_?C.jsx(re,{size:18,className:"animate-spin"}):C.jsx(ie,{size:18,className:"text-emerald-500"})," ",l("ubicacion")]}),I.enableVoice&&s&&C.jsxs("button",{onClick:()=>{s?.(),h(!1)},className:"flex items-center border shadow-soft-2xl rounded-2xl transition-colors text-[10px] font-black uppercase tracking-widest",style:{gap:"var(--spacing-3)",padding:"var(--spacing-3) var(--spacing-5)",backgroundColor:"hsl(var(--card))",borderColor:"hsl(var(--border))",color:"hsl(var(--card-foreground))"},children:[C.jsx(ue,{size:18,className:"text-amber-500"})," Llamar"]})]}),C.jsx("button",{onClick:()=>h(!d),className:Ot("h-10 w-10 rounded-full flex items-center justify-center transition-all shadow-sm z-10",d?"bg-muted text-foreground rotate-45":"bg-muted/50 text-muted-foreground hover:bg-muted"),children:C.jsx(he,{size:22,strokeWidth:2.5})})]}),C.jsx("div",{className:Ot("flex-1 relative flex items-center min-w-0 rounded-[24px] border px-4 transition-all shadow-inner",p?"h-[44px]":"min-h-[40px] max-h-[120px]"),style:{backgroundColor:p?"hsl(var(--destructive) / 0.05)":"hsl(var(--muted))",borderColor:p?"hsl(var(--destructive))":"hsl(var(--border))"},children:p?C.jsxs("div",{className:"flex items-center w-full animate-in zoom-in-95",style:{gap:"var(--spacing-4)"},children:[C.jsx("button",{onClick:()=>D(!1),className:"text-destructive/50 hover:text-destructive",children:C.jsx(ge,{size:18})}),C.jsxs("div",{className:"flex-1 flex items-center",style:{gap:"var(--spacing-2)"},children:[C.jsx("div",{className:"flex gap-[3px]",children:[1,2,3,4].map(e=>C.jsx("span",{className:"w-[3px] h-3 bg-destructive/60 rounded-full animate-pulse",style:{animationDelay:.15*e+"s"}},e))}),C.jsxs("span",{className:"text-destructive font-black text-[11px] tabular-nums",children:[Math.floor(m/60),":",(m%60).toString().padStart(2,"0")]})]}),C.jsx("button",{onClick:()=>D(!0),className:"w-7 h-7 rounded-full bg-destructive flex items-center justify-center text-white shadow-lg",children:C.jsx(fe,{size:12,fill:"currentColor"})})]}):C.jsxs("div",{className:"w-full relative flex items-center",children:[C.jsx("textarea",{ref:M,rows:1,value:c,onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.ctrlKey||e.metaKey?"Enter"===e.key&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),N()):(e.preventDefault(),N())},onChange:e=>{const t=e.target.value.slice(0,gc);u(t),M.current&&(M.current.style.height="40px",M.current.style.height=`${Math.min(M.current.scrollHeight,120)}px`)},onFocus:()=>h(!1),placeholder:t,"aria-label":l("accessibility.typeMessage"),"aria-describedby":"send-message-hint","aria-invalid":c.length>gc,disabled:!e,className:"w-full bg-transparent text-sm py-2.5 outline-none resize-none overflow-hidden leading-tight pr-8 scrollbar-none disabled:opacity-50",style:{scrollbarWidth:"none",msOverflowStyle:"none",color:"hsl(var(--foreground))"}}),C.jsx("span",{id:"send-message-hint",className:"sr-only",children:l("accessibility.sendMessageHint")}),c.length>800&&C.jsx("span",{className:Ot("absolute right-0 text-[9px] font-bold tabular-nums",c.length>=gc?"text-destructive":"text-muted-foreground/40"),children:gc-c.length})]})}),!p&&C.jsx(C.Fragment,{children:c.trim()||v?C.jsx("button",{onClick:N,disabled:!e||b&&!!v,className:"h-10 w-10 rounded-full flex items-center justify-center transition-all active:scale-90 shadow-md shadow-primary/20 shrink-0 disabled:opacity-30 disabled:grayscale",style:{backgroundColor:P},children:C.jsx(fe,{size:18,className:"text-white ml-0.5 fill-current"})}):I.enableAudio&&o?C.jsx("button",{onClick:async()=>{if(e)try{const e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=new MediaRecorder(e);A.current=t,k.current=[],t.ondataavailable=e=>k.current.push(e.data),t.onstop=()=>{const e=new File([new Blob(k.current)],"voice.webm",{type:"audio/webm"});o?.(e,"audio")},t.start(),f(!0),R.current=setInterval(()=>g(e=>e+1),1e3)}catch{alert("Micrófono denegado o no disponible")}},disabled:!e,className:"h-10 w-10 rounded-full flex items-center justify-center transition-all active:scale-90 shadow-md shadow-primary/20 shrink-0 disabled:opacity-30 disabled:grayscale",style:{backgroundColor:P},children:C.jsx(se,{size:20,strokeWidth:2.5,className:"text-white"})}):C.jsx("button",{onClick:N,disabled:!e,className:"h-10 w-10 rounded-full flex items-center justify-center transition-all active:scale-90 shadow-md shadow-primary/20 shrink-0 disabled:opacity-30 disabled:grayscale",style:{backgroundColor:P},children:C.jsx(fe,{size:18,className:"text-white ml-0.5 fill-current"})})})]})]})}function bc(e,t){let n=0,r=null;return function(...i){const o=Date.now(),a=o-n,s=()=>{n=o,e(...i)};a>=t?(r&&(clearTimeout(r),r=null),s()):r||(r=setTimeout(()=>{s(),r=null},t-a))}}function xc(e=640){const[t,n]=w.useState(()=>"undefined"!=typeof window&&window.innerWidth<e);return w.useEffect(()=>{const t=bc(()=>{n(window.innerWidth<e)},250);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[e]),t}const _c="24px";const wc=w.lazy(()=>Promise.resolve().then(()=>uz)),Sc={happy:"😊",wink:"😉",thinking:"🤔",sad:"😢",excited:"🤩",love:"❤️",laugh:"😄",surprised:"😲",angry:"😠",confused:"😕",sorry:"😔",default:"💬"},Mc={idle:"Llamada de voz",connecting:"Conectando...",listening:"Escuchando...",thinking:"Pensando...",speaking:"Hablando..."},Ec={tagNames:["p","a","strong","em","ul","ol","li","br","span","code"],attributes:{a:["href","target","rel"],span:["className"],code:["className"]},protocols:{a:{href:["http","https","mailto","tel"]}}},Tc=24e3,Ac=300;class Cc extends w.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.warn("[Avatar3D] Three.js failed, falling back to 2D orb:",e.message),this.props.onError()}render(){return this.state.hasError?null:this.props.children}}function kc({avatars:e,logoUrl:t,avatar3dUrl:n,emotion:r,callState:i,audioLevel:o,config:a}){const s=e&&Object.keys(e).length>0,l=!!t,[c,u]=w.useState(!1),d=w.useMemo(()=>{if(!s&&!l)return null;if(s){return e[r||"default"]||e.default||t||en}return t||en},[s,l,e,r,t]),h="listening"===i||"speaking"===i,p="speaking"===i?a.speakingColor:"thinking"===i?a.thinkingColor:"listening"===i?a.listeningColor:"#ffffff20",f="speaking"===i?a.speakingScale:"thinking"===i?a.thinkingScale:1,m=a.orbSize;return n&&!c?C.jsxs("div",{className:"relative flex flex-col items-center gap-4",children:[C.jsx(Cc,{onError:()=>u(!0),children:C.jsx(w.Suspense,{fallback:C.jsx("div",{className:"rounded-full flex items-center justify-center animate-pulse",style:{width:`${a.orbSize}px`,height:`${a.orbSize}px`,background:`radial-gradient(circle at 35% 35%, ${a.speakingColor}40, ${a.speakingColor}10 60%, transparent 80%)`,boxShadow:`0 0 30px ${a.speakingColor}15`}}),children:C.jsx(wc,{modelUrl:n,emotion:r,callState:i,audioLevel:o,primaryColor:a.speakingColor,size:a.orbSize})})}),a.showWaveform&&C.jsx(Rc,{isActive:"listening"===i||"speaking"===i,audioLevel:o,color:"speaking"===i?a.speakingColor:"thinking"===i?a.thinkingColor:a.listeningColor})]}):d?C.jsxs("div",{className:"relative flex flex-col items-center gap-4",children:[C.jsxs("div",{className:Ot("relative rounded-full flex items-center justify-center","transition-all duration-500 ease-out"),style:{width:`${m}px`,height:`${m}px`,boxShadow:h?`0 0 0 4px ${p}40, 0 0 30px ${p}30, 0 0 60px ${p}15`:`0 0 0 2px ${p}20`,transform:`scale(${f})`},children:[C.jsx("img",{src:d,alt:"Bot avatar",className:Ot("h-full w-full rounded-full object-cover","transition-all duration-300","thinking"===i&&"opacity-80"),style:{boxShadow:"listening"===i?`0 0 0 2px ${a.listeningColor}80`:"speaking"===i?`0 0 0 2px ${a.speakingColor}80`:"none"}}),a.showEmotionLabel&&r&&C.jsxs("div",{className:"absolute -bottom-1 left-1/2 -translate-x-1/2 px-2 py-0.5 rounded-full bg-black/70 backdrop-blur-sm text-[10px] font-bold text-white whitespace-nowrap",children:[a.showEmojis&&(a.emotionEmojis[r]||"💬")," ",r]})]}),a.showWaveform&&C.jsx(Rc,{isActive:h,audioLevel:o,color:p})]}):C.jsxs("div",{className:"relative flex flex-col items-center gap-6",children:[C.jsxs("div",{className:"relative",style:{width:`${m+48}px`,height:`${m+48}px`},children:[C.jsx("div",{className:"absolute inset-0 rounded-full",style:{border:`1.5px solid ${p}20`,animation:h?"spin 8s linear infinite":"none"}}),C.jsx("div",{className:"absolute rounded-full",style:{inset:"12px",border:`1px solid ${p}15`,animation:h?"spin 12s linear infinite reverse":"none"}}),C.jsx("div",{className:"absolute rounded-full flex items-center justify-center",style:{inset:"24px",background:`radial-gradient(circle at 35% 35%, ${p}40, ${p}10 60%, transparent 80%)`,boxShadow:h?`0 0 60px ${p}35, 0 0 120px ${p}15, inset 0 0 40px ${p}10`:`0 0 30px ${p}15`,transform:`scale(${f})`,transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)"},children:C.jsx("div",{className:"rounded-full",style:{width:.35*m+"px",height:.35*m+"px",background:`radial-gradient(circle, ${p}90, ${p}40)`,boxShadow:`0 0 20px ${p}60`,animation:h?"pulse 2s ease-in-out infinite":"none"}})}),h&&[0,1,2].map(e=>C.jsx("div",{className:"absolute rounded-full",style:{width:"4px",height:"4px",backgroundColor:p,opacity:.6,top:"50%",left:"50%",transform:`rotate(${120*e+Date.now()/20%360}deg) translateX(${(m+48)/2}px)`,animation:`spin ${6+2*e}s linear infinite`,boxShadow:`0 0 6px ${p}`}},e))]}),a.showWaveform&&C.jsx(Rc,{isActive:h,audioLevel:o,color:p})]})}function Rc({isActive:e,audioLevel:t,color:n}){return C.jsx("div",{className:"flex items-center gap-[3px] h-10",children:Array.from({length:12}).map((r,i)=>{const o=Math.abs(i-5.5)/5.5,a=e?Math.max(4,40*t*(1-.5*o)*(.5+.5*Math.sin(Date.now()/100+.8*i))):4;return C.jsx("div",{className:"rounded-full transition-all duration-100",style:{width:"3px",height:`${a}px`,backgroundColor:n,opacity:e?.7-.3*o:.2}},i)})})}function Pc({isOpen:e,onClose:t,primaryColor:n="#10b981",getSocket:r,avatars:i,logoUrl:o,avatar3dUrl:a,voiceConfig:s,onAddMessage:l}){const c=w.useMemo(()=>function(e,t="#10b981"){return{backgroundColor:e?.backgroundColor??"#0a0a0a",listeningColor:e?.listeningColor??"#10b981",speakingColor:e?.speakingColor??t,thinkingColor:e?.thinkingColor??"#a855f7",showEmojis:e?.showEmojis??!0,showEmotionLabel:e?.showEmotionLabel??!0,showWaveform:e?.showWaveform??!0,showBadge:e?.showBadge??!1,badgeText:e?.badgeText??"",emotionEmojis:{...Sc,...e?.emotionEmojis},statusLabels:{...Mc,...e?.statusLabels},orbSize:e?.orbSize??128,speakingScale:e?.speakingScale??1.08,thinkingScale:e?.thinkingScale??.95,avatar3dUrl:e?.avatar3dUrl}}(s,n),[s,n]),[u,d]=w.useState("idle"),[h,p]=w.useState(0),[f,m]=w.useState(!1),[g,v]=w.useState(0),[y,b]=w.useState(null),[x,_]=w.useState([]),[S,M]=w.useState(!1),[E,T]=w.useState(""),[A,k]=w.useState(!1),R=w.useRef(null),P=w.useRef(null),I=w.useRef(null),L=w.useRef(null),N=w.useRef(null),O=w.useRef(0),D=w.useRef(!1),U=w.useRef(null),F=w.useRef(null),z=w.useRef(()=>{}),B=w.useRef(null),V=w.useRef([]),j=w.useRef(!1),H=w.useRef(0),W=w.useRef([]),G=w.useCallback(e=>`${Math.floor(e/60)}:${(e%60).toString().padStart(2,"0")}`,[]),X=w.useCallback(()=>{if(0===V.current.length)return;B.current&&"closed"!==B.current.state||(B.current=new AudioContext({sampleRate:Tc}));const e=B.current;j.current=!0,d("speaking");const t=e.currentTime;for(H.current<t&&(H.current=t);V.current.length>0;){const t=V.current.shift(),n=e.createBuffer(1,t.length,Tc);n.getChannelData(0).set(t);const r=e.createBufferSource();r.buffer=n,r.connect(e.destination),r.start(H.current),W.current.push(r),r.onended=()=>{W.current=W.current.filter(e=>e!==r),0===W.current.length&&0===V.current.length&&(j.current=!1,d(e=>"speaking"===e?"listening":e))},H.current+=t.length/Tc}},[]),q=w.useRef({}),$=w.useCallback(()=>{const e=r?.();if(!e||D.current)return;const t=()=>{d("listening")},n=e=>{if(!e?.data)return;const t=function(e){const t=atob(e),n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);const r=new Int16Array(n.buffer),i=new Float32Array(r.length);for(let o=0;o<r.length;o++)i[o]=r[o]/32768;return i}(e.data);V.current.push(t),X()},i=()=>{W.current.forEach(e=>{try{e.stop()}catch{}}),W.current=[],V.current.length=0,H.current=0,j.current=!1,d("listening")},o=()=>{},a=e=>{console.error("[VoiceCall] Voice error:",e)},s=e=>{e?.emotion&&(b(e.emotion),setTimeout(()=>b(t=>t===e.emotion?null:t),4e3))},l=e=>{e?.text&&_(t=>{if(t.length>0&&"user"===t[t.length-1].role){const n=[...t],r=n[n.length-1].text,i=r.length>0&&!r.endsWith(" ")&&!e.text.startsWith(" ");return n[n.length-1]={...n[n.length-1],text:r+(i?" ":"")+e.text},n}return[...t,{role:"user",text:e.text}]})},c=e=>{e?.text&&_(t=>{if(t.length>0&&"bot"===t[t.length-1].role){const n=[...t],r=n[n.length-1].text,i=r.length>0&&!r.endsWith(" ")&&!e.text.startsWith(" ");return n[n.length-1]={...n[n.length-1],text:r+(i?" ":"")+e.text},n}return[...t,{role:"bot",text:e.text}]})},u=()=>{d("thinking")};q.current={voiceReady:t,voiceAudioChunk:n,voiceInterrupted:i,voiceTurnComplete:o,voiceError:a,voiceEmotion:s,voiceUserTranscript:l,voiceModelTranscript:c,voiceModelThinking:u},e.on("voice_ready",t),e.on("voice_audio_chunk",n),e.on("voice_interrupted",i),e.on("voice_turn_complete",o),e.on("voice_error",a),e.on("voice_emotion",s),e.on("voice_user_transcript",l),e.on("voice_model_transcript",c),e.on("voice_model_thinking",u),e.on("voice_timeout",()=>{z.current()}),D.current=!0},[r,X]),Y=w.useCallback(()=>{const e=r?.();if(!e||!D.current)return;const t=q.current;t.voiceReady&&e.off("voice_ready",t.voiceReady),t.voiceAudioChunk&&e.off("voice_audio_chunk",t.voiceAudioChunk),t.voiceInterrupted&&e.off("voice_interrupted",t.voiceInterrupted),t.voiceTurnComplete&&e.off("voice_turn_complete",t.voiceTurnComplete),t.voiceError&&e.off("voice_error",t.voiceError),t.voiceEmotion&&e.off("voice_emotion",t.voiceEmotion),t.voiceUserTranscript&&e.off("voice_user_transcript",t.voiceUserTranscript),t.voiceModelTranscript&&e.off("voice_model_transcript",t.voiceModelTranscript),t.voiceModelThinking&&e.off("voice_model_thinking",t.voiceModelThinking),e.off("voice_timeout"),q.current={},D.current=!1},[r]),Z=w.useCallback(async()=>{const e=r?.();if(!e)return;const t=await navigator.mediaDevices.getUserMedia({audio:{sampleRate:16e3,channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}});I.current=t;const n=new AudioContext({sampleRate:16e3});L.current=n;const i=n.createMediaStreamSource(t),o=n.createAnalyser();if(o.fftSize=256,i.connect(o),P.current=o,!U.current){const e=new Blob(["\nclass VoicePCMProcessor extends AudioWorkletProcessor {\n constructor() {\n super();\n this.buffer = new Float32Array(1600); // 100ms at 16kHz\n this.bufferIndex = 0;\n }\n process(inputs) {\n const input = inputs[0]?.[0];\n if (!input) return true;\n for (let i = 0; i < input.length; i++) {\n this.buffer[this.bufferIndex++] = input[i];\n if (this.bufferIndex >= 1600) {\n // Convert Float32 → Int16 PCM\n const int16 = new Int16Array(1600);\n for (let j = 0; j < 1600; j++) {\n const s = Math.max(-1, Math.min(1, this.buffer[j]));\n int16[j] = s < 0 ? s * 0x8000 : s * 0x7FFF;\n }\n this.port.postMessage(int16.buffer, [int16.buffer]);\n this.buffer = new Float32Array(1600);\n this.bufferIndex = 0;\n }\n }\n return true;\n }\n}\nregisterProcessor('voice-pcm-processor', VoicePCMProcessor);\n"],{type:"application/javascript"});U.current=URL.createObjectURL(e)}await n.audioWorklet.addModule(U.current);const a=new AudioWorkletNode(n,"voice-pcm-processor");N.current=a,a.port.onmessage=t=>{if(e.connected&&!f){const n=function(e){const t=new Uint8Array(e);let n="";for(let r=0;r<t.byteLength;r++)n+=String.fromCharCode(t[r]);return btoa(n)}(t.data);e.emit("voice_audio_chunk",{data:n})}},i.connect(a);const s=()=>{if(!P.current)return;const e=new Uint8Array(P.current.frequencyBinCount);P.current.getByteFrequencyData(e);const t=e.reduce((e,t)=>e+t,0)/e.length;v(t/255),O.current=requestAnimationFrame(s)};s()},[r,f]),J=w.useCallback(()=>{cancelAnimationFrame(O.current),N.current?.disconnect(),N.current=null,I.current?.getTracks().forEach(e=>e.stop()),I.current=null,L.current?.close(),L.current=null,P.current=null,v(0)},[]),K=w.useCallback(async()=>{const e=r?.();if(e?.connected){d("connecting"),p(0),_([]),b(null),V.current=[],$();try{await Z()}catch(t){return console.error("[VoiceCall] Mic error:",t),void d("idle")}e.emit("voice_start",{language:"es-AR",voice:"Kore"}),R.current=setInterval(()=>{p(e=>{const t=e+1;return t>=240&&t<Ac&&k(!0),t>=Ac?(z.current(),e):t})},1e3)}else console.error("[VoiceCall] Socket not connected")},[r,$,Z]),Q=w.useCallback(()=>{J(),W.current.forEach(e=>{try{e.stop()}catch{}}),W.current=[],V.current=[],H.current=0,j.current=!1,B.current?.close(),B.current=null,R.current&&(clearInterval(R.current),R.current=null);const e=r?.();e?.connected&&e.emit("voice_stop"),l&&x.length>0&&x.forEach(e=>{l({sender:"user"===e.role?"user":"bot",content:e.text})}),Y(),d("idle"),v(0),p(0),m(!1),_([]),k(!1),t()},[r,J,Y,t,l,x]);w.useEffect(()=>{z.current=Q},[Q]);const ee=w.useCallback(()=>{m(e=>!e)},[]),te=w.useCallback(()=>{const e=E.trim();if(!e)return;const t=r?.();t?.connected&&(t.emit("voice_text_input",{text:e}),T(""),M(!1))},[E,r]);if(w.useEffect(()=>{e&&"idle"===u&&K()},[e]),w.useEffect(()=>()=>{J(),R.current&&clearInterval(R.current),Y()},[]),!e)return null;const re="speaking"===u?c.speakingColor:"thinking"===u?c.thinkingColor:"listening"===u?c.listeningColor:n;return C.jsxs("div",{className:Ot("absolute inset-0 z-50 flex flex-col overflow-hidden","animate-in fade-in duration-300"),style:{backgroundColor:"#0a0a0f",borderRadius:"inherit"},children:[C.jsxs("div",{className:"absolute inset-0 pointer-events-none",style:{overflow:"hidden"},children:[C.jsx("div",{className:"absolute rounded-full",style:{width:"300px",height:"300px",top:"-80px",right:"-60px",background:`radial-gradient(circle, ${re}18 0%, transparent 70%)`,transition:"background 1.5s ease",filter:"blur(40px)"}}),C.jsx("div",{className:"absolute rounded-full",style:{width:"250px",height:"250px",bottom:"-40px",left:"-50px",background:`radial-gradient(circle, ${c.thinkingColor}12 0%, transparent 70%)`,filter:"blur(50px)"}}),C.jsx("div",{className:"absolute rounded-full",style:{width:"200px",height:"200px",top:"40%",left:"50%",transform:"translateX(-50%)",background:`radial-gradient(circle, ${re}10 0%, transparent 70%)`,transition:"background 1.5s ease",filter:"blur(60px)"}})]}),C.jsxs("div",{className:"relative flex items-center justify-between",style:{background:"rgba(255,255,255,0.03)",borderBottom:"1px solid rgba(255,255,255,0.06)",padding:"16px 24px",paddingTop:"20px"},children:[C.jsxs("div",{className:"flex items-center gap-3",children:[C.jsx("div",{className:"relative",children:C.jsx("div",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:re,boxShadow:`0 0 8px ${re}80`,animation:"idle"!==u?"pulse 2s ease-in-out infinite":"none"}})}),C.jsx("span",{style:{color:"rgba(255,255,255,0.8)",fontSize:"13px",fontWeight:500,letterSpacing:"-0.01em"},children:c.statusLabels[u]||u})]}),C.jsxs("div",{className:"flex items-center gap-3",children:[c.showEmotionLabel&&y&&C.jsxs("span",{style:{fontSize:"11px",padding:"2px 10px",borderRadius:"20px",background:`${re}15`,border:`1px solid ${re}25`,color:re,fontWeight:600},children:[c.showEmojis&&(c.emotionEmojis[y]||"💬")," ",y]}),C.jsx("span",{style:{fontSize:"13px",fontFamily:"ui-monospace, monospace",color:"rgba(255,255,255,0.4)",fontVariantNumeric:"tabular-nums"},children:G(h)}),A&&C.jsxs("span",{style:{fontSize:"10px",padding:"2px 8px",borderRadius:"12px",backgroundColor:h>=270?"rgba(239,68,68,0.2)":"rgba(245,158,11,0.15)",color:h>=270?"#ef4444":"#f59e0b",fontWeight:700,fontVariantNumeric:"tabular-nums",animation:h>=270?"pulse 1s ease-in-out infinite":"none"},children:[G(Ac-h)," restante"]})]})]}),c.showBadge&&c.badgeText&&C.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"8px 0"},children:C.jsx("span",{style:{padding:"4px 14px",borderRadius:"20px",fontSize:"11px",fontWeight:700,background:`linear-gradient(135deg, ${n}, ${c.thinkingColor})`,color:"white"},children:c.badgeText})}),C.jsx("div",{className:"relative flex-1 overflow-y-auto px-5 py-4",style:{scrollbarWidth:"none"},children:C.jsxs("div",{className:"flex flex-col items-center justify-start h-full gap-4",children:[C.jsx(kc,{avatars:i,logoUrl:o,avatar3dUrl:a||c.avatar3dUrl,emotion:y,callState:u,audioLevel:g,config:c}),x.length>0&&C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",width:"100%"},children:[x.slice(-2).map((e,t)=>C.jsx("div",{style:{maxWidth:"85%",padding:"10px 14px",borderRadius:"user"===e.role?"16px 16px 4px 16px":"16px 16px 16px 4px",fontSize:"13.5px",lineHeight:1.5,color:"white",marginLeft:"user"===e.role?"auto":"0",marginRight:"user"===e.role?"0":"auto",backgroundColor:"user"===e.role?"rgba(255,255,255,0.08)":`${n}25`,backdropFilter:"blur(8px)",border:"user"===e.role?"1px solid rgba(255,255,255,0.08)":`1px solid ${n}20`},children:C.jsx(ts,{remarkPlugins:[Yl],rehypePlugins:[[oc,Ec]],components:{p:({children:e})=>C.jsx("p",{style:{margin:0},children:e}),a:({href:e,children:t})=>C.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",style:{color:n,textDecoration:"underline"},children:t}),strong:({children:e})=>C.jsx("strong",{style:{fontWeight:600},children:e}),em:({children:e})=>C.jsx("em",{children:e}),ul:({children:e})=>C.jsx("ul",{style:{margin:"4px 0",paddingLeft:"18px"},children:e}),ol:({children:e})=>C.jsx("ol",{style:{margin:"4px 0",paddingLeft:"18px"},children:e}),li:({children:e})=>C.jsx("li",{style:{marginBottom:"2px"},children:e}),code:({children:e})=>C.jsx("code",{style:{background:"rgba(255,255,255,0.1)",padding:"0 4px",borderRadius:"3px",fontSize:"12px"},children:e})},children:e.text})},t)),C.jsx("div",{ref:F})]})]})}),C.jsx("div",{style:{textAlign:"center",paddingBottom:"12px"},children:C.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"4px 16px",borderRadius:"20px",fontSize:"11px",fontWeight:500,color:"rgba(255,255,255,0.35)",background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.06)",letterSpacing:"0.02em"},children:f?C.jsxs(C.Fragment,{children:[C.jsx(ae,{style:{width:"12px",height:"12px"}})," Micrófono silenciado"]}):"thinking"===u?"Procesando...":"speaking"===u?C.jsxs(C.Fragment,{children:[C.jsx(ve,{style:{width:"12px",height:"12px"}})," Respuesta de voz"]}):"Habla cuando quieras"})}),C.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"20px",paddingBottom:"28px",paddingTop:"8px"},children:[C.jsx("button",{onClick:ee,style:{width:"52px",height:"52px",borderRadius:"50%",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s",backgroundColor:f?"rgba(239,68,68,0.15)":"rgba(255,255,255,0.08)",color:f?"#f87171":"rgba(255,255,255,0.7)",backdropFilter:"blur(12px)",border:"1px solid "+(f?"rgba(239,68,68,0.2)":"rgba(255,255,255,0.08)")},"aria-label":f?"Activar micrófono":"Silenciar micrófono",children:f?C.jsx(ae,{style:{width:"22px",height:"22px"}}):C.jsx(se,{style:{width:"22px",height:"22px"}})}),C.jsx("button",{onClick:Q,style:{width:"64px",height:"64px",borderRadius:"50%",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#ef4444",color:"white",boxShadow:"0 4px 24px rgba(239,68,68,0.4), 0 0 0 4px rgba(239,68,68,0.1)",transition:"all 0.2s"},"aria-label":"Finalizar llamada",children:C.jsx(ce,{style:{width:"26px",height:"26px"}})}),C.jsx("div",{style:{width:"52px",height:"52px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"speaking"===u?`${c.listeningColor}15`:"rgba(255,255,255,0.08)",color:"speaking"===u?c.listeningColor:"rgba(255,255,255,0.5)",border:"1px solid "+("speaking"===u?`${c.listeningColor}25`:"rgba(255,255,255,0.08)"),transition:"all 0.3s"},children:C.jsx(ve,{style:{width:"22px",height:"22px"}})}),C.jsx("button",{onClick:()=>M(e=>!e),style:{width:"52px",height:"52px",borderRadius:"50%",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s",backgroundColor:S?`${n}20`:"rgba(255,255,255,0.08)",color:S?n:"rgba(255,255,255,0.5)",border:"1px solid "+(S?`${n}30`:"rgba(255,255,255,0.08)")},"aria-label":"Escribir texto",children:C.jsx(ne,{style:{width:"20px",height:"20px"}})})]}),S&&C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 20px 20px"},children:[C.jsx("input",{type:"text",value:E,onChange:e=>T(e.target.value),onKeyDown:e=>"Enter"===e.key&&te(),placeholder:"Escribí email, teléfono, etc.",autoFocus:!0,style:{flex:1,padding:"10px 14px",borderRadius:"12px",border:"1px solid rgba(255,255,255,0.12)",background:"rgba(255,255,255,0.06)",color:"white",fontSize:"13px",outline:"none",backdropFilter:"blur(8px)"}}),C.jsx("button",{onClick:te,disabled:!E.trim(),style:{width:"40px",height:"40px",borderRadius:"50%",border:"none",cursor:E.trim()?"pointer":"default",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:E.trim()?n:"rgba(255,255,255,0.06)",color:E.trim()?"white":"rgba(255,255,255,0.2)",transition:"all 0.2s"},"aria-label":"Enviar texto",children:C.jsx(fe,{style:{width:"16px",height:"16px"}})})]}),C.jsx("style",{children:"\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n @keyframes pulse {\n 0%, 100% { opacity: 1; transform: scale(1); }\n 50% { opacity: 0.7; transform: scale(0.95); }\n }\n "})]})}function Ic({isOpen:e,isConnected:t,isTyping:n,messages:r,botName:i="BotUyo",logoUrl:o,welcomeMessage:a,inputPlaceholder:s,primaryColor:l,mediaConfig:c,onClose:u,onSendMessage:d,bubbleStyles:h,avatars:p,onSendAttachment:f,onSendLocation:m,getSocket:g,onAddVoiceMessage:v,avatar3dUrl:y,theme:b}){const[x,_]=w.useState(!1),[S,M]=w.useState(!1),[E,T]=w.useState(!1),{t:A}=V(),k=xc(),R=Ht({primaryColor:l}),P=function({isOpen:e,height:t,bottom:n}){const r=xc(),[i,o]=w.useState({}),a=w.useCallback(()=>{if(r){const e=()=>{window.visualViewport?o({height:`${window.visualViewport.height}px`,width:"100%",top:`${window.visualViewport.offsetTop}px`,left:"0px",bottom:"auto",right:"auto",transform:"none"}):o({height:"100dvh",width:"100%",top:"0px",left:"0px"})};return e(),window.visualViewport?.addEventListener("resize",e),window.visualViewport?.addEventListener("scroll",e),()=>{window.visualViewport?.removeEventListener("resize",e),window.visualViewport?.removeEventListener("scroll",e)}}{const e=parseFloat(n||_c)||24,r=window.innerHeight-64-e;if(t){const e=parseFloat(t)||700,i=Math.min(e,r);o({height:`${i}px`,maxHeight:`${r}px`,bottom:n||_c})}else{const e=Math.min(700,Math.max(500,r));o({height:`${e}px`,maxHeight:`${r}px`,bottom:n||_c})}}},[r,t,n]);return w.useEffect(()=>{if(!e)return;const t=a();return window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a),t&&t()}},[e,a]),i}({isOpen:e,height:b?.height,bottom:b?.bottom}),I=function({enabled:e,returnFocusRef:t,onEscape:n}){const r=w.useRef(null),i=w.useRef(null);return w.useEffect(()=>{if(!e)return;i.current=document.activeElement;const o=t?.current,a=r.current;if(!a)return;const s=setTimeout(()=>{const e=a.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');e.length>0?e[0].focus():a.focus()},100),l=e=>{if(a)if("Escape"!==e.key){if("Tab"===e.key){const t=a.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(0===t.length)return;const n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):e.shiftKey||document.activeElement!==r||(e.preventDefault(),n.focus())}}else n?.()};return document.addEventListener("keydown",l),()=>{clearTimeout(s),document.removeEventListener("keydown",l);const e=o||i.current;e&&"function"==typeof e.focus&&e.focus()}},[e,n,t]),r}({enabled:e,onEscape:u});if(w.useEffect(()=>{if(e)return k&&(document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%"),()=>{document.body.style.overflow="",document.body.style.position="",document.body.style.width=""}},[e,k]),!e)return null;const L="bottom-left"===b?.position;return C.jsxs(C.Fragment,{children:[C.jsx("div",{id:"chat-window-description",className:"sr-only",children:A("accessibility.dialogDescription")}),C.jsxs("div",{ref:I,role:"dialog","aria-modal":"true","aria-labelledby":"chat-window-title","aria-describedby":"chat-window-description",tabIndex:-1,className:Ot("flex flex-col overflow-hidden transition-all duration-500 ease-[cubic-bezier(0.16,1,0.3,1)]","text-foreground z-[9999]",!k&&["fixed",L?"left-6":"right-6","w-[350px] min-w-[350px] max-w-[350px]","rounded-[32px] border shadow-soft-2xl","animate-in fade-in zoom-in-95","slide-in-from-bottom-10"],k&&["fixed inset-0 w-full"]),style:{...P,backgroundColor:"hsl(var(--background))",borderColor:"hsl(var(--border))",color:"hsl(var(--foreground))"},children:[C.jsx("header",{className:"relative shrink-0 border-b z-20",style:{padding:"var(--spacing-5)",backgroundColor:"hsl(var(--background) / 0.9)",borderColor:"hsl(var(--border))",backdropFilter:"blur(24px)"},children:C.jsxs("div",{className:"flex items-center justify-between",children:[C.jsxs("div",{className:"flex items-center gap-3",children:[C.jsxs("div",{className:"relative",children:[C.jsx("div",{className:"h-10 w-10 rounded-2xl overflow-hidden bg-primary/10 border-2 border-background shadow-soft-sm",children:x?C.jsx("div",{className:"h-full w-full flex items-center justify-center bg-muted text-muted-foreground",children:C.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:C.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})})}):C.jsx("img",{src:o||en,alt:i,className:"h-full w-full object-cover",onError:()=>_(!0)})}),C.jsx("div",{className:Ot("absolute -bottom-0.5 -right-0.5 h-3.5 w-3.5 rounded-full border-2 border-background",t?"bg-emerald-500":"bg-amber-500 animate-pulse")})]}),C.jsxs("div",{className:"flex flex-col",children:[C.jsxs("div",{className:"flex items-center gap-1",children:[C.jsx("span",{id:"chat-window-title",className:"font-black text-xs uppercase tracking-tight text-foreground",children:i}),C.jsx(me,{className:"h-3 w-3 text-primary fill-primary/10"})]}),C.jsxs("div",{id:"chat-window-description",className:"flex items-center gap-1.5 mt-0.5",children:[C.jsx("span",{className:"flex h-1 w-1 rounded-full bg-emerald-500"}),C.jsx("span",{className:"text-[9px] font-black text-muted-foreground uppercase tracking-[0.1em]",children:A(t?"online":"offline")})]})]})]}),C.jsxs("div",{className:"flex items-center gap-2",children:[c?.enableVoice&&C.jsxs("div",{className:"relative",children:[C.jsx("button",{onClick:()=>T(!E),"aria-label":"Iniciar llamada de voz",title:"Llamar",className:"h-8 w-8 flex items-center justify-center rounded-full bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-600 transition-all active:scale-90 focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:ring-offset-2",children:C.jsx(ue,{className:"h-4 w-4","aria-hidden":"true"})}),E&&C.jsxs("div",{className:"absolute top-full right-0 mt-2 rounded-2xl border shadow-soft-2xl animate-in fade-in zoom-in-95 duration-200 z-50",style:{backgroundColor:"hsl(var(--card))",borderColor:"hsl(var(--border))",padding:"var(--spacing-4)",minWidth:"180px"},children:[C.jsx("p",{className:"text-xs font-bold text-center",style:{color:"hsl(var(--foreground))",marginBottom:"var(--spacing-3)"},children:A("call_confirm")||"¿Iniciar llamada de voz?"}),C.jsxs("div",{className:"flex items-center justify-center",style:{gap:"var(--spacing-2)"},children:[C.jsx("button",{onClick:()=>T(!1),className:"h-8 rounded-xl text-[10px] font-black uppercase tracking-wider transition-all active:scale-95",style:{padding:"0 var(--spacing-4)",backgroundColor:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:A("cancel")||"Cancelar"}),C.jsx("button",{onClick:()=>{T(!1),M(!0)},className:"h-8 rounded-xl text-[10px] font-black uppercase tracking-wider text-white transition-all active:scale-95 shadow-md",style:{padding:"0 var(--spacing-4)",backgroundColor:"#10b981"},children:A("call")||"Llamar"})]})]})]}),C.jsx("button",{onClick:u,"aria-label":A("accessibility.closeChat"),title:"Esc",className:"h-8 w-8 flex items-center justify-center rounded-full bg-muted/60 hover:bg-muted text-foreground transition-all active:scale-90 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2",children:C.jsx(ye,{className:"h-4 w-4","aria-hidden":"true"})})]})]})}),C.jsxs("main",{role:"region","aria-label":A("accessibility.chatMessages"),className:"flex-1 min-h-0 relative flex flex-col",style:{padding:"var(--spacing-5)",backgroundColor:"hsl(var(--muted))"},children:[C.jsx(pc,{messages:r,isTyping:n,welcomeMessage:a,primaryColor:l,logoUrl:o,botName:i,bubbleStyles:h,avatars:p}),C.jsx("div",{className:"absolute top-0 left-0 right-0 h-6 bg-gradient-to-b from-background/10 to-transparent pointer-events-none"})]}),C.jsxs("footer",{className:"border-t",style:{paddingTop:"var(--spacing-5)",paddingLeft:"var(--spacing-5)",paddingRight:"var(--spacing-5)",paddingBottom:k?"max(var(--spacing-3), env(safe-area-inset-bottom))":"var(--spacing-3)",backgroundColor:"hsl(var(--background))",borderColor:"hsl(var(--border))"},children:[C.jsx(yc,{isConnected:t,placeholder:s,primaryColor:R,mediaConfig:c,onSendMessage:d,onSendAttachment:f,onSendLocation:m,onVoiceCall:c?.enableVoice?()=>M(!0):void 0}),C.jsxs("div",{className:"flex items-center justify-center gap-1 opacity-25 select-none",style:{marginTop:"var(--spacing-2)",paddingBottom:"var(--spacing-1)"},children:[C.jsx(ee,{className:"h-2 w-2 text-primary fill-primary"}),C.jsx("span",{className:"text-[7px] font-bold uppercase tracking-[0.2em]",children:A("con_amor_paseo_libre")})]})]}),C.jsx(Pc,{isOpen:S,onClose:()=>M(!1),primaryColor:R,avatars:p,logoUrl:o,avatar3dUrl:y,getSocket:g,onAddMessage:v})]})]})}let Lc=class extends w.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){Jt("ErrorBoundary caught error:",e,t),this.props.onError?.(e,t)}handleReset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?this.props.fallback?this.props.fallback:C.jsxs("div",{className:"flex flex-col items-center justify-center p-8 bg-background text-center",children:[C.jsx("div",{className:"text-6xl mb-4",children:"⚠️"}),C.jsx("h2",{className:"text-xl font-bold text-foreground mb-2",children:"Algo salió mal"}),C.jsx("p",{className:"text-sm text-muted-foreground mb-6 max-w-md",children:this.state.error?.message||"Ocurrió un error inesperado"}),C.jsx("button",{onClick:this.handleReset,className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg font-medium hover:opacity-90 transition-opacity",children:"Intentar de nuevo"})]}):this.props.children}};const Nc={bubble:"rounded-2xl",image:"rounded-xl",button:"rounded-xl",card:"rounded-2xl"},Oc={bg:"bg-muted/50 dark:bg-muted/20",text:"text-foreground",border:"border-border/50"},Dc={text:"text-primary-foreground"};function Uc(e,t){const n=function(){const[e,t]=w.useState(()=>"undefined"!=typeof window&&(window.matchMedia("(prefers-contrast: high)").matches||window.matchMedia("(prefers-contrast: more)").matches));return w.useEffect(()=>{const e=window.matchMedia("(prefers-contrast: high)"),n=window.matchMedia("(prefers-contrast: more)"),r=e=>{t(e.matches)};return e.addEventListener("change",r),n.addEventListener("change",r),()=>{e.removeEventListener("change",r),n.removeEventListener("change",r)}},[]),e}(),r=w.useMemo(()=>{const r=function(e,t){const n={...Dt,...t?.cssVariables||{},...e?.cssVariables||{}};return{primaryColor:e?.primaryColor||t?.primaryColor||Ut,botName:e?.botName||t?.botName||Ft,logoUrl:e?.logoUrl||t?.logoUrl||zt,position:e?.position||t?.position||Bt,welcomeMessage:e?.welcomeMessage||t?.welcomeMessage||Vt,inputPlaceholder:e?.inputPlaceholder||t?.inputPlaceholder||jt,cssVariables:n,isHidden:e?.isHidden??t?.isHidden??!1}}(e,t);return n?{...r,primaryColor:"#000000",cssVariables:{...r.cssVariables,background:"#FFFFFF",foreground:"#000000",card:"#FFFFFF",cardForeground:"#000000",primary:"#000000",primaryForeground:"#FFFFFF",muted:"#F5F5F5",mutedForeground:"#000000",border:"#000000"}}:r},[e,t,n]),i=w.useMemo(()=>({radius:{...Nc,...e?.bubbleStyles?.radius},bot:{...Oc,...e?.bubbleStyles?.bot},user:{...Dc,...e?.bubbleStyles?.user},launcher:{...e?.bubbleStyles?.launcher},mapCard:{...e?.bubbleStyles?.mapCard}}),[e?.bubbleStyles]);return{mergedTheme:r,mergedStyles:i,getContainerStyle:(e,t,n)=>({"--chat-primary":r.primaryColor,zIndex:e?2147483647:9999,position:"fixed",top:t&&e?0:"auto",left:t&&e?0:"bottom-left"===n?"24px":"auto",right:t&&e?0:"bottom-right"!==n&&n?"auto":"24px",bottom:t&&e?0:"24px",width:t&&e?"100%":"auto",height:t&&e?"100%":"auto"})}}const Fc=(e,t)=>t.some(t=>e instanceof t);let zc,Bc;const Vc=new WeakMap,jc=new WeakMap,Hc=new WeakMap;let Wc={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return Vc.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return $c(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function Gc(e){Wc=e(Wc)}function Xc(e){return(Bc||(Bc=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(Yc(this),t),$c(this.request)}:function(...t){return $c(e.apply(Yc(this),t))}}function qc(e){return"function"==typeof e?Xc(e):(e instanceof IDBTransaction&&function(e){if(Vc.has(e))return;const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{t(),r()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)});Vc.set(e,t)}(e),Fc(e,zc||(zc=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,Wc):e)}function $c(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t($c(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)});return Hc.set(t,e),t}(e);if(jc.has(e))return jc.get(e);const t=qc(e);return t!==e&&(jc.set(e,t),Hc.set(t,e)),t}const Yc=e=>Hc.get(e);const Zc=["get","getKey","getAll","getAllKeys","count"],Jc=["put","add","delete","clear"],Kc=new Map;function Qc(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(Kc.get(t))return Kc.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=Jc.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!Zc.includes(n))return;const o=async function(e,...t){const o=this.transaction(e,i?"readwrite":"readonly");let a=o.store;return r&&(a=a.index(t.shift())),(await Promise.all([a[n](...t),i&&o.done]))[0]};return Kc.set(t,o),o}Gc(e=>({...e,get:(t,n,r)=>Qc(t,n)||e.get(t,n,r),has:(t,n)=>!!Qc(t,n)||e.has(t,n)}));const eu=["continue","continuePrimaryKey","advance"],tu={},nu=new WeakMap,ru=new WeakMap,iu={get(e,t){if(!eu.includes(t))return e[t];let n=tu[t];return n||(n=tu[t]=function(...e){nu.set(this,ru.get(this)[t](...e))}),n}};async function*ou(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;const n=new Proxy(t,iu);for(ru.set(n,t),Hc.set(n,Yc(t));t;)yield n,t=await(nu.get(n)||t.continue()),nu.delete(n)}function au(e,t){return t===Symbol.asyncIterator&&Fc(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===t&&Fc(e,[IDBIndex,IDBObjectStore])}Gc(e=>({...e,get:(t,n,r)=>au(t,n)?ou:e.get(t,n,r),has:(t,n)=>au(t,n)||e.has(t,n)}));class su{db=null;DB_NAME;DB_VERSION=1;constructor(e="default"){this.DB_NAME=`botuyo-chat-${e}`}async init(){try{this.db=await function(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const a=indexedDB.open(e,t),s=$c(a);return r&&a.addEventListener("upgradeneeded",e=>{r($c(a.result),e.oldVersion,e.newVersion,$c(a.transaction),e)}),n&&a.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),s.then(e=>{o&&e.addEventListener("close",()=>o()),i&&e.addEventListener("versionchange",e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),s}(this.DB_NAME,this.DB_VERSION,{upgrade(e){if(!e.objectStoreNames.contains("messages")){e.createObjectStore("messages",{keyPath:"id"}).createIndex("by-timestamp","timestamp")}e.objectStoreNames.contains("metadata")||e.createObjectStore("metadata")}}),Qt("IndexedDB initialized")}catch(e){throw Jt("Failed to initialize IndexedDB:",e),e}}async saveMessage(e){this.db||await this.init();try{await this.db.put("messages",e)}catch(t){Jt("Failed to save message:",t)}}async saveMessages(e){this.db||await this.init();try{const t=this.db.transaction("messages","readwrite");await Promise.all([...e.map(e=>t.store.put(e)),t.done])}catch(t){Jt("Failed to save messages:",t)}}async getMessages(e=100){this.db||await this.init();try{return(await this.db.getAllFromIndex("messages","by-timestamp")).slice(-e)}catch(t){return Jt("Failed to get messages:",t),[]}}async getMessage(e){this.db||await this.init();try{return await this.db.get("messages",e)}catch(t){return void Jt("Failed to get message:",t)}}async deleteMessage(e){this.db||await this.init();try{await this.db.delete("messages",e)}catch(t){Jt("Failed to delete message:",t)}}async clearMessages(){this.db||await this.init();try{await this.db.clear("messages"),Qt("Messages cleared from IndexedDB")}catch(e){Jt("Failed to clear messages:",e)}}async setMetadata(e){this.db||await this.init();try{await this.db.put("metadata",e,"chat-metadata")}catch(t){Jt("Failed to set metadata:",t)}}async getMetadata(){this.db||await this.init();try{return await this.db.get("metadata","chat-metadata")}catch(e){return Jt("Failed to get metadata:",e),null}}async clearAll(){this.db||await this.init();try{await Promise.all([this.db.clear("messages"),this.db.clear("metadata")]),Qt("All data cleared from IndexedDB")}catch(e){Jt("Failed to clear all data:",e)}}async migrateFromLocalStorage(e="default"){try{const t=`botuyo_chat_v1_${e}`,n=localStorage.getItem(t);if(!n)return;const r=JSON.parse(n);if(r.messages&&Array.isArray(r.messages)){const e=r.messages.map(e=>({...e,timestamp:new Date(e.timestamp)}));await this.saveMessages(e),Qt(`Migrated ${e.length} messages from localStorage`)}r.sessionId&&await this.setMetadata({sessionId:r.sessionId}),localStorage.removeItem(t),Qt("Migration from localStorage completed")}catch(t){Jt("Failed to migrate from localStorage:",t)}}}const lu=new Map;const cu={isOpen:!1,isConnected:!1,isTyping:!1,messages:[],error:null,sessionId:null};function uu(e,t){switch(t.type){case"TOGGLE_WINDOW":return{...e,isOpen:!e.isOpen};case"OPEN_WINDOW":return{...e,isOpen:!0};case"CLOSE_WINDOW":return{...e,isOpen:!1};case"SET_CONNECTED":return{...e,isConnected:t.payload};case"SET_TYPING":return{...e,isTyping:t.payload};case"ADD_MESSAGE":{if(e.messages.some(e=>e.id===t.payload.id))return e;if(t.payload.id.startsWith("msg-")&&"text"===t.payload.type){const n=(new Date).getTime();if(e.messages.slice(-10).some(e=>"text"===e.type&&e.sender===t.payload.sender&&"content"in e&&"content"in t.payload&&e.content===t.payload.content&&Math.abs(n-new Date(e.timestamp).getTime())<3e4))return e}const n=[...e.messages,t.payload],r="bot"===t.payload.sender;return{...e,messages:n,isTyping:!r&&e.isTyping}}case"SET_MESSAGES":return{...e,messages:[...t.payload]};case"SET_ERROR":return{...e,error:t.payload};case"SET_SESSION_ID":return{...e,sessionId:t.payload};case"CLEAR_CHAT":return{...cu,isOpen:e.isOpen};case"RESTORE_SESSION":return{...e,...t.payload,isConnected:!1,isTyping:!1,error:null};default:return e}}function du(e="default"){const[t,n]=w.useReducer(uu,cu),[r,i]=w.useState(!1),o=S.useMemo(()=>function(e="default"){return`botuyo_chat_v1_${e}`}(e),[e]),a=S.useMemo(()=>((e="default")=>(lu.has(e)||lu.set(e,new su(e)),lu.get(e)))(e),[e]);w.useEffect(()=>{if("undefined"==typeof window||r)return;(async()=>{try{await a.migrateFromLocalStorage(e);const t=await a.getMessages(100),r=await a.getMetadata();if(t.length>0||r){const e={messages:t.map(e=>({...e,timestamp:new Date(e.timestamp)})),sessionId:r?.sessionId||null,isOpen:r?.isOpen||!1};n({type:"RESTORE_SESSION",payload:e})}}catch(Dv){Zt("Chat: Error rehydrating from IndexedDB",Dv);try{const e=localStorage.getItem(o);if(e){const t=JSON.parse(e);t.messages&&(t.messages=t.messages.map(e=>({...e,timestamp:new Date(e.timestamp)}))),n({type:"RESTORE_SESSION",payload:t})}}catch(t){Jt("Chat: Fallback rehydration failed",t)}}finally{i(!0)}})()},[r]),w.useEffect(()=>{if(!r)return;const e=setTimeout(async()=>{try{await a.saveMessages(t.messages),await a.setMetadata({isOpen:t.isOpen,sessionId:t.sessionId})}catch(Dv){Jt("Chat Persistence Error:",Dv);try{const e={isOpen:t.isOpen,messages:t.messages,sessionId:t.sessionId};localStorage.setItem(o,JSON.stringify(e))}catch(e){Jt("Chat: Fallback persistence failed",e)}}},500);return()=>clearTimeout(e)},[t.isOpen,t.messages,t.sessionId,r]);const s=w.useCallback(e=>{n({type:"ADD_MESSAGE",payload:e})},[]),l=w.useCallback(()=>n({type:"TOGGLE_WINDOW"}),[]),c=w.useCallback(()=>n({type:"OPEN_WINDOW"}),[]),u=w.useCallback(()=>n({type:"CLOSE_WINDOW"}),[]),d=w.useCallback(e=>n({type:"SET_CONNECTED",payload:e}),[]),h=w.useCallback(e=>n({type:"SET_TYPING",payload:e}),[]),p=w.useCallback(e=>n({type:"SET_MESSAGES",payload:e}),[]),f=w.useCallback(e=>n({type:"SET_ERROR",payload:e}),[]),m=w.useCallback(e=>n({type:"SET_SESSION_ID",payload:e}),[]),g=w.useCallback(()=>{localStorage.removeItem(o),n({type:"CLEAR_CHAT"})},[]),v=w.useCallback(()=>{n({type:"SET_MESSAGES",payload:[]})},[]);return{state:t,isHydrated:r,actions:{toggleWindow:l,openWindow:c,closeWindow:u,setConnected:d,setTyping:h,addMessage:s,setMessages:p,setError:f,setSessionId:m,clearChat:g,clearMessages:v}}}function hu(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:a,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);const i=a.prototype,o=Object.keys(i);for(let e=0;e<o.length;e++){const t=o[e];t in n||(n[t]=i[t].bind(n))}}const i=n?.Parent??Object;class o extends i{}function a(e){var t;const i=n?.Parent?new o:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(const n of i._zod.deferred)n();return i}return Object.defineProperty(o,"name",{value:e}),Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}class pu extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class fu extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const mu={};function gu(e){return mu}function vu(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function yu(e,t){return"bigint"==typeof t?t.toString():t}function bu(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function xu(e){return null==e}function _u(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const wu=Symbol("evaluating");function Su(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==wu)return void 0===r&&(r=wu,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Mu(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Eu(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Tu(e){return JSON.stringify(e)}const Au="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Cu(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const ku=bu(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Ru(e){if(!1===Cu(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==Cu(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function Pu(e){return Ru(e)?{...e}:Array.isArray(e)?[...e]:e}const Iu=new Set(["string","number","symbol"]);function Lu(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Nu(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function Ou(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}const Du={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Uu(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function Fu(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function zu(e){return"string"==typeof e?e:e?.message}function Bu(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const i=zu(e.inst?._zod.def?.error?.(e))??zu(t?.error?.(e))??zu(n.customError?.(e))??zu(n.localeError?.(e))??"Invalid input";r.message=i}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Vu(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function ju(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}const Hu=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,yu,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Wu=hu("$ZodError",Hu),Gu=hu("$ZodError",Hu,{Parent:Error});const Xu=e=>(t,n,r,i)=>{const o=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise)throw new pu;if(a.issues.length){const t=new(i?.Err??e)(a.issues.map(e=>Bu(e,o,gu())));throw Au(t,i?.callee),t}return a.value},qu=e=>async(t,n,r,i)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){const t=new(i?.Err??e)(a.issues.map(e=>Bu(e,o,gu())));throw Au(t,i?.callee),t}return a.value},$u=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new pu;return o.issues.length?{success:!1,error:new(e??Wu)(o.issues.map(e=>Bu(e,i,gu())))}:{success:!0,data:o.value}},Yu=$u(Gu),Zu=e=>async(t,n,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>Bu(e,i,gu())))}:{success:!0,data:o.value}},Ju=Zu(Gu),Ku=e=>(t,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Xu(e)(t,n,i)},Qu=e=>(t,n,r)=>Xu(e)(t,n,r),ed=e=>async(t,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return qu(e)(t,n,i)},td=e=>async(t,n,r)=>qu(e)(t,n,r),nd=e=>(t,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return $u(e)(t,n,i)},rd=e=>(t,n,r)=>$u(e)(t,n,r),id=e=>async(t,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Zu(e)(t,n,i)},od=e=>async(t,n,r)=>Zu(e)(t,n,r),ad=/^[cC][^\s-]{8,}$/,sd=/^[0-9a-z]+$/,ld=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,cd=/^[0-9a-vA-V]{20}$/,ud=/^[A-Za-z0-9]{27}$/,dd=/^[a-zA-Z0-9_-]{21}$/,hd=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,pd=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,fd=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,md=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const gd=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,vd=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,yd=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,bd=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,xd=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_d=/^[A-Za-z0-9_-]*$/,wd=/^\+[1-9]\d{6,14}$/,Sd="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Md=new RegExp(`^${Sd}$`);function Ed(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const Td=/^-?\d+$/,Ad=/^-?\d+(?:\.\d+)?$/,Cd=/^[^A-Z]*$/,kd=/^[^a-z]*$/,Rd=hu("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Pd={number:"number",bigint:"bigint",object:"date"},Id=hu("$ZodCheckLessThan",(e,t)=>{Rd.init(e,t);const n=Pd[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ld=hu("$ZodCheckGreaterThan",(e,t)=>{Rd.init(e,t);const n=Pd[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Nd=hu("$ZodCheckMultipleOf",(e,t)=>{Rd.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value===BigInt(0):0===function(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let i=(r.split(".")[1]||"").length;if(0===i&&/\d?e-\d?/.test(r)){const e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}const o=n>i?n:i;return Number.parseInt(e.toFixed(o).replace(".",""))%Number.parseInt(t.toFixed(o).replace(".",""))/10**o}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Od=hu("$ZodCheckNumberFormat",(e,t)=>{Rd.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,o]=Du[t.format];e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=o,n&&(r.pattern=Td)}),e._zod.check=a=>{const s=a.value;if(n){if(!Number.isInteger(s))return void a.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}))}s<i&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Dd=hu("$ZodCheckMaxLength",(e,t)=>{var n;Rd.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!xu(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const r=n.value;if(r.length<=t.maximum)return;const i=Vu(r);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ud=hu("$ZodCheckMinLength",(e,t)=>{var n;Rd.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!xu(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const r=n.value;if(r.length>=t.minimum)return;const i=Vu(r);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Fd=hu("$ZodCheckLengthEquals",(e,t)=>{var n;Rd.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!xu(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const r=n.value,i=r.length;if(i===t.length)return;const o=Vu(r),a=i>t.length;n.issues.push({origin:o,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),zd=hu("$ZodCheckStringFormat",(e,t)=>{var n,r;Rd.init(e,t),e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Bd=hu("$ZodCheckRegex",(e,t)=>{zd.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Vd=hu("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Cd),zd.init(e,t)}),jd=hu("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=kd),zd.init(e,t)}),Hd=hu("$ZodCheckIncludes",(e,t)=>{Rd.init(e,t);const n=Lu(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Wd=hu("$ZodCheckStartsWith",(e,t)=>{Rd.init(e,t);const n=new RegExp(`^${Lu(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Gd=hu("$ZodCheckEndsWith",(e,t)=>{Rd.init(e,t);const n=new RegExp(`.*${Lu(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Xd=hu("$ZodCheckOverwrite",(e,t)=>{Rd.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class qd{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const i of r)this.content.push(i)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const $d={major:4,minor:3,patch:6},Yd=hu("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=$d;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const t of i._zod.onattach)t(e);if(0===r.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let r,i=Uu(e);for(const o of t){if(o._zod.def.when){if(!o._zod.def.when(e))continue}else if(i)continue;const t=e.issues.length,a=o._zod.check(e);if(a instanceof Promise&&!1===n?.async)throw new pu;if(r||a instanceof Promise)r=(r??Promise.resolve()).then(async()=>{await a;e.issues.length!==t&&(i||(i=Uu(e,t)))});else{if(e.issues.length===t)continue;i||(i=Uu(e,t))}}return r?r.then(()=>e):e},n=(n,i,o)=>{if(Uu(n))return n.aborted=!0,n;const a=t(i,r,o);if(a instanceof Promise){if(!1===o.async)throw new pu;return a.then(t=>e._zod.parse(t,o))}return e._zod.parse(a,o)};e._zod.run=(i,o)=>{if(o.skipChecks)return e._zod.parse(i,o);if("backward"===o.direction){const t=e._zod.parse({value:i.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,o)):n(t,i,o)}const a=e._zod.parse(i,o);if(a instanceof Promise){if(!1===o.async)throw new pu;return a.then(e=>t(e,r,o))}return t(a,r,o)}}Su(e,"~standard",()=>({validate:t=>{try{const n=Yu(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return Ju(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Zd=hu("$ZodString",(e,t)=>{var n;Yd.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(i){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Jd=hu("$ZodStringFormat",(e,t)=>{zd.init(e,t),Zd.init(e,t)}),Kd=hu("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=pd),Jd.init(e,t)}),Qd=hu("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=fd(e))}else t.pattern??(t.pattern=fd());Jd.init(e,t)}),eh=hu("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=md),Jd.init(e,t)}),th=hu("$ZodURL",(e,t)=>{Jd.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),i=new URL(r);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=i.href:n.value=r)}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),nh=hu("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Jd.init(e,t)}),rh=hu("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=dd),Jd.init(e,t)}),ih=hu("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ad),Jd.init(e,t)}),oh=hu("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=sd),Jd.init(e,t)}),ah=hu("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ld),Jd.init(e,t)}),sh=hu("$ZodXID",(e,t)=>{t.pattern??(t.pattern=cd),Jd.init(e,t)}),lh=hu("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ud),Jd.init(e,t)}),ch=hu("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=Ed({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Sd}T(?:${r})$`)}(t)),Jd.init(e,t)}),uh=hu("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Md),Jd.init(e,t)}),dh=hu("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${Ed(t)}$`)),Jd.init(e,t)}),hh=hu("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=hd),Jd.init(e,t)}),ph=hu("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=gd),Jd.init(e,t),e._zod.bag.format="ipv4"}),fh=hu("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=vd),Jd.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),mh=hu("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=yd),Jd.init(e,t)}),gh=hu("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=bd),Jd.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(2!==r.length)throw new Error;const[e,t]=r;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function vh(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const yh=hu("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=xd),Jd.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{vh(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});const bh=hu("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=_d),Jd.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{(function(e){if(!_d.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return vh(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),xh=hu("$ZodE164",(e,t)=>{t.pattern??(t.pattern=wd),Jd.init(e,t)});const _h=hu("$ZodJWT",(e,t)=>{Jd.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),wh=hu("$ZodNumber",(e,t)=>{Yd.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ad,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(a){}const i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;const o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}}),Sh=hu("$ZodNumberFormat",(e,t)=>{Od.init(e,t),wh.init(e,t)}),Mh=hu("$ZodAny",(e,t)=>{Yd.init(e,t),e._zod.parse=e=>e}),Eh=hu("$ZodUnknown",(e,t)=>{Yd.init(e,t),e._zod.parse=e=>e}),Th=hu("$ZodNever",(e,t)=>{Yd.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function Ah(e,t,n){e.issues.length&&t.issues.push(...Fu(n,e.issues)),t.value[n]=e.value}const Ch=hu("$ZodArray",(e,t)=>{Yd.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);const o=[];for(let e=0;e<i.length;e++){const a=i[e],s=t.element._zod.run({value:a,issues:[]},r);s instanceof Promise?o.push(s.then(t=>Ah(t,n,e))):Ah(s,n,e)}return o.length?Promise.all(o).then(()=>n):n}});function kh(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...Fu(n,e.issues))}void 0===e.value?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Rh(e){const t=Object.keys(e.shape);for(const i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);const n=(r=e.shape,Object.keys(r).filter(e=>"optional"===r[e]._zod.optin&&"optional"===r[e]._zod.optout));var r;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Ph(e,t,n,r,i,o){const a=[],s=i.keySet,l=i.catchall._zod,c=l.def.type,u="optional"===l.optout;for(const d in t){if(s.has(d))continue;if("never"===c){a.push(d);continue}const i=l.run({value:t[d],issues:[]},r);i instanceof Promise?e.push(i.then(e=>kh(e,n,d,t,u))):kh(i,n,d,t,u)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const Ih=hu("$ZodObject",(e,t)=>{Yd.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const r=bu(()=>Rh(t));Su(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(const e of r.values)n[t].add(e)}}return n});const i=Cu,o=t.catchall;let a;e._zod.parse=(t,n)=>{a??(a=r.value);const s=t.value;if(!i(s))return t.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),t;t.value={};const l=[],c=a.shape;for(const e of a.keys){const r=c[e],i="optional"===r._zod.optout,o=r._zod.run({value:s[e],issues:[]},n);o instanceof Promise?l.push(o.then(n=>kh(n,t,e,s,i))):kh(o,t,e,s,i)}return o?Ph(l,s,t,n,r.value,e):l.length?Promise.all(l).then(()=>t):t}}),Lh=hu("$ZodObjectJIT",(e,t)=>{Ih.init(e,t);const n=e._zod.parse,r=bu(()=>Rh(t));let i;const o=Cu,a=!mu.jitless,s=a&&ku.value,l=t.catchall;let c;e._zod.parse=(u,d)=>{c??(c=r.value);const h=u.value;return o(h)?a&&s&&!1===d?.async&&!0!==d.jitless?(i||(i=(e=>{const t=new qd(["shape","payload","ctx"]),n=r.value,i=e=>{const t=Tu(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const o=Object.create(null);let a=0;for(const r of n.keys)o[r]="key_"+a++;t.write("const newResult = {};");for(const r of n.keys){const n=o[r],a=Tu(r),s=e[r],l="optional"===s?._zod?.optout;t.write(`const ${n} = ${i(r)};`),l?t.write(`\n if (${n}.issues.length) {\n if (${a} in input) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${a}, ...iss.path] : [${a}]\n })));\n }\n }\n \n if (${n}.value === undefined) {\n if (${a} in input) {\n newResult[${a}] = undefined;\n }\n } else {\n newResult[${a}] = ${n}.value;\n }\n \n `):t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${a}, ...iss.path] : [${a}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${a} in input) {\n newResult[${a}] = undefined;\n }\n } else {\n newResult[${a}] = ${n}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const s=t.compile();return(t,n)=>s(e,t,n)})(t.shape)),u=i(u,d),l?Ph([],h,u,d,c,e):u):n(u,d):(u.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),u)}});function Nh(e,t,n,r){for(const o of e)if(0===o.issues.length)return t.value=o.value,t;const i=e.filter(e=>!Uu(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Bu(e,r,gu())))}),t)}const Oh=hu("$ZodUnion",(e,t)=>{Yd.init(e,t),Su(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),Su(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),Su(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Su(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>_u(e.source)).join("|")})$`)}});const n=1===t.options.length,r=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(n)return r(i,o);let a=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:i.value,issues:[]},o);if(t instanceof Promise)s.push(t),a=!0;else{if(0===t.issues.length)return t;s.push(t)}}return a?Promise.all(s).then(t=>Nh(t,i,e,o)):Nh(s,i,e,o)}}),Dh=hu("$ZodIntersection",(e,t)=>{Yd.init(e,t),e._zod.parse=(e,n)=>{const r=e.value,i=t.left._zod.run({value:r,issues:[]},n),o=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([t,n])=>Fh(e,t,n)):Fh(e,i,o)}});function Uh(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Ru(e)&&Ru(t)){const n=Object.keys(t),r=Object.keys(e).filter(e=>-1!==n.indexOf(e)),i={...e,...t};for(const o of r){const n=Uh(e[o],t[o]);if(!n.valid)return{valid:!1,mergeErrorPath:[o,...n.mergeErrorPath]};i[o]=n.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const i=Uh(e[r],t[r]);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Fh(e,t,n){const r=new Map;let i;for(const s of t.issues)if("unrecognized_keys"===s.code){i??(i=s);for(const e of s.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(s);for(const s of n.issues)if("unrecognized_keys"===s.code)for(const e of s.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(s);const o=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(o.length&&i&&e.issues.push({...i,keys:o}),Uu(e))return e;const a=Uh(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const zh=hu("$ZodEnum",(e,t)=>{Yd.init(e,t);const n=vu(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(e=>Iu.has(typeof e)).map(e=>"string"==typeof e?Lu(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{const o=t.value;return r.has(o)||t.issues.push({code:"invalid_value",values:n,input:o,inst:e}),t}}),Bh=hu("$ZodTransform",(e,t)=>{Yd.init(e,t),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new fu(e.constructor.name);const i=t.transform(n.value,n);if(r.async){return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n))}if(i instanceof Promise)throw new pu;return n.value=i,n}});function Vh(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const jh=hu("$ZodOptional",(e,t)=>{Yd.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Su(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Su(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${_u(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>Vh(t,e.value)):Vh(r,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),Hh=hu("$ZodExactOptional",(e,t)=>{jh.init(e,t),Su(e._zod,"values",()=>t.innerType._zod.values),Su(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Wh=hu("$ZodNullable",(e,t)=>{Yd.init(e,t),Su(e._zod,"optin",()=>t.innerType._zod.optin),Su(e._zod,"optout",()=>t.innerType._zod.optout),Su(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${_u(e.source)}|null)$`):void 0}),Su(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),Gh=hu("$ZodDefault",(e,t)=>{Yd.init(e,t),e._zod.optin="optional",Su(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Xh(e,t)):Xh(r,t)}});function Xh(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const qh=hu("$ZodPrefault",(e,t)=>{Yd.init(e,t),e._zod.optin="optional",Su(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),$h=hu("$ZodNonOptional",(e,t)=>{Yd.init(e,t),Su(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Yh(t,e)):Yh(i,e)}});function Yh(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Zh=hu("$ZodCatch",(e,t)=>{Yd.init(e,t),Su(e._zod,"optin",()=>t.innerType._zod.optin),Su(e._zod,"optout",()=>t.innerType._zod.optout),Su(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Bu(e,n,gu()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Bu(e,n,gu()))},input:e.value}),e.issues=[]),e)}}),Jh=hu("$ZodPipe",(e,t)=>{Yd.init(e,t),Su(e._zod,"values",()=>t.in._zod.values),Su(e._zod,"optin",()=>t.in._zod.optin),Su(e._zod,"optout",()=>t.out._zod.optout),Su(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Kh(e,t.in,n)):Kh(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Kh(e,t.out,n)):Kh(r,t.out,n)}});function Kh(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Qh=hu("$ZodReadonly",(e,t)=>{Yd.init(e,t),Su(e._zod,"propValues",()=>t.innerType._zod.propValues),Su(e._zod,"values",()=>t.innerType._zod.values),Su(e._zod,"optin",()=>t.innerType?._zod?.optin),Su(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(ep):ep(r)}});function ep(e){return e.value=Object.freeze(e.value),e}const tp=hu("$ZodCustom",(e,t)=>{Rd.init(e,t),Yd.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>np(t,n,r,e));np(i,n,r,e)}});function np(e,t,n,r){if(!e){const e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(ju(e))}}var rp;class ip{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(rp=globalThis).__zod_globalRegistry??(rp.__zod_globalRegistry=new ip);const op=globalThis.__zod_globalRegistry;function ap(e,t){return new e({type:"string",...Ou(t)})}function sp(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ou(t)})}function lp(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ou(t)})}function cp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ou(t)})}function up(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ou(t)})}function dp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ou(t)})}function hp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ou(t)})}function pp(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ou(t)})}function fp(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ou(t)})}function mp(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ou(t)})}function gp(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ou(t)})}function vp(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ou(t)})}function yp(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ou(t)})}function bp(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ou(t)})}function xp(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ou(t)})}function _p(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ou(t)})}function wp(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ou(t)})}function Sp(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ou(t)})}function Mp(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ou(t)})}function Ep(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ou(t)})}function Tp(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ou(t)})}function Ap(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ou(t)})}function Cp(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ou(t)})}function kp(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ou(t)})}function Rp(e,t){return new e({type:"string",format:"date",check:"string_format",...Ou(t)})}function Pp(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ou(t)})}function Ip(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ou(t)})}function Lp(e,t){return new e({type:"number",checks:[],...Ou(t)})}function Np(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ou(t)})}function Op(e){return new e({type:"any"})}function Dp(e){return new e({type:"unknown"})}function Up(e,t){return new e({type:"never",...Ou(t)})}function Fp(e,t){return new Id({check:"less_than",...Ou(t),value:e,inclusive:!1})}function zp(e,t){return new Id({check:"less_than",...Ou(t),value:e,inclusive:!0})}function Bp(e,t){return new Ld({check:"greater_than",...Ou(t),value:e,inclusive:!1})}function Vp(e,t){return new Ld({check:"greater_than",...Ou(t),value:e,inclusive:!0})}function jp(e,t){return new Nd({check:"multiple_of",...Ou(t),value:e})}function Hp(e,t){return new Dd({check:"max_length",...Ou(t),maximum:e})}function Wp(e,t){return new Ud({check:"min_length",...Ou(t),minimum:e})}function Gp(e,t){return new Fd({check:"length_equals",...Ou(t),length:e})}function Xp(e,t){return new Bd({check:"string_format",format:"regex",...Ou(t),pattern:e})}function qp(e){return new Vd({check:"string_format",format:"lowercase",...Ou(e)})}function $p(e){return new jd({check:"string_format",format:"uppercase",...Ou(e)})}function Yp(e,t){return new Hd({check:"string_format",format:"includes",...Ou(t),includes:e})}function Zp(e,t){return new Wd({check:"string_format",format:"starts_with",...Ou(t),prefix:e})}function Jp(e,t){return new Gd({check:"string_format",format:"ends_with",...Ou(t),suffix:e})}function Kp(e){return new Xd({check:"overwrite",tx:e})}function Qp(e){return Kp(t=>t.normalize(e))}function ef(){return Kp(e=>e.trim())}function tf(){return Kp(e=>e.toLowerCase())}function nf(){return Kp(e=>e.toUpperCase())}function rf(){return Kp(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e))}function of(e,t,n){return new e({type:"array",element:t,...Ou(n)})}function af(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Ou(n)})}function sf(e){const t=lf(n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(ju(e,n.value,t._zod.def));else{const r=e;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=t),r.continue??(r.continue=!t._zod.def.abort),n.issues.push(ju(r))}},e(n.value,n)));return t}function lf(e,t){const n=new Rd({check:"custom",...Ou(t)});return n._zod.check=e,n}function cf(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??op,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function uf(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,o=t.seen.get(e);if(o){o.count++;return n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema}const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{const r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,r);else{const n=a.schema,o=t.processors[i.type];if(!o)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);o(e,t,n,r)}const o=e._zod.parent;o&&(a.ref||(a.ref=o),uf(o,t,r),t.seen.get(o).isParent=!0)}const l=t.metadataRegistry.get(e);l&&Object.assign(a.schema,l),"input"===t.io&&pf(e)&&(delete a.schema.examples,delete a.schema.default),"input"===t.io&&a.schema._prefault&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault;return t.seen.get(e).schema}function df(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const o of e.seen.entries()){const t=e.metadataRegistry.get(o[0])?.id;if(t){const e=r.get(t);if(e&&e!==o[0])throw new Error(`Duplicate schema id "${t}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(t,o[0])}}const i=t=>{if(t[1].schema.$ref)return;const r=t[1],{ref:i,defId:o}=(t=>{const r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};const o=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=o,{defId:o,ref:`${i("__shared")}#/${r}/${o}`}}if(t[1]===n)return{ref:"#"};const i=`#/${r}/`,o=t[1].schema.id??"__schema"+e.counter++;return{defId:o,ref:i+o}})(t);r.def={...r.schema},o&&(r.defId=o);const a=r.schema;for(const e in a)delete a[e];a.$ref=i};if("throw"===e.cycles)for(const o of e.seen.entries()){const e=o[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const o of e.seen.entries()){const n=o[1];if(t===o[0]){i(o);continue}if(e.external){const n=e.external.registry.get(o[0])?.id;if(t!==o[0]&&n){i(o);continue}}const r=e.metadataRegistry.get(o[0])?.id;r?i(o):(n.cycle||n.count>1&&"ref"===e.reused)&&i(o)}}function hf(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=t=>{const n=e.seen.get(t);if(null===n.ref)return;const i=n.def??n.schema,o={...i},a=n.ref;if(n.ref=null,a){r(a);const n=e.seen.get(a),s=n.schema;!s.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(i,s):(i.allOf=i.allOf??[],i.allOf.push(s)),Object.assign(i,o);if(t._zod.parent===a)for(const e in i)"$ref"!==e&&"allOf"!==e&&(e in o||delete i[e]);if(s.$ref&&n.def)for(const e in i)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}const s=t._zod.parent;if(s&&s!==a){r(s);const t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(const e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(const s of[...e.seen.entries()].reverse())r(s[0]);const i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);const o=e.external?.defs??{};for(const s of e.seen.entries()){const e=s[1];e.def&&e.defId&&(o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?i.$defs=o:i.definitions=o);try{const n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:ff(t,"input",e.processors),output:ff(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(a){throw new Error("Error converting schema to JSON.")}}function pf(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if("transform"===r.type)return!0;if("array"===r.type)return pf(r.element,n);if("set"===r.type)return pf(r.valueType,n);if("lazy"===r.type)return pf(r.getter(),n);if("promise"===r.type||"optional"===r.type||"nonoptional"===r.type||"nullable"===r.type||"readonly"===r.type||"default"===r.type||"prefault"===r.type)return pf(r.innerType,n);if("intersection"===r.type)return pf(r.left,n)||pf(r.right,n);if("record"===r.type||"map"===r.type)return pf(r.keyType,n)||pf(r.valueType,n);if("pipe"===r.type)return pf(r.in,n)||pf(r.out,n);if("object"===r.type){for(const e in r.shape)if(pf(r.shape[e],n))return!0;return!1}if("union"===r.type){for(const e of r.options)if(pf(e,n))return!0;return!1}if("tuple"===r.type){for(const e of r.items)if(pf(e,n))return!0;return!(!r.rest||!pf(r.rest,n))}return!1}const ff=(e,t,n={})=>r=>{const{libraryOptions:i,target:o}=r??{},a=cf({...i??{},target:o,io:t,processors:n});return uf(e,a),df(a,e),hf(a,e)},mf={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},gf=(e,t,n,r)=>{const i=e._zod.def;uf(i.innerType,t,r);t.seen.get(e).ref=i.innerType},vf=hu("ZodISODateTime",(e,t)=>{ch.init(e,t),Ff.init(e,t)});const yf=hu("ZodISODate",(e,t)=>{uh.init(e,t),Ff.init(e,t)});const bf=hu("ZodISOTime",(e,t)=>{dh.init(e,t),Ff.init(e,t)});const xf=hu("ZodISODuration",(e,t)=>{hh.init(e,t),Ff.init(e,t)});const _f=hu("ZodError",(e,t)=>{Wu.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},r=e=>{for(const i of e.issues)if("invalid_union"===i.code&&i.errors.length)i.errors.map(e=>r({issues:e}));else if("invalid_key"===i.code)r({issues:i.issues});else if("invalid_element"===i.code)r({issues:i.issues});else if(0===i.path.length)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){const n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},r=[];for(const i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,yu,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,yu,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),wf=Xu(_f),Sf=qu(_f),Mf=$u(_f),Ef=Zu(_f),Tf=Ku(_f),Af=Qu(_f),Cf=ed(_f),kf=td(_f),Rf=nd(_f),Pf=rd(_f),If=id(_f),Lf=od(_f),Nf=hu("ZodType",(e,t)=>(Yd.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ff(e,"input"),output:ff(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{const r=cf({...n,processors:t});return uf(e,r),df(r,e),hf(r,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Eu(t,{checks:[...t.checks??[],...n.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>Nu(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>wf(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Mf(e,t,n),e.parseAsync=async(t,n)=>Sf(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ef(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Tf(e,t,n),e.decode=(t,n)=>Af(e,t,n),e.encodeAsync=async(t,n)=>Cf(e,t,n),e.decodeAsync=async(t,n)=>kf(e,t,n),e.safeEncode=(t,n)=>Rf(e,t,n),e.safeDecode=(t,n)=>Pf(e,t,n),e.safeEncodeAsync=async(t,n)=>If(e,t,n),e.safeDecodeAsync=async(t,n)=>Lf(e,t,n),e.refine=(t,n)=>e.check(function(e,t={}){return af(Pm,e,t)}(t,n)),e.superRefine=t=>e.check(sf(t)),e.overwrite=t=>e.check(Kp(t)),e.optional=()=>xm(e),e.exactOptional=()=>new _m({type:"optional",innerType:e}),e.nullable=()=>Sm(e),e.nullish=()=>xm(Sm(e)),e.nonoptional=t=>function(e,t){return new Tm({type:"nonoptional",innerType:e,...Ou(t)})}(e,t),e.array=()=>{return of(hm,e,t);var t},e.or=t=>{return new fm({type:"union",options:[e,t],...Ou(n)});var n},e.and=t=>new mm({type:"intersection",left:e,right:t}),e.transform=t=>km(e,new ym({type:"transform",transform:t})),e.default=t=>{return n=t,new Mm({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():Pu(n)}});var n},e.prefault=t=>{return n=t,new Em({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():Pu(n)}});var n},e.catch=t=>{return new Am({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>km(e,t),e.readonly=()=>new Rm({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return op.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>op.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return op.get(e);const n=e.clone();return op.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),Of=hu("_ZodString",(e,t)=>{Zd.init(e,t),Nf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n;r.type="string";const{minimum:i,maximum:o,format:a,patterns:s,contentEncoding:l}=e._zod.bag;if("number"==typeof i&&(r.minLength=i),"number"==typeof o&&(r.maxLength=o),a&&(r.format=mf[a]??a,""===r.format&&delete r.format,"time"===a&&delete r.format),l&&(r.contentEncoding=l),s&&s.size>0){const e=[...s];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,n);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Xp(...t)),e.includes=(...t)=>e.check(Yp(...t)),e.startsWith=(...t)=>e.check(Zp(...t)),e.endsWith=(...t)=>e.check(Jp(...t)),e.min=(...t)=>e.check(Wp(...t)),e.max=(...t)=>e.check(Hp(...t)),e.length=(...t)=>e.check(Gp(...t)),e.nonempty=(...t)=>e.check(Wp(1,...t)),e.lowercase=t=>e.check(qp(t)),e.uppercase=t=>e.check($p(t)),e.trim=()=>e.check(ef()),e.normalize=(...t)=>e.check(Qp(...t)),e.toLowerCase=()=>e.check(tf()),e.toUpperCase=()=>e.check(nf()),e.slugify=()=>e.check(rf())}),Df=hu("ZodString",(e,t)=>{Zd.init(e,t),Of.init(e,t),e.email=t=>e.check(sp(zf,t)),e.url=t=>e.check(pp(jf,t)),e.jwt=t=>e.check(Cp(rm,t)),e.emoji=t=>e.check(fp(Hf,t)),e.guid=t=>e.check(lp(Bf,t)),e.uuid=t=>e.check(cp(Vf,t)),e.uuidv4=t=>e.check(up(Vf,t)),e.uuidv6=t=>e.check(dp(Vf,t)),e.uuidv7=t=>e.check(hp(Vf,t)),e.nanoid=t=>e.check(mp(Wf,t)),e.guid=t=>e.check(lp(Bf,t)),e.cuid=t=>e.check(gp(Gf,t)),e.cuid2=t=>e.check(vp(Xf,t)),e.ulid=t=>e.check(yp(qf,t)),e.base64=t=>e.check(Ep(em,t)),e.base64url=t=>e.check(Tp(tm,t)),e.xid=t=>e.check(bp($f,t)),e.ksuid=t=>e.check(xp(Yf,t)),e.ipv4=t=>e.check(_p(Zf,t)),e.ipv6=t=>e.check(wp(Jf,t)),e.cidrv4=t=>e.check(Sp(Kf,t)),e.cidrv6=t=>e.check(Mp(Qf,t)),e.e164=t=>e.check(Ap(nm,t)),e.datetime=t=>e.check(function(e){return kp(vf,e)}(t)),e.date=t=>e.check(function(e){return Rp(yf,e)}(t)),e.time=t=>e.check(function(e){return Pp(bf,e)}(t)),e.duration=t=>e.check(function(e){return Ip(xf,e)}(t))});function Uf(e){return ap(Df,e)}const Ff=hu("ZodStringFormat",(e,t)=>{Jd.init(e,t),Of.init(e,t)}),zf=hu("ZodEmail",(e,t)=>{eh.init(e,t),Ff.init(e,t)}),Bf=hu("ZodGUID",(e,t)=>{Kd.init(e,t),Ff.init(e,t)}),Vf=hu("ZodUUID",(e,t)=>{Qd.init(e,t),Ff.init(e,t)}),jf=hu("ZodURL",(e,t)=>{th.init(e,t),Ff.init(e,t)}),Hf=hu("ZodEmoji",(e,t)=>{nh.init(e,t),Ff.init(e,t)}),Wf=hu("ZodNanoID",(e,t)=>{rh.init(e,t),Ff.init(e,t)}),Gf=hu("ZodCUID",(e,t)=>{ih.init(e,t),Ff.init(e,t)}),Xf=hu("ZodCUID2",(e,t)=>{oh.init(e,t),Ff.init(e,t)}),qf=hu("ZodULID",(e,t)=>{ah.init(e,t),Ff.init(e,t)}),$f=hu("ZodXID",(e,t)=>{sh.init(e,t),Ff.init(e,t)}),Yf=hu("ZodKSUID",(e,t)=>{lh.init(e,t),Ff.init(e,t)}),Zf=hu("ZodIPv4",(e,t)=>{ph.init(e,t),Ff.init(e,t)}),Jf=hu("ZodIPv6",(e,t)=>{fh.init(e,t),Ff.init(e,t)}),Kf=hu("ZodCIDRv4",(e,t)=>{mh.init(e,t),Ff.init(e,t)}),Qf=hu("ZodCIDRv6",(e,t)=>{gh.init(e,t),Ff.init(e,t)}),em=hu("ZodBase64",(e,t)=>{yh.init(e,t),Ff.init(e,t)}),tm=hu("ZodBase64URL",(e,t)=>{bh.init(e,t),Ff.init(e,t)}),nm=hu("ZodE164",(e,t)=>{xh.init(e,t),Ff.init(e,t)}),rm=hu("ZodJWT",(e,t)=>{_h.init(e,t),Ff.init(e,t)}),im=hu("ZodNumber",(e,t)=>{wh.init(e,t),Nf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n,{minimum:i,maximum:o,format:a,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:c}=e._zod.bag;"string"==typeof a&&a.includes("int")?r.type="integer":r.type="number","number"==typeof c&&("draft-04"===t.target||"openapi-3.0"===t.target?(r.minimum=c,r.exclusiveMinimum=!0):r.exclusiveMinimum=c),"number"==typeof i&&(r.minimum=i,"number"==typeof c&&"draft-04"!==t.target&&(c>=i?delete r.minimum:delete r.exclusiveMinimum)),"number"==typeof l&&("draft-04"===t.target||"openapi-3.0"===t.target?(r.maximum=l,r.exclusiveMaximum=!0):r.exclusiveMaximum=l),"number"==typeof o&&(r.maximum=o,"number"==typeof l&&"draft-04"!==t.target&&(l<=o?delete r.maximum:delete r.exclusiveMaximum)),"number"==typeof s&&(r.multipleOf=s)})(e,t,n),e.gt=(t,n)=>e.check(Bp(t,n)),e.gte=(t,n)=>e.check(Vp(t,n)),e.min=(t,n)=>e.check(Vp(t,n)),e.lt=(t,n)=>e.check(Fp(t,n)),e.lte=(t,n)=>e.check(zp(t,n)),e.max=(t,n)=>e.check(zp(t,n)),e.int=t=>e.check(sm(t)),e.safe=t=>e.check(sm(t)),e.positive=t=>e.check(Bp(0,t)),e.nonnegative=t=>e.check(Vp(0,t)),e.negative=t=>e.check(Fp(0,t)),e.nonpositive=t=>e.check(zp(0,t)),e.multipleOf=(t,n)=>e.check(jp(t,n)),e.step=(t,n)=>e.check(jp(t,n)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function om(e){return Lp(im,e)}const am=hu("ZodNumberFormat",(e,t)=>{Sh.init(e,t),im.init(e,t)});function sm(e){return Np(am,e)}const lm=hu("ZodAny",(e,t)=>{Mh.init(e,t),Nf.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});const cm=hu("ZodUnknown",(e,t)=>{Eh.init(e,t),Nf.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function um(){return Dp(cm)}const dm=hu("ZodNever",(e,t)=>{Th.init(e,t),Nf.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.not={}})(0,0,t)});const hm=hu("ZodArray",(e,t)=>{Ch.init(e,t),Nf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;"number"==typeof a&&(i.minItems=a),"number"==typeof s&&(i.maxItems=s),i.type="array",i.items=uf(o.element,t,{...r,path:[...r.path,"items"]})})(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Wp(t,n)),e.nonempty=t=>e.check(Wp(1,t)),e.max=(t,n)=>e.check(Hp(t,n)),e.length=(t,n)=>e.check(Gp(t,n)),e.unwrap=()=>e.element});const pm=hu("ZodObject",(e,t)=>{Lh.init(e,t),Nf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def;i.type="object",i.properties={};const a=o.shape;for(const c in a)i.properties[c]=uf(a[c],t,{...r,path:[...r.path,"properties",c]});const s=new Set(Object.keys(a)),l=new Set([...s].filter(e=>{const n=o.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout}));l.size>0&&(i.required=Array.from(l)),"never"===o.catchall?._zod.def.type?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=uf(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(i.additionalProperties=!1)})(e,t,n,r),Su(e,"shape",()=>t.shape),e.keyof=()=>vm(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:um()}),e.loose=()=>e.clone({...e._zod.def,catchall:um()}),e.strict=()=>{return e.clone({...e._zod.def,catchall:Up(dm,t)});var t},e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!Ru(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const r=Eu(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Mu(this,"shape",n),n}});return Nu(e,r)}(e,t),e.safeExtend=t=>function(e,t){if(!Ru(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Eu(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Mu(this,"shape",n),n}});return Nu(e,n)}(e,t),e.merge=t=>function(e,t){const n=Eu(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Mu(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Nu(e,n)}(e,t),e.pick=t=>function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return Nu(e,Eu(e._zod.def,{get shape(){const e={};for(const r in t){if(!(r in n.shape))throw new Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Mu(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=Eu(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Mu(this,"shape",r),r},checks:[]});return Nu(e,i)}(e,t),e.partial=(...t)=>function(e,t,n){const r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=Eu(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:"optional",innerType:r[t]}):r[t])}else for(const t in r)i[t]=e?new e({type:"optional",innerType:r[t]}):r[t];return Mu(this,"shape",i),i},checks:[]});return Nu(t,i)}(bm,e,t[0]),e.required=(...t)=>function(e,t,n){const r=Eu(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const t in n){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:"nonoptional",innerType:r[t]}))}else for(const t in r)i[t]=new e({type:"nonoptional",innerType:r[t]});return Mu(this,"shape",i),i}});return Nu(t,r)}(Tm,e,t[0])});const fm=hu("ZodUnion",(e,t)=>{Oh.init(e,t),Nf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=!1===i.inclusive,a=i.options.map((e,n)=>uf(e,t,{...r,path:[...r.path,o?"oneOf":"anyOf",n]}));o?n.oneOf=a:n.anyOf=a})(e,t,n,r),e.options=t.options});const mm=hu("ZodIntersection",(e,t)=>{Dh.init(e,t),Nf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=uf(i.left,t,{...r,path:[...r.path,"allOf",0]}),a=uf(i.right,t,{...r,path:[...r.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length,l=[...s(o)?o.allOf:[o],...s(a)?a.allOf:[a]];n.allOf=l})(e,t,n,r)});const gm=hu("ZodEnum",(e,t)=>{zh.init(e,t),Nf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=vu(e._zod.def.entries);r.every(e=>"number"==typeof e)&&(n.type="number"),r.every(e=>"string"==typeof e)&&(n.type="string"),n.enum=r})(e,0,n),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{const i={};for(const o of e){if(!n.has(o))throw new Error(`Key ${o} not found in enum`);i[o]=t.entries[o]}return new gm({...t,checks:[],...Ou(r),entries:i})},e.exclude=(e,r)=>{const i={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete i[t]}return new gm({...t,checks:[],...Ou(r),entries:i})}});function vm(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new gm({type:"enum",entries:n,...Ou(t)})}const ym=hu("ZodTransform",(e,t)=>{Bh.init(e,t),Nf.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new fu(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(ju(r,n.value,t));else{const t=r;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(ju(t))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});const bm=hu("ZodOptional",(e,t)=>{jh.init(e,t),Nf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gf(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});function xm(e){return new bm({type:"optional",innerType:e})}const _m=hu("ZodExactOptional",(e,t)=>{Hh.init(e,t),Nf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gf(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});const wm=hu("ZodNullable",(e,t)=>{Wh.init(e,t),Nf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=uf(i.innerType,t,r),a=t.seen.get(e);"openapi-3.0"===t.target?(a.ref=i.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Sm(e){return new wm({type:"nullable",innerType:e})}const Mm=hu("ZodDefault",(e,t)=>{Gh.init(e,t),Nf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;uf(i.innerType,t,r),t.seen.get(e).ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const Em=hu("ZodPrefault",(e,t)=>{qh.init(e,t),Nf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;uf(i.innerType,t,r),t.seen.get(e).ref=i.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});const Tm=hu("ZodNonOptional",(e,t)=>{$h.init(e,t),Nf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;uf(i.innerType,t,r),t.seen.get(e).ref=i.innerType})(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});const Am=hu("ZodCatch",(e,t)=>{Zh.init(e,t),Nf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;let o;uf(i.innerType,t,r),t.seen.get(e).ref=i.innerType;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const Cm=hu("ZodPipe",(e,t)=>{Jh.init(e,t),Nf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o="input"===t.io?"transform"===i.in._zod.def.type?i.out:i.in:i.out;uf(o,t,r),t.seen.get(e).ref=o})(e,t,0,r),e.in=t.in,e.out=t.out});function km(e,t){return new Cm({type:"pipe",in:e,out:t})}const Rm=hu("ZodReadonly",(e,t)=>{Qh.init(e,t),Nf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;uf(i.innerType,t,r),t.seen.get(e).ref=i.innerType,n.readOnly=!0})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});const Pm=hu("ZodCustom",(e,t)=>{tp.init(e,t),Nf.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)});const Im=Object.create(null);Im.open="0",Im.close="1",Im.ping="2",Im.pong="3",Im.message="4",Im.upgrade="5",Im.noop="6";const Lm=Object.create(null);Object.keys(Im).forEach(e=>{Lm[Im[e]]=e});const Nm={type:"error",data:"parser error"},Om="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),Dm="function"==typeof ArrayBuffer,Um=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Fm=({type:e,data:t},n,r)=>Om&&t instanceof Blob?n?r(t):zm(t,r):Dm&&(t instanceof ArrayBuffer||Um(t))?n?r(t):zm(new Blob([t]),r):r(Im[e]+(t||"")),zm=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function Bm(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Vm;const jm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Hm="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let hz=0;hz<64;hz++)Hm[jm.charCodeAt(hz)]=hz;const Wm="function"==typeof ArrayBuffer,Gm=(e,t)=>{if("string"!=typeof e)return{type:"message",data:qm(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:Xm(e.substring(1),t)};return Lm[n]?e.length>1?{type:Lm[n],data:e.substring(1)}:{type:Lm[n]}:Nm},Xm=(e,t)=>{if(Wm){const n=(e=>{let t,n,r,i,o,a=.75*e.length,s=e.length,l=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);const c=new ArrayBuffer(a),u=new Uint8Array(c);for(t=0;t<s;t+=4)n=Hm[e.charCodeAt(t)],r=Hm[e.charCodeAt(t+1)],i=Hm[e.charCodeAt(t+2)],o=Hm[e.charCodeAt(t+3)],u[l++]=n<<2|r>>4,u[l++]=(15&r)<<4|i>>2,u[l++]=(3&i)<<6|63&o;return c})(e);return qm(n,t)}return{base64:!0,data:e}},qm=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,$m=String.fromCharCode(30);function Ym(){return new TransformStream({transform(e,t){!function(e,t){Om&&e.data instanceof Blob?e.data.arrayBuffer().then(Bm).then(t):Dm&&(e.data instanceof ArrayBuffer||Um(e.data))?t(Bm(e.data)):Fm(e,!1,e=>{Vm||(Vm=new TextEncoder),t(Vm.encode(e))})}(e,n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{i=new Uint8Array(9);const e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let Zm;function Jm(e){return e.reduce((e,t)=>e+t.length,0)}function Km(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function Qm(e){if(e)return function(e){for(var t in Qm.prototype)e[t]=Qm.prototype[t];return e}(e)}Qm.prototype.on=Qm.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},Qm.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},Qm.prototype.off=Qm.prototype.removeListener=Qm.prototype.removeAllListeners=Qm.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i<r.length;i++)if((n=r[i])===t||n.fn===t){r.splice(i,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},Qm.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var i=(n=n.slice(0)).length;r<i;++r)n[r].apply(this,t)}return this},Qm.prototype.emitReserved=Qm.prototype.emit,Qm.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},Qm.prototype.hasListeners=function(e){return!!this.listeners(e).length};const eg="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),tg="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function ng(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}const rg=tg.setTimeout,ig=tg.clearTimeout;function og(e,t){t.useNativeTimers?(e.setTimeoutFn=rg.bind(tg),e.clearTimeoutFn=ig.bind(tg)):(e.setTimeoutFn=tg.setTimeout.bind(tg),e.clearTimeoutFn=tg.clearTimeout.bind(tg))}function ag(e){return"string"==typeof e?function(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}(e):Math.ceil(1.33*(e.byteLength||e.size))}function sg(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class lg extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class cg extends Qm{constructor(e){super(),this.writable=!1,og(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved("error",new lg(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Gm(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&443!==Number(this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}class ug extends cg{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",function(){--e||t()})),this.writable||(e++,this.once("drain",function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split($m),r=[];for(let i=0;i<n.length;i++){const e=Gm(n[i],t);if(r.push(e),"error"===e.type)break}return r})(e,this.socket.binaryType).forEach(e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)}),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((e,o)=>{Fm(e,!1,e=>{r[o]=e,++i===n&&t(r.join($m))})})})(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=sg()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let dg=!1;try{dg="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(dz){}const hg=dg;function pg(){}class fg extends ug{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,t)=>{this.onError("xhr poll error",e,t)}),this.pollXhr=e}}let mg=class e extends Qm{constructor(e,t,n){super(),this.createRequest=e,og(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var t;const n=ng(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(Dv){}if("POST"===this._method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(Dv){}try{r.setRequestHeader("Accept","*/*")}catch(Dv){}null===(t=this._opts.cookieJar)||void 0===t||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;3===r.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(r.getResponseHeader("set-cookie"))),4===r.readyState&&(200===r.status||1223===r.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof r.status?r.status:0)},0))},r.send(this._data)}catch(Dv){return void this.setTimeoutFn(()=>{this._onError(Dv)},0)}"undefined"!=typeof document&&(this._index=e.requestsCount++,e.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(t){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=pg,t)try{this._xhr.abort()}catch(Dv){}"undefined"!=typeof document&&delete e.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};if(mg.requestsCount=0,mg.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",gg);else if("function"==typeof addEventListener){addEventListener("onpagehide"in tg?"pagehide":"unload",gg,!1)}function gg(){for(let e in mg.requests)mg.requests.hasOwnProperty(e)&&mg.requests[e].abort()}const vg=function(){const e=yg({xdomain:!1});return e&&null!==e.responseType}();function yg(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||hg))return new XMLHttpRequest}catch(Dv){}if(!t)try{return new(tg[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(Dv){}}const bg="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class xg extends cg{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=bg?{}:ng(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(dz){return this.emitReserved("error",dz)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;Fm(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch(Dv){}r&&eg(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=sg()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const _g=tg.WebSocket||tg.MozWebSocket;const wg={websocket:class extends xg{createSocket(e,t,n){return bg?new _g(e,t,n):t?new _g(e,t):new _g(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends cg{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(dz){return this.emitReserved("error",dz)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=function(e,t){Zm||(Zm=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(a,s){for(n.push(a);;){if(0===r){if(Jm(n)<1)break;const e=Km(n,1);o=!(128&~e[0]),i=127&e[0],r=i<126?3:126===i?1:2}else if(1===r){if(Jm(n)<2)break;const e=Km(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(Jm(n)<8)break;const e=Km(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),o=t.getUint32(0);if(o>Math.pow(2,21)-1){s.enqueue(Nm);break}i=o*Math.pow(2,32)+t.getUint32(4),r=3}else{if(Jm(n)<i)break;const e=Km(n,i);s.enqueue(Gm(o?e:Zm.decode(e),t)),r=0}if(0===i||i>e){s.enqueue(Nm);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=Ym();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const i=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),i())}).catch(e=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&eg(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends fg{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=vg&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new mg(yg,this.uri(),e)}}},Sg=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Mg=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Eg(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=Sg.exec(e||""),o={},a=14;for(;a--;)o[Mg[a]]=i[a]||"";return-1!=n&&-1!=r&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1);"/"==t.slice(-1)&&r.splice(r.length-1,1);return r}(0,o.path),o.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}(0,o.query),o}const Tg="function"==typeof addEventListener&&"function"==typeof removeEventListener,Ag=[];Tg&&addEventListener("offline",()=>{Ag.forEach(e=>e())},!1);class Cg extends Qm{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const n=Eg(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=Eg(t.host).host);og(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let r=0,i=n.length;r<i;r++){let e=n[r].split("=");t[decodeURIComponent(e[0])]=decodeURIComponent(e[1])}return t}(this.opts.query)),Tg&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Ag.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const e=this.opts.rememberUpgrade&&Cg.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){this.readyState="open",Cg.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){const n=this.writeBuffer[t].data;if(n&&(e+=ag(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,eg(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket("message",e,t,n),this}send(e,t,n){return this._sendPacket("message",e,t,n),this}_sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const i={type:e,data:t,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(e){if(Cg.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Tg&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=Ag.indexOf(this._offlineEventListener);-1!==e&&Ag.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}Cg.protocol=4;class kg extends Cg{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;Cg.priorWebsocketSuccess=!1;const r=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Cg.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{n||"closed"!==this.readyState&&(c(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}}))};function i(){n||(n=!0,c(),t.close(),t=null)}const o=e=>{const n=new Error("probe error: "+e);n.transport=t.name,i(),this.emitReserved("upgradeError",n)};function a(){o("transport closed")}function s(){o("socket closed")}function l(e){t&&e.name!==t.name&&i()}const c=()=>{t.removeListener("open",r),t.removeListener("error",o),t.removeListener("close",a),this.off("close",s),this.off("upgrading",l)};t.once("open",r),t.once("error",o),t.once("close",a),this.once("close",s),this.once("upgrading",l),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}let Rg=class extends kg{constructor(e,t={}){const n="object"==typeof e?e:t;(!n.transports||n.transports&&"string"==typeof n.transports[0])&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(e=>wg[e]).filter(e=>!!e)),super(e,n)}};const Pg="function"==typeof ArrayBuffer,Ig=Object.prototype.toString,Lg="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Ig.call(Blob),Ng="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===Ig.call(File);function Og(e){return Pg&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||Lg&&e instanceof Blob||Ng&&e instanceof File}function Dg(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(Dg(e[t]))return!0;return!1}if(Og(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return Dg(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&Dg(e[n]))return!0;return!1}function Ug(e){const t=[],n=e.data,r=e;return r.data=Fg(n,t),r.attachments=t.length,{packet:r,buffers:t}}function Fg(e,t){if(!e)return e;if(Og(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=Fg(e[r],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=Fg(e[r],t));return n}return e}function zg(e,t){return e.data=Bg(e.data,t),delete e.attachments,e}function Bg(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=Bg(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Bg(e[n],t));return e}const Vg=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var jg,Hg;(Hg=jg||(jg={}))[Hg.CONNECT=0]="CONNECT",Hg[Hg.DISCONNECT=1]="DISCONNECT",Hg[Hg.EVENT=2]="EVENT",Hg[Hg.ACK=3]="ACK",Hg[Hg.CONNECT_ERROR=4]="CONNECT_ERROR",Hg[Hg.BINARY_EVENT=5]="BINARY_EVENT",Hg[Hg.BINARY_ACK=6]="BINARY_ACK";class Wg extends Qm{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===jg.BINARY_EVENT;n||t.type===jg.BINARY_ACK?(t.type=n?jg.EVENT:jg.ACK,this.reconstructor=new Gg(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!Og(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(void 0===jg[n.type])throw new Error("unknown packet type "+n.type);if(n.type===jg.BINARY_EVENT||n.type===jg.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const i=e.substring(r,t);if(i!=Number(i)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(i)}if("/"===e.charAt(t+1)){const r=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}n.nsp=e.substring(r,t)}else n.nsp="/";const r=e.charAt(t+1);if(""!==r&&Number(r)==r){const r=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(!Wg.isPayloadValid(n.type,r))throw new Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(Dv){return!1}}static isPayloadValid(e,t){switch(e){case jg.CONNECT:return qg(t);case jg.DISCONNECT:return void 0===t;case jg.CONNECT_ERROR:return"string"==typeof t||qg(t);case jg.EVENT:case jg.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Vg.indexOf(t[0]));case jg.ACK:case jg.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Gg{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=zg(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Xg=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e};function qg(e){return"[object Object]"===Object.prototype.toString.call(e)}const $g=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Wg,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==jg.EVENT&&e.type!==jg.ACK||!Dg(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===jg.EVENT?jg.BINARY_EVENT:jg.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==jg.BINARY_EVENT&&e.type!==jg.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Ug(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return jg},isPacketValid:function(e){return"string"==typeof e.nsp&&(void 0===(t=e.id)||Xg(t))&&function(e,t){switch(e){case jg.CONNECT:return void 0===t||qg(t);case jg.DISCONNECT:return void 0===t;case jg.EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Vg.indexOf(t[0]));case jg.ACK:return Array.isArray(t);case jg.CONNECT_ERROR:return"string"==typeof t||qg(t);default:return!1}}(e.type,e.data);var t},protocol:5},Symbol.toStringTag,{value:"Module"}));function Yg(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Zg=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Jg extends Qm{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Yg(e,"open",this.onopen.bind(this)),Yg(e,"packet",this.onpacket.bind(this)),Yg(e,"error",this.onerror.bind(this)),Yg(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var n,r,i;if(Zg.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const o={type:jg.EVENT,data:t,options:{}};if(o.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),o.id=e}const a=null===(r=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===r?void 0:r.writable,s=this.connected&&!(null===(i=this.io.engine)||void 0===i?void 0:i._hasPingExpired());return this.flags.volatile&&!a||(s?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[e]=t);const i=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))},r),o=(...e)=>{this.io.clearTimeoutFn(i),t.apply(this,e)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((n,r)=>{const i=(e,t)=>e?r(e):n(t);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>{this._queue[0];return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue()}),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:jg.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case jg.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case jg.EVENT:case jg.BINARY_EVENT:this.onevent(e);break;case jg.ACK:case jg.BINARY_ACK:this.onack(e);break;case jg.DISCONNECT:this.ondisconnect();break;case jg.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...r){n||(n=!0,t.packet({type:jg.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:jg.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function Kg(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Kg.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},Kg.prototype.reset=function(){this.attempts=0},Kg.prototype.setMin=function(e){this.ms=e},Kg.prototype.setMax=function(e){this.max=e},Kg.prototype.setJitter=function(e){this.jitter=e};class Qg extends Qm{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,og(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new Kg({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||$g;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Rg(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=Yg(t,"open",function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},o=Yg(t,"error",i);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn(()=>{r(),i(new Error("timeout")),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Yg(e,"ping",this.onping.bind(this)),Yg(e,"data",this.ondata.bind(this)),Yg(e,"error",this.onerror.bind(this)),Yg(e,"close",this.onclose.bind(this)),Yg(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(Dv){this.onclose("parse error",Dv)}}ondecoded(e){eg(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new Jg(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const n of t){if(this.nsps[n].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),null===(n=this.engine)||void 0===n||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const ev={};function tv(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=Eg(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+t,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=ev[i]&&o in ev[i].nsps;let s;return t.forceNew||t["force new connection"]||!1===t.multiplex||a?s=new Qg(r,t):(ev[i]||(ev[i]=new Qg(r,t)),s=ev[i]),n.query&&!t.query&&(t.query=n.queryKey),s.socket(n.path,t)}Object.assign(tv,{Manager:Qg,Socket:Jg,io:tv,connect:tv});const nv="chat_device_id";function rv(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}const iv=function(e,t){const n={type:"object",shape:e??{},...Ou(t)};return new pm(n)}({id:Uf().optional(),type:vm(["text","image","audio","location","system"]).default("text"),content:Uf().optional(),imageUrl:Uf().url().optional(),audioUrl:Uf().url().optional(),latitude:om().optional(),longitude:om().optional(),timestamp:Uf().optional(),sender:vm(["bot","user","system"]).optional(),emotion:Op(lm).optional()});function ov(e){const{apiKey:t,apiBaseUrl:n,agentId:r,pageContext:i,userContext:o}=e,a=w.useRef(e);w.useEffect(()=>{a.current=e},[e]);const s=w.useRef(null),[l,c]=w.useState(!1),[u,d]=w.useState(!1),h=w.useRef(function(){try{const e=localStorage.getItem(nv);if(e)return e;const t=rv();return localStorage.setItem(nv,t),t}catch{return Zt("localStorage not available, using session-only device ID"),rv()}}()),p=w.useRef(i);w.useEffect(()=>{p.current=i},[i]);const f=w.useCallback(e=>{const t=iv.safeParse(e),n=t.success&&t.data.id?t.data.id:`msg-${Math.random().toString(36).slice(2,11)}`,r=t.success&&t.data.sender?t.data.sender:"bot",i=t.success&&t.data.timestamp?new Date(t.data.timestamp):new Date,o=t.success?t.data:{type:"text"};switch(o.type){case"image":return{id:n,type:"image",sender:r,timestamp:i,imageUrl:o.imageUrl||o.content||"",altText:"Imagen enviada"};case"audio":return{id:n,type:"audio",sender:r,timestamp:i,content:o.audioUrl||o.content||""};case"location":return{id:n,type:"location",sender:r,timestamp:i,latitude:Number(o.latitude||0),longitude:Number(o.longitude||0),name:o.content||"Ubicación compartida"};case"system":return{id:n,type:"system",sender:"system",timestamp:i,content:String(o.content||"")};default:return{id:n,type:"text",sender:r,timestamp:i,content:String(o.content||"Sin contenido"),emotion:o.emotion}}},[]),m=w.useCallback(()=>{if(!t||!n)return;if(s.current?.connected)return;c(!0);const e=tv(`${n}/webchat`,{auth:{apiKey:t,deviceId:h.current,agentId:r,token:o?.token,metadata:o?.metadata},transports:["websocket","polling"],reconnection:!0,reconnectionAttempts:5,reconnectionDelay:1e3,extraHeaders:{"bypass-tunnel-reminder":"true","X-Tunnel-Skip-Anti-Phishing-Page":"true"}});e.on("connect",()=>{c(!1),d(!0),a.current.onConnected(`temp-${Date.now()}`,void 0)}),e.on("disconnect",e=>{c(!1),d(!1),a.current.onDisconnected()}),e.on("connect_error",e=>{c(!1),a.current.onError(`Error de conexión: ${e.message}`)}),e.on("connection_ack",e=>{a.current.onConnected(e.sessionId,e.config)}),e.on("bot_message",e=>{try{a.current.onMessage(f(e))}catch(Dv){Jt("ChatSocket Error processing bot_message:",Dv)}}),e.on("chat_history",e=>{if(e.messages&&Array.isArray(e.messages))if(a.current.onHistoryLoaded){const t=e.messages.map(e=>{try{return f(e)}catch(Dv){return Kt("Error processing history message:",Dv),null}}).filter(e=>null!==e);a.current.onHistoryLoaded(t)}else e.messages.forEach(e=>{try{a.current.onMessage(f(e))}catch(Dv){Kt("Error processing history message:",Dv)}});a.current.onEvent&&a.current.onEvent("history_loaded",e)}),e.on("bot_typing",e=>a.current.onTyping(e)),e.on("auth_success",e=>{a.current.onLogin&&a.current.onLogin(e),e.theme&&a.current.onThemeUpdate&&a.current.onThemeUpdate(e.theme)}),s.current=e},[t,n]),g=w.useCallback(()=>{s.current&&(s.current.disconnect(),s.current=null,d(!1))},[]),v=w.useRef(m);v.current=m,w.useEffect(()=>(v.current(),()=>{s.current&&(s.current.disconnect(),s.current=null)}),[]);const y=w.useRef([]),b=w.useRef([]),x=w.useCallback(()=>`msg_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,[]),_=w.useCallback(()=>{if(s.current?.connected)for(;y.current.length>0;){const e=y.current.shift();s.current.emit("user_message",e)}},[]);w.useEffect(()=>{u&&_()},[u,_]),w.useEffect(()=>{if(!u)return;const e=setInterval(()=>{const e=Date.now();b.current=b.current.filter(t=>e<t.nextRetryAt||(t.attempts>=t.maxAttempts?(a.current.onEvent?.("message_failed",{id:t.id,payload:t.payload}),Jt("Message failed after max retries:",t.id),!1):!s.current?.connected||(s.current.emit("user_message",t.payload,e=>{e?.success&&a.current.onEvent?.("message_sent",{id:t.id})}),t.attempts++,t.nextRetryAt=e+1e3*Math.pow(2,t.attempts),t.attempts<t.maxAttempts)))},500);return()=>clearInterval(e)},[u]);const S=w.useCallback((e,t="text")=>{const n=x(),r={...p.current,currentUrl:"undefined"!=typeof window?window.location.href:void 0,sentAt:(new Date).toISOString(),deviceId:h.current},i={id:n,content:e.trim(),type:t,metadata:r};return s.current?.connected?(s.current.emit("user_message",i,e=>{!1!==e?.success&&e?a.current.onEvent?.("message_sent",{id:n}):(b.current.push({id:n,payload:i,attempts:0,maxAttempts:3,nextRetryAt:Date.now()+1e3}),a.current.onEvent?.("message_retry_queued",{id:n}))}),n):(y.current.push(i),a.current.onEvent?.("queued_message",{id:n,payload:i}),n)},[x]),M=w.useMemo(()=>bc(e=>{s.current?.emit("typing",e)},250),[]);return{isConnected:u,isConnecting:l,sendMessage:S,sendTyping:M,getSocket:w.useCallback(()=>s.current,[]),requestHistory:w.useCallback(()=>{s.current?.emit("request_history")},[]),reconnect:m,disconnect:g}}function av(e=!1){const t="undefined"!=typeof window?window.location.pathname:"",n=w.useMemo(()=>t,[t]),[r,i]=w.useState({});return w.useEffect(()=>{if(!e)return void i({});const t=setTimeout(()=>{const e=function(){if("undefined"==typeof window)return{};const e={};e.title=document.title,document.querySelectorAll("meta").forEach(t=>{const n=t.getAttribute("name"),r=t.getAttribute("property"),i=t.getAttribute("content");if(i){if(n)switch(n){case"description":e.description=i;break;case"keywords":e.keywords=i.split(",").map(e=>e.trim());break;case"author":e.author=i}if(r){if(r.startsWith("og:")){const t=r.replace("og:","og_");e[t]=i}if(r.startsWith("twitter:")){const t=r.replace("twitter:","twitter_");e[t]=i}}}});try{const t=document.querySelectorAll('script[type="application/ld+json"]');if(t.length>0){const n=[];t.forEach(e=>{try{const t=JSON.parse(e.textContent||"");n.push(t)}catch{}}),n.length>0&&(e.structuredData=n)}}catch{}return e}();i(e)},100);return()=>clearTimeout(t)},[n,e]),e&&Object.keys(r).length>0?r:void 0}class sv{queue=[];endpoint;apiKey;flushInterval=null;isFlushing=!1;isDisabled=!1;MAX_QUEUE_SIZE=100;FLUSH_INTERVAL_MS=3e4;BATCH_SIZE=10;constructor(e,t){this.endpoint=e,this.apiKey=t,this.startAutoFlush()}startAutoFlush(){this.flushInterval=setInterval(()=>{!this.isDisabled&&this.queue.length>0&&this.flush()},this.FLUSH_INTERVAL_MS)}trackOpen(){this.track("chat_opened")}trackClose(){this.track("chat_closed")}trackMessageSent(e){this.track("message_sent",{type:e})}trackMessageReceived(e,t){this.track("message_received",{type:e,latency:t})}trackError(e,t){this.track("error",{error:e,context:t})}trackConnectionStatus(e){this.track("connection_status",{isConnected:e})}trackFeatureUsed(e){this.track("feature_used",{feature:e})}trackTypingStarted(){this.track("typing_started")}trackAttachmentSent(e,t){this.track("attachment_sent",{type:e,size:t})}track(e,t){this.isDisabled||(this.queue.push({event:e,properties:{...t,userAgent:"undefined"!=typeof navigator?navigator.userAgent:void 0,url:"undefined"!=typeof window?window.location.href:void 0},timestamp:Date.now()}),this.queue.length>=this.BATCH_SIZE&&this.flush(),this.queue.length>this.MAX_QUEUE_SIZE&&(this.queue=this.queue.slice(-this.MAX_QUEUE_SIZE),Zt("Analytics queue overflow, dropping old events")))}async flush(){if(this.isDisabled||0===this.queue.length||this.isFlushing)return;this.isFlushing=!0;const e=[...this.queue];this.queue=[];try{const t=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({events:e}),keepalive:!0});t.ok?Kt(`Analytics: Flushed ${e.length} events`):(this.isDisabled=!0,this.queue=[],Kt(`Analytics disabled: endpoint returned ${t.status}`))}catch(t){this.isDisabled=!0,this.queue=[],Kt("Analytics disabled due to network error")}finally{this.isFlushing=!1}}destroy(){this.flushInterval&&clearInterval(this.flushInterval),this.flush()}}let lv=null,cv=null;function uv(e){lv=e}function dv(e){cv=e}const hv=w.createContext(null);const pv=e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)});function fv(e){const{apiKey:t,apiBaseUrl:n,agentId:r,pageContext:i,includeSEOMetadata:o=!1,theme:a,userContext:s,onLogin:l,onNavigate:c,onEvent:u,onStateChange:d,onThemeUpdate:h}=e,[p,f]=w.useState(0),m=w.useRef(0),{t:g}=V(),v=function(e,t,n=!0){const r=w.useRef(null);return w.useEffect(()=>{if(!n||!e||!t)return;const i=`${e}/analytics`;r.current=new sv(i,t);const o=()=>r.current?.flush(),a=()=>{"hidden"===document.visibilityState&&r.current?.flush()};return window.addEventListener("beforeunload",o),window.addEventListener("visibilitychange",a),()=>{window.removeEventListener("beforeunload",o),window.removeEventListener("visibilitychange",a),r.current?.destroy()}},[e,t,n]),{trackOpen:w.useCallback(()=>{r.current?.trackOpen()},[]),trackClose:w.useCallback(()=>{r.current?.trackClose()},[]),trackMessageSent:w.useCallback(e=>{r.current?.trackMessageSent(e)},[]),trackMessageReceived:w.useCallback((e,t)=>{r.current?.trackMessageReceived(e,t)},[]),trackError:w.useCallback((e,t)=>{r.current?.trackError(e,t)},[]),trackConnectionStatus:w.useCallback(e=>{r.current?.trackConnectionStatus(e)},[]),trackFeatureUsed:w.useCallback(e=>{r.current?.trackFeatureUsed(e)},[])}}(n,t,!0),y=function({enabled:e=!0,soundEnabled:t=!0,desktopEnabled:n=!0,botName:r="BotUyo",logoUrl:i,notificationSoundUrl:o}={}){const[a,s]=w.useState("default"),l=w.useRef(null),c=i||en,u=o||tn;w.useEffect(()=>{t&&"undefined"!=typeof window&&(l.current=new Audio(u),l.current.volume=.3)},[t,u]),w.useEffect(()=>{"undefined"!=typeof window&&"Notification"in window&&s(Notification.permission)},[]);const d=w.useCallback(async()=>{if("undefined"==typeof window||!("Notification"in window))return Zt("Notifications API not available"),!1;try{const e=await Notification.requestPermission();return s(e),Qt("Notification permission:",e),"granted"===e}catch(e){return Jt("Error requesting notification permission:",e),!1}},[]),h=w.useCallback(t=>{if(e&&n&&"granted"===a&&("undefined"==typeof document||!document.hasFocus()))try{const e=`Nuevo mensaje de ${r}`;let n="Mensaje recibido";"text"===t.type&&"content"in t?n=t.content?.slice(0,100)||"Mensaje recibido":"image"===t.type?n="📷 Imagen":"audio"===t.type?n="🎵 Audio":"location"===t.type&&(n="📍 Ubicación");const i=new Notification(e,{body:n,icon:c,tag:"chat-message",requireInteraction:!1,silent:!1});i.onclick=()=>{window.focus(),i.close()},setTimeout(()=>i.close(),5e3)}catch(i){Jt("Error showing notification:",i)}},[e,n,a,r,c]),p=w.useCallback(()=>{if(e&&t&&("undefined"==typeof document||!document.hasFocus()))try{l.current?.play().catch(e=>{Kt("Audio playback blocked:",e)})}catch(n){Jt("Error playing sound:",n)}},[e,t]),f=w.useCallback(e=>{h(e),p()},[h,p]);return{permission:a,requestPermission:d,notify:h,playSound:p,notifyWithSound:f}}({enabled:!0,soundEnabled:!0,desktopEnabled:!0,botName:a?.botName||"BotUyo",logoUrl:a?.logoUrl}),b=function(e=10,t=6e4){const n=w.useRef([]);return{isAllowed:w.useCallback(()=>{const r=Date.now();return n.current=n.current.filter(e=>r-e<t),!(n.current.length>=e||(n.current.push(r),0))},[e,t]),getRemainingAttempts:w.useCallback(()=>{const r=Date.now();return n.current=n.current.filter(e=>r-e<t),Math.max(0,e-n.current.length)},[e,t]),getTimeUntilReset:w.useCallback(()=>{if(0===n.current.length)return 0;const e=Date.now(),r=n.current[0],i=t-(e-r);return Math.max(0,i)},[t]),reset:w.useCallback(()=>{n.current=[]},[])}}(10,6e4),{state:x,actions:_}=du(r),S=av(o),M=ov({apiKey:t,apiBaseUrl:n,agentId:r,pageContext:w.useMemo(()=>S?{...i||{},seo:{...S||{}}}:i,[i,S]),userContext:s,onMessage:w.useCallback(e=>{const t=Date.now(),n=m.current>0?t-m.current:void 0;m.current=t,_.addMessage(e),v.trackMessageReceived(e.type,n),x.isOpen||"bot"!==e.sender||(f(e=>e+1),y.notifyWithSound(e))},[_,x.isOpen,v,y]),onConnected:w.useCallback((e,t)=>{_.setConnected(!0),_.setSessionId(e),v.trackConnectionStatus(!0),t&&h&&h(t),t&&u&&u("backend_config",t)},[_,u,h,v]),onDisconnected:w.useCallback(()=>{_.setConnected(!1),v.trackConnectionStatus(!1)},[_,v]),onTyping:w.useCallback(e=>_.setTyping(e),[_]),onError:w.useCallback(e=>{_.setError(e),v.trackError(e)},[_,v]),onLogin:l,onNavigate:c,onEvent:u,onThemeUpdate:h,onHistoryLoaded:w.useCallback(e=>{const t=new Set(x.messages.map(e=>e.id)),n=e.filter(e=>!t.has(e.id));n.length>0&&(0===x.messages.length?_.setMessages(e):n.forEach(e=>_.addMessage(e)))},[x.messages,_])}),E=w.useCallback(()=>{Kt("ChatWidget handleToggle called, current isOpen:",x.isOpen),x.isOpen?(_.closeWindow(),v.trackClose(),d?.(!1),Kt("ChatWidget Closing window")):(_.openWindow(),f(0),v.trackOpen(),d?.(!0),Kt("ChatWidget Opening window"))},[x.isOpen,_,d,v]),T=w.useCallback(e=>{if(!b.isAllowed()){const e=b.getTimeUntilReset(),t=Math.ceil(e/1e3);return void _.setError(g("rate_limit_exceeded")+` Espera ${t}s.`)}const t={id:`temp-${Date.now()}-${Math.random()}`,type:"text",sender:"user",timestamp:new Date,content:e};_.addMessage(t),v.trackMessageSent("text"),M.sendMessage(e,"text")},[_,M,b,v,g]),A=w.useCallback(async(e,t)=>{let n;n="audio"===t?{id:`temp-${Date.now()}-${Math.random()}`,type:"audio",sender:"user",timestamp:new Date,content:URL.createObjectURL(e)}:"image"===t?{id:`temp-${Date.now()}-${Math.random()}`,type:"image",sender:"user",timestamp:new Date,imageUrl:URL.createObjectURL(e)}:{id:`temp-${Date.now()}-${Math.random()}`,type:"text",sender:"user",timestamp:new Date,content:`📎 ${e.name}`},_.addMessage(n);const r=await pv(e);M.sendMessage(r,t)},[_,M]),C=w.useCallback(e=>{const t={id:`temp-${Date.now()}-${Math.random()}`,type:"location",sender:"user",timestamp:new Date,latitude:e.latitude,longitude:e.longitude,name:"Mi ubicación"};_.addMessage(t),M.sendMessage(JSON.stringify(e),"location")},[_,M]);w.useEffect(()=>{const e=()=>{x.isOpen||_.openWindow()},t=()=>{x.isOpen&&_.closeWindow()},n=()=>{x.isOpen?_.closeWindow():_.openWindow()},r=e=>{e.detail?.message&&T(e.detail.message)};return window.addEventListener("botuyo-chat:open",e),window.addEventListener("botuyo-chat:close",t),window.addEventListener("botuyo-chat:toggle",n),window.addEventListener("botuyo-chat:send-message",r),()=>{window.removeEventListener("botuyo-chat:open",e),window.removeEventListener("botuyo-chat:close",t),window.removeEventListener("botuyo-chat:toggle",n),window.removeEventListener("botuyo-chat:send-message",r)}},[x.isOpen,_,T]),w.useEffect(()=>(uv(T),()=>uv(null)),[T]);const k=w.useCallback(()=>{_.clearMessages(),Qt("Chat history cleared")},[_]);w.useEffect(()=>(dv(k),()=>dv(null)),[k]);const R=w.useMemo(()=>{if(x.isTyping)return"thinking";const e=[...x.messages].reverse().find(e=>"bot"===e.sender&&"text"===e.type);return"text"===e?.type&&e.emotion?e.emotion:"default"},[x.isTyping,x.messages]);return{state:x,actions:_,unreadCount:p,currentBotEmotion:R,isConnected:M.isConnected,getSocket:M.getSocket,handleToggle:E,handleSendText:T,handleSendAttachment:A,handleSendLocation:C}}function mv(e){const{apiKey:t,apiBaseUrl:n="https://api.botuyo.com",agentId:r,pageContext:i,includeSEOMetadata:o=!1,theme:a,mediaConfig:s,userContext:l,onLogin:c,onNavigate:u,onEvent:d,onStateChange:h}=e,p=w.useRef(null),f=xc();!function(e){const[t,n]=w.useState(!1);w.useEffect(()=>{let t=null;const r=()=>{if(!e.current)return;const t=!!e.current.parentElement?.closest(".dark"),r=!!document.getElementById("botuyo-chat-widget-root")?.classList.contains("dark"),i=document.getElementById("botuyo-chat-widget-root"),o=!!i?.parentElement?.closest(".dark"),a=document.documentElement.classList.contains("dark"),s=document.body.classList.contains("dark"),l="dark"===document.documentElement.getAttribute("data-theme"),c="dark"===document.body.getAttribute("data-theme"),u=!!e.current.parentElement?.closest('[data-theme="dark"]'),d=window.matchMedia("(prefers-color-scheme: dark)").matches,h=t||r||o||a||s||l||c||u||d;e.current&&(h?e.current.classList.add("dark"):e.current.classList.remove("dark")),n(h)};r();const i=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>r();i.addEventListener("change",o);const a=new MutationObserver(()=>{r()}),s=document.getElementById("botuyo-chat-widget-root");s&&(a.observe(s,{attributes:!0,attributeFilter:["class"]}),s.parentElement&&(a.observe(s.parentElement,{attributes:!0,attributeFilter:["class"],childList:!0}),t=s.parentElement)),a.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme"]}),a.observe(document.body,{attributes:!0,attributeFilter:["class","data-theme"]});let l=e.current?.parentElement;for(;l;)a.observe(l,{attributes:!0,attributeFilter:["class","data-theme"]}),l=l.parentElement;const c=setInterval(()=>{const e=document.getElementById("botuyo-chat-widget-root");e&&e.parentElement!==t&&(t&&e.parentElement&&(a.observe(e.parentElement,{attributes:!0,attributeFilter:["class"],childList:!0}),t=e.parentElement),r())},100);return()=>{a.disconnect(),i.removeEventListener("change",o),clearInterval(c)}},[e])}(p);const[m,g]=w.useState(),{mergedTheme:v,mergedStyles:y,getContainerStyle:b}=Uc(a,m);w.useEffect(()=>{v.isHidden&&console.warn('[BotUyo] ⚠️ El agente (o Flow) de IA asociado a esta API Key se encuentra pausado o en estado "boceto" (draft). El widget no se mostrará hasta que lo publiques dentro de la plataforma BotUyo.')},[v.isHidden]);const{state:x,actions:_,unreadCount:S,currentBotEmotion:M,isConnected:E,handleToggle:T,handleSendText:A,handleSendAttachment:k,handleSendLocation:R,getSocket:P}=fv({apiKey:t,apiBaseUrl:n,agentId:r,pageContext:i,includeSEOMetadata:o,theme:a,userContext:l,onLogin:c,onNavigate:u,onEvent:d,onStateChange:h,onThemeUpdate:g}),I=w.useCallback(e=>{_.addMessage({id:`voice-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,type:"text",sender:e.sender,timestamp:new Date,content:e.content})},[_]),L=w.useMemo(()=>{const e={...s||{}},t=m;return null!=t?.voiceEnabled&&(e.enableVoice=t.voiceEnabled),e},[s,m]),N=w.useCallback(e=>{e.stopPropagation()},[]),O=b(x.isOpen,f,a?.position),D=w.useMemo(()=>{if(!v.cssVariables)return{};const e={},t=v.cssVariables;return t.background&&(e["--background"]=t.background),t.foreground&&(e["--foreground"]=t.foreground),t.card&&(e["--card"]=t.card),t.cardForeground&&(e["--card-foreground"]=t.cardForeground),t.primary&&(e["--primary"]=t.primary),t.primaryForeground&&(e["--primary-foreground"]=t.primaryForeground),t.muted&&(e["--muted"]=t.muted),t.mutedForeground&&(e["--muted-foreground"]=t.mutedForeground),t.border&&(e["--border"]=t.border),t.destructive&&(e["--destructive"]=t.destructive),t.radius&&(e["--radius"]=t.radius),t.spacing1&&(e["--spacing-1"]=t.spacing1),t.spacing2&&(e["--spacing-2"]=t.spacing2),t.spacing3&&(e["--spacing-3"]=t.spacing3),t.spacing4&&(e["--spacing-4"]=t.spacing4),t.spacing5&&(e["--spacing-5"]=t.spacing5),t.spacing6&&(e["--spacing-6"]=t.spacing6),t.spacing8&&(e["--spacing-8"]=t.spacing8),e},[v.cssVariables]);return v.isHidden?null:C.jsxs("div",{ref:p,id:"botuyo-chat-widget",className:Ot("botuyo-chat-widget flex flex-col",!f&&("bottom-left"===a?.position?"items-start":"items-end")),style:{...O,...D,pointerEvents:"auto",backgroundColor:"transparent"},"data-animations-disabled":!1===a?.animations?.enabled?"true":void 0,"data-effects-glassmorphism":!1===a?.effects?.glassmorphism?"false":void 0,"data-effects-shadows":!1===a?.effects?.softShadows?"false":void 0,children:[C.jsx("div",{className:Ot("transition-all duration-400 ease-[cubic-bezier(0.34,1.56,0.64,1)]",f?"bottom-left"===a?.position?"origin-bottom-left":"origin-bottom-right":"origin-bottom",x.isOpen?"opacity-100 scale-100 h-full w-full translate-y-0 pointer-events-auto":"opacity-0 scale-[0.85] pointer-events-none translate-y-8 h-0 w-0"),style:{pointerEvents:x.isOpen?"auto":"none"},onMouseDown:N,onTouchStart:N,children:C.jsx(Lc,{children:C.jsx(Ic,{isOpen:x.isOpen,isConnected:E,isTyping:x.isTyping,messages:x.messages,onClose:()=>_.closeWindow(),onSendMessage:A,onSendAttachment:k,onSendLocation:R,botName:v.botName,logoUrl:v.logoUrl,welcomeMessage:v.welcomeMessage,inputPlaceholder:a?.inputPlaceholder||m?.inputPlaceholder,primaryColor:v.primaryColor,position:a?.position,bubbleStyles:y,avatars:a?.avatars||m?.avatars||m?.avatarAnimations||{},mediaConfig:L,theme:v,avatar3dUrl:a?.avatar3dUrl,getSocket:P,onAddVoiceMessage:I})})}),C.jsx("div",{className:Ot(x.isOpen?"hidden":"block",!f&&"mt-4"),style:{pointerEvents:"auto"},onMouseDown:N,onTouchStart:N,children:C.jsx(rn,{isOpen:x.isOpen,onClick:T,unreadCount:S,position:a?.position||"bottom-right",primaryColor:v.primaryColor,logoUrl:v.logoUrl,starterPrompt:a?.starterPrompt||m?.starterPrompt,avatars:a?.avatars||m?.avatars||m?.avatarAnimations||{},emotion:M,styles:y,promptPersistence:a?.promptPersistence,avatarScale:a?.avatarScale??m?.avatarScale,showPromptAvatar:a?.showPromptAvatar??m?.showPromptAvatar})})]})}function gv(e){return C.jsx(N,{defaultLocale:e.theme?.defaultLocale,children:C.jsx($t,{animations:e.theme?.animations,effects:e.theme?.effects,children:C.jsx(mv,{...e})})})}const vv=Object.freeze(Object.defineProperty({__proto__:null,ChatWidget:gv,ChatWidgetInner:mv},Symbol.toStringTag,{value:"Module"})),yv="https://api.botuyo.com";class bv extends w.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){console.error("[BotUyoChat] Widget error:",e,t)}render(){return this.state.hasError?null:this.props.children}}const xv={"--background":"240 10% 3.9%","--foreground":"0 0% 98%","--card":"240 10% 3.9%","--cardForeground":"0 0% 98%","--primary":"160 84% 39%","--primaryForeground":"0 0% 100%","--muted":"240 3.7% 15.9%","--mutedForeground":"240 5% 64.9%","--border":"240 3.7% 15.9%"};const _v=w.lazy(()=>Promise.resolve().then(()=>vv).then(e=>({default:e.ChatWidget})));class wv{root=null;container=null;shadowRoot=null;mountPoint=null;darkModeObserver=null;darkModeMediaQuery=null;config=null;init(e){return this.config={...e,apiBaseUrl:e.apiBaseUrl||yv},this.render(),this.setupDarkModeDetection(),this}render(){if(!this.config)return void console.error("[BotUyoChat] No configuration provided");if(!this.container){this.container=document.createElement("div"),this.container.id="botuyo-chat-widget-root",document.body.appendChild(this.container),this.shadowRoot=this.container.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=D.replace(/:root/g,":host"),this.shadowRoot.appendChild(e),this.mountPoint=document.createElement("div"),this.mountPoint.id="botuyo-chat-widget-root",this.shadowRoot.appendChild(this.mountPoint)}if(this.config.theme?.cssVariables&&this.mountPoint){const e=this.config.theme.cssVariables,t={background:e.background,foreground:e.foreground,card:e.card,cardForeground:e.cardForeground,primary:e.primary,primaryForeground:e.primaryForeground,muted:e.muted,mutedForeground:e.mutedForeground,border:e.border,destructive:e.destructive,radius:e.radius,spacing1:e.spacing1,spacing2:e.spacing2,spacing3:e.spacing3,spacing4:e.spacing4,spacing5:e.spacing5,spacing6:e.spacing6,spacing8:e.spacing8};Object.entries(t).forEach(([e,t])=>{void 0!==t&&this.mountPoint.style.setProperty(`--${e}`,t)})}if(this.mountPoint&&!this.config.theme?.cssVariables){(function(){const e=document.documentElement.getAttribute("data-theme");return"dark"===e||"light"!==e&&window.matchMedia("(prefers-color-scheme: dark)").matches})()?Object.entries(xv).forEach(([e,t])=>{this.mountPoint.style.setProperty(e,t)}):Object.keys(xv).forEach(e=>{this.mountPoint.style.removeProperty(e)})}!this.root&&this.mountPoint&&(this.root=_.createRoot(this.mountPoint));const e={apiKey:this.config.apiKey,apiBaseUrl:this.config.apiBaseUrl||yv,agentId:this.config.agentId,theme:{primaryColor:"#10b981",botName:"Asistente Virtual",position:"bottom-right",welcomeMessage:"¡Hola! 👋 ¿En qué puedo ayudarte?",inputPlaceholder:"Escribe tu mensaje...",borderRadius:"0.75rem",launcherBorderRadius:"50%",...this.config.theme},userContext:this.config.userContext,pageContext:this.config.pageContext,includeSEOMetadata:this.config.includeSEOMetadata??!1,mediaConfig:this.config.mediaConfig,onNavigate:this.config.onNavigate,onLogin:this.config.onLogin,onEvent:this.config.onEvent,onStateChange:this.config.onStateChange},t=S.createElement(w.Suspense,{fallback:S.createElement("div",{style:{position:"fixed",bottom:"24px",right:"24px",width:"60px",height:"60px",borderRadius:"50%",backgroundColor:e.theme?.primaryColor||"#10b981",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",cursor:"wait"}},S.createElement("div",{style:{width:"24px",height:"24px",border:"3px solid rgba(255, 255, 255, 0.3)",borderTopColor:"#fff",borderRadius:"50%",animation:"spin 1s linear infinite"}}))},S.createElement(_v,e));this.root.render(S.createElement(bv,null,S.createElement(N,{defaultLocale:this.config.theme?.defaultLocale,children:t}))),console.log("[BotUyoChat] Widget initialized",e)}update(e){this.config?(this.config={...this.config,...e,theme:{...this.config.theme,...e.theme}},this.render()):console.error("[BotUyoChat] Widget not initialized")}destroy(){this.darkModeObserver&&(this.darkModeObserver.disconnect(),this.darkModeObserver=null),this.darkModeMediaQuery&&(this.darkModeMediaQuery.removeEventListener("change",this.handleDarkModeChange),this.darkModeMediaQuery=null),this.root&&(this.root.unmount(),this.root=null),this.container&&this.container.parentNode&&(this.container.parentNode.removeChild(this.container),this.container=null,this.shadowRoot=null,this.mountPoint=null),this.config=null,console.log("[BotUyoChat] Widget destroyed")}setupDarkModeDetection(){this.config?.theme?.cssVariables||(this.handleDarkModeChange=()=>this.render(),this.darkModeObserver=new MutationObserver(this.handleDarkModeChange),this.darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),this.darkModeMediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.darkModeMediaQuery.addEventListener("change",this.handleDarkModeChange))}handleDarkModeChange=()=>{};open(){window.dispatchEvent(new CustomEvent("botuyo-chat:open"))}close(){window.dispatchEvent(new CustomEvent("botuyo-chat:close"))}sendMessage(e){window.dispatchEvent(new CustomEvent("botuyo-chat:send-message",{detail:{message:e}}))}getState(){return null}}const Sv=new wv;window.BotUyoChat=Sv;const Mv=w.memo(function({url:e,isBot:t,primaryColor:n}){const[r,i]=w.useState(!1),[o,a]=w.useState(0),[s,l]=w.useState(0),[c,u]=w.useState(!0),[d,h]=w.useState(null),p=w.useRef(null),f=w.useMemo(()=>Ht({primaryColor:n}),[n]),m=w.useCallback(()=>{d||(r?p.current?.pause():p.current?.play().catch(e=>{console.error("[AudioPlayer] Play error:",e),h("Error al reproducir")}),i(!r))},[r,d]),g=w.useCallback(()=>{a(p.current?.duration||0)},[]),v=w.useCallback(()=>{u(!1),h(null)},[]),y=w.useCallback(()=>{console.error("[AudioPlayer] Failed to load audio:",e),u(!1),h("No se pudo cargar")},[e]),b=w.useCallback(()=>{u(!0),h(null),p.current&&p.current.load()},[]);return C.jsxs("div",{className:Ot("flex items-center gap-3 py-1 min-w-[200px]",t?"text-foreground":"text-primary-foreground"),children:[C.jsx("audio",{ref:p,src:e,preload:"metadata",onLoadedMetadata:g,onCanPlayThrough:v,onTimeUpdate:()=>l(p.current?.currentTime||0),onEnded:()=>i(!1),onError:y}),d?C.jsx("button",{onClick:b,className:"w-8 h-8 rounded-full flex items-center justify-center shrink-0 bg-red-500/20 text-red-500 hover:bg-red-500/30 transition-colors",title:"Reintentar",children:C.jsx(pe,{className:"w-4 h-4"})}):C.jsx("button",{onClick:m,disabled:c,className:"w-8 h-8 rounded-full flex items-center justify-center shrink-0 transition-opacity",style:{backgroundColor:t?f:"hsl(var(--card))",color:t?"white":f,opacity:c?.6:1},children:c?C.jsx(re,{className:"w-4 h-4 animate-spin"}):r?C.jsx(le,{className:"w-4 h-4 fill-current"}):C.jsx(de,{className:"w-4 h-4 fill-current ml-0.5"})}),C.jsx("div",{className:"flex-1 space-y-1",children:d?C.jsxs("div",{className:"flex items-center gap-1.5 text-red-500",children:[C.jsx(Z,{className:"w-3 h-3"}),C.jsx("span",{className:"text-[9px] font-bold",children:d})]}):C.jsxs(C.Fragment,{children:[C.jsx("div",{className:"relative h-1 w-full bg-current/20 rounded-full overflow-hidden",children:C.jsx("div",{className:"absolute h-full bg-current rounded-full transition-all",style:{width:`${s/o*100||0}%`}})}),C.jsxs("div",{className:"flex justify-between text-[9px] font-bold opacity-60",children:[C.jsxs("span",{children:[Math.floor(s/60),":",Math.floor(s%60).toString().padStart(2,"0")]}),C.jsx("span",{children:c?"--:--":`${Math.floor(o/60)}:${Math.floor(o%60).toString().padStart(2,"0")}`})]})]})})]})}),Ev=Object.freeze(Object.defineProperty({__proto__:null,AudioPlayer:Mv},Symbol.toStringTag,{value:"Module"})),Tv=w.memo(function({images:e,radius:t="rounded-lg"}){const{t:n}=V("extracted"),[r,i]=w.useState(0),[o,a]=w.useState(!1),s=()=>{i(t=>(t+1)%e.length)},l=()=>{i(t=>(t-1+e.length)%e.length)},c=e=>{i(e),a(!0)},[u,d]=w.useState(new Set),h=e=>{d(t=>new Set(t).add(e))};return 1===e.length?C.jsx("div",{className:"my-3 relative group",children:u.has(0)?C.jsxs("div",{className:Ot("w-full h-48 flex flex-col items-center justify-center","border bg-muted text-muted-foreground",t),style:{borderColor:"hsl(var(--border))"},children:[C.jsx("svg",{className:"w-12 h-12 mb-2 opacity-50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:C.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),C.jsx("span",{className:"text-sm",children:"Imagen no disponible"})]}):C.jsxs(C.Fragment,{children:[C.jsx("img",{src:e[0].src,alt:e[0].alt||"Imagen",className:Ot("w-full h-auto object-cover cursor-pointer transition-all duration-300","border shadow-soft-md hover:shadow-soft-lg hover:scale-[1.02]",t),style:{borderColor:"hsl(var(--border))"},loading:"lazy",onClick:()=>c(0),onError:()=>h(0)}),C.jsx("div",{className:"absolute top-2 right-2 bg-black/50 backdrop-blur-sm p-1.5 rounded-full opacity-0 group-hover:opacity-100 transition-opacity",children:C.jsx(be,{size:16,className:"text-white"})})]})}):e.length<=3?C.jsxs("div",{className:Ot("my-3 grid gap-2",2===e.length?"grid-cols-2":"grid-cols-3"),children:[e.map((n,r)=>C.jsx("div",{className:"relative group overflow-hidden",children:u.has(r)?C.jsx("div",{className:Ot("w-full h-32 flex flex-col items-center justify-center","border bg-muted text-muted-foreground",t),children:C.jsx("svg",{className:"w-8 h-8 opacity-50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:C.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}):C.jsxs(C.Fragment,{children:[C.jsx("img",{src:n.src,alt:n.alt||`Imagen ${r+1}`,className:Ot("w-full h-32 object-cover cursor-pointer transition-all duration-300","border border-border shadow-soft-md hover:shadow-soft-lg hover:scale-110",t),loading:"lazy",onClick:()=>c(r),onError:()=>h(r)}),C.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/40 to-transparent opacity-0 group-hover:opacity-100 transition-opacity flex items-end justify-end p-2",children:C.jsxs("span",{className:"text-white text-xs font-bold bg-black/50 backdrop-blur-sm px-2 py-1 rounded-full",children:[r+1,"/",e.length]})})]})},r)),o&&C.jsx(Av,{images:e,currentIndex:r,onClose:()=>a(!1),onNext:s,onPrev:l})]}):C.jsxs("div",{className:"my-3 space-y-2",children:[C.jsx("div",{className:"relative group",children:u.has(r)?C.jsxs("div",{className:Ot("w-full h-56 flex flex-col items-center justify-center","border bg-muted text-muted-foreground",t),style:{borderColor:"hsl(var(--border))"},children:[C.jsx("svg",{className:"w-12 h-12 mb-2 opacity-50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:C.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),C.jsx("span",{className:"text-sm",children:"Imagen no disponible"})]}):C.jsxs(C.Fragment,{children:[C.jsx("img",{src:e[r].src,alt:e[r].alt||`Imagen ${r+1}`,className:Ot("w-full h-56 object-cover cursor-pointer transition-all duration-300","border shadow-soft-md",t),style:{borderColor:"hsl(var(--border))"},loading:"lazy",onClick:()=>c(r),onError:()=>h(r)}),C.jsxs("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-black/20 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-between px-3",children:[C.jsx("button",{onClick:l,className:"p-2 rounded-full shadow-soft-lg transition-all hover:scale-110 active:scale-95",style:{backgroundColor:"hsl(var(--card) / 0.9)",color:"hsl(var(--foreground))"},"aria-label":n("anterior"),children:C.jsx($,{size:20})}),C.jsx("button",{onClick:s,className:"p-2 rounded-full shadow-soft-lg transition-all hover:scale-110 active:scale-95",style:{backgroundColor:"hsl(var(--card) / 0.9)",color:"hsl(var(--foreground))"},"aria-label":n("siguiente"),children:C.jsx(Y,{size:20})})]}),C.jsx("div",{className:"absolute top-3 right-3 bg-black/70 backdrop-blur-sm px-3 py-1 rounded-full",children:C.jsxs("span",{className:"text-white text-xs font-bold",children:[r+1," / ",e.length]})}),C.jsx("div",{className:"absolute bottom-3 right-3 bg-black/70 backdrop-blur-sm p-2 rounded-full opacity-0 group-hover:opacity-100 transition-opacity",children:C.jsx(be,{size:16,className:"text-white"})})]})}),C.jsx("div",{className:"flex gap-2 overflow-x-auto pb-2 scrollbar-thin scrollbar-thumb-border scrollbar-track-transparent",children:e.map((e,n)=>C.jsx("button",{onClick:()=>i(n),className:Ot("flex-shrink-0 w-16 h-16 overflow-hidden transition-all duration-300 relative","border-2 hover:scale-110",t,r===n?"border-[hsl(210,90%,50%)] ring-2 ring-[hsl(210,90%,50%)]/30 scale-105":"border-border hover:border-[hsl(210,90%,70%)] opacity-70 hover:opacity-100"),children:u.has(n)?C.jsx("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:C.jsx("svg",{className:"w-6 h-6 opacity-50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:C.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}):C.jsx("img",{src:e.src,alt:e.alt||`Thumbnail ${n+1}`,className:"w-full h-full object-cover",loading:"lazy",onError:()=>h(n)})},n))}),o&&C.jsx(Av,{images:e,currentIndex:r,onClose:()=>a(!1),onNext:s,onPrev:l})]})});function Av({images:e,currentIndex:t,onClose:n,onNext:r,onPrev:i}){const{t:o}=V("extracted");return C.jsxs("div",{className:"fixed inset-0 z-[100000] bg-black/95 backdrop-blur-sm flex items-center justify-center animate-in fade-in duration-200",onClick:n,children:[C.jsx("button",{onClick:n,className:"absolute top-4 right-4 bg-white/10 hover:bg-white/20 p-2 rounded-full transition-all hover:scale-110 active:scale-95 z-10","aria-label":o("cerrar"),children:C.jsx(ye,{size:24,className:"text-white"})}),C.jsx("div",{className:"absolute top-4 left-4 bg-white/10 backdrop-blur-sm px-4 py-2 rounded-full z-10",children:C.jsxs("span",{className:"text-white text-sm font-bold",children:[t+1," / ",e.length]})}),e.length>1&&C.jsxs(C.Fragment,{children:[C.jsx("button",{onClick:e=>{e.stopPropagation(),i()},className:"absolute left-4 bg-white/10 hover:bg-white/20 p-3 rounded-full transition-all hover:scale-110 active:scale-95 z-10","aria-label":"Anterior",children:C.jsx($,{size:32,className:"text-white"})}),C.jsx("button",{onClick:e=>{e.stopPropagation(),r()},className:"absolute right-4 bg-white/10 hover:bg-white/20 p-3 rounded-full transition-all hover:scale-110 active:scale-95 z-10","aria-label":"Siguiente",children:C.jsx(Y,{size:32,className:"text-white"})})]}),C.jsx("img",{src:e[t].src,alt:e[t].alt||`Imagen ${t+1}`,className:"max-w-[90%] max-h-[90vh] object-contain",onClick:e=>e.stopPropagation()})]})}const Cv=Object.freeze(Object.defineProperty({__proto__:null,Gallery:Tv},Symbol.toStringTag,{value:"Module"}));function kv(e,t){return new Promise(function(n,r){let i;return Rv(e).then(function(e){try{return i=e,n(new Blob([t.slice(0,2),i,t.slice(2)],{type:"image/jpeg"}))}catch(o){return r(o)}},r)})}const Rv=e=>new Promise((t,n)=>{const r=new FileReader;r.addEventListener("load",({target:{result:e}})=>{const r=new DataView(e);let i=0;if(65496!==r.getUint16(i))return n("not a valid JPEG");for(i+=2;;){const o=r.getUint16(i);if(65498===o)break;const a=r.getUint16(i+2);if(65505===o&&1165519206===r.getUint32(i+4)){const o=i+10;let s;switch(r.getUint16(o)){case 18761:s=!0;break;case 19789:s=!1;break;default:return n("TIFF header contains invalid endian")}if(42!==r.getUint16(o+2,s))return n("TIFF header contains invalid version");const l=r.getUint32(o+4,s),c=o+l+2+12*r.getUint16(o+l,s);for(let e=o+l+2;e<c;e+=12)if(274==r.getUint16(e,s)){if(3!==r.getUint16(e+2,s))return n("Orientation data type is invalid");if(1!==r.getUint32(e+4,s))return n("Orientation data count is invalid");r.setUint16(e+8,1,s);break}return t(e.slice(i,i+2+a))}i+=2+a}return t(new Blob)}),r.readAsArrayBuffer(e)});var Pv,Iv,Lv,Nv={},Ov={get exports(){return Nv},set exports(e){Nv=e}};Lv={},Ov.exports=Lv,Lv.parse=function(e,t){for(var n=Lv.bin.readUshort,r=Lv.bin.readUint,i=0,o={},a=new Uint8Array(e),s=a.length-4;101010256!=r(a,s);)s--;i=s,i+=4;var l=n(a,i+=4);n(a,i+=2);var c=r(a,i+=2),u=r(a,i+=4);i+=4,i=u;for(var d=0;d<l;d++){r(a,i),i+=4,i+=4,i+=4,r(a,i+=4),c=r(a,i+=4);var h=r(a,i+=4),p=n(a,i+=4),f=n(a,i+2),m=n(a,i+4);i+=6;var g=r(a,i+=8);i+=4,i+=p+f+m,Lv._readLocal(a,g,o,c,h,t)}return o},Lv._readLocal=function(e,t,n,r,i,o){var a=Lv.bin.readUshort,s=Lv.bin.readUint;s(e,t),a(e,t+=4),a(e,t+=2);var l=a(e,t+=2);s(e,t+=2),s(e,t+=4),t+=4;var c=a(e,t+=8),u=a(e,t+=2);t+=2;var d=Lv.bin.readUTF8(e,t,c);if(t+=c,t+=u,o)n[d]={size:i,csize:r};else{var h=new Uint8Array(e.buffer,t);if(0==l)n[d]=new Uint8Array(h.buffer.slice(t,t+r));else{if(8!=l)throw"unknown compression method: "+l;var p=new Uint8Array(i);Lv.inflateRaw(h,p),n[d]=p}}},Lv.inflateRaw=function(e,t){return Lv.F.inflate(e,t)},Lv.inflate=function(e,t){return e[0],e[1],Lv.inflateRaw(new Uint8Array(e.buffer,e.byteOffset+2,e.length-6),t)},Lv.deflate=function(e,t){null==t&&(t={level:6});var n=0,r=new Uint8Array(50+Math.floor(1.1*e.length));r[n]=120,r[n+1]=156,n+=2,n=Lv.F.deflateRaw(e,r,n,t.level);var i=Lv.adler(e,0,e.length);return r[n+0]=i>>>24&255,r[n+1]=i>>>16&255,r[n+2]=i>>>8&255,r[n+3]=i>>>0&255,new Uint8Array(r.buffer,0,n+4)},Lv.deflateRaw=function(e,t){null==t&&(t={level:6});var n=new Uint8Array(50+Math.floor(1.1*e.length)),r=Lv.F.deflateRaw(e,n,r,t.level);return new Uint8Array(n.buffer,0,r)},Lv.encode=function(e,t){null==t&&(t=!1);var n=0,r=Lv.bin.writeUint,i=Lv.bin.writeUshort,o={};for(var a in e){var s=!Lv._noNeed(a)&&!t,l=e[a],c=Lv.crc.crc(l,0,l.length);o[a]={cpr:s,usize:l.length,crc:c,file:s?Lv.deflateRaw(l):l}}for(var a in o)n+=o[a].file.length+30+46+2*Lv.bin.sizeUTF8(a);n+=22;var u=new Uint8Array(n),d=0,h=[];for(var a in o){var p=o[a];h.push(d),d=Lv._writeHeader(u,d,a,p,0)}var f=0,m=d;for(var a in o)p=o[a],h.push(d),d=Lv._writeHeader(u,d,a,p,1,h[f++]);var g=d-m;return r(u,d,101010256),d+=4,i(u,d+=4,f),i(u,d+=2,f),r(u,d+=2,g),r(u,d+=4,m),d+=4,d+=2,u.buffer},Lv._noNeed=function(e){var t=e.split(".").pop().toLowerCase();return-1!="png,jpg,jpeg,zip".indexOf(t)},Lv._writeHeader=function(e,t,n,r,i,o){var a=Lv.bin.writeUint,s=Lv.bin.writeUshort,l=r.file;return a(e,t,0==i?67324752:33639248),t+=4,1==i&&(t+=2),s(e,t,20),s(e,t+=2,0),s(e,t+=2,r.cpr?8:0),a(e,t+=2,0),a(e,t+=4,r.crc),a(e,t+=4,l.length),a(e,t+=4,r.usize),s(e,t+=4,Lv.bin.sizeUTF8(n)),s(e,t+=2,0),t+=2,1==i&&(t+=2,t+=2,a(e,t+=6,o),t+=4),t+=Lv.bin.writeUTF8(e,t,n),0==i&&(e.set(l,t),t+=l.length),t},Lv.crc={table:function(){for(var e=new Uint32Array(256),t=0;t<256;t++){for(var n=t,r=0;r<8;r++)1&n?n=3988292384^n>>>1:n>>>=1;e[t]=n}return e}(),update:function(e,t,n,r){for(var i=0;i<r;i++)e=Lv.crc.table[255&(e^t[n+i])]^e>>>8;return e},crc:function(e,t,n){return 4294967295^Lv.crc.update(4294967295,e,t,n)}},Lv.adler=function(e,t,n){for(var r=1,i=0,o=t,a=t+n;o<a;){for(var s=Math.min(o+5552,a);o<s;)i+=r+=e[o++];r%=65521,i%=65521}return i<<16|r},Lv.bin={readUshort:function(e,t){return e[t]|e[t+1]<<8},writeUshort:function(e,t,n){e[t]=255&n,e[t+1]=n>>8&255},readUint:function(e,t){return 16777216*e[t+3]+(e[t+2]<<16|e[t+1]<<8|e[t])},writeUint:function(e,t,n){e[t]=255&n,e[t+1]=n>>8&255,e[t+2]=n>>16&255,e[t+3]=n>>24&255},readASCII:function(e,t,n){for(var r="",i=0;i<n;i++)r+=String.fromCharCode(e[t+i]);return r},writeASCII:function(e,t,n){for(var r=0;r<n.length;r++)e[t+r]=n.charCodeAt(r)},pad:function(e){return e.length<2?"0"+e:e},readUTF8:function(e,t,n){for(var r,i="",o=0;o<n;o++)i+="%"+Lv.bin.pad(e[t+o].toString(16));try{r=decodeURIComponent(i)}catch(a){return Lv.bin.readASCII(e,t,n)}return r},writeUTF8:function(e,t,n){for(var r=n.length,i=0,o=0;o<r;o++){var a=n.charCodeAt(o);if(4294967168&a)if(4294965248&a)if(4294901760&a){if(4292870144&a)throw"e";e[t+i]=240|a>>18,e[t+i+1]=128|a>>12&63,e[t+i+2]=128|a>>6&63,e[t+i+3]=128|63&a,i+=4}else e[t+i]=224|a>>12,e[t+i+1]=128|a>>6&63,e[t+i+2]=128|63&a,i+=3;else e[t+i]=192|a>>6,e[t+i+1]=128|63&a,i+=2;else e[t+i]=a,i++}return i},sizeUTF8:function(e){for(var t=e.length,n=0,r=0;r<t;r++){var i=e.charCodeAt(r);if(4294967168&i)if(4294965248&i)if(4294901760&i){if(4292870144&i)throw"e";n+=4}else n+=3;else n+=2;else n++}return n}},Lv.F={},Lv.F.deflateRaw=function(e,t,n,r){var i=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][r],o=Lv.F.U,a=Lv.F._goodIndex;Lv.F._hash;var s=Lv.F._putsE,l=0,c=n<<3,u=0,d=e.length;if(0==r){for(;l<d;)s(t,c,l+(S=Math.min(65535,d-l))==d?1:0),c=Lv.F._copyExact(e,l,S,t,c+8),l+=S;return c>>>3}var h=o.lits,p=o.strt,f=o.prev,m=0,g=0,v=0,y=0,b=0,x=0;for(d>2&&(p[x=Lv.F._hash(e,0)]=0),l=0;l<d;l++){if(b=x,l+1<d-2){x=Lv.F._hash(e,l+1);var _=l+1&32767;f[_]=p[x],p[x]=_}if(u<=l){(m>14e3||g>26697)&&d-l>100&&(u<l&&(h[m]=l-u,m+=2,u=l),c=Lv.F._writeBlock(l==d-1||u==d?1:0,h,m,y,e,v,l-v,t,c),m=g=y=0,v=l);var w=0;l<d-2&&(w=Lv.F._bestMatch(e,l,f,b,Math.min(i[2],d-l),i[3]));var S=w>>>16,M=65535&w;if(0!=w){M=65535&w;var E=a(S=w>>>16,o.of0);o.lhst[257+E]++;var T=a(M,o.df0);o.dhst[T]++,y+=o.exb[E]+o.dxb[T],h[m]=S<<23|l-u,h[m+1]=M<<16|E<<8|T,m+=2,u=l+S}else o.lhst[e[l]]++;g++}}for(v==l&&0!=e.length||(u<l&&(h[m]=l-u,m+=2,u=l),c=Lv.F._writeBlock(1,h,m,y,e,v,l-v,t,c),m=0,g=0,m=g=y=0,v=l);7&c;)c++;return c>>>3},Lv.F._bestMatch=function(e,t,n,r,i,o){var a=32767&t,s=n[a],l=a-s+32768&32767;if(s==a||r!=Lv.F._hash(e,t-l))return 0;for(var c=0,u=0,d=Math.min(32767,t);l<=d&&0!=--o&&s!=a;){if(0==c||e[t+c]==e[t+c-l]){var h=Lv.F._howLong(e,t,l);if(h>c){if(u=l,(c=h)>=i)break;l+2<h&&(h=l+2);for(var p=0,f=0;f<h-2;f++){var m=t-l+f+32768&32767,g=m-n[m]+32768&32767;g>p&&(p=g,s=m)}}}l+=(a=s)-(s=n[a])+32768&32767}return c<<16|u},Lv.F._howLong=function(e,t,n){if(e[t]!=e[t-n]||e[t+1]!=e[t+1-n]||e[t+2]!=e[t+2-n])return 0;var r=t,i=Math.min(e.length,t+258);for(t+=3;t<i&&e[t]==e[t-n];)t++;return t-r},Lv.F._hash=function(e,t){return(e[t]<<8|e[t+1])+(e[t+2]<<4)&65535},Lv.saved=0,Lv.F._writeBlock=function(e,t,n,r,i,o,a,s,l){var c,u,d,h,p,f,m,g,v,y=Lv.F.U,b=Lv.F._putsF,x=Lv.F._putsE;y.lhst[256]++,u=(c=Lv.F.getTrees())[0],d=c[1],h=c[2],p=c[3],f=c[4],m=c[5],g=c[6],v=c[7];var _=32+(l+3&7?8-(l+3&7):0)+(a<<3),w=r+Lv.F.contSize(y.fltree,y.lhst)+Lv.F.contSize(y.fdtree,y.dhst),S=r+Lv.F.contSize(y.ltree,y.lhst)+Lv.F.contSize(y.dtree,y.dhst);S+=14+3*m+Lv.F.contSize(y.itree,y.ihst)+(2*y.ihst[16]+3*y.ihst[17]+7*y.ihst[18]);for(var M=0;M<286;M++)y.lhst[M]=0;for(M=0;M<30;M++)y.dhst[M]=0;for(M=0;M<19;M++)y.ihst[M]=0;var E=_<w&&_<S?0:w<S?1:2;if(b(s,l,e),b(s,l+1,E),l+=3,0==E){for(;7&l;)l++;l=Lv.F._copyExact(i,o,a,s,l)}else{var T,A;if(1==E&&(T=y.fltree,A=y.fdtree),2==E){Lv.F.makeCodes(y.ltree,u),Lv.F.revCodes(y.ltree,u),Lv.F.makeCodes(y.dtree,d),Lv.F.revCodes(y.dtree,d),Lv.F.makeCodes(y.itree,h),Lv.F.revCodes(y.itree,h),T=y.ltree,A=y.dtree,x(s,l,p-257),x(s,l+=5,f-1),x(s,l+=5,m-4),l+=4;for(var C=0;C<m;C++)x(s,l+3*C,y.itree[1+(y.ordr[C]<<1)]);l+=3*m,l=Lv.F._codeTiny(g,y.itree,s,l),l=Lv.F._codeTiny(v,y.itree,s,l)}for(var k=o,R=0;R<n;R+=2){for(var P=t[R],I=P>>>23,L=k+(8388607&P);k<L;)l=Lv.F._writeLit(i[k++],T,s,l);if(0!=I){var N=t[R+1],O=N>>16,D=N>>8&255,U=255&N;x(s,l=Lv.F._writeLit(257+D,T,s,l),I-y.of0[D]),l+=y.exb[D],b(s,l=Lv.F._writeLit(U,A,s,l),O-y.df0[U]),l+=y.dxb[U],k+=I}}l=Lv.F._writeLit(256,T,s,l)}return l},Lv.F._copyExact=function(e,t,n,r,i){var o=i>>>3;return r[o]=n,r[o+1]=n>>>8,r[o+2]=255-r[o],r[o+3]=255-r[o+1],o+=4,r.set(new Uint8Array(e.buffer,t,n),o),i+(n+4<<3)},Lv.F.getTrees=function(){for(var e=Lv.F.U,t=Lv.F._hufTree(e.lhst,e.ltree,15),n=Lv.F._hufTree(e.dhst,e.dtree,15),r=[],i=Lv.F._lenCodes(e.ltree,r),o=[],a=Lv.F._lenCodes(e.dtree,o),s=0;s<r.length;s+=2)e.ihst[r[s]]++;for(s=0;s<o.length;s+=2)e.ihst[o[s]]++;for(var l=Lv.F._hufTree(e.ihst,e.itree,7),c=19;c>4&&0==e.itree[1+(e.ordr[c-1]<<1)];)c--;return[t,n,l,i,a,c,r,o]},Lv.F.getSecond=function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(e[n+1]);return t},Lv.F.nonZero=function(e){for(var t="",n=0;n<e.length;n+=2)0!=e[n+1]&&(t+=(n>>1)+",");return t},Lv.F.contSize=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r]*e[1+(r<<1)];return n},Lv.F._codeTiny=function(e,t,n,r){for(var i=0;i<e.length;i+=2){var o=e[i],a=e[i+1];r=Lv.F._writeLit(o,t,n,r);var s=16==o?2:17==o?3:7;o>15&&(Lv.F._putsE(n,r,a,s),r+=s)}return r},Lv.F._lenCodes=function(e,t){for(var n=e.length;2!=n&&0==e[n-1];)n-=2;for(var r=0;r<n;r+=2){var i=e[r+1],o=r+3<n?e[r+3]:-1,a=r+5<n?e[r+5]:-1,s=0==r?-1:e[r-1];if(0==i&&o==i&&a==i){for(var l=r+5;l+2<n&&e[l+2]==i;)l+=2;(c=Math.min(l+1-r>>>1,138))<11?t.push(17,c-3):t.push(18,c-11),r+=2*c-2}else if(i==s&&o==i&&a==i){for(l=r+5;l+2<n&&e[l+2]==i;)l+=2;var c=Math.min(l+1-r>>>1,6);t.push(16,c-3),r+=2*c-2}else t.push(i,0)}return n>>>1},Lv.F._hufTree=function(e,t,n){var r=[],i=e.length,o=t.length,a=0;for(a=0;a<o;a+=2)t[a]=0,t[a+1]=0;for(a=0;a<i;a++)0!=e[a]&&r.push({lit:a,f:e[a]});var s=r.length,l=r.slice(0);if(0==s)return 0;if(1==s){var c=r[0].lit;return l=0==c?1:0,t[1+(c<<1)]=1,t[1+(l<<1)]=1,1}r.sort(function(e,t){return e.f-t.f});var u=r[0],d=r[1],h=0,p=1,f=2;for(r[0]={lit:-1,f:u.f+d.f,l:u,r:d,d:0};p!=s-1;)u=h!=p&&(f==s||r[h].f<r[f].f)?r[h++]:r[f++],d=h!=p&&(f==s||r[h].f<r[f].f)?r[h++]:r[f++],r[p++]={lit:-1,f:u.f+d.f,l:u,r:d};var m=Lv.F.setDepth(r[p-1],0);for(m>n&&(Lv.F.restrictDepth(l,n,m),m=n),a=0;a<s;a++)t[1+(l[a].lit<<1)]=l[a].d;return m},Lv.F.setDepth=function(e,t){return-1!=e.lit?(e.d=t,t):Math.max(Lv.F.setDepth(e.l,t+1),Lv.F.setDepth(e.r,t+1))},Lv.F.restrictDepth=function(e,t,n){var r=0,i=1<<n-t,o=0;for(e.sort(function(e,t){return t.d==e.d?e.f-t.f:t.d-e.d}),r=0;r<e.length&&e[r].d>t;r++){var a=e[r].d;e[r].d=t,o+=i-(1<<n-a)}for(o>>>=n-t;o>0;)(a=e[r].d)<t?(e[r].d++,o-=1<<t-a-1):r++;for(;r>=0;r--)e[r].d==t&&o<0&&(e[r].d--,o++);0!=o&&console.log("debt left")},Lv.F._goodIndex=function(e,t){var n=0;return t[16|n]<=e&&(n|=16),t[8|n]<=e&&(n|=8),t[4|n]<=e&&(n|=4),t[2|n]<=e&&(n|=2),t[1|n]<=e&&(n|=1),n},Lv.F._writeLit=function(e,t,n,r){return Lv.F._putsF(n,r,t[e<<1]),r+t[1+(e<<1)]},Lv.F.inflate=function(e,t){var n=Uint8Array;if(3==e[0]&&0==e[1])return t||new n(0);var r=Lv.F,i=r._bitsF,o=r._bitsE,a=r._decodeTiny,s=r.makeCodes,l=r.codes2map,c=r._get17,u=r.U,d=null==t;d&&(t=new n(e.length>>>2<<3));for(var h,p,f=0,m=0,g=0,v=0,y=0,b=0,x=0,_=0,w=0;0==f;)if(f=i(e,w,1),m=i(e,w+1,2),w+=3,0!=m){if(d&&(t=Lv.F._check(t,_+(1<<17))),1==m&&(h=u.flmap,p=u.fdmap,b=511,x=31),2==m){g=o(e,w,5)+257,v=o(e,w+5,5)+1,y=o(e,w+10,4)+4,w+=14;for(var S=0;S<38;S+=2)u.itree[S]=0,u.itree[S+1]=0;var M=1;for(S=0;S<y;S++){var E=o(e,w+3*S,3);u.itree[1+(u.ordr[S]<<1)]=E,E>M&&(M=E)}w+=3*y,s(u.itree,M),l(u.itree,M,u.imap),h=u.lmap,p=u.dmap,w=a(u.imap,(1<<M)-1,g+v,e,w,u.ttree);var T=r._copyOut(u.ttree,0,g,u.ltree);b=(1<<T)-1;var A=r._copyOut(u.ttree,g,v,u.dtree);x=(1<<A)-1,s(u.ltree,T),l(u.ltree,T,h),s(u.dtree,A),l(u.dtree,A,p)}for(;;){var C=h[c(e,w)&b];w+=15&C;var k=C>>>4;if(k>>>8==0)t[_++]=k;else{if(256==k)break;var R=_+k-254;if(k>264){var P=u.ldef[k-257];R=_+(P>>>3)+o(e,w,7&P),w+=7&P}var I=p[c(e,w)&x];w+=15&I;var L=I>>>4,N=u.ddef[L],O=(N>>>4)+i(e,w,15&N);for(w+=15&N,d&&(t=Lv.F._check(t,_+(1<<17)));_<R;)t[_]=t[_++-O],t[_]=t[_++-O],t[_]=t[_++-O],t[_]=t[_++-O];_=R}}}else{7&w&&(w+=8-(7&w));var D=4+(w>>>3),U=e[D-4]|e[D-3]<<8;d&&(t=Lv.F._check(t,_+U)),t.set(new n(e.buffer,e.byteOffset+D,U),_),w=D+U<<3,_+=U}return t.length==_?t:t.slice(0,_)},Lv.F._check=function(e,t){var n=e.length;if(t<=n)return e;var r=new Uint8Array(Math.max(n<<1,t));return r.set(e,0),r},Lv.F._decodeTiny=function(e,t,n,r,i,o){for(var a=Lv.F._bitsE,s=Lv.F._get17,l=0;l<n;){var c=e[s(r,i)&t];i+=15&c;var u=c>>>4;if(u<=15)o[l]=u,l++;else{var d=0,h=0;16==u?(h=3+a(r,i,2),i+=2,d=o[l-1]):17==u?(h=3+a(r,i,3),i+=3):18==u&&(h=11+a(r,i,7),i+=7);for(var p=l+h;l<p;)o[l]=d,l++}}return i},Lv.F._copyOut=function(e,t,n,r){for(var i=0,o=0,a=r.length>>>1;o<n;){var s=e[o+t];r[o<<1]=0,r[1+(o<<1)]=s,s>i&&(i=s),o++}for(;o<a;)r[o<<1]=0,r[1+(o<<1)]=0,o++;return i},Lv.F.makeCodes=function(e,t){for(var n,r,i,o,a=Lv.F.U,s=e.length,l=a.bl_count,c=0;c<=t;c++)l[c]=0;for(c=1;c<s;c+=2)l[e[c]]++;var u=a.next_code;for(n=0,l[0]=0,r=1;r<=t;r++)n=n+l[r-1]<<1,u[r]=n;for(i=0;i<s;i+=2)0!=(o=e[i+1])&&(e[i]=u[o],u[o]++)},Lv.F.codes2map=function(e,t,n){for(var r=e.length,i=Lv.F.U.rev15,o=0;o<r;o+=2)if(0!=e[o+1])for(var a=o>>1,s=e[o+1],l=a<<4|s,c=t-s,u=e[o]<<c,d=u+(1<<c);u!=d;)n[i[u]>>>15-t]=l,u++},Lv.F.revCodes=function(e,t){for(var n=Lv.F.U.rev15,r=15-t,i=0;i<e.length;i+=2){var o=e[i]<<t-e[i+1];e[i]=n[o]>>>r}},Lv.F._putsE=function(e,t,n){n<<=7&t;var r=t>>>3;e[r]|=n,e[r+1]|=n>>>8},Lv.F._putsF=function(e,t,n){n<<=7&t;var r=t>>>3;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},Lv.F._bitsE=function(e,t,n){return(e[t>>>3]|e[1+(t>>>3)]<<8)>>>(7&t)&(1<<n)-1},Lv.F._bitsF=function(e,t,n){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)&(1<<n)-1},Lv.F._get17=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)},Lv.F._get25=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16|e[3+(t>>>3)]<<24)>>>(7&t)},Lv.F.U=(Pv=Uint16Array,Iv=Uint32Array,{next_code:new Pv(16),bl_count:new Pv(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[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],ldef:new Pv(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[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],ddef:new Iv(32),flmap:new Pv(512),fltree:[],fdmap:new Pv(32),fdtree:[],lmap:new Pv(32768),ltree:[],ttree:[],dmap:new Pv(32768),dtree:[],imap:new Pv(512),itree:[],rev15:new Pv(32768),lhst:new Iv(286),dhst:new Iv(30),ihst:new Iv(19),lits:new Iv(15e3),strt:new Pv(65536),prev:new Pv(32768)}),function(){for(var e=Lv.F.U,t=0;t<32768;t++){var n=t;n=(4278255360&(n=(4042322160&(n=(3435973836&(n=(2863311530&n)>>>1|(1431655765&n)<<1))>>>2|(858993459&n)<<2))>>>4|(252645135&n)<<4))>>>8|(16711935&n)<<8,e.rev15[t]=(n>>>16|n<<16)>>>17}function r(e,t,n){for(;0!=t--;)e.push(0,n)}for(t=0;t<32;t++)e.ldef[t]=e.of0[t]<<3|e.exb[t],e.ddef[t]=e.df0[t]<<4|e.dxb[t];r(e.fltree,144,8),r(e.fltree,112,9),r(e.fltree,24,7),r(e.fltree,8,8),Lv.F.makeCodes(e.fltree,9),Lv.F.codes2map(e.fltree,9,e.flmap),Lv.F.revCodes(e.fltree,9),r(e.fdtree,32,5),Lv.F.makeCodes(e.fdtree,5),Lv.F.codes2map(e.fdtree,5,e.fdmap),Lv.F.revCodes(e.fdtree,5),r(e.itree,19,0),r(e.ltree,286,0),r(e.dtree,30,0),r(e.ttree,320,0)}();var Dv,Uv=(Dv={__proto__:null,default:Nv},[Nv].forEach(function(e){e&&"string"!=typeof e&&!Array.isArray(e)&&Object.keys(e).forEach(function(t){if("default"!==t&&!(t in Dv)){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(Dv,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}})}),Object.freeze(Dv));const Fv=function(){var e={nextZero(e,t){for(;0!=e[t];)t++;return t},readUshort:(e,t)=>e[t]<<8|e[t+1],writeUshort(e,t,n){e[t]=n>>8&255,e[t+1]=255&n},readUint:(e,t)=>16777216*e[t]+(e[t+1]<<16|e[t+2]<<8|e[t+3]),writeUint(e,t,n){e[t]=n>>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n},readASCII(e,t,n){let r="";for(let i=0;i<n;i++)r+=String.fromCharCode(e[t+i]);return r},writeASCII(e,t,n){for(let r=0;r<n.length;r++)e[t+r]=n.charCodeAt(r)},readBytes(e,t,n){const r=[];for(let i=0;i<n;i++)r.push(e[t+i]);return r},pad:e=>e.length<2?`0${e}`:e,readUTF8(t,n,r){let i,o="";for(let s=0;s<r;s++)o+=`%${e.pad(t[n+s].toString(16))}`;try{i=decodeURIComponent(o)}catch(a){return e.readASCII(t,n,r)}return i}};function t(t,n,r,i){const a=n*r,s=o(i),l=Math.ceil(n*s/8),c=new Uint8Array(4*a),u=new Uint32Array(c.buffer),{ctype:d}=i,{depth:h}=i,p=e.readUshort;if(6==d){const e=a<<2;if(8==h)for(var f=0;f<e;f+=4)c[f]=t[f],c[f+1]=t[f+1],c[f+2]=t[f+2],c[f+3]=t[f+3];if(16==h)for(f=0;f<e;f++)c[f]=t[f<<1]}else if(2==d){const e=i.tabs.tRNS;if(null==e){if(8==h)for(f=0;f<a;f++){var m=3*f;u[f]=255<<24|t[m+2]<<16|t[m+1]<<8|t[m]}if(16==h)for(f=0;f<a;f++)m=6*f,u[f]=255<<24|t[m+4]<<16|t[m+2]<<8|t[m]}else{var g=e[0];const n=e[1],r=e[2];if(8==h)for(f=0;f<a;f++){var v=f<<2;m=3*f,u[f]=255<<24|t[m+2]<<16|t[m+1]<<8|t[m],t[m]==g&&t[m+1]==n&&t[m+2]==r&&(c[v+3]=0)}if(16==h)for(f=0;f<a;f++)v=f<<2,m=6*f,u[f]=255<<24|t[m+4]<<16|t[m+2]<<8|t[m],p(t,m)==g&&p(t,m+2)==n&&p(t,m+4)==r&&(c[v+3]=0)}}else if(3==d){const e=i.tabs.PLTE,o=i.tabs.tRNS,s=o?o.length:0;if(1==h)for(var y=0;y<r;y++){var b=y*l,x=y*n;for(f=0;f<n;f++){v=x+f<<2;var _=3*(w=t[b+(f>>3)]>>7-(7&f)&1);c[v]=e[_],c[v+1]=e[_+1],c[v+2]=e[_+2],c[v+3]=w<s?o[w]:255}}if(2==h)for(y=0;y<r;y++)for(b=y*l,x=y*n,f=0;f<n;f++)v=x+f<<2,_=3*(w=t[b+(f>>2)]>>6-((3&f)<<1)&3),c[v]=e[_],c[v+1]=e[_+1],c[v+2]=e[_+2],c[v+3]=w<s?o[w]:255;if(4==h)for(y=0;y<r;y++)for(b=y*l,x=y*n,f=0;f<n;f++)v=x+f<<2,_=3*(w=t[b+(f>>1)]>>4-((1&f)<<2)&15),c[v]=e[_],c[v+1]=e[_+1],c[v+2]=e[_+2],c[v+3]=w<s?o[w]:255;if(8==h)for(f=0;f<a;f++){var w;v=f<<2,_=3*(w=t[f]),c[v]=e[_],c[v+1]=e[_+1],c[v+2]=e[_+2],c[v+3]=w<s?o[w]:255}}else if(4==d){if(8==h)for(f=0;f<a;f++){v=f<<2;var S=t[M=f<<1];c[v]=S,c[v+1]=S,c[v+2]=S,c[v+3]=t[M+1]}if(16==h)for(f=0;f<a;f++){var M;v=f<<2,S=t[M=f<<2],c[v]=S,c[v+1]=S,c[v+2]=S,c[v+3]=t[M+2]}}else if(0==d)for(g=i.tabs.tRNS?i.tabs.tRNS:-1,y=0;y<r;y++){const e=y*l,r=y*n;if(1==h)for(var E=0;E<n;E++){var T=(S=255*(t[e+(E>>>3)]>>>7-(7&E)&1))==255*g?0:255;u[r+E]=T<<24|S<<16|S<<8|S}else if(2==h)for(E=0;E<n;E++)T=(S=85*(t[e+(E>>>2)]>>>6-((3&E)<<1)&3))==85*g?0:255,u[r+E]=T<<24|S<<16|S<<8|S;else if(4==h)for(E=0;E<n;E++)T=(S=17*(t[e+(E>>>1)]>>>4-((1&E)<<2)&15))==17*g?0:255,u[r+E]=T<<24|S<<16|S<<8|S;else if(8==h)for(E=0;E<n;E++)T=(S=t[e+E])==g?0:255,u[r+E]=T<<24|S<<16|S<<8|S;else if(16==h)for(E=0;E<n;E++)S=t[e+(E<<1)],T=p(t,e+(E<<1))==g?0:255,u[r+E]=T<<24|S<<16|S<<8|S}return c}function n(e,t,n,s){const l=o(e),c=Math.ceil(n*l/8),u=new Uint8Array((c+1+e.interlace)*s);return t=e.tabs.CgBI?i(t,u):r(t,u),0==e.interlace?t=a(t,e,0,n,s):1==e.interlace&&(t=function(e,t){const n=t.width,r=t.height,i=o(t),s=i>>3,l=Math.ceil(n*i/8),c=new Uint8Array(r*l);let u=0;const d=[0,0,4,0,2,0,1],h=[0,4,0,2,0,1,0],p=[8,8,8,4,4,2,2],f=[8,8,4,4,2,2,1];let m=0;for(;m<7;){const o=p[m],v=f[m];let y=0,b=0,x=d[m];for(;x<r;)x+=o,b++;let _=h[m];for(;_<n;)_+=v,y++;const w=Math.ceil(y*i/8);a(e,t,u,y,b);let S=0,M=d[m];for(;M<r;){let t=h[m],r=u+S*w<<3;for(;t<n;){var g;if(1==i&&(g=(g=e[r>>3])>>7-(7&r)&1,c[M*l+(t>>3)]|=g<<7-(7&t)),2==i&&(g=(g=e[r>>3])>>6-(7&r)&3,c[M*l+(t>>2)]|=g<<6-((3&t)<<1)),4==i&&(g=(g=e[r>>3])>>4-(7&r)&15,c[M*l+(t>>1)]|=g<<4-((1&t)<<2)),i>=8){const n=M*l+t*s;for(let t=0;t<s;t++)c[n+t]=e[(r>>3)+t]}r+=i,t+=v}S++,M+=o}y*b!=0&&(u+=b*(1+w)),m+=1}return c}(t,e)),t}function r(e,t){return i(new Uint8Array(e.buffer,2,e.length-6),t)}var i=function(){const e={H:{}};return e.H.N=function(t,n){const r=Uint8Array;let i,o,a=0,s=0,l=0,c=0,u=0,d=0,h=0,p=0,f=0;if(3==t[0]&&0==t[1])return n||new r(0);const m=e.H,g=m.b,v=m.e,y=m.R,b=m.n,x=m.A,_=m.Z,w=m.m,S=null==n;for(S&&(n=new r(t.length>>>2<<5));0==a;)if(a=g(t,f,1),s=g(t,f+1,2),f+=3,0!=s){if(S&&(n=e.H.W(n,p+(1<<17))),1==s&&(i=w.J,o=w.h,d=511,h=31),2==s){l=v(t,f,5)+257,c=v(t,f+5,5)+1,u=v(t,f+10,4)+4,f+=14;let e=1;for(var M=0;M<38;M+=2)w.Q[M]=0,w.Q[M+1]=0;for(M=0;M<u;M++){const n=v(t,f+3*M,3);w.Q[1+(w.X[M]<<1)]=n,n>e&&(e=n)}f+=3*u,b(w.Q,e),x(w.Q,e,w.u),i=w.w,o=w.d,f=y(w.u,(1<<e)-1,l+c,t,f,w.v);const n=m.V(w.v,0,l,w.C);d=(1<<n)-1;const r=m.V(w.v,l,c,w.D);h=(1<<r)-1,b(w.C,n),x(w.C,n,i),b(w.D,r),x(w.D,r,o)}for(;;){const e=i[_(t,f)&d];f+=15&e;const r=e>>>4;if(r>>>8==0)n[p++]=r;else{if(256==r)break;{let e=p+r-254;if(r>264){const n=w.q[r-257];e=p+(n>>>3)+v(t,f,7&n),f+=7&n}const i=o[_(t,f)&h];f+=15&i;const a=i>>>4,s=w.c[a],l=(s>>>4)+g(t,f,15&s);for(f+=15&s;p<e;)n[p]=n[p++-l],n[p]=n[p++-l],n[p]=n[p++-l],n[p]=n[p++-l];p=e}}}}else{7&f&&(f+=8-(7&f));const i=4+(f>>>3),o=t[i-4]|t[i-3]<<8;S&&(n=e.H.W(n,p+o)),n.set(new r(t.buffer,t.byteOffset+i,o),p),f=i+o<<3,p+=o}return n.length==p?n:n.slice(0,p)},e.H.W=function(e,t){const n=e.length;if(t<=n)return e;const r=new Uint8Array(n<<1);return r.set(e,0),r},e.H.R=function(t,n,r,i,o,a){const s=e.H.e,l=e.H.Z;let c=0;for(;c<r;){const e=t[l(i,o)&n];o+=15&e;const r=e>>>4;if(r<=15)a[c]=r,c++;else{let e=0,t=0;16==r?(t=3+s(i,o,2),o+=2,e=a[c-1]):17==r?(t=3+s(i,o,3),o+=3):18==r&&(t=11+s(i,o,7),o+=7);const n=c+t;for(;c<n;)a[c]=e,c++}}return o},e.H.V=function(e,t,n,r){let i=0,o=0;const a=r.length>>>1;for(;o<n;){const n=e[o+t];r[o<<1]=0,r[1+(o<<1)]=n,n>i&&(i=n),o++}for(;o<a;)r[o<<1]=0,r[1+(o<<1)]=0,o++;return i},e.H.n=function(t,n){const r=e.H.m,i=t.length;let o,a,s,l;const c=r.j;for(var u=0;u<=n;u++)c[u]=0;for(u=1;u<i;u+=2)c[t[u]]++;const d=r.K;for(o=0,c[0]=0,a=1;a<=n;a++)o=o+c[a-1]<<1,d[a]=o;for(s=0;s<i;s+=2)l=t[s+1],0!=l&&(t[s]=d[l],d[l]++)},e.H.A=function(t,n,r){const i=t.length,o=e.H.m.r;for(let e=0;e<i;e+=2)if(0!=t[e+1]){const i=e>>1,a=t[e+1],s=i<<4|a,l=n-a;let c=t[e]<<l;const u=c+(1<<l);for(;c!=u;)r[o[c]>>>15-n]=s,c++}},e.H.l=function(t,n){const r=e.H.m.r,i=15-n;for(let e=0;e<t.length;e+=2){const o=t[e]<<n-t[e+1];t[e]=r[o]>>>i}},e.H.M=function(e,t,n){n<<=7&t;const r=t>>>3;e[r]|=n,e[r+1]|=n>>>8},e.H.I=function(e,t,n){n<<=7&t;const r=t>>>3;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},e.H.e=function(e,t,n){return(e[t>>>3]|e[1+(t>>>3)]<<8)>>>(7&t)&(1<<n)-1},e.H.b=function(e,t,n){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)&(1<<n)-1},e.H.Z=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)},e.H.i=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16|e[3+(t>>>3)]<<24)>>>(7&t)},e.H.m=function(){const e=Uint16Array,t=Uint32Array;return{K:new e(16),j:new e(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[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],q:new e(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[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],c:new t(32),J:new e(512),_:[],h:new e(32),$:[],w:new e(32768),C:[],v:[],d:new e(32768),D:[],u:new e(512),Q:[],r:new e(32768),s:new t(286),Y:new t(30),a:new t(19),t:new t(15e3),k:new e(65536),g:new e(32768)}}(),function(){const t=e.H.m;for(var n=0;n<32768;n++){let e=n;e=(2863311530&e)>>>1|(1431655765&e)<<1,e=(3435973836&e)>>>2|(858993459&e)<<2,e=(4042322160&e)>>>4|(252645135&e)<<4,e=(4278255360&e)>>>8|(16711935&e)<<8,t.r[n]=(e>>>16|e<<16)>>>17}function r(e,t,n){for(;0!=t--;)e.push(0,n)}for(n=0;n<32;n++)t.q[n]=t.S[n]<<3|t.T[n],t.c[n]=t.p[n]<<4|t.z[n];r(t._,144,8),r(t._,112,9),r(t._,24,7),r(t._,8,8),e.H.n(t._,9),e.H.A(t._,9,t.J),e.H.l(t._,9),r(t.$,32,5),e.H.n(t.$,5),e.H.A(t.$,5,t.h),e.H.l(t.$,5),r(t.Q,19,0),r(t.C,286,0),r(t.D,30,0),r(t.v,320,0)}(),e.H.N}();function o(e){return[1,null,3,1,2,null,4][e.ctype]*e.depth}function a(e,t,n,r,i){let a=o(t);const l=Math.ceil(r*a/8);let c,u;a=Math.ceil(a/8);let d=e[n],h=0;if(d>1&&(e[n]=[0,0,1][d-2]),3==d)for(h=a;h<l;h++)e[h+1]=e[h+1]+(e[h+1-a]>>>1)&255;for(let o=0;o<i;o++)if(c=n+o*l,u=c+o+1,d=e[u-1],h=0,0==d)for(;h<l;h++)e[c+h]=e[u+h];else if(1==d){for(;h<a;h++)e[c+h]=e[u+h];for(;h<l;h++)e[c+h]=e[u+h]+e[c+h-a]}else if(2==d)for(;h<l;h++)e[c+h]=e[u+h]+e[c+h-l];else if(3==d){for(;h<a;h++)e[c+h]=e[u+h]+(e[c+h-l]>>>1);for(;h<l;h++)e[c+h]=e[u+h]+(e[c+h-l]+e[c+h-a]>>>1)}else{for(;h<a;h++)e[c+h]=e[u+h]+s(0,e[c+h-l],0);for(;h<l;h++)e[c+h]=e[u+h]+s(e[c+h-a],e[c+h-l],e[c+h-a-l])}return e}function s(e,t,n){const r=e+t-n,i=r-e,o=r-t,a=r-n;return i*i<=o*o&&i*i<=a*a?e:o*o<=a*a?t:n}function l(t,n,r){r.width=e.readUint(t,n),n+=4,r.height=e.readUint(t,n),n+=4,r.depth=t[n],n++,r.ctype=t[n],n++,r.compress=t[n],n++,r.filter=t[n],n++,r.interlace=t[n],n++}function c(e,t,n,r,i,o,a,s,l){const c=Math.min(t,i),u=Math.min(n,o);let d=0,h=0;for(let _=0;_<u;_++)for(let n=0;n<c;n++)if(a>=0&&s>=0?(d=_*t+n<<2,h=(s+_)*i+a+n<<2):(d=(-s+_)*t-a+n<<2,h=_*i+n<<2),0==l)r[h]=e[d],r[h+1]=e[d+1],r[h+2]=e[d+2],r[h+3]=e[d+3];else if(1==l){var p=e[d+3]*(1/255),f=e[d]*p,m=e[d+1]*p,g=e[d+2]*p,v=r[h+3]*(1/255),y=r[h]*v,b=r[h+1]*v,x=r[h+2]*v;const t=1-p,n=p+v*t,i=0==n?0:1/n;r[h+3]=255*n,r[h+0]=(f+y*t)*i,r[h+1]=(m+b*t)*i,r[h+2]=(g+x*t)*i}else if(2==l)p=e[d+3],f=e[d],m=e[d+1],g=e[d+2],v=r[h+3],y=r[h],b=r[h+1],x=r[h+2],p==v&&f==y&&m==b&&g==x?(r[h]=0,r[h+1]=0,r[h+2]=0,r[h+3]=0):(r[h]=f,r[h+1]=m,r[h+2]=g,r[h+3]=p);else if(3==l){if(p=e[d+3],f=e[d],m=e[d+1],g=e[d+2],v=r[h+3],y=r[h],b=r[h+1],x=r[h+2],p==v&&f==y&&m==b&&g==x)continue;if(p<220&&v>20)return!1}return!0}return{decode:function(t){const o=new Uint8Array(t);let a=8;const s=e,c=s.readUshort,u=s.readUint,d={tabs:{},frames:[]},h=new Uint8Array(o.length);let p,f=0,m=0;const g=[137,80,78,71,13,10,26,10];for(var v=0;v<8;v++)if(o[v]!=g[v])throw"The input is not a PNG file!";for(;a<o.length;){const e=s.readUint(o,a);a+=4;const t=s.readASCII(o,a,4);if(a+=4,"IHDR"==t)l(o,a,d);else if("iCCP"==t){for(var y=a;0!=o[y];)y++;s.readASCII(o,a,y-a),o[y+1];const n=o.slice(y+2,a+e);let l=null;try{l=r(n)}catch(E){l=i(n)}d.tabs[t]=l}else if("CgBI"==t)d.tabs[t]=o.slice(a,a+4);else if("IDAT"==t){for(v=0;v<e;v++)h[f+v]=o[a+v];f+=e}else if("acTL"==t)d.tabs[t]={num_frames:u(o,a),num_plays:u(o,a+4)},p=new Uint8Array(o.length);else if("fcTL"==t){0!=m&&((M=d.frames[d.frames.length-1]).data=n(d,p.slice(0,m),M.rect.width,M.rect.height),m=0);const e={x:u(o,a+12),y:u(o,a+16),width:u(o,a+4),height:u(o,a+8)};let t=c(o,a+22);t=c(o,a+20)/(0==t?100:t);const r={rect:e,delay:Math.round(1e3*t),dispose:o[a+24],blend:o[a+25]};d.frames.push(r)}else if("fdAT"==t){for(v=0;v<e-4;v++)p[m+v]=o[a+v+4];m+=e-4}else if("pHYs"==t)d.tabs[t]=[s.readUint(o,a),s.readUint(o,a+4),o[a+8]];else if("cHRM"==t)for(d.tabs[t]=[],v=0;v<8;v++)d.tabs[t].push(s.readUint(o,a+4*v));else if("tEXt"==t||"zTXt"==t){null==d.tabs[t]&&(d.tabs[t]={});var b=s.nextZero(o,a),x=s.readASCII(o,a,b-a),_=a+e-b-1;if("tEXt"==t)S=s.readASCII(o,b+1,_);else{var w=r(o.slice(b+2,b+2+_));S=s.readUTF8(w,0,w.length)}d.tabs[t][x]=S}else if("iTXt"==t){null==d.tabs[t]&&(d.tabs[t]={}),b=0,y=a,b=s.nextZero(o,y),x=s.readASCII(o,y,b-y);const n=o[y=b+1];var S;o[y+1],y+=2,b=s.nextZero(o,y),s.readASCII(o,y,b-y),y=b+1,b=s.nextZero(o,y),s.readUTF8(o,y,b-y),_=e-((y=b+1)-a),0==n?S=s.readUTF8(o,y,_):(w=r(o.slice(y,y+_)),S=s.readUTF8(w,0,w.length)),d.tabs[t][x]=S}else if("PLTE"==t)d.tabs[t]=s.readBytes(o,a,e);else if("hIST"==t){const e=d.tabs.PLTE.length/3;for(d.tabs[t]=[],v=0;v<e;v++)d.tabs[t].push(c(o,a+2*v))}else if("tRNS"==t)3==d.ctype?d.tabs[t]=s.readBytes(o,a,e):0==d.ctype?d.tabs[t]=c(o,a):2==d.ctype&&(d.tabs[t]=[c(o,a),c(o,a+2),c(o,a+4)]);else if("gAMA"==t)d.tabs[t]=s.readUint(o,a)/1e5;else if("sRGB"==t)d.tabs[t]=o[a];else if("bKGD"==t)0==d.ctype||4==d.ctype?d.tabs[t]=[c(o,a)]:2==d.ctype||6==d.ctype?d.tabs[t]=[c(o,a),c(o,a+2),c(o,a+4)]:3==d.ctype&&(d.tabs[t]=o[a]);else if("IEND"==t)break;a+=e,s.readUint(o,a),a+=4}var M;return 0!=m&&((M=d.frames[d.frames.length-1]).data=n(d,p.slice(0,m),M.rect.width,M.rect.height)),d.data=n(d,h,d.width,d.height),delete d.compress,delete d.interlace,delete d.filter,d},toRGBA8:function(e){const n=e.width,r=e.height;if(null==e.tabs.acTL)return[t(e.data,n,r,e).buffer];const i=[];null==e.frames[0].data&&(e.frames[0].data=e.data);const o=n*r*4,a=new Uint8Array(o),s=new Uint8Array(o),l=new Uint8Array(o);for(let d=0;d<e.frames.length;d++){const h=e.frames[d],p=h.rect.x,f=h.rect.y,m=h.rect.width,g=h.rect.height,v=t(h.data,m,g,e);if(0!=d)for(var u=0;u<o;u++)l[u]=a[u];if(0==h.blend?c(v,m,g,a,n,r,p,f,0):1==h.blend&&c(v,m,g,a,n,r,p,f,1),i.push(a.buffer.slice(0)),0==h.dispose);else if(1==h.dispose)c(s,m,g,a,n,r,p,f,0);else if(2==h.dispose)for(u=0;u<o;u++)a[u]=l[u]}return i},_paeth:s,_copyTile:c,_bin:e}}();!function(){const{_copyTile:e}=Fv,{_bin:t}=Fv,n=Fv._paeth;var r={table:function(){const e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)1&n?n=3988292384^n>>>1:n>>>=1;e[t]=n}return e}(),update(e,t,n,i){for(let o=0;o<i;o++)e=r.table[255&(e^t[n+o])]^e>>>8;return e},crc:(e,t,n)=>4294967295^r.update(4294967295,e,t,n)};function i(e,t,n,r){t[n]+=e[0]*r>>4,t[n+1]+=e[1]*r>>4,t[n+2]+=e[2]*r>>4,t[n+3]+=e[3]*r>>4}function o(e){return Math.max(0,Math.min(255,e))}function a(e,t){const n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return n*n+r*r+i*i+o*o}function s(e,t,n,r,s,l,c){null==c&&(c=1);const u=r.length,d=[];for(var h=0;h<u;h++){const e=r[h];d.push([e>>>0&255,e>>>8&255,e>>>16&255,e>>>24&255])}for(h=0;h<u;h++){let e=4294967295;for(var p=0,f=0;f<u;f++){var m=a(d[h],d[f]);f!=h&&m<e&&(e=m,p=f)}}const g=new Uint32Array(s.buffer),v=new Int16Array(t*n*4),y=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(h=0;h<y.length;h++)y[h]=255*((y[h]+.5)/16-.5);for(let x=0;x<n;x++)for(let s=0;s<t;s++){var b;h=4*(x*t+s),2!=c?b=[o(e[h]+v[h]),o(e[h+1]+v[h+1]),o(e[h+2]+v[h+2]),o(e[h+3]+v[h+3])]:(m=y[4*(3&x)+(3&s)],b=[o(e[h]+m),o(e[h+1]+m),o(e[h+2]+m),o(e[h+3]+m)]),p=0;let _=16777215;for(f=0;f<u;f++){const e=a(b,d[f]);e<_&&(_=e,p=f)}const w=d[p],S=[b[0]-w[0],b[1]-w[1],b[2]-w[2],b[3]-w[3]];1==c&&(s!=t-1&&i(S,v,h+4,7),x!=n-1&&(0!=s&&i(S,v,h+4*t-4,3),i(S,v,h+4*t,5),s!=t-1&&i(S,v,h+4*t+4,1))),l[h>>2]=p,g[h>>2]=r[p]}}function l(e,n,i,o,a){null==a&&(a={});const{crc:s}=r,l=t.writeUint,c=t.writeUshort,u=t.writeASCII;let d=8;const h=e.frames.length>1;let p,f=!1,m=33+(h?20:0);if(null!=a.sRGB&&(m+=13),null!=a.pHYs&&(m+=21),null!=a.iCCP&&(p=pako.deflate(a.iCCP),m+=21+p.length+4),3==e.ctype){for(var g=e.plte.length,v=0;v<g;v++)e.plte[v]>>>24!=255&&(f=!0);m+=8+3*g+4+(f?8+1*g+4:0)}for(var y=0;y<e.frames.length;y++)h&&(m+=38),m+=(w=e.frames[y]).cimg.length+12,0!=y&&(m+=4);m+=12;const b=new Uint8Array(m),x=[137,80,78,71,13,10,26,10];for(v=0;v<8;v++)b[v]=x[v];if(l(b,d,13),d+=4,u(b,d,"IHDR"),d+=4,l(b,d,n),d+=4,l(b,d,i),d+=4,b[d]=e.depth,d++,b[d]=e.ctype,d++,b[d]=0,d++,b[d]=0,d++,b[d]=0,d++,l(b,d,s(b,d-17,17)),d+=4,null!=a.sRGB&&(l(b,d,1),d+=4,u(b,d,"sRGB"),d+=4,b[d]=a.sRGB,d++,l(b,d,s(b,d-5,5)),d+=4),null!=a.iCCP){const e=13+p.length;l(b,d,e),d+=4,u(b,d,"iCCP"),d+=4,u(b,d,"ICC profile"),d+=11,d+=2,b.set(p,d),d+=p.length,l(b,d,s(b,d-(e+4),e+4)),d+=4}if(null!=a.pHYs&&(l(b,d,9),d+=4,u(b,d,"pHYs"),d+=4,l(b,d,a.pHYs[0]),d+=4,l(b,d,a.pHYs[1]),d+=4,b[d]=a.pHYs[2],d++,l(b,d,s(b,d-13,13)),d+=4),h&&(l(b,d,8),d+=4,u(b,d,"acTL"),d+=4,l(b,d,e.frames.length),d+=4,l(b,d,null!=a.loop?a.loop:0),d+=4,l(b,d,s(b,d-12,12)),d+=4),3==e.ctype){for(l(b,d,3*(g=e.plte.length)),d+=4,u(b,d,"PLTE"),d+=4,v=0;v<g;v++){const t=3*v,n=e.plte[v],r=255&n,i=n>>>8&255,o=n>>>16&255;b[d+t+0]=r,b[d+t+1]=i,b[d+t+2]=o}if(d+=3*g,l(b,d,s(b,d-3*g-4,3*g+4)),d+=4,f){for(l(b,d,g),d+=4,u(b,d,"tRNS"),d+=4,v=0;v<g;v++)b[d+v]=e.plte[v]>>>24&255;d+=g,l(b,d,s(b,d-g-4,g+4)),d+=4}}let _=0;for(y=0;y<e.frames.length;y++){var w=e.frames[y];h&&(l(b,d,26),d+=4,u(b,d,"fcTL"),d+=4,l(b,d,_++),d+=4,l(b,d,w.rect.width),d+=4,l(b,d,w.rect.height),d+=4,l(b,d,w.rect.x),d+=4,l(b,d,w.rect.y),d+=4,c(b,d,o[y]),d+=2,c(b,d,1e3),d+=2,b[d]=w.dispose,d++,b[d]=w.blend,d++,l(b,d,s(b,d-30,30)),d+=4);const t=w.cimg;l(b,d,(g=t.length)+(0==y?0:4)),d+=4;const n=d;u(b,d,0==y?"IDAT":"fdAT"),d+=4,0!=y&&(l(b,d,_++),d+=4),b.set(t,d),d+=g,l(b,d,s(b,n,d-n)),d+=4}return l(b,d,0),d+=4,u(b,d,"IEND"),d+=4,l(b,d,s(b,d-4,4)),d+=4,b.buffer}function c(e,t,n){for(let r=0;r<e.frames.length;r++){const i=e.frames[r];i.rect.width;const o=i.rect.height,a=new Uint8Array(o*i.bpl+o);i.cimg=p(i.img,o,i.bpp,i.bpl,a,t,n)}}function u(t,n,r,i,o){const a=o[0],l=o[1],c=o[2],u=o[3],p=o[4],f=o[5];let g=6,v=8,y=255;for(var b=0;b<t.length;b++){const e=new Uint8Array(t[b]);for(var x=e.length,_=0;_<x;_+=4)y&=e[_+3]}const w=255!=y,S=function(t,n,r,i,o,a){const s=[];for(var l=0;l<t.length;l++){const d=new Uint8Array(t[l]),p=new Uint32Array(d.buffer);var c;let m=0,g=0,v=n,y=r,b=i?1:0;if(0!=l){const x=a||i||1==l||0!=s[l-2].dispose?1:2;let _=0,w=1e9;for(let e=0;e<x;e++){var u=new Uint8Array(t[l-1-e]);const i=new Uint32Array(t[l-1-e]);let a=n,s=r,c=-1,d=-1;for(let e=0;e<r;e++)for(let t=0;t<n;t++)p[f=e*n+t]!=i[f]&&(t<a&&(a=t),t>c&&(c=t),e<s&&(s=e),e>d&&(d=e));-1==c&&(a=s=c=d=0),o&&(!(1&~a)&&a--,!(1&~s)&&s--);const h=(c-a+1)*(d-s+1);h<w&&(w=h,_=e,m=a,g=s,v=c-a+1,y=d-s+1)}u=new Uint8Array(t[l-1-_]),1==_&&(s[l-1].dispose=2),c=new Uint8Array(v*y*4),e(u,n,r,c,v,y,-m,-g,0),b=e(d,n,r,c,v,y,-m,-g,3)?1:0,1==b?h(d,n,r,c,{x:m,y:g,width:v,height:y}):e(d,n,r,c,v,y,-m,-g,0)}else c=d.slice(0);s.push({rect:{x:m,y:g,width:v,height:y},img:c,blend:b,dispose:0})}if(i)for(l=0;l<s.length;l++){if(1==(m=s[l]).blend)continue;const e=m.rect,i=s[l-1].rect,a=Math.min(e.x,i.x),c=Math.min(e.y,i.y),u={x:a,y:c,width:Math.max(e.x+e.width,i.x+i.width)-a,height:Math.max(e.y+e.height,i.y+i.height)-c};s[l-1].dispose=1,l-1!=0&&d(t,n,r,s,l-1,u,o),d(t,n,r,s,l,u,o)}let p=0;if(1!=t.length)for(var f=0;f<s.length;f++){var m;p+=(m=s[f]).rect.width*m.rect.height}return s}(t,n,r,a,l,c),M={},E=[],T=[];if(0!=i){const e=[];for(_=0;_<S.length;_++)e.push(S[_].img.buffer);const t=m(function(e){let t=0;for(var n=0;n<e.length;n++)t+=e[n].byteLength;const r=new Uint8Array(t);let i=0;for(n=0;n<e.length;n++){const t=new Uint8Array(e[n]),o=t.length;for(let e=0;e<o;e+=4){let n=t[e],o=t[e+1],a=t[e+2];const s=t[e+3];0==s&&(n=o=a=0),r[i+e]=n,r[i+e+1]=o,r[i+e+2]=a,r[i+e+3]=s}i+=o}return r.buffer}(e),i);for(_=0;_<t.plte.length;_++)E.push(t.plte[_].est.rgba);let n=0;for(_=0;_<S.length;_++){const e=(C=S[_]).img.length;var A=new Uint8Array(t.inds.buffer,n>>2,e>>2);T.push(A);const r=new Uint8Array(t.abuf,n,e);f&&s(C.img,C.rect.width,C.rect.height,E,r,A),C.img.set(r),n+=e}}else for(b=0;b<S.length;b++){var C=S[b];const e=new Uint32Array(C.img.buffer);var k=C.rect.width;for(x=e.length,A=new Uint8Array(x),T.push(A),_=0;_<x;_++){const t=e[_];if(0!=_&&t==e[_-1])A[_]=A[_-1];else if(_>k&&t==e[_-k])A[_]=A[_-k];else{let e=M[t];if(null==e&&(M[t]=e=E.length,E.push(t),E.length>=300))break;A[_]=e}}}const R=E.length;for(R<=256&&0==p&&(v=R<=2?1:R<=4?2:R<=16?4:8,v=Math.max(v,u)),b=0;b<S.length;b++){(C=S[b]).rect.x,C.rect.y,k=C.rect.width;const e=C.rect.height;let t=C.img;new Uint32Array(t.buffer);let n=4*k,r=4;if(R<=256&&0==p){n=Math.ceil(v*k/8);var P=new Uint8Array(n*e);const i=T[b];for(let t=0;t<e;t++){_=t*n;const e=t*k;if(8==v)for(var I=0;I<k;I++)P[_+I]=i[e+I];else if(4==v)for(I=0;I<k;I++)P[_+(I>>1)]|=i[e+I]<<4-4*(1&I);else if(2==v)for(I=0;I<k;I++)P[_+(I>>2)]|=i[e+I]<<6-2*(3&I);else if(1==v)for(I=0;I<k;I++)P[_+(I>>3)]|=i[e+I]<<7-1*(7&I)}t=P,g=3,r=1}else if(0==w&&1==S.length){P=new Uint8Array(k*e*3);const i=k*e;for(_=0;_<i;_++){const e=3*_,n=4*_;P[e]=t[n],P[e+1]=t[n+1],P[e+2]=t[n+2]}t=P,g=2,r=3,n=3*k}C.img=t,C.bpl=n,C.bpp=r}return{ctype:g,depth:v,plte:E,frames:S}}function d(t,n,r,i,o,a,s){const l=Uint8Array,c=Uint32Array,u=new l(t[o-1]),d=new c(t[o-1]),p=o+1<t.length?new l(t[o+1]):null,f=new l(t[o]),m=new c(f.buffer);let g=n,v=r,y=-1,b=-1;for(let e=0;e<a.height;e++)for(let t=0;t<a.width;t++){const r=a.x+t,s=a.y+e,l=s*n+r,c=m[l];0==c||0==i[o-1].dispose&&d[l]==c&&(null==p||0!=p[4*l+3])||(r<g&&(g=r),r>y&&(y=r),s<v&&(v=s),s>b&&(b=s))}-1==y&&(g=v=y=b=0),s&&(!(1&~g)&&g--,!(1&~v)&&v--),a={x:g,y:v,width:y-g+1,height:b-v+1};const x=i[o];x.rect=a,x.blend=1,x.img=new Uint8Array(a.width*a.height*4),0==i[o-1].dispose?(e(u,n,r,x.img,a.width,a.height,-a.x,-a.y,0),h(f,n,r,x.img,a)):e(f,n,r,x.img,a.width,a.height,-a.x,-a.y,0)}function h(t,n,r,i,o){e(t,n,r,i,o.width,o.height,-o.x,-o.y,2)}function p(e,t,n,r,i,o,a){const s=[];let l,c=[0,1,2,3,4];-1!=o?c=[o]:(t*r>5e5||1==n)&&(c=[0]),a&&(l={level:0});const u=Uv;for(var d=0;d<c.length;d++){for(let o=0;o<t;o++)f(i,e,o,r,n,c[d]);s.push(u.deflate(i,l))}let h,p=1e9;for(d=0;d<s.length;d++)s[d].length<p&&(h=d,p=s[d].length);return s[h]}function f(e,t,r,i,o,a){const s=r*i;let l=s+r;if(e[l]=a,l++,0==a)if(i<500)for(var c=0;c<i;c++)e[l+c]=t[s+c];else e.set(new Uint8Array(t.buffer,s,i),l);else if(1==a){for(c=0;c<o;c++)e[l+c]=t[s+c];for(c=o;c<i;c++)e[l+c]=t[s+c]-t[s+c-o]+256&255}else if(0==r){for(c=0;c<o;c++)e[l+c]=t[s+c];if(2==a)for(c=o;c<i;c++)e[l+c]=t[s+c];if(3==a)for(c=o;c<i;c++)e[l+c]=t[s+c]-(t[s+c-o]>>1)+256&255;if(4==a)for(c=o;c<i;c++)e[l+c]=t[s+c]-n(t[s+c-o],0,0)+256&255}else{if(2==a)for(c=0;c<i;c++)e[l+c]=t[s+c]+256-t[s+c-i]&255;if(3==a){for(c=0;c<o;c++)e[l+c]=t[s+c]+256-(t[s+c-i]>>1)&255;for(c=o;c<i;c++)e[l+c]=t[s+c]+256-(t[s+c-i]+t[s+c-o]>>1)&255}if(4==a){for(c=0;c<o;c++)e[l+c]=t[s+c]+256-n(0,t[s+c-i],0)&255;for(c=o;c<i;c++)e[l+c]=t[s+c]+256-n(t[s+c-o],t[s+c-i],t[s+c-o-i])&255}}}function m(e,t){const n=new Uint8Array(e),r=n.slice(0),i=new Uint32Array(r.buffer),o=g(r,t),a=o[0],s=o[1],l=n.length,c=new Uint8Array(l>>2);let u;if(n.length<2e7)for(var d=0;d<l;d+=4)u=v(a,h=n[d]*(1/255),p=n[d+1]*(1/255),f=n[d+2]*(1/255),m=n[d+3]*(1/255)),c[d>>2]=u.ind,i[d>>2]=u.est.rgba;else for(d=0;d<l;d+=4){var h=n[d]*(1/255),p=n[d+1]*(1/255),f=n[d+2]*(1/255),m=n[d+3]*(1/255);for(u=a;u.left;)u=y(u.est,h,p,f,m)<=0?u.left:u.right;c[d>>2]=u.ind,i[d>>2]=u.est.rgba}return{abuf:r.buffer,inds:c,plte:s}}function g(e,t,n){null==n&&(n=1e-4);const r=new Uint32Array(e.buffer),i={i0:0,i1:e.length,bst:null,est:null,tdst:0,left:null,right:null};i.bst=_(e,i.i0,i.i1),i.est=w(i.bst);const o=[i];for(;o.length<t;){let t=0,i=0;for(var a=0;a<o.length;a++)o[a].est.L>t&&(t=o[a].est.L,i=a);if(t<n)break;const s=o[i],l=b(e,r,s.i0,s.i1,s.est.e,s.est.eMq255);if(s.i0>=l||s.i1<=l){s.est.L=0;continue}const c={i0:s.i0,i1:l,bst:null,est:null,tdst:0,left:null,right:null};c.bst=_(e,c.i0,c.i1),c.est=w(c.bst);const u={i0:l,i1:s.i1,bst:null,est:null,tdst:0,left:null,right:null};for(u.bst={R:[],m:[],N:s.bst.N-c.bst.N},a=0;a<16;a++)u.bst.R[a]=s.bst.R[a]-c.bst.R[a];for(a=0;a<4;a++)u.bst.m[a]=s.bst.m[a]-c.bst.m[a];u.est=w(u.bst),s.left=c,s.right=u,o[i]=c,o.push(u)}for(o.sort((e,t)=>t.bst.N-e.bst.N),a=0;a<o.length;a++)o[a].ind=a;return[i,o]}function v(e,t,n,r,i){if(null==e.left)return e.tdst=function(e,t,n,r,i){const o=t-e[0],a=n-e[1],s=r-e[2],l=i-e[3];return o*o+a*a+s*s+l*l}(e.est.q,t,n,r,i),e;const o=y(e.est,t,n,r,i);let a=e.left,s=e.right;o>0&&(a=e.right,s=e.left);const l=v(a,t,n,r,i);if(l.tdst<=o*o)return l;const c=v(s,t,n,r,i);return c.tdst<l.tdst?c:l}function y(e,t,n,r,i){const{e:o}=e;return o[0]*t+o[1]*n+o[2]*r+o[3]*i-e.eMq}function b(e,t,n,r,i,o){for(r-=4;n<r;){for(;x(e,n,i)<=o;)n+=4;for(;x(e,r,i)>o;)r-=4;if(n>=r)break;const a=t[n>>2];t[n>>2]=t[r>>2],t[r>>2]=a,n+=4,r-=4}for(;x(e,n,i)>o;)n-=4;return n+4}function x(e,t,n){return e[t]*n[0]+e[t+1]*n[1]+e[t+2]*n[2]+e[t+3]*n[3]}function _(e,t,n){const r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=[0,0,0,0],o=n-t>>2;for(let a=t;a<n;a+=4){const t=e[a]*(1/255),n=e[a+1]*(1/255),o=e[a+2]*(1/255),s=e[a+3]*(1/255);i[0]+=t,i[1]+=n,i[2]+=o,i[3]+=s,r[0]+=t*t,r[1]+=t*n,r[2]+=t*o,r[3]+=t*s,r[5]+=n*n,r[6]+=n*o,r[7]+=n*s,r[10]+=o*o,r[11]+=o*s,r[15]+=s*s}return r[4]=r[1],r[8]=r[2],r[9]=r[6],r[12]=r[3],r[13]=r[7],r[14]=r[11],{R:r,m:i,N:o}}function w(e){const{R:t}=e,{m:n}=e,{N:r}=e,i=n[0],o=n[1],a=n[2],s=n[3],l=0==r?0:1/r,c=[t[0]-i*i*l,t[1]-i*o*l,t[2]-i*a*l,t[3]-i*s*l,t[4]-o*i*l,t[5]-o*o*l,t[6]-o*a*l,t[7]-o*s*l,t[8]-a*i*l,t[9]-a*o*l,t[10]-a*a*l,t[11]-a*s*l,t[12]-s*i*l,t[13]-s*o*l,t[14]-s*a*l,t[15]-s*s*l],u=c,d=S;let h=[Math.random(),Math.random(),Math.random(),Math.random()],p=0,f=0;if(0!=r)for(let g=0;g<16&&(h=d.multVec(u,h),f=Math.sqrt(d.dot(h,h)),h=d.sml(1/f,h),!(0!=g&&Math.abs(f-p)<1e-9));g++)p=f;const m=[i*l,o*l,a*l,s*l];return{Cov:c,q:m,e:h,L:p,eMq255:d.dot(d.sml(255,m),h),eMq:d.dot(h,m),rgba:(Math.round(255*m[3])<<24|Math.round(255*m[2])<<16|Math.round(255*m[1])<<8|Math.round(255*m[0]))>>>0}}var S={multVec:(e,t)=>[e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],e[4]*t[0]+e[5]*t[1]+e[6]*t[2]+e[7]*t[3],e[8]*t[0]+e[9]*t[1]+e[10]*t[2]+e[11]*t[3],e[12]*t[0]+e[13]*t[1]+e[14]*t[2]+e[15]*t[3]],dot:(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],sml:(e,t)=>[e*t[0],e*t[1],e*t[2],e*t[3]]};Fv.encode=function(e,t,n,r,i,o,a){null==r&&(r=0),null==a&&(a=!1);const s=u(e,t,n,r,[!1,!1,!1,0,a,!1]);return c(s,-1),l(s,t,n,i,o)},Fv.encodeLL=function(e,t,n,r,i,o,a,s){const u={ctype:0+(1==r?0:2)+(0==i?0:4),depth:o,frames:[]},d=(r+i)*o,h=d*t;for(let l=0;l<e.length;l++)u.frames.push({rect:{x:0,y:0,width:t,height:n},img:new Uint8Array(e[l]),blend:0,dispose:1,bpp:Math.ceil(d/8),bpl:Math.ceil(h/8)});return c(u,0,!0),l(u,t,n,a,s)},Fv.encode.compress=u,Fv.encode.dither=s,Fv.quantize=m,Fv.quantize.getKDtree=g,Fv.quantize.getNearest=v}();const zv={toArrayBuffer(e,t){const n=e.width,r=e.height,i=n<<2,o=e.getContext("2d").getImageData(0,0,n,r),a=new Uint32Array(o.data.buffer),s=(32*n+31)/32<<2,l=s*r,c=122+l,u=new ArrayBuffer(c),d=new DataView(u),h=1<<20;let p,f,m,g,v=h,y=0,b=0,x=0;function _(e){d.setUint16(b,e,!0),b+=2}function w(e){d.setUint32(b,e,!0),b+=4}function S(e){b+=e}_(19778),w(c),S(4),w(122),w(108),w(n),w(-r>>>0),_(1),_(32),w(3),w(l),w(2835),w(2835),S(8),w(16711680),w(65280),w(255),w(4278190080),w(1466527264),function e(){for(;y<r&&v>0;){for(g=122+y*s,p=0;p<i;)v--,f=a[x++],m=f>>>24,d.setUint32(g+p,f<<8|m),p+=4;y++}x<a.length?(v=h,setTimeout(e,zv._dly)):t(u)}()},toBlob(e,t){this.toArrayBuffer(e,e=>{t(new Blob([e],{type:"image/bmp"}))})},_dly:9};var Bv={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},Vv={[Bv.CHROME]:16384,[Bv.FIREFOX]:11180,[Bv.DESKTOP_SAFARI]:16384,[Bv.IE]:8192,[Bv.IOS]:4096,[Bv.ETC]:8192};const jv="undefined"!=typeof window,Hv="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,Wv=jv&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),Gv=(jv||Hv)&&(Wv&&Wv.getOriginalSymbol(window,"File")||"undefined"!=typeof File&&File),Xv=(jv||Hv)&&(Wv&&Wv.getOriginalSymbol(window,"FileReader")||"undefined"!=typeof FileReader&&FileReader);function qv(e,t,n=Date.now()){return new Promise(r=>{const i=e.split(","),o=i[0].match(/:(.*?);/)[1],a=globalThis.atob(i[1]);let s=a.length;const l=new Uint8Array(s);for(;s--;)l[s]=a.charCodeAt(s);const c=new Blob([l],{type:o});c.name=t,c.lastModified=n,r(c)})}function $v(e){return new Promise((t,n)=>{const r=new Xv;r.onload=()=>t(r.result),r.onerror=e=>n(e),r.readAsDataURL(e)})}function Yv(e){return new Promise((t,n)=>{const r=new Image;r.onload=()=>t(r),r.onerror=e=>n(e),r.src=e})}function Zv(){if(void 0!==Zv.cachedResult)return Zv.cachedResult;let e=Bv.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=Bv.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=Bv.IOS:/Safari/i.test(t)?e=Bv.DESKTOP_SAFARI:/Firefox/i.test(t)?e=Bv.FIREFOX:(/MSIE/i.test(t)||1==!!document.documentMode)&&(e=Bv.IE),Zv.cachedResult=e,Zv.cachedResult}function Jv(e,t){const n=Zv(),r=Vv[n];let i=e,o=t,a=i*o;const s=i>o?o/i:i/o;for(;a>r*r;){const e=(r+i)/2,t=(r+o)/2;e<t?(o=t,i=t*s):(o=e*s,i=e),a=i*o}return{width:i,height:o}}function Kv(e,t){let n,r;try{if(n=new OffscreenCanvas(e,t),r=n.getContext("2d"),null===r)throw new Error("getContext of OffscreenCanvas returns null")}catch(i){n=document.createElement("canvas"),r=n.getContext("2d")}return n.width=e,n.height=t,[n,r]}function Qv(e,t){const{width:n,height:r}=Jv(e.width,e.height),[i,o]=Kv(n,r);return t&&/jpe?g/.test(t)&&(o.fillStyle="white",o.fillRect(0,0,i.width,i.height)),o.drawImage(e,0,0,i.width,i.height),i}function ey(){return void 0!==ey.cachedResult||(ey.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"undefined"!=typeof document&&"ontouchend"in document),ey.cachedResult}function ty(e,t={}){return new Promise(function(n,r){let i,o;var a=function(){try{return o=Qv(i,t.fileType||e.type),n([i,o])}catch(a){return r(a)}},s=function(t){try{var n=function(e){try{throw e}catch(t){return r(t)}};try{let t;return $v(e).then(function(e){try{return t=e,Yv(t).then(function(e){try{return i=e,function(){try{return a()}catch(e){return r(e)}}()}catch(t){return n(t)}},n)}catch(o){return n(o)}},n)}catch(o){n(o)}}catch(o){return r(o)}};try{if(ey()||[Bv.DESKTOP_SAFARI,Bv.MOBILE_SAFARI].includes(Zv()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then(function(e){try{return i=e,a()}catch(t){return s()}},s)}catch(l){s()}})}function ny(e,t,n,r,i=1){return new Promise(function(o,a){let s;if("image/png"===t){let o,a,c;return o=e.getContext("2d"),({data:a}=o.getImageData(0,0,e.width,e.height)),c=Fv.encode([a.buffer],e.width,e.height,4096*i),s=new Blob([c],{type:t}),s.name=n,s.lastModified=r,l.call(this)}{let o=function(){return l.call(this)};if("image/bmp"===t)return new Promise(t=>zv.toBlob(e,t)).then(function(e){try{return s=e,s.name=n,s.lastModified=r,o.call(this)}catch(t){return a(t)}}.bind(this),a);{let l=function(){return o.call(this)};if("function"==typeof OffscreenCanvas&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:i}).then(function(e){try{return s=e,s.name=n,s.lastModified=r,l.call(this)}catch(t){return a(t)}}.bind(this),a);{let o;return o=e.toDataURL(t,i),qv(o,n,r).then(function(e){try{return s=e,l.call(this)}catch(t){return a(t)}}.bind(this),a)}}}function l(){return o(s)}})}function ry(e){e.width=0,e.height=0}function iy(){return new Promise(function(e,t){let n,r,i,o;return void 0!==iy.cachedResult?e(iy.cachedResult):qv("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then(function(a){try{return n=a,ty(n).then(function(a){try{return r=a[1],ny(r,n.type,n.name,n.lastModified).then(function(n){try{return i=n,ry(r),ty(i).then(function(n){try{return o=n[0],iy.cachedResult=1===o.width&&2===o.height,e(iy.cachedResult)}catch(r){return t(r)}},t)}catch(a){return t(a)}},t)}catch(s){return t(s)}},t)}catch(s){return t(s)}},t)})}function oy(e){return new Promise((t,n)=>{const r=new Xv;r.onload=e=>{const n=new DataView(e.target.result);if(65496!=n.getUint16(0,!1))return t(-2);const r=n.byteLength;let i=2;for(;i<r;){if(n.getUint16(i+2,!1)<=8)return t(-1);const e=n.getUint16(i,!1);if(i+=2,65505==e){if(1165519206!=n.getUint32(i+=2,!1))return t(-1);const e=18761==n.getUint16(i+=6,!1);i+=n.getUint32(i+4,e);const r=n.getUint16(i,e);i+=2;for(let o=0;o<r;o++)if(274==n.getUint16(i+12*o,e))return t(n.getUint16(i+12*o+8,e))}else{if(65280&~e)break;i+=n.getUint16(i,!1)}}return t(-1)},r.onerror=e=>n(e),r.readAsArrayBuffer(e)})}function ay(e,t){const{width:n}=e,{height:r}=e,{maxWidthOrHeight:i}=t;let o,a=e;return isFinite(i)&&(n>i||r>i)&&([a,o]=Kv(n,r),n>r?(a.width=i,a.height=r/n*i):(a.width=n/r*i,a.height=i),o.drawImage(e,0,0,a.width,a.height),ry(e)),a}function sy(e,t){const{width:n}=e,{height:r}=e,[i,o]=Kv(n,r);switch(t>4&&t<9?(i.width=r,i.height=n):(i.width=n,i.height=r),t){case 2:o.transform(-1,0,0,1,n,0);break;case 3:o.transform(-1,0,0,-1,n,r);break;case 4:o.transform(1,0,0,-1,0,r);break;case 5:o.transform(0,1,1,0,0,0);break;case 6:o.transform(0,1,-1,0,r,0);break;case 7:o.transform(0,-1,-1,0,r,n);break;case 8:o.transform(0,-1,1,0,0,n)}return o.drawImage(e,0,0,n,r),ry(e),i}function ly(e,t,n=0){return new Promise(function(r,i){let o,a,s,l,c,u,d,h,p,f,m,g,v,y,b,x,_,w,S,M;function E(e=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;o+=e,t.onProgress(Math.min(o,100))}function T(e){if(t.signal&&t.signal.aborted)throw t.signal.reason;o=Math.min(Math.max(e,o),100),t.onProgress(o)}return o=n,a=t.maxIteration||10,s=1024*t.maxSizeMB*1024,E(),ty(e,t).then(function(n){try{return[,l]=n,E(),c=ay(l,t),E(),new Promise(function(n,r){var i;if(!(i=t.exifOrientation))return oy(e).then(function(e){try{return i=e,o.call(this)}catch(t){return r(t)}}.bind(this),r);function o(){return n(i)}return o.call(this)}).then(function(n){try{return u=n,E(),iy().then(function(n){try{return d=n?c:sy(c,u),E(),h=t.initialQuality||1,p=t.fileType||e.type,ny(d,p,e.name,e.lastModified,h).then(function(n){try{{let u=function(){if(a--&&(b>s||b>v)){let t,n;return t=M?.95*S.width:S.width,n=M?.95*S.height:S.height,[_,w]=Kv(t,n),w.drawImage(S,0,0,t,n),h*="image/png"===p?.85:.95,ny(_,p,e.name,e.lastModified,h).then(function(e){try{return x=e,ry(S),S=_,b=x.size,T(Math.min(99,Math.floor((y-b)/(y-s)*100))),u}catch(t){return i(t)}},i)}return[1]},A=function(){return ry(S),ry(_),ry(c),ry(d),ry(l),T(100),r(x)};return f=n,E(),m=f.size>s,g=f.size>e.size,m||g?(v=e.size,y=f.size,b=y,S=d,M=!t.alwaysKeepResolution&&m,(o=function(e){for(;e;){if(e.then)return void e.then(o,i);try{if(e.pop){if(e.length)return e.pop()?A.call(this):e;e=u}else e=e.call(this)}catch(t){return i(t)}}}.bind(this))(u)):(T(100),r(f));var o}}catch(u){return i(u)}}.bind(this),i)}catch(o){return i(o)}}.bind(this),i)}catch(o){return i(o)}}.bind(this),i)}catch(o){return i(o)}}.bind(this),i)})}let cy;function uy(e,t){return new Promise(function(n,r){let i,o,a,s,l,c;if(i={...t},a=0,({onProgress:s}=i),i.maxSizeMB=i.maxSizeMB||Number.POSITIVE_INFINITY,l="boolean"!=typeof i.useWebWorker||i.useWebWorker,delete i.useWebWorker,i.onProgress=e=>{a=e,"function"==typeof s&&s(a)},!(e instanceof Blob||e instanceof Gv))return r(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return r(new Error("The file given is not an image"));if(c="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,!l||"function"!=typeof Worker||c)return ly(e,i).then(function(e){try{return o=e,h.call(this)}catch(t){return r(t)}}.bind(this),r);var u=function(){try{return h.call(this)}catch(e){return r(e)}}.bind(this),d=function(t){try{return ly(e,i).then(function(e){try{return o=e,u()}catch(t){return r(t)}},r)}catch(n){return r(n)}};try{return i.libURL=i.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",function(e,t){return new Promise((n,r)=>{cy||(cy=function(e){const t=[];return t.push(e),URL.createObjectURL(new Blob(t))}("\nlet scriptImported = false\nself.addEventListener('message', async (e) => {\n const { file, id, imageCompressionLibUrl, options } = e.data\n options.onProgress = (progress) => self.postMessage({ progress, id })\n try {\n if (!scriptImported) {\n // console.log('[worker] importScripts', imageCompressionLibUrl)\n self.importScripts(imageCompressionLibUrl)\n scriptImported = true\n }\n // console.log('[worker] self', self)\n const compressedFile = await imageCompression(file, options)\n self.postMessage({ file: compressedFile, id })\n } catch (e) {\n // console.error('[worker] error', e)\n self.postMessage({ error: e.message + '\\n' + e.stack, id })\n }\n})\n"));const i=new Worker(cy);i.addEventListener("message",function(e){if(t.signal&&t.signal.aborted)i.terminate();else if(void 0===e.data.progress){if(e.data.error)return r(new Error(e.data.error)),void i.terminate();n(e.data.file),i.terminate()}else t.onProgress(e.data.progress)}),i.addEventListener("error",r),t.signal&&t.signal.addEventListener("abort",()=>{r(t.signal.reason),i.terminate()}),i.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})})}(e,i).then(function(e){try{return o=e,u()}catch(t){return d()}},d)}catch(p){d()}function h(){try{o.name=e.name,o.lastModified=e.lastModified}catch(p){}try{i.preserveExif&&"image/jpeg"===e.type&&(!i.fileType||i.fileType&&i.fileType===e.type)&&(o=kv(e,o))}catch(p){}return n(o)}})}uy.getDataUrlFromFile=$v,uy.getFilefromDataUrl=qv,uy.loadImage=Yv,uy.drawImageInCanvas=Qv,uy.drawFileInCanvas=ty,uy.canvasToFile=ny,uy.getExifOrientation=oy,uy.handleMaxWidthOrHeight=ay,uy.followExifOrientation=sy,uy.cleanupCanvasMemory=ry,uy.isAutoOrientationInBrowser=iy,uy.approximateBelowMaximumCanvasSizeOfBrowser=Jv,uy.copyExifWithoutOrientation=kv,uy.getBrowserName=Zv,uy.version="2.0.2";const dy=Object.freeze(Object.defineProperty({__proto__:null,default:uy},Symbol.toStringTag,{value:"Module"})),hy="182",py=1,fy=3,my=0,gy=1,vy=2,yy=100,by=101,xy=102,_y=200,wy=201,Sy=202,My=203,Ey=204,Ty=205,Ay=206,Cy=207,ky=208,Ry=209,Py=210,Iy=211,Ly=212,Ny=213,Oy=214,Dy=0,Uy=1,Fy=2,zy=3,By=4,Vy=5,jy=6,Hy=7,Wy=0,Gy=1,Xy=2,qy=1,$y=2,Yy=3,Zy=4,Jy=5,Ky=6,Qy=7,eb="attached",tb="detached",nb=300,rb=301,ib=302,ob=303,ab=304,sb=306,lb=1e3,cb=1001,ub=1002,db=1003,hb=1004,pb=1005,fb=1006,mb=1007,gb=1008,vb=1009,yb=1010,bb=1011,xb=1012,_b=1013,wb=1014,Sb=1015,Mb=1016,Eb=1017,Tb=1018,Ab=1020,Cb=35902,kb=35899,Rb=1021,Pb=1022,Ib=1023,Lb=1026,Nb=1027,Ob=1028,Db=1029,Ub=1030,Fb=1031,zb=1033,Bb=33776,Vb=33777,jb=33778,Hb=33779,Wb=35840,Gb=35841,Xb=35842,qb=35843,$b=36196,Yb=37492,Zb=37496,Jb=37488,Kb=37489,Qb=37490,ex=37491,tx=37808,nx=37809,rx=37810,ix=37811,ox=37812,ax=37813,sx=37814,lx=37815,cx=37816,ux=37817,dx=37818,hx=37819,px=37820,fx=37821,mx=36492,gx=36494,vx=36495,yx=36283,bx=36284,xx=36285,_x=36286,wx=2300,Sx=2301,Mx=2302,Ex=2400,Tx=2401,Ax=2402,Cx=2500,kx=2501,Rx="",Px="srgb",Ix="srgb-linear",Lx="linear",Nx="srgb",Ox=7680,Dx=512,Ux=513,Fx=514,zx=515,Bx=516,Vx=517,jx=518,Hx=519,Wx=35044,Gx="300 es",Xx=2e3,qx=2001;function $x(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}const Yx={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Zx(e,t){return new Yx[e](t)}function Jx(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Kx(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function Qx(){const e=Kx("canvas");return e.style.display="block",e}const e_={};let t_=null;function n_(...e){const t="THREE."+e.shift();t_?t_("log",t,...e):console.log(t,...e)}function r_(...e){const t="THREE."+e.shift();t_?t_("warn",t,...e):console.warn(t,...e)}function i_(...e){const t="THREE."+e.shift();t_?t_("error",t,...e):console.error(t,...e)}function o_(...e){const t=e.join(" ");t in e_||(e_[t]=!0,r_(...e))}class a_{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return void 0!==n&&(void 0!==n[e]&&-1!==n[e].indexOf(t))}removeEventListener(e,t){const n=this._listeners;if(void 0===n)return;const r=n[e];if(void 0!==r){const e=r.indexOf(t);-1!==e&&r.splice(e,1)}}dispatchEvent(e){const t=this._listeners;if(void 0===t)return;const n=t[e.type];if(void 0!==n){e.target=this;const t=n.slice(0);for(let n=0,r=t.length;n<r;n++)t[n].call(this,e);e.target=null}}}const s_=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let l_=1234567;const c_=Math.PI/180,u_=180/Math.PI;function d_(){const e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(s_[255&e]+s_[e>>8&255]+s_[e>>16&255]+s_[e>>24&255]+"-"+s_[255&t]+s_[t>>8&255]+"-"+s_[t>>16&15|64]+s_[t>>24&255]+"-"+s_[63&n|128]+s_[n>>8&255]+"-"+s_[n>>16&255]+s_[n>>24&255]+s_[255&r]+s_[r>>8&255]+s_[r>>16&255]+s_[r>>24&255]).toLowerCase()}function h_(e,t,n){return Math.max(t,Math.min(n,e))}function p_(e,t){return(e%t+t)%t}function f_(e,t,n){return(1-n)*e+n*t}function m_(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function g_(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}const v_={DEG2RAD:c_,RAD2DEG:u_,generateUUID:d_,clamp:h_,euclideanModulo:p_,mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:f_,damp:function(e,t,n,r){return f_(e,t,1-Math.exp(-n*r))},pingpong:function(e,t=1){return t-Math.abs(p_(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(l_=e);let t=l_+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*c_},radToDeg:function(e){return e*u_},isPowerOfTwo:function(e){return!(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,r,i){const o=Math.cos,a=Math.sin,s=o(n/2),l=a(n/2),c=o((t+r)/2),u=a((t+r)/2),d=o((t-r)/2),h=a((t-r)/2),p=o((r-t)/2),f=a((r-t)/2);switch(i){case"XYX":e.set(s*u,l*d,l*h,s*c);break;case"YZY":e.set(l*h,s*u,l*d,s*c);break;case"ZXZ":e.set(l*d,l*h,s*u,s*c);break;case"XZX":e.set(s*u,l*f,l*p,s*c);break;case"YXY":e.set(l*p,s*u,l*f,s*c);break;case"ZYZ":e.set(l*f,l*p,s*u,s*c);break;default:r_("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}},normalize:g_,denormalize:m_};class y_{constructor(e=0,t=0){y_.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,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[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=h_(this.x,e.x,t.x),this.y=h_(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=h_(this.x,e,t),this.y=h_(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(h_(n,e,t))}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(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(h_(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,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 n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,o=this.y-e.y;return this.x=i*n-o*r+e.x,this.y=i*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class b_{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,o,a){let s=n[r+0],l=n[r+1],c=n[r+2],u=n[r+3],d=i[o+0],h=i[o+1],p=i[o+2],f=i[o+3];if(a<=0)return e[t+0]=s,e[t+1]=l,e[t+2]=c,void(e[t+3]=u);if(a>=1)return e[t+0]=d,e[t+1]=h,e[t+2]=p,void(e[t+3]=f);if(u!==f||s!==d||l!==h||c!==p){let e=s*d+l*h+c*p+u*f;e<0&&(d=-d,h=-h,p=-p,f=-f,e=-e);let t=1-a;if(e<.9995){const n=Math.acos(e),r=Math.sin(n);t=Math.sin(t*n)/r,s=s*t+d*(a=Math.sin(a*n)/r),l=l*t+h*a,c=c*t+p*a,u=u*t+f*a}else{s=s*t+d*a,l=l*t+h*a,c=c*t+p*a,u=u*t+f*a;const e=1/Math.sqrt(s*s+l*l+c*c+u*u);s*=e,l*=e,c*=e,u*=e}}e[t]=s,e[t+1]=l,e[t+2]=c,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,o){const a=n[r],s=n[r+1],l=n[r+2],c=n[r+3],u=i[o],d=i[o+1],h=i[o+2],p=i[o+3];return e[t]=a*p+c*u+s*h-l*d,e[t+1]=s*p+c*d+l*u-a*h,e[t+2]=l*p+c*h+a*d-s*u,e[t+3]=c*p-a*u-s*d-l*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,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,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 n=e._x,r=e._y,i=e._z,o=e._order,a=Math.cos,s=Math.sin,l=a(n/2),c=a(r/2),u=a(i/2),d=s(n/2),h=s(r/2),p=s(i/2);switch(o){case"XYZ":this._x=d*c*u+l*h*p,this._y=l*h*u-d*c*p,this._z=l*c*p+d*h*u,this._w=l*c*u-d*h*p;break;case"YXZ":this._x=d*c*u+l*h*p,this._y=l*h*u-d*c*p,this._z=l*c*p-d*h*u,this._w=l*c*u+d*h*p;break;case"ZXY":this._x=d*c*u-l*h*p,this._y=l*h*u+d*c*p,this._z=l*c*p+d*h*u,this._w=l*c*u-d*h*p;break;case"ZYX":this._x=d*c*u-l*h*p,this._y=l*h*u+d*c*p,this._z=l*c*p-d*h*u,this._w=l*c*u+d*h*p;break;case"YZX":this._x=d*c*u+l*h*p,this._y=l*h*u+d*c*p,this._z=l*c*p-d*h*u,this._w=l*c*u-d*h*p;break;case"XZY":this._x=d*c*u-l*h*p,this._y=l*h*u-d*c*p,this._z=l*c*p+d*h*u,this._w=l*c*u+d*h*p;break;default:r_("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],i=t[8],o=t[1],a=t[5],s=t[9],l=t[2],c=t[6],u=t[10],d=n+a+u;if(d>0){const e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(c-s)*e,this._y=(i-l)*e,this._z=(o-r)*e}else if(n>a&&n>u){const e=2*Math.sqrt(1+n-a-u);this._w=(c-s)/e,this._x=.25*e,this._y=(r+o)/e,this._z=(i+l)/e}else if(a>u){const e=2*Math.sqrt(1+a-n-u);this._w=(i-l)/e,this._x=(r+o)/e,this._y=.25*e,this._z=(s+c)/e}else{const e=2*Math.sqrt(1+u-n-a);this._w=(o-r)/e,this._x=(i+l)/e,this._y=(s+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(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=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(h_(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const r=Math.min(1,t/n);return this.slerp(e,r),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 0===e?(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 n=e._x,r=e._y,i=e._z,o=e._w,a=t._x,s=t._y,l=t._z,c=t._w;return this._x=n*c+o*a+r*l-i*s,this._y=r*c+o*s+i*a-n*l,this._z=i*c+o*l+n*s-r*a,this._w=o*c-n*a-r*s-i*l,this._onChangeCallback(),this}slerp(e,t){if(t<=0)return this;if(t>=1)return this.copy(e);let n=e._x,r=e._y,i=e._z,o=e._w,a=this.dot(e);a<0&&(n=-n,r=-r,i=-i,o=-o,a=-a);let s=1-t;if(a<.9995){const e=Math.acos(a),l=Math.sin(e);s=Math.sin(s*e)/l,t=Math.sin(t*e)/l,this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+o*t,this._onChangeCallback()}else this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*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 x_{constructor(e=0,t=0,n=0){x_.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,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(w_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(w_.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,i=e.elements,o=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*o,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*o,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,i=e.x,o=e.y,a=e.z,s=e.w,l=2*(o*r-a*n),c=2*(a*t-i*r),u=2*(i*n-o*t);return this.x=t+s*l+o*u-a*c,this.y=n+s*c+a*l-i*u,this.z=r+s*u+i*c-o*l,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,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,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=h_(this.x,e.x,t.x),this.y=h_(this.y,e.y,t.y),this.z=h_(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=h_(this.x,e,t),this.y=h_(this.y,e,t),this.z=h_(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(h_(n,e,t))}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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,i=e.z,o=t.x,a=t.y,s=t.z;return this.x=r*s-i*a,this.y=i*o-n*s,this.z=n*a-r*o,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return __.copy(this).projectOnVector(e),this.sub(__)}reflect(e){return this.sub(__.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(h_(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}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,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,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(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}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=2*Math.random()-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const __=new x_,w_=new b_;class S_{constructor(e,t,n,r,i,o,a,s,l){S_.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,r,i,o,a,s,l)}set(e,t,n,r,i,o,a,s,l){const c=this.elements;return c[0]=e,c[1]=r,c[2]=a,c[3]=t,c[4]=i,c[5]=s,c[6]=n,c[7]=o,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.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 n=e.elements,r=t.elements,i=this.elements,o=n[0],a=n[3],s=n[6],l=n[1],c=n[4],u=n[7],d=n[2],h=n[5],p=n[8],f=r[0],m=r[3],g=r[6],v=r[1],y=r[4],b=r[7],x=r[2],_=r[5],w=r[8];return i[0]=o*f+a*v+s*x,i[3]=o*m+a*y+s*_,i[6]=o*g+a*b+s*w,i[1]=l*f+c*v+u*x,i[4]=l*m+c*y+u*_,i[7]=l*g+c*b+u*w,i[2]=d*f+h*v+p*x,i[5]=d*m+h*y+p*_,i[8]=d*g+h*b+p*w,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],n=e[1],r=e[2],i=e[3],o=e[4],a=e[5],s=e[6],l=e[7],c=e[8];return t*o*c-t*a*l-n*i*c+n*a*s+r*i*l-r*o*s}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],a=e[5],s=e[6],l=e[7],c=e[8],u=c*o-a*l,d=a*s-c*i,h=l*i-o*s,p=t*u+n*d+r*h;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return e[0]=u*f,e[1]=(r*l-c*n)*f,e[2]=(a*n-r*o)*f,e[3]=d*f,e[4]=(c*t-r*s)*f,e[5]=(r*i-a*t)*f,e[6]=h*f,e[7]=(n*s-l*t)*f,e[8]=(o*t-n*i)*f,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,n,r,i,o,a){const s=Math.cos(i),l=Math.sin(i);return this.set(n*s,n*l,-n*(s*o+l*a)+o+e,-r*l,r*s,-r*(-l*o+s*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(M_.makeScale(e,t)),this}rotate(e){return this.premultiply(M_.makeRotation(-e)),this}translate(e,t){return this.premultiply(M_.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),n=Math.sin(e);return this.set(t,-n,0,n,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,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}const M_=new S_,E_=(new S_).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),T_=(new S_).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function A_(){const e={enabled:!0,workingColorSpace:Ix,spaces:{},convert:function(e,t,n){return!1!==this.enabled&&t!==n&&t&&n?(this.spaces[t].transfer===Nx&&(e.r=k_(e.r),e.g=k_(e.g),e.b=k_(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===Nx&&(e.r=R_(e.r),e.g=R_(e.g),e.b=R_(e.b)),e):e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===Rx?Lx:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return o_("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return o_("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[Ix]:{primaries:t,whitePoint:r,transfer:Lx,toXYZ:E_,fromXYZ:T_,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:Px},outputColorSpaceConfig:{drawingBufferColorSpace:Px}},[Px]:{primaries:t,whitePoint:r,transfer:Nx,toXYZ:E_,fromXYZ:T_,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:Px}}}),e}const C_=A_();function k_(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function R_(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let P_;class I_{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{void 0===P_&&(P_=Kx("canvas")),P_.width=e.width,P_.height=e.height;const t=P_.getContext("2d");e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=P_}return n.toDataURL(t)}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=Kx("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e<i.length;e++)i[e]=255*k_(i[e]/255);return n.putImageData(r,0,0),t}if(e.data){const t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*k_(t[e]/255)):t[e]=k_(t[e]);return{data:t,width:e.width,height:e.height}}return r_("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let L_=0;class N_{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:L_++}),this.uuid=d_(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return"undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):"undefined"!=typeof VideoFrame&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):null!==t?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){!0===e&&this.version++}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(null!==r){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t<n;t++)r[t].isDataTexture?e.push(O_(r[t].image)):e.push(O_(r[t]))}else e=O_(r);n.url=e}return t||(e.images[this.uuid]=n),n}}function O_(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?I_.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(r_("Texture: Unable to serialize Texture."),{})}let D_=0;const U_=new x_;class F_ extends a_{constructor(e=F_.DEFAULT_IMAGE,t=F_.DEFAULT_MAPPING,n=1001,r=1001,i=1006,o=1008,a=1023,s=vb,l=F_.DEFAULT_ANISOTROPY,c=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:D_++}),this.uuid=d_(),this.name="",this.source=new N_(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=i,this.minFilter=o,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=s,this.offset=new y_(0,0),this.repeat=new y_(1,1),this.center=new y_(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new S_,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(U_).x}get height(){return this.source.getSize(U_).y}get depth(){return this.source.getSize(U_).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return(new this.constructor).copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(void 0===n){r_(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];void 0!==r?r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n:r_(`Texture.setValues(): property '${t}' does not exist.`)}}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==nb)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case lb:e.x=e.x-Math.floor(e.x);break;case cb:e.x=e.x<0?0:1;break;case ub:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case lb:e.y=e.y-Math.floor(e.y);break;case cb:e.y=e.y<0?0:1;break;case ub:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}F_.DEFAULT_IMAGE=null,F_.DEFAULT_MAPPING=nb,F_.DEFAULT_ANISOTROPY=1;class z_{constructor(e=0,t=0,n=0,r=1){z_.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}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,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,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=void 0!==e.w?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,n=this.y,r=this.z,i=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*i,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*i,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*i,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,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,n,r,i;const o=.01,a=.1,s=e.elements,l=s[0],c=s[4],u=s[8],d=s[1],h=s[5],p=s[9],f=s[2],m=s[6],g=s[10];if(Math.abs(c-d)<o&&Math.abs(u-f)<o&&Math.abs(p-m)<o){if(Math.abs(c+d)<a&&Math.abs(u+f)<a&&Math.abs(p+m)<a&&Math.abs(l+h+g-3)<a)return this.set(1,0,0,0),this;t=Math.PI;const e=(l+1)/2,s=(h+1)/2,v=(g+1)/2,y=(c+d)/4,b=(u+f)/4,x=(p+m)/4;return e>s&&e>v?e<o?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(e),r=y/n,i=b/n):s>v?s<o?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),n=y/r,i=x/r):v<o?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(v),n=b/i,r=x/i),this.set(n,r,i,t),this}let v=Math.sqrt((m-p)*(m-p)+(u-f)*(u-f)+(d-c)*(d-c));return Math.abs(v)<.001&&(v=1),this.x=(m-p)/v,this.y=(u-f)/v,this.z=(d-c)/v,this.w=Math.acos((l+h+g-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=h_(this.x,e.x,t.x),this.y=h_(this.y,e.y,t.y),this.z=h_(this.z,e.z,t.z),this.w=h_(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=h_(this.x,e,t),this.y=h_(this.y,e,t),this.z=h_(this.z,e,t),this.w=h_(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(h_(n,e,t))}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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,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 B_ extends a_{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:fb,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new z_(0,0,e,t),this.scissorTest=!1,this.viewport=new z_(0,0,e,t);const r={width:e,height:t,depth:n.depth},i=new F_(r);this.textures=[];const o=n.count;for(let a=0;a<o;a++)this.textures[a]=i.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:fb,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==e.mapping&&(t.mapping=e.mapping),void 0!==e.wrapS&&(t.wrapS=e.wrapS),void 0!==e.wrapT&&(t.wrapT=e.wrapT),void 0!==e.wrapR&&(t.wrapR=e.wrapR),void 0!==e.magFilter&&(t.magFilter=e.magFilter),void 0!==e.minFilter&&(t.minFilter=e.minFilter),void 0!==e.format&&(t.format=e.format),void 0!==e.type&&(t.type=e.type),void 0!==e.anisotropy&&(t.anisotropy=e.anisotropy),void 0!==e.colorSpace&&(t.colorSpace=e.colorSpace),void 0!==e.flipY&&(t.flipY=e.flipY),void 0!==e.generateMipmaps&&(t.generateMipmaps=e.generateMipmaps),void 0!==e.internalFormat&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++){this.textures[n].setValues(t)}}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==e&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,i=this.textures.length;r<i;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,!0!==this.textures[r].isData3DTexture&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return(new this.constructor).copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const n=Object.assign({},e.textures[t].image);this.textures[t].source=new N_(n)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class V_ extends B_{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class j_ extends F_{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=db,this.minFilter=db,this.wrapR=cb,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class H_ extends F_{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=db,this.minFilter=db,this.wrapR=cb,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class W_{constructor(e=new x_(1/0,1/0,1/0),t=new x_(-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,n=e.length;t<n;t+=3)this.expandByPoint(X_.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(X_.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=X_.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(void 0!==n){const r=n.getAttribute("position");if(!0===t&&void 0!==r&&!0!==e.isInstancedMesh)for(let t=0,n=r.count;t<n;t++)!0===e.isMesh?e.getVertexPosition(t,X_):X_.fromBufferAttribute(r,t),X_.applyMatrix4(e.matrixWorld),this.expandByPoint(X_);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),q_.copy(e.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),q_.copy(n.boundingBox)),q_.applyMatrix4(e.matrixWorld),this.union(q_)}const r=e.children;for(let i=0,o=r.length;i<o;i++)this.expandByObject(r[i],t);return this}containsPoint(e){return e.x>=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,X_),X_.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ew),tw.subVectors(this.max,ew),$_.subVectors(e.a,ew),Y_.subVectors(e.b,ew),Z_.subVectors(e.c,ew),J_.subVectors(Y_,$_),K_.subVectors(Z_,Y_),Q_.subVectors($_,Z_);let t=[0,-J_.z,J_.y,0,-K_.z,K_.y,0,-Q_.z,Q_.y,J_.z,0,-J_.x,K_.z,0,-K_.x,Q_.z,0,-Q_.x,-J_.y,J_.x,0,-K_.y,K_.x,0,-Q_.y,Q_.x,0];return!!iw(t,$_,Y_,Z_,tw)&&(t=[1,0,0,0,1,0,0,0,1],!!iw(t,$_,Y_,Z_,tw)&&(nw.crossVectors(J_,K_),t=[nw.x,nw.y,nw.z],iw(t,$_,Y_,Z_,tw)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,X_).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(X_).length()),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()||(G_[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),G_[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),G_[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),G_[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),G_[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),G_[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),G_[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),G_[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(G_)),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)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const G_=[new x_,new x_,new x_,new x_,new x_,new x_,new x_,new x_],X_=new x_,q_=new W_,$_=new x_,Y_=new x_,Z_=new x_,J_=new x_,K_=new x_,Q_=new x_,ew=new x_,tw=new x_,nw=new x_,rw=new x_;function iw(e,t,n,r,i){for(let o=0,a=e.length-3;o<=a;o+=3){rw.fromArray(e,o);const a=i.x*Math.abs(rw.x)+i.y*Math.abs(rw.y)+i.z*Math.abs(rw.z),s=t.dot(rw),l=n.dot(rw),c=r.dot(rw);if(Math.max(-Math.max(s,l,c),Math.min(s,l,c))>a)return!1}return!0}const ow=new W_,aw=new x_,sw=new x_;class lw{constructor(e=new x_,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 n=this.center;void 0!==t?n.copy(t):ow.setFromPoints(e).getCenter(n);let r=0;for(let i=0,o=e.length;i<o;i++)r=Math.max(r,n.distanceToSquared(e[i]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.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;aw.subVectors(e,this.center);const t=aw.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.addScaledVector(aw,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(sw.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(aw.copy(e.center).add(sw)),this.expandByPoint(aw.copy(e.center).sub(sw))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const cw=new x_,uw=new x_,dw=new x_,hw=new x_,pw=new x_,fw=new x_,mw=new x_;class gw{constructor(e=new x_,t=new x_(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,cw)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=cw.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(cw.copy(this.origin).addScaledVector(this.direction,t),cw.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){uw.copy(e).add(t).multiplyScalar(.5),dw.copy(t).sub(e).normalize(),hw.copy(this.origin).sub(uw);const i=.5*e.distanceTo(t),o=-this.direction.dot(dw),a=hw.dot(this.direction),s=-hw.dot(dw),l=hw.lengthSq(),c=Math.abs(1-o*o);let u,d,h,p;if(c>0)if(u=o*s-a,d=o*a-s,p=i*c,u>=0)if(d>=-p)if(d<=p){const e=1/c;u*=e,d*=e,h=u*(u+o*d+2*a)+d*(o*u+d+2*s)+l}else d=i,u=Math.max(0,-(o*d+a)),h=-u*u+d*(d+2*s)+l;else d=-i,u=Math.max(0,-(o*d+a)),h=-u*u+d*(d+2*s)+l;else d<=-p?(u=Math.max(0,-(-o*i+a)),d=u>0?-i:Math.min(Math.max(-i,-s),i),h=-u*u+d*(d+2*s)+l):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),h=d*(d+2*s)+l):(u=Math.max(0,-(o*i+a)),d=u>0?i:Math.min(Math.max(-i,-s),i),h=-u*u+d*(d+2*s)+l);else d=o>0?-i:i,u=Math.max(0,-(o*d+a)),h=-u*u+d*(d+2*s)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(uw).addScaledVector(dw,d),h}intersectSphere(e,t){cw.subVectors(e.center,this.origin);const n=cw.dot(this.direction),r=cw.dot(cw)-n*n,i=e.radius*e.radius;if(r>i)return null;const o=Math.sqrt(i-r),a=n-o,s=n+o;return s<0?null:a<0?this.at(s,t):this.at(a,t)}intersectsSphere(e){return!(e.radius<0)&&this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);if(0===t)return!0;return e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,o,a,s;const l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,r=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,r=(e.min.x-d.x)*l),c>=0?(i=(e.min.y-d.y)*c,o=(e.max.y-d.y)*c):(i=(e.max.y-d.y)*c,o=(e.min.y-d.y)*c),n>o||i>r?null:((i>n||isNaN(n))&&(n=i),(o<r||isNaN(r))&&(r=o),u>=0?(a=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(a=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||a>r?null:((a>n||n!=n)&&(n=a),(s<r||r!=r)&&(r=s),r<0?null:this.at(n>=0?n:r,t)))}intersectsBox(e){return null!==this.intersectBox(e,cw)}intersectTriangle(e,t,n,r,i){pw.subVectors(t,e),fw.subVectors(n,e),mw.crossVectors(pw,fw);let o,a=this.direction.dot(mw);if(a>0){if(r)return null;o=1}else{if(!(a<0))return null;o=-1,a=-a}hw.subVectors(this.origin,e);const s=o*this.direction.dot(fw.crossVectors(hw,fw));if(s<0)return null;const l=o*this.direction.dot(pw.cross(hw));if(l<0)return null;if(s+l>a)return null;const c=-o*hw.dot(mw);return c<0?null:this.at(c/a,i)}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 vw{constructor(e,t,n,r,i,o,a,s,l,c,u,d,h,p,f,m){vw.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,r,i,o,a,s,l,c,u,d,h,p,f,m)}set(e,t,n,r,i,o,a,s,l,c,u,d,h,p,f,m){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=o,g[9]=a,g[13]=s,g[2]=l,g[6]=c,g[10]=u,g[14]=d,g[3]=h,g[7]=p,g[11]=f,g[15]=m,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 vw).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[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,n){return 0===this.determinant()?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(0===e.determinant())return this.identity();const t=this.elements,n=e.elements,r=1/yw.setFromMatrixColumn(e,0).length(),i=1/yw.setFromMatrixColumn(e,1).length(),o=1/yw.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,i=e.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(r),l=Math.sin(r),c=Math.cos(i),u=Math.sin(i);if("XYZ"===e.order){const e=o*c,n=o*u,r=a*c,i=a*u;t[0]=s*c,t[4]=-s*u,t[8]=l,t[1]=n+r*l,t[5]=e-i*l,t[9]=-a*s,t[2]=i-e*l,t[6]=r+n*l,t[10]=o*s}else if("YXZ"===e.order){const e=s*c,n=s*u,r=l*c,i=l*u;t[0]=e+i*a,t[4]=r*a-n,t[8]=o*l,t[1]=o*u,t[5]=o*c,t[9]=-a,t[2]=n*a-r,t[6]=i+e*a,t[10]=o*s}else if("ZXY"===e.order){const e=s*c,n=s*u,r=l*c,i=l*u;t[0]=e-i*a,t[4]=-o*u,t[8]=r+n*a,t[1]=n+r*a,t[5]=o*c,t[9]=i-e*a,t[2]=-o*l,t[6]=a,t[10]=o*s}else if("ZYX"===e.order){const e=o*c,n=o*u,r=a*c,i=a*u;t[0]=s*c,t[4]=r*l-n,t[8]=e*l+i,t[1]=s*u,t[5]=i*l+e,t[9]=n*l-r,t[2]=-l,t[6]=a*s,t[10]=o*s}else if("YZX"===e.order){const e=o*s,n=o*l,r=a*s,i=a*l;t[0]=s*c,t[4]=i-e*u,t[8]=r*u+n,t[1]=u,t[5]=o*c,t[9]=-a*c,t[2]=-l*c,t[6]=n*u+r,t[10]=e-i*u}else if("XZY"===e.order){const e=o*s,n=o*l,r=a*s,i=a*l;t[0]=s*c,t[4]=-u,t[8]=l*c,t[1]=e*u+i,t[5]=o*c,t[9]=n*u-r,t[2]=r*u-n,t[6]=a*c,t[10]=i*u+e}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(xw,e,_w)}lookAt(e,t,n){const r=this.elements;return Mw.subVectors(e,t),0===Mw.lengthSq()&&(Mw.z=1),Mw.normalize(),ww.crossVectors(n,Mw),0===ww.lengthSq()&&(1===Math.abs(n.z)?Mw.x+=1e-4:Mw.z+=1e-4,Mw.normalize(),ww.crossVectors(n,Mw)),ww.normalize(),Sw.crossVectors(Mw,ww),r[0]=ww.x,r[4]=Sw.x,r[8]=Mw.x,r[1]=ww.y,r[5]=Sw.y,r[9]=Mw.y,r[2]=ww.z,r[6]=Sw.z,r[10]=Mw.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,i=this.elements,o=n[0],a=n[4],s=n[8],l=n[12],c=n[1],u=n[5],d=n[9],h=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],b=n[11],x=n[15],_=r[0],w=r[4],S=r[8],M=r[12],E=r[1],T=r[5],A=r[9],C=r[13],k=r[2],R=r[6],P=r[10],I=r[14],L=r[3],N=r[7],O=r[11],D=r[15];return i[0]=o*_+a*E+s*k+l*L,i[4]=o*w+a*T+s*R+l*N,i[8]=o*S+a*A+s*P+l*O,i[12]=o*M+a*C+s*I+l*D,i[1]=c*_+u*E+d*k+h*L,i[5]=c*w+u*T+d*R+h*N,i[9]=c*S+u*A+d*P+h*O,i[13]=c*M+u*C+d*I+h*D,i[2]=p*_+f*E+m*k+g*L,i[6]=p*w+f*T+m*R+g*N,i[10]=p*S+f*A+m*P+g*O,i[14]=p*M+f*C+m*I+g*D,i[3]=v*_+y*E+b*k+x*L,i[7]=v*w+y*T+b*R+x*N,i[11]=v*S+y*A+b*P+x*O,i[15]=v*M+y*C+b*I+x*D,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],n=e[4],r=e[8],i=e[12],o=e[1],a=e[5],s=e[9],l=e[13],c=e[2],u=e[6],d=e[10],h=e[14],p=e[3],f=e[7],m=e[11],g=e[15],v=s*h-l*d,y=a*h-l*u,b=a*d-s*u,x=o*h-l*c,_=o*d-s*c,w=o*u-a*c;return t*(f*v-m*y+g*b)-n*(p*v-m*x+g*_)+r*(p*y-f*x+g*w)-i*(p*b-f*_+m*w)}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,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],a=e[5],s=e[6],l=e[7],c=e[8],u=e[9],d=e[10],h=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=u*m*l-f*d*l+f*s*h-a*m*h-u*s*g+a*d*g,y=p*d*l-c*m*l-p*s*h+o*m*h+c*s*g-o*d*g,b=c*f*l-p*u*l+p*a*h-o*f*h-c*a*g+o*u*g,x=p*u*s-c*f*s-p*a*d+o*f*d+c*a*m-o*u*m,_=t*v+n*y+r*b+i*x;if(0===_)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/_;return e[0]=v*w,e[1]=(f*d*i-u*m*i-f*r*h+n*m*h+u*r*g-n*d*g)*w,e[2]=(a*m*i-f*s*i+f*r*l-n*m*l-a*r*g+n*s*g)*w,e[3]=(u*s*i-a*d*i-u*r*l+n*d*l+a*r*h-n*s*h)*w,e[4]=y*w,e[5]=(c*m*i-p*d*i+p*r*h-t*m*h-c*r*g+t*d*g)*w,e[6]=(p*s*i-o*m*i-p*r*l+t*m*l+o*r*g-t*s*g)*w,e[7]=(o*d*i-c*s*i+c*r*l-t*d*l-o*r*h+t*s*h)*w,e[8]=b*w,e[9]=(p*u*i-c*f*i-p*n*h+t*f*h+c*n*g-t*u*g)*w,e[10]=(o*f*i-p*a*i+p*n*l-t*f*l-o*n*g+t*a*g)*w,e[11]=(c*a*i-o*u*i-c*n*l+t*u*l+o*n*h-t*a*h)*w,e[12]=x*w,e[13]=(c*f*r-p*u*r+p*n*d-t*f*d-c*n*m+t*u*m)*w,e[14]=(p*a*r-o*f*r-p*n*s+t*f*s+o*n*m-t*a*m)*w,e[15]=(o*u*r-c*a*r+c*n*s-t*u*s-o*n*d+t*a*d)*w,this}scale(e){const t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){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,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),i=1-n,o=e.x,a=e.y,s=e.z,l=i*o,c=i*a;return this.set(l*o+n,l*a-r*s,l*s+r*a,0,l*a+r*s,c*a+n,c*s-r*o,0,l*s-r*a,c*s+r*o,i*s*s+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,o){return this.set(1,n,i,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,i=t._x,o=t._y,a=t._z,s=t._w,l=i+i,c=o+o,u=a+a,d=i*l,h=i*c,p=i*u,f=o*c,m=o*u,g=a*u,v=s*l,y=s*c,b=s*u,x=n.x,_=n.y,w=n.z;return r[0]=(1-(f+g))*x,r[1]=(h+b)*x,r[2]=(p-y)*x,r[3]=0,r[4]=(h-b)*_,r[5]=(1-(d+g))*_,r[6]=(m+v)*_,r[7]=0,r[8]=(p+y)*w,r[9]=(m-v)*w,r[10]=(1-(d+f))*w,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;if(e.x=r[12],e.y=r[13],e.z=r[14],0===this.determinant())return n.set(1,1,1),t.identity(),this;let i=yw.set(r[0],r[1],r[2]).length();const o=yw.set(r[4],r[5],r[6]).length(),a=yw.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),bw.copy(this);const s=1/i,l=1/o,c=1/a;return bw.elements[0]*=s,bw.elements[1]*=s,bw.elements[2]*=s,bw.elements[4]*=l,bw.elements[5]*=l,bw.elements[6]*=l,bw.elements[8]*=c,bw.elements[9]*=c,bw.elements[10]*=c,t.setFromRotationMatrix(bw),n.x=i,n.y=o,n.z=a,this}makePerspective(e,t,n,r,i,o,a=2e3,s=!1){const l=this.elements,c=2*i/(t-e),u=2*i/(n-r),d=(t+e)/(t-e),h=(n+r)/(n-r);let p,f;if(s)p=i/(o-i),f=o*i/(o-i);else if(a===Xx)p=-(o+i)/(o-i),f=-2*o*i/(o-i);else{if(a!==qx)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);p=-o/(o-i),f=-o*i/(o-i)}return l[0]=c,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=u,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=f,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,i,o,a=2e3,s=!1){const l=this.elements,c=2/(t-e),u=2/(n-r),d=-(t+e)/(t-e),h=-(n+r)/(n-r);let p,f;if(s)p=1/(o-i),f=o/(o-i);else if(a===Xx)p=-2/(o-i),f=-(o+i)/(o-i);else{if(a!==qx)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);p=-1/(o-i),f=-i/(o-i)}return l[0]=c,l[4]=0,l[8]=0,l[12]=d,l[1]=0,l[5]=u,l[9]=0,l[13]=h,l[2]=0,l[6]=0,l[10]=p,l[14]=f,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const yw=new x_,bw=new vw,xw=new x_(0,0,0),_w=new x_(1,1,1),ww=new x_,Sw=new x_,Mw=new x_,Ew=new vw,Tw=new b_;class Aw{constructor(e=0,t=0,n=0,r=Aw.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}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,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,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,n=!0){const r=e.elements,i=r[0],o=r[4],a=r[8],s=r[1],l=r[5],c=r[9],u=r[2],d=r[6],h=r[10];switch(t){case"XYZ":this._y=Math.asin(h_(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,h),this._z=Math.atan2(-o,i)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-h_(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,h),this._z=Math.atan2(s,l)):(this._y=Math.atan2(-u,i),this._z=0);break;case"ZXY":this._x=Math.asin(h_(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,h),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(s,i));break;case"ZYX":this._y=Math.asin(-h_(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,h),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(h_(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(a,h));break;case"XZY":this._z=Math.asin(-h_(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(a,i)):(this._x=Math.atan2(-c,h),this._y=0);break;default:r_("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Ew.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ew,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Tw.setFromEuler(this),this.setFromQuaternion(Tw,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],void 0!==e[3]&&(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}}Aw.DEFAULT_ORDER="XYZ";class Cw{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return 0!==(this.mask&e.mask)}isEnabled(e){return!!(this.mask&1<<e)}}let kw=0;const Rw=new x_,Pw=new b_,Iw=new vw,Lw=new x_,Nw=new x_,Ow=new x_,Dw=new b_,Uw=new x_(1,0,0),Fw=new x_(0,1,0),zw=new x_(0,0,1),Bw={type:"added"},Vw={type:"removed"},jw={type:"childadded",child:null},Hw={type:"childremoved",child:null};class Ww extends a_{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:kw++}),this.uuid=d_(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ww.DEFAULT_UP.clone();const e=new x_,t=new Aw,n=new b_,r=new x_(1,1,1);t._onChange(function(){n.setFromEuler(t,!1)}),n._onChange(function(){t.setFromQuaternion(n,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new vw},normalMatrix:{value:new S_}}),this.matrix=new vw,this.matrixWorld=new vw,this.matrixAutoUpdate=Ww.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Ww.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Cw,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Pw.setFromAxisAngle(e,t),this.quaternion.multiply(Pw),this}rotateOnWorldAxis(e,t){return Pw.setFromAxisAngle(e,t),this.quaternion.premultiply(Pw),this}rotateX(e){return this.rotateOnAxis(Uw,e)}rotateY(e){return this.rotateOnAxis(Fw,e)}rotateZ(e){return this.rotateOnAxis(zw,e)}translateOnAxis(e,t){return Rw.copy(e).applyQuaternion(this.quaternion),this.position.add(Rw.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Uw,e)}translateY(e){return this.translateOnAxis(Fw,e)}translateZ(e){return this.translateOnAxis(zw,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Iw.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Lw.copy(e):Lw.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),Nw.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Iw.lookAt(Nw,Lw,this.up):Iw.lookAt(Lw,Nw,this.up),this.quaternion.setFromRotationMatrix(Iw),r&&(Iw.extractRotation(r.matrixWorld),Pw.setFromRotationMatrix(Iw),this.quaternion.premultiply(Pw.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(i_("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Bw),jw.child=e,this.dispatchEvent(jw),jw.child=null):i_("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}const t=this.children.indexOf(e);return-1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Vw),Hw.child=e,this.dispatchEvent(Hw),Hw.child=null),this}removeFromParent(){const e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Iw.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),Iw.multiply(e.parent.matrixWorld)),e.applyMatrix4(Iw),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Bw),jw.child=e,this.dispatchEvent(jw),jw.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){const r=this.children[n].getObjectByProperty(e,t);if(void 0!==r)return r}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const r=this.children;for(let i=0,o=r.length;i<o;i++)r[i].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Nw,e,Ow),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Nw,Dw,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++){t[n].updateMatrixWorld(e)}}updateWorldMatrix(e,t){const n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===t){const e=this.children;for(let t=0,n=e.length;t<n;t++){e[t].updateWorldMatrix(!1,!0)}}}toJSON(e){const t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};function i(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),null!==this._colorsTexture&&(r.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(r.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(r.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t<r;t++){const r=n[t];i(e.shapes,r)}else i(e.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(i(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const t=[];for(let n=0,r=this.material.length;n<r;n++)t.push(i(e.materials,this.material[n]));r.material=t}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(let t=0;t<this.children.length;t++)r.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let t=0;t<this.animations.length;t++){const n=this.animations[t];r.animations.push(i(e.animations,n))}}if(t){const t=o(e.geometries),r=o(e.materials),i=o(e.textures),a=o(e.images),s=o(e.shapes),l=o(e.skeletons),c=o(e.animations),u=o(e.nodes);t.length>0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),a.length>0&&(n.images=a),s.length>0&&(n.shapes=s),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),u.length>0&&(n.nodes=u)}return n.object=r,n;function o(e){const t=[];for(const n in e){const r=e[n];delete r.metadata,t.push(r)}return t}}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)),!0===t)for(let n=0;n<e.children.length;n++){const t=e.children[n];this.add(t.clone())}return this}}Ww.DEFAULT_UP=new x_(0,1,0),Ww.DEFAULT_MATRIX_AUTO_UPDATE=!0,Ww.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Gw=new x_,Xw=new x_,qw=new x_,$w=new x_,Yw=new x_,Zw=new x_,Jw=new x_,Kw=new x_,Qw=new x_,eS=new x_,tS=new z_,nS=new z_,rS=new z_;class iS{constructor(e=new x_,t=new x_,n=new x_){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Gw.subVectors(e,t),r.cross(Gw);const i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){Gw.subVectors(r,t),Xw.subVectors(n,t),qw.subVectors(e,t);const o=Gw.dot(Gw),a=Gw.dot(Xw),s=Gw.dot(qw),l=Xw.dot(Xw),c=Xw.dot(qw),u=o*l-a*a;if(0===u)return i.set(0,0,0),null;const d=1/u,h=(l*s-a*c)*d,p=(o*c-a*s)*d;return i.set(1-h-p,p,h)}static containsPoint(e,t,n,r){return null!==this.getBarycoord(e,t,n,r,$w)&&($w.x>=0&&$w.y>=0&&$w.x+$w.y<=1)}static getInterpolation(e,t,n,r,i,o,a,s){return null===this.getBarycoord(e,t,n,r,$w)?(s.x=0,s.y=0,"z"in s&&(s.z=0),"w"in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,$w.x),s.addScaledVector(o,$w.y),s.addScaledVector(a,$w.z),s)}static getInterpolatedAttribute(e,t,n,r,i,o){return tS.setScalar(0),nS.setScalar(0),rS.setScalar(0),tS.fromBufferAttribute(e,t),nS.fromBufferAttribute(e,n),rS.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(tS,i.x),o.addScaledVector(nS,i.y),o.addScaledVector(rS,i.z),o}static isFrontFacing(e,t,n,r){return Gw.subVectors(n,t),Xw.subVectors(e,t),Gw.cross(Xw).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),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 Gw.subVectors(this.c,this.b),Xw.subVectors(this.a,this.b),.5*Gw.cross(Xw).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return iS.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return iS.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,i){return iS.getInterpolation(e,this.a,this.b,this.c,t,n,r,i)}containsPoint(e){return iS.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return iS.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,i=this.c;let o,a;Yw.subVectors(r,n),Zw.subVectors(i,n),Kw.subVectors(e,n);const s=Yw.dot(Kw),l=Zw.dot(Kw);if(s<=0&&l<=0)return t.copy(n);Qw.subVectors(e,r);const c=Yw.dot(Qw),u=Zw.dot(Qw);if(c>=0&&u<=c)return t.copy(r);const d=s*u-c*l;if(d<=0&&s>=0&&c<=0)return o=s/(s-c),t.copy(n).addScaledVector(Yw,o);eS.subVectors(e,i);const h=Yw.dot(eS),p=Zw.dot(eS);if(p>=0&&h<=p)return t.copy(i);const f=h*l-s*p;if(f<=0&&l>=0&&p<=0)return a=l/(l-p),t.copy(n).addScaledVector(Zw,a);const m=c*p-h*u;if(m<=0&&u-c>=0&&h-p>=0)return Jw.subVectors(i,r),a=(u-c)/(u-c+(h-p)),t.copy(r).addScaledVector(Jw,a);const g=1/(m+f+d);return o=f*g,a=d*g,t.copy(n).addScaledVector(Yw,o).addScaledVector(Zw,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const oS={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},aS={h:0,s:0,l:0},sS={h:0,s:0,l:0};function lS(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}class cS{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(void 0===t&&void 0===n){const t=e;t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Px){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,C_.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=C_.workingColorSpace){return this.r=e,this.g=t,this.b=n,C_.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=C_.workingColorSpace){if(e=p_(e,1),t=h_(t,0,1),n=h_(n,0,1),0===t)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=lS(i,r,e+1/3),this.g=lS(i,r,e),this.b=lS(i,r,e-1/3)}return C_.colorSpaceToWorking(this,r),this}setStyle(e,t=Px){function n(t){void 0!==t&&parseFloat(t)<1&&r_("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:r_("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const n=r[1],i=n.length;if(3===i)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(6===i)return this.setHex(parseInt(n,16),t);r_("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Px){const n=oS[e.toLowerCase()];return void 0!==n?this.setHex(n,t):r_("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=k_(e.r),this.g=k_(e.g),this.b=k_(e.b),this}copyLinearToSRGB(e){return this.r=R_(e.r),this.g=R_(e.g),this.b=R_(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Px){return C_.workingToColorSpace(uS.copy(this),e),65536*Math.round(h_(255*uS.r,0,255))+256*Math.round(h_(255*uS.g,0,255))+Math.round(h_(255*uS.b,0,255))}getHexString(e=Px){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=C_.workingColorSpace){C_.workingToColorSpace(uS.copy(this),t);const n=uS.r,r=uS.g,i=uS.b,o=Math.max(n,r,i),a=Math.min(n,r,i);let s,l;const c=(a+o)/2;if(a===o)s=0,l=0;else{const e=o-a;switch(l=c<=.5?e/(o+a):e/(2-o-a),o){case n:s=(r-i)/e+(r<i?6:0);break;case r:s=(i-n)/e+2;break;case i:s=(n-r)/e+4}s/=6}return e.h=s,e.s=l,e.l=c,e}getRGB(e,t=C_.workingColorSpace){return C_.workingToColorSpace(uS.copy(this),t),e.r=uS.r,e.g=uS.g,e.b=uS.b,e}getStyle(e=Px){C_.workingToColorSpace(uS.copy(this),e);const t=uS.r,n=uS.g,r=uS.b;return e!==Px?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*n)},${Math.round(255*r)})`}offsetHSL(e,t,n){return this.getHSL(aS),this.setHSL(aS.h+e,aS.s+t,aS.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(aS),e.getHSL(sS);const n=f_(aS.h,sS.h,t),r=f_(aS.s,sS.s,t),i=f_(aS.l,sS.l,t);return this.setHSL(n,r,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,r=this.b,i=e.elements;return this.r=i[0]*t+i[3]*n+i[6]*r,this.g=i[1]*t+i[4]*n+i[7]*r,this.b=i[2]*t+i[5]*n+i[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const uS=new cS;cS.NAMES=oS;let dS=0;class hS extends a_{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:dS++}),this.uuid=d_(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Ey,this.blendDst=Ty,this.blendEquation=yy,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new cS(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ox,this.stencilZFail=Ox,this.stencilZPass=Ox,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){r_(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n:r_(`Material: '${t}' is not a property of THREE.${this.type}.`)}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function r(e){const t=[];for(const n in e){const r=e[n];delete r.metadata,t.push(r)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),this.blendSrc!==Ey&&(n.blendSrc=this.blendSrc),this.blendDst!==Ty&&(n.blendDst=this.blendDst),this.blendEquation!==yy&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ox&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Ox&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Ox&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!1===this.allowOverride&&(n.allowOverride=!1),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){const t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}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 n=null;if(null!==t){const e=t.length;n=new Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,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.allowOverride=e.allowOverride,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){!0===e&&this.version++}}class pS extends hS{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new cS(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 Aw,this.combine=0,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 fS=mS();function mS(){const e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),r=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const e=l-127;e<-27?(r[l]=0,r[256|l]=32768,i[l]=24,i[256|l]=24):e<-14?(r[l]=1024>>-e-14,r[256|l]=1024>>-e-14|32768,i[l]=-e-1,i[256|l]=-e-1):e<=15?(r[l]=e+15<<10,r[256|l]=e+15<<10|32768,i[l]=13,i[256|l]=13):e<128?(r[l]=31744,r[256|l]=64512,i[l]=24,i[256|l]=24):(r[l]=31744,r[256|l]=64512,i[l]=13,i[256|l]=13)}const o=new Uint32Array(2048),a=new Uint32Array(64),s=new Uint32Array(64);for(let l=1;l<1024;++l){let e=l<<13,t=0;for(;!(8388608&e);)e<<=1,t-=8388608;e&=-8388609,t+=947912704,o[l]=e|t}for(let l=1024;l<2048;++l)o[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)32!==l&&(s[l]=1024);return{floatView:t,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:o,exponentTable:a,offsetTable:s}}function gS(e){Math.abs(e)>65504&&r_("DataUtils.toHalfFloat(): Value out of range."),e=h_(e,-65504,65504),fS.floatView[0]=e;const t=fS.uint32View[0],n=t>>23&511;return fS.baseTable[n]+((8388607&t)>>fS.shiftTable[n])}function vS(e){const t=e>>10;return fS.uint32View[0]=fS.mantissaTable[fS.offsetTable[t]+(1023&e)]+fS.exponentTable[t],fS.floatView[0]}const yS=new x_,bS=new y_;let xS=0;class _S{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:xS++}),this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=Wx,this.updateRanges=[],this.gpuType=Sb,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&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,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,n=this.count;t<n;t++)bS.fromBufferAttribute(this,t),bS.applyMatrix3(e),this.setXY(t,bS.x,bS.y);else if(3===this.itemSize)for(let t=0,n=this.count;t<n;t++)yS.fromBufferAttribute(this,t),yS.applyMatrix3(e),this.setXYZ(t,yS.x,yS.y,yS.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)yS.fromBufferAttribute(this,t),yS.applyMatrix4(e),this.setXYZ(t,yS.x,yS.y,yS.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)yS.fromBufferAttribute(this,t),yS.applyNormalMatrix(e),this.setXYZ(t,yS.x,yS.y,yS.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)yS.fromBufferAttribute(this,t),yS.transformDirection(e),this.setXYZ(t,yS.x,yS.y,yS.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=m_(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=g_(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=m_(t,this.array)),t}setX(e,t){return this.normalized&&(t=g_(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=m_(t,this.array)),t}setY(e,t){return this.normalized&&(t=g_(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=m_(t,this.array)),t}setZ(e,t){return this.normalized&&(t=g_(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=m_(t,this.array)),t}setW(e,t){return this.normalized&&(t=g_(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=g_(t,this.array),n=g_(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=g_(t,this.array),n=g_(n,this.array),r=g_(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=g_(t,this.array),n=g_(n,this.array),r=g_(r,this.array),i=g_(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==Wx&&(e.usage=this.usage),e}}class wS extends _S{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class SS extends _S{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class MS extends _S{constructor(e,t,n){super(new Float32Array(e),t,n)}}let ES=0;const TS=new vw,AS=new Ww,CS=new x_,kS=new W_,RS=new W_,PS=new x_;class IS extends a_{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:ES++}),this.uuid=d_(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new($x(e)?SS:wS)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const t=(new S_).getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}const r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return TS.makeRotationFromQuaternion(e),this.applyMatrix4(TS),this}rotateX(e){return TS.makeRotationX(e),this.applyMatrix4(TS),this}rotateY(e){return TS.makeRotationY(e),this.applyMatrix4(TS),this}rotateZ(e){return TS.makeRotationZ(e),this.applyMatrix4(TS),this}translate(e,t,n){return TS.makeTranslation(e,t,n),this.applyMatrix4(TS),this}scale(e,t,n){return TS.makeScale(e,t,n),this.applyMatrix4(TS),this}lookAt(e){return AS.lookAt(e),AS.updateMatrix(),this.applyMatrix4(AS.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(CS).negate(),this.translate(CS.x,CS.y,CS.z),this}setFromPoints(e){const t=this.getAttribute("position");if(void 0===t){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];t.push(r.x,r.y,r.z||0)}this.setAttribute("position",new MS(t,3))}else{const n=Math.min(e.length,t.count);for(let r=0;r<n;r++){const n=e[r];t.setXYZ(r,n.x,n.y,n.z||0)}e.length>t.count&&r_("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new W_);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return i_("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new x_(-1/0,-1/0,-1/0),new x_(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const e=t[n];kS.setFromBufferAttribute(e),this.morphTargetsRelative?(PS.addVectors(this.boundingBox.min,kS.min),this.boundingBox.expandByPoint(PS),PS.addVectors(this.boundingBox.max,kS.max),this.boundingBox.expandByPoint(PS)):(this.boundingBox.expandByPoint(kS.min),this.boundingBox.expandByPoint(kS.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&i_('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new lw);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return i_("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new x_,1/0);if(e){const n=this.boundingSphere.center;if(kS.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){const n=t[e];RS.setFromBufferAttribute(n),this.morphTargetsRelative?(PS.addVectors(kS.min,RS.min),kS.expandByPoint(PS),PS.addVectors(kS.max,RS.max),kS.expandByPoint(PS)):(kS.expandByPoint(RS.min),kS.expandByPoint(RS.max))}kS.getCenter(n);let r=0;for(let t=0,i=e.count;t<i;t++)PS.fromBufferAttribute(e,t),r=Math.max(r,n.distanceToSquared(PS));if(t)for(let i=0,o=t.length;i<o;i++){const o=t[i],a=this.morphTargetsRelative;for(let t=0,i=o.count;t<i;t++)PS.fromBufferAttribute(o,t),a&&(CS.fromBufferAttribute(e,t),PS.add(CS)),r=Math.max(r,n.distanceToSquared(PS))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&i_('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void i_("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=t.position,r=t.normal,i=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new _S(new Float32Array(4*n.count),4));const o=this.getAttribute("tangent"),a=[],s=[];for(let S=0;S<n.count;S++)a[S]=new x_,s[S]=new x_;const l=new x_,c=new x_,u=new x_,d=new y_,h=new y_,p=new y_,f=new x_,m=new x_;function g(e,t,r){l.fromBufferAttribute(n,e),c.fromBufferAttribute(n,t),u.fromBufferAttribute(n,r),d.fromBufferAttribute(i,e),h.fromBufferAttribute(i,t),p.fromBufferAttribute(i,r),c.sub(l),u.sub(l),h.sub(d),p.sub(d);const o=1/(h.x*p.y-p.x*h.y);isFinite(o)&&(f.copy(c).multiplyScalar(p.y).addScaledVector(u,-h.y).multiplyScalar(o),m.copy(u).multiplyScalar(h.x).addScaledVector(c,-p.x).multiplyScalar(o),a[e].add(f),a[t].add(f),a[r].add(f),s[e].add(m),s[t].add(m),s[r].add(m))}let v=this.groups;0===v.length&&(v=[{start:0,count:e.count}]);for(let S=0,M=v.length;S<M;++S){const t=v[S],n=t.start;for(let r=n,i=n+t.count;r<i;r+=3)g(e.getX(r+0),e.getX(r+1),e.getX(r+2))}const y=new x_,b=new x_,x=new x_,_=new x_;function w(e){x.fromBufferAttribute(r,e),_.copy(x);const t=a[e];y.copy(t),y.sub(x.multiplyScalar(x.dot(t))).normalize(),b.crossVectors(_,t);const n=b.dot(s[e])<0?-1:1;o.setXYZW(e,y.x,y.y,y.z,n)}for(let S=0,M=v.length;S<M;++S){const t=v[S],n=t.start;for(let r=n,i=n+t.count;r<i;r+=3)w(e.getX(r+0)),w(e.getX(r+1)),w(e.getX(r+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(void 0!==t){let n=this.getAttribute("normal");if(void 0===n)n=new _S(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);const r=new x_,i=new x_,o=new x_,a=new x_,s=new x_,l=new x_,c=new x_,u=new x_;if(e)for(let d=0,h=e.count;d<h;d+=3){const h=e.getX(d+0),p=e.getX(d+1),f=e.getX(d+2);r.fromBufferAttribute(t,h),i.fromBufferAttribute(t,p),o.fromBufferAttribute(t,f),c.subVectors(o,i),u.subVectors(r,i),c.cross(u),a.fromBufferAttribute(n,h),s.fromBufferAttribute(n,p),l.fromBufferAttribute(n,f),a.add(c),s.add(c),l.add(c),n.setXYZ(h,a.x,a.y,a.z),n.setXYZ(p,s.x,s.y,s.z),n.setXYZ(f,l.x,l.y,l.z)}else for(let e=0,d=t.count;e<d;e+=3)r.fromBufferAttribute(t,e+0),i.fromBufferAttribute(t,e+1),o.fromBufferAttribute(t,e+2),c.subVectors(o,i),u.subVectors(r,i),c.cross(u),n.setXYZ(e+0,c.x,c.y,c.z),n.setXYZ(e+1,c.x,c.y,c.z),n.setXYZ(e+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)PS.fromBufferAttribute(e,t),PS.normalize(),e.setXYZ(t,PS.x,PS.y,PS.z)}toNonIndexed(){function e(e,t){const n=e.array,r=e.itemSize,i=e.normalized,o=new n.constructor(t.length*r);let a=0,s=0;for(let l=0,c=t.length;l<c;l++){a=e.isInterleavedBufferAttribute?t[l]*e.data.stride+e.offset:t[l]*r;for(let e=0;e<r;e++)o[s++]=n[a++]}return new _S(o,r,i)}if(null===this.index)return r_("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new IS,n=this.index.array,r=this.attributes;for(const a in r){const i=e(r[a],n);t.setAttribute(a,i)}const i=this.morphAttributes;for(const a in i){const r=[],o=i[a];for(let t=0,i=o.length;t<i;t++){const i=e(o[t],n);r.push(i)}t.morphAttributes[a]=r}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,s=o.length;a<s;a++){const e=o[a];t.addGroup(e.start,e.count,e.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const s in n){const t=n[s];e.data.attributes[s]=t.toJSON(e.data)}const r={};let i=!1;for(const s in this.morphAttributes){const t=this.morphAttributes[s],n=[];for(let r=0,i=t.length;r<i;r++){const i=t[r];n.push(i.toJSON(e.data))}n.length>0&&(r[s]=n,i=!0)}i&&(e.data.morphAttributes=r,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 null!==a&&(e.data.boundingSphere=a.toJSON()),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 n=e.index;null!==n&&this.setIndex(n.clone());const r=e.attributes;for(const l in r){const e=r[l];this.setAttribute(l,e.clone(t))}const i=e.morphAttributes;for(const l in i){const e=[],n=i[l];for(let r=0,i=n.length;r<i;r++)e.push(n[r].clone(t));this.morphAttributes[l]=e}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let l=0,c=o.length;l<c;l++){const e=o[l];this.addGroup(e.start,e.count,e.materialIndex)}const a=e.boundingBox;null!==a&&(this.boundingBox=a.clone());const s=e.boundingSphere;return null!==s&&(this.boundingSphere=s.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const LS=new vw,NS=new gw,OS=new lw,DS=new x_,US=new x_,FS=new x_,zS=new x_,BS=new x_,VS=new x_,jS=new x_,HS=new x_;class WS extends Ww{constructor(e=new IS,t=new pS){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,i=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const a=this.morphTargetInfluences;if(i&&a){VS.set(0,0,0);for(let n=0,r=i.length;n<r;n++){const r=a[n],s=i[n];0!==r&&(BS.fromBufferAttribute(s,e),o?VS.addScaledVector(BS,r):VS.addScaledVector(BS.sub(t),r))}t.add(VS)}return t}raycast(e,t){const n=this.geometry,r=this.material,i=this.matrixWorld;if(void 0!==r){if(null===n.boundingSphere&&n.computeBoundingSphere(),OS.copy(n.boundingSphere),OS.applyMatrix4(i),NS.copy(e.ray).recast(e.near),!1===OS.containsPoint(NS.origin)){if(null===NS.intersectSphere(OS,DS))return;if(NS.origin.distanceToSquared(DS)>(e.far-e.near)**2)return}LS.copy(i).invert(),NS.copy(e.ray).applyMatrix4(LS),null!==n.boundingBox&&!1===NS.intersectsBox(n.boundingBox)||this._computeIntersections(e,t,NS)}}_computeIntersections(e,t,n){let r;const i=this.geometry,o=this.material,a=i.index,s=i.attributes.position,l=i.attributes.uv,c=i.attributes.uv1,u=i.attributes.normal,d=i.groups,h=i.drawRange;if(null!==a)if(Array.isArray(o))for(let p=0,f=d.length;p<f;p++){const i=d[p],s=o[i.materialIndex];for(let o=Math.max(i.start,h.start),d=Math.min(a.count,Math.min(i.start+i.count,h.start+h.count));o<d;o+=3){r=GS(this,s,e,n,l,c,u,a.getX(o),a.getX(o+1),a.getX(o+2)),r&&(r.faceIndex=Math.floor(o/3),r.face.materialIndex=i.materialIndex,t.push(r))}}else{for(let i=Math.max(0,h.start),s=Math.min(a.count,h.start+h.count);i<s;i+=3){r=GS(this,o,e,n,l,c,u,a.getX(i),a.getX(i+1),a.getX(i+2)),r&&(r.faceIndex=Math.floor(i/3),t.push(r))}}else if(void 0!==s)if(Array.isArray(o))for(let p=0,f=d.length;p<f;p++){const i=d[p],a=o[i.materialIndex];for(let o=Math.max(i.start,h.start),d=Math.min(s.count,Math.min(i.start+i.count,h.start+h.count));o<d;o+=3){r=GS(this,a,e,n,l,c,u,o,o+1,o+2),r&&(r.faceIndex=Math.floor(o/3),r.face.materialIndex=i.materialIndex,t.push(r))}}else{for(let i=Math.max(0,h.start),a=Math.min(s.count,h.start+h.count);i<a;i+=3){r=GS(this,o,e,n,l,c,u,i,i+1,i+2),r&&(r.faceIndex=Math.floor(i/3),t.push(r))}}}}function GS(e,t,n,r,i,o,a,s,l,c){e.getVertexPosition(s,US),e.getVertexPosition(l,FS),e.getVertexPosition(c,zS);const u=function(e,t,n,r,i,o,a,s){let l;if(l=1===t.side?r.intersectTriangle(a,o,i,!0,s):r.intersectTriangle(i,o,a,0===t.side,s),null===l)return null;HS.copy(s),HS.applyMatrix4(e.matrixWorld);const c=n.ray.origin.distanceTo(HS);return c<n.near||c>n.far?null:{distance:c,point:HS.clone(),object:e}}(e,t,n,r,US,FS,zS,jS);if(u){const e=new x_;iS.getBarycoord(jS,US,FS,zS,e),i&&(u.uv=iS.getInterpolatedAttribute(i,s,l,c,e,new y_)),o&&(u.uv1=iS.getInterpolatedAttribute(o,s,l,c,e,new y_)),a&&(u.normal=iS.getInterpolatedAttribute(a,s,l,c,e,new x_),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));const t={a:s,b:l,c:c,normal:new x_,materialIndex:0};iS.getNormal(US,FS,zS,t.normal),u.face=t,u.barycoord=e}return u}class XS extends IS{constructor(e=1,t=1,n=1,r=1,i=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:o};const a=this;r=Math.floor(r),i=Math.floor(i),o=Math.floor(o);const s=[],l=[],c=[],u=[];let d=0,h=0;function p(e,t,n,r,i,o,p,f,m,g,v){const y=o/m,b=p/g,x=o/2,_=p/2,w=f/2,S=m+1,M=g+1;let E=0,T=0;const A=new x_;for(let a=0;a<M;a++){const o=a*b-_;for(let s=0;s<S;s++){const d=s*y-x;A[e]=d*r,A[t]=o*i,A[n]=w,l.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[n]=f>0?1:-1,c.push(A.x,A.y,A.z),u.push(s/m),u.push(1-a/g),E+=1}}for(let a=0;a<g;a++)for(let e=0;e<m;e++){const t=d+e+S*a,n=d+e+S*(a+1),r=d+(e+1)+S*(a+1),i=d+(e+1)+S*a;s.push(t,n,i),s.push(n,r,i),T+=6}a.addGroup(h,T,v),h+=T,d+=E}p("z","y","x",-1,-1,n,t,e,o,i,0),p("z","y","x",1,-1,n,t,-e,o,i,1),p("x","z","y",1,1,e,n,t,r,o,2),p("x","z","y",1,-1,e,n,-t,r,o,3),p("x","y","z",1,-1,e,t,n,r,i,4),p("x","y","z",-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute("position",new MS(l,3)),this.setAttribute("normal",new MS(c,3)),this.setAttribute("uv",new MS(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new XS(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function qS(e){const t={};for(const n in e){t[n]={};for(const r in e[n]){const i=e[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(r_("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][r]=null):t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}}return t}function $S(e){const t={};for(let n=0;n<e.length;n++){const r=qS(e[n]);for(const e in r)t[e]=r[e]}return t}function YS(e){const t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:C_.workingColorSpace}const ZS={clone:qS,merge:$S};class JS extends hS{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",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,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=qS(e.uniforms),this.uniformsGroups=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}(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.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const n=this.uniforms[r].value;n&&n.isTexture?t.uniforms[r]={type:"t",value:n.toJSON(e).uuid}:n&&n.isColor?t.uniforms[r]={type:"c",value:n.getHex()}:n&&n.isVector2?t.uniforms[r]={type:"v2",value:n.toArray()}:n&&n.isVector3?t.uniforms[r]={type:"v3",value:n.toArray()}:n&&n.isVector4?t.uniforms[r]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?t.uniforms[r]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?t.uniforms[r]={type:"m4",value:n.toArray()}:t.uniforms[r]={value:n}}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 n={};for(const r in this.extensions)!0===this.extensions[r]&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class KS extends Ww{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new vw,this.projectionMatrix=new vw,this.projectionMatrixInverse=new vw,this.coordinateSystem=Xx,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}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 QS=new x_,eM=new y_,tM=new y_;class nM extends KS{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,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=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*u_*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*c_*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*u_*Math.atan(Math.tan(.5*c_*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,n){QS.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(QS.x,QS.y).multiplyScalar(-e/QS.z),QS.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(QS.x,QS.y).multiplyScalar(-e/QS.z)}getViewSize(e,t){return this.getViewBounds(e,eM,tM),t.subVectors(tM,eM)}setViewOffset(e,t,n,r,i,o){this.aspect=e/t,null===this.view&&(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=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*c_*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r;const o=this.view;if(null!==this.view&&this.view.enabled){const e=o.fullWidth,a=o.fullHeight;i+=o.offsetX*r/e,t-=o.offsetY*n/a,r*=o.width/e,n*=o.height/a}const a=this.filmOffset;0!==a&&(i+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),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,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const rM=-90;class iM extends Ww{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new nM(rM,1,e,t);r.layers=this.layers,this.add(r);const i=new nM(rM,1,e,t);i.layers=this.layers,this.add(i);const o=new nM(rM,1,e,t);o.layers=this.layers,this.add(o);const a=new nM(rM,1,e,t);a.layers=this.layers,this.add(a);const s=new nM(rM,1,e,t);s.layers=this.layers,this.add(s);const l=new nM(rM,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,i,o,a,s]=t;for(const l of t)this.remove(l);if(e===Xx)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),i.up.set(0,0,-1),i.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),s.up.set(0,1,0),s.lookAt(0,0,-1);else{if(e!==qx)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),i.up.set(0,0,1),i.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),s.up.set(0,-1,0),s.lookAt(0,0,-1)}for(const l of t)this.add(l),l.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[i,o,a,s,l,c]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),h=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const f=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,i),e.setRenderTarget(n,1,r),e.render(t,o),e.setRenderTarget(n,2,r),e.render(t,a),e.setRenderTarget(n,3,r),e.render(t,s),e.setRenderTarget(n,4,r),e.render(t,l),n.texture.generateMipmaps=f,e.setRenderTarget(n,5,r),e.render(t,c),e.setRenderTarget(u,d,h),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class oM extends F_{constructor(e=[],t=301,n,r,i,o,a,s,l,c){super(e,t,n,r,i,o,a,s,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class aM extends V_{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new oM(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}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 n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},r=new XS(5,5,5),i=new JS({name:"CubemapFromEquirect",uniforms:qS(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=t;const o=new WS(r,i),a=t.minFilter;t.minFilter===gb&&(t.minFilter=fb);return new iM(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){const i=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(i)}}class sM extends Ww{constructor(){super(),this.isGroup=!0,this.type="Group"}}const lM={type:"move"};class cM{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new sM,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new sM,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new x_,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new x_),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new sM,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new x_,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new x_),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,n){let r=null,i=null,o=null;const a=this._targetRay,s=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){o=!0;for(const o of e.hand.values()){const e=t.getJointPose(o,n),r=this._getHandJoint(l,o);null!==e&&(r.matrix.fromArray(e.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=e.radius),r.visible=null!==e}const r=l.joints["index-finger-tip"],i=l.joints["thumb-tip"],a=r.position.distanceTo(i.position),s=.02,c=.005;l.inputState.pinching&&a>s+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&a<=s-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==s&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1));null!==a&&(r=t.getPose(e.targetRaySpace,n),null===r&&null!==i&&(r=i),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(lM)))}return null!==a&&(a.visible=null!==r),null!==s&&(s.visible=null!==i),null!==l&&(l.visible=null!==o),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){const n=new sM;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class uM{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new cS(e),this.density=t}clone(){return new uM(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class dM{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new cS(e),this.near=t,this.far=n}clone(){return new dM(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class hM extends Ww{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 Aw,this.environmentIntensity=1,this.environmentRotation=new Aw,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(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),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class pM{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=Wx,this.updateRanges=[],this.version=0,this.uuid=d_()}onUploadCallback(){}set needsUpdate(e){!0===e&&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,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=d_()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=d_()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const fM=new x_;class mM{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)fM.fromBufferAttribute(this,t),fM.applyMatrix4(e),this.setXYZ(t,fM.x,fM.y,fM.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)fM.fromBufferAttribute(this,t),fM.applyNormalMatrix(e),this.setXYZ(t,fM.x,fM.y,fM.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)fM.fromBufferAttribute(this,t),fM.transformDirection(e),this.setXYZ(t,fM.x,fM.y,fM.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=m_(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=g_(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=g_(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=g_(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=g_(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=g_(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=m_(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=m_(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=m_(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=m_(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=g_(t,this.array),n=g_(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=g_(t,this.array),n=g_(n,this.array),r=g_(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=g_(t,this.array),n=g_(n,this.array),r=g_(r,this.array),i=g_(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this}clone(e){if(void 0===e){n_("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new _S(new this.array.constructor(e),this.itemSize,this.normalized)}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new mM(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(void 0===e){n_("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class gM extends hS{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new cS(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let vM;const yM=new x_,bM=new x_,xM=new x_,_M=new y_,wM=new y_,SM=new vw,MM=new x_,EM=new x_,TM=new x_,AM=new y_,CM=new y_,kM=new y_;class RM extends Ww{constructor(e=new gM){if(super(),this.isSprite=!0,this.type="Sprite",void 0===vM){vM=new IS;const e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),t=new pM(e,5);vM.setIndex([0,1,2,0,2,3]),vM.setAttribute("position",new mM(t,3,0,!1)),vM.setAttribute("uv",new mM(t,2,3,!1))}this.geometry=vM,this.material=e,this.center=new y_(.5,.5),this.count=1}raycast(e,t){null===e.camera&&i_('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),bM.setFromMatrixScale(this.matrixWorld),SM.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),xM.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&bM.multiplyScalar(-xM.z);const n=this.material.rotation;let r,i;0!==n&&(i=Math.cos(n),r=Math.sin(n));const o=this.center;PM(MM.set(-.5,-.5,0),xM,o,bM,r,i),PM(EM.set(.5,-.5,0),xM,o,bM,r,i),PM(TM.set(.5,.5,0),xM,o,bM,r,i),AM.set(0,0),CM.set(1,0),kM.set(1,1);let a=e.ray.intersectTriangle(MM,EM,TM,!1,yM);if(null===a&&(PM(EM.set(-.5,.5,0),xM,o,bM,r,i),CM.set(0,1),a=e.ray.intersectTriangle(MM,TM,EM,!1,yM),null===a))return;const s=e.ray.origin.distanceTo(yM);s<e.near||s>e.far||t.push({distance:s,point:yM.clone(),uv:iS.getInterpolation(yM,MM,EM,TM,AM,CM,kM,new y_),face:null,object:this})}copy(e,t){return super.copy(e,t),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}function PM(e,t,n,r,i,o){_M.subVectors(e,n).addScalar(.5).multiply(r),void 0!==i?(wM.x=o*_M.x-i*_M.y,wM.y=i*_M.x+o*_M.y):wM.copy(_M),e.copy(t),e.x+=wM.x,e.y+=wM.y,e.applyMatrix4(SM)}const IM=new x_,LM=new x_;class NM extends Ww{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,r=t.length;n<r;n++){const e=t[n];this.addLevel(e.object.clone(),e.distance,e.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const r=this.levels;let i;for(i=0;i<r.length&&!(t<r[i].distance);i++);return r.splice(i,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const e=t.splice(n,1);return this.remove(e[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,r;for(n=1,r=t.length;n<r;n++){let r=t[n].distance;if(t[n].object.visible&&(r-=r*t[n].hysteresis),e<r)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){IM.setFromMatrixPosition(this.matrixWorld);const n=e.ray.origin.distanceTo(IM);this.getObjectForDistance(n).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){IM.setFromMatrixPosition(e.matrixWorld),LM.setFromMatrixPosition(this.matrixWorld);const n=IM.distanceTo(LM)/e.zoom;let r,i;for(t[0].object.visible=!0,r=1,i=t.length;r<i;r++){let e=t[r].distance;if(t[r].object.visible&&(e-=e*t[r].hysteresis),!(n>=e))break;t[r-1].object.visible=!1,t[r].object.visible=!0}for(this._currentLevel=r-1;r<i;r++)t[r].object.visible=!1}}toJSON(e){const t=super.toJSON(e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let r=0,i=n.length;r<i;r++){const e=n[r];t.object.levels.push({object:e.object.uuid,distance:e.distance,hysteresis:e.hysteresis})}return t}}const OM=new x_,DM=new z_,UM=new z_,FM=new x_,zM=new vw,BM=new x_,VM=new lw,jM=new vw,HM=new gw;class WM extends WS{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=eb,this.bindMatrix=new vw,this.bindMatrixInverse=new vw,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;null===this.boundingBox&&(this.boundingBox=new W_),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,BM),this.boundingBox.expandByPoint(BM)}computeBoundingSphere(){const e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new lw),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,BM),this.boundingSphere.expandByPoint(BM)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,r=this.matrixWorld;void 0!==n&&(null===this.boundingSphere&&this.computeBoundingSphere(),VM.copy(this.boundingSphere),VM.applyMatrix4(r),!1!==e.ray.intersectsSphere(VM)&&(jM.copy(r).invert(),HM.copy(e.ray).applyMatrix4(jM),null!==this.boundingBox&&!1===HM.intersectsBox(this.boundingBox)||this._computeIntersections(e,t,HM)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new z_,t=this.geometry.attributes.skinWeight;for(let n=0,r=t.count;n<r;n++){e.fromBufferAttribute(t,n);const r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===eb?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===tb?this.bindMatrixInverse.copy(this.bindMatrix).invert():r_("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,r=this.geometry;DM.fromBufferAttribute(r.attributes.skinIndex,e),UM.fromBufferAttribute(r.attributes.skinWeight,e),OM.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let i=0;i<4;i++){const e=UM.getComponent(i);if(0!==e){const r=DM.getComponent(i);zM.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),t.addScaledVector(FM.copy(OM).applyMatrix4(zM),e)}}return t.applyMatrix4(this.bindMatrixInverse)}}class GM extends Ww{constructor(){super(),this.isBone=!0,this.type="Bone"}}class XM extends F_{constructor(e=null,t=1,n=1,r,i,o,a,s,l=1003,c=1003,u,d){super(null,o,a,s,l,c,r,i,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const qM=new vw,$M=new vw;class YM{constructor(e=[],t=[]){this.uuid=d_(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){r_("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new vw)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const t=new vw;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture;for(let i=0,o=e.length;i<o;i++){const r=e[i]?e[i].matrixWorld:$M;qM.multiplyMatrices(r,t[i]),qM.toArray(n,16*i)}null!==r&&(r.needsUpdate=!0)}clone(){return new YM(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length);e=4*Math.ceil(e/4),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new XM(t,e,e,Ib,Sb);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const n=this.bones[t];if(n.name===e)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,r=e.bones.length;n<r;n++){const r=e.bones[n];let i=t[r];void 0===i&&(r_("Skeleton: No bone found with UUID:",r),i=new GM),this.bones.push(i),this.boneInverses.push((new vw).fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let r=0,i=t.length;r<i;r++){const i=t[r];e.bones.push(i.uuid);const o=n[r];e.boneInverses.push(o.toArray())}return e}}class ZM extends _S{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const JM=new vw,KM=new vw,QM=[],eE=new W_,tE=new vw,nE=new WS,rE=new lw;class iE extends WS{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new ZM(new Float32Array(16*n),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<n;r++)this.setMatrixAt(r,tE)}computeBoundingBox(){const e=this.geometry,t=this.count;null===this.boundingBox&&(this.boundingBox=new W_),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,JM),eE.copy(e.boundingBox).applyMatrix4(JM),this.boundingBox.union(eE)}computeBoundingSphere(){const e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new lw),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,JM),rE.copy(e.boundingSphere).applyMatrix4(JM),this.boundingSphere.union(rE)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.morphTexture&&(this.morphTexture=e.morphTexture.clone()),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,16*e)}getMorphAt(e,t){const n=t.morphTargetInfluences,r=this.morphTexture.source.data.data,i=e*(n.length+1)+1;for(let o=0;o<n.length;o++)n[o]=r[i+o]}raycast(e,t){const n=this.matrixWorld,r=this.count;if(nE.geometry=this.geometry,nE.material=this.material,void 0!==nE.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),rE.copy(this.boundingSphere),rE.applyMatrix4(n),!1!==e.ray.intersectsSphere(rE)))for(let i=0;i<r;i++){this.getMatrixAt(i,JM),KM.multiplyMatrices(n,JM),nE.matrixWorld=KM,nE.raycast(e,QM);for(let e=0,n=QM.length;e<n;e++){const n=QM[e];n.instanceId=i,n.object=this,t.push(n)}QM.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new ZM(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}setMorphAt(e,t){const n=t.morphTargetInfluences,r=n.length+1;null===this.morphTexture&&(this.morphTexture=new XM(new Float32Array(r*this.count),r,this.count,Ob,Sb));const i=this.morphTexture.source.data.data;let o=0;for(let l=0;l<n.length;l++)o+=n[l];const a=this.geometry.morphTargetsRelative?1:1-o,s=r*e;i[s]=a,i.set(n,s+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null)}}const oE=new x_,aE=new x_,sE=new S_;class lE{constructor(e=new x_(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,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=oE.subVectors(n,t).cross(aE.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,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 n=e.delta(oE),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const i=-(e.start.dot(this.normal)+this.constant)/r;return i<0||i>1?null:t.copy(e.start).addScaledVector(n,i)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<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 n=t||sE.getNormalMatrix(e),r=this.coplanarPoint(oE).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),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 cE=new lw,uE=new y_(.5,.5),dE=new x_;class hE{constructor(e=new lE,t=new lE,n=new lE,r=new lE,i=new lE,o=new lE){this.planes=[e,t,n,r,i,o]}set(e,t,n,r,i,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(r),a[4].copy(i),a[5].copy(o),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=2e3,n=!1){const r=this.planes,i=e.elements,o=i[0],a=i[1],s=i[2],l=i[3],c=i[4],u=i[5],d=i[6],h=i[7],p=i[8],f=i[9],m=i[10],g=i[11],v=i[12],y=i[13],b=i[14],x=i[15];if(r[0].setComponents(l-o,h-c,g-p,x-v).normalize(),r[1].setComponents(l+o,h+c,g+p,x+v).normalize(),r[2].setComponents(l+a,h+u,g+f,x+y).normalize(),r[3].setComponents(l-a,h-u,g-f,x-y).normalize(),n)r[4].setComponents(s,d,m,b).normalize(),r[5].setComponents(l-s,h-d,g-m,x-b).normalize();else if(r[4].setComponents(l-s,h-d,g-m,x-b).normalize(),t===Xx)r[5].setComponents(l+s,h+d,g+m,x+b).normalize();else{if(t!==qx)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);r[5].setComponents(s,d,m,b).normalize()}return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),cE.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),cE.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(cE)}intersectsSprite(e){cE.center.set(0,0,0);const t=uE.distanceTo(e.center);return cE.radius=.7071067811865476+t,cE.applyMatrix4(e.matrixWorld),this.intersectsSphere(cE)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let i=0;i<6;i++){if(t[i].distanceToPoint(n)<r)return!1}return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(dE.x=r.normal.x>0?e.max.x:e.min.x,dE.y=r.normal.y>0?e.max.y:e.min.y,dE.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(dE)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}const pE=new vw,fE=new hE;class mE{constructor(){this.coordinateSystem=Xx}intersectsObject(e,t){if(!t.isArrayCamera||0===t.cameras.length)return!1;for(let n=0;n<t.cameras.length;n++){const r=t.cameras[n];if(pE.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),fE.setFromProjectionMatrix(pE,r.coordinateSystem,r.reversedDepth),fE.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||0===t.cameras.length)return!1;for(let n=0;n<t.cameras.length;n++){const r=t.cameras[n];if(pE.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),fE.setFromProjectionMatrix(pE,r.coordinateSystem,r.reversedDepth),fE.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||0===t.cameras.length)return!1;for(let n=0;n<t.cameras.length;n++){const r=t.cameras[n];if(pE.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),fE.setFromProjectionMatrix(pE,r.coordinateSystem,r.reversedDepth),fE.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||0===t.cameras.length)return!1;for(let n=0;n<t.cameras.length;n++){const r=t.cameras[n];if(pE.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),fE.setFromProjectionMatrix(pE,r.coordinateSystem,r.reversedDepth),fE.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||0===t.cameras.length)return!1;for(let n=0;n<t.cameras.length;n++){const r=t.cameras[n];if(pE.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),fE.setFromProjectionMatrix(pE,r.coordinateSystem,r.reversedDepth),fE.containsPoint(e))return!0}return!1}clone(){return new mE}}function gE(e,t){return e-t}function vE(e,t){return e.z-t.z}function yE(e,t){return t.z-e.z}class bE{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,r){const i=this.pool,o=this.list;this.index>=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});const a=i[this.index];o.push(a),this.index++,a.start=e,a.count=t,a.z=n,a.index=r}reset(){this.list.length=0,this.index=0}}const xE=new vw,_E=new cS(1,1,1),wE=new hE,SE=new mE,ME=new W_,EE=new lw,TE=new x_,AE=new x_,CE=new x_,kE=new bE,RE=new WS,PE=[];function IE(e,t,n=0){const r=t.itemSize;if(e.isInterleavedBufferAttribute||e.array.constructor!==t.array.constructor){const i=e.count;for(let o=0;o<i;o++)for(let i=0;i<r;i++)t.setComponent(o+n,i,e.getComponent(o,i))}else t.array.set(e.array,n*r);t.needsUpdate=!0}function LE(e,t){if(e.constructor!==t.constructor){const n=Math.min(e.length,t.length);for(let r=0;r<n;r++)t[r]=e[r]}else{const n=Math.min(e.length,t.length);t.set(new e.constructor(e.buffer,0,n))}}class NE extends WS{constructor(e,t,n=2*t,r){super(new IS,r),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(4*this._maxInstanceCount);e=4*Math.ceil(e/4),e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new XM(t,e,e,Ib,Sb);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new XM(t,e,e,Db,wb);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new XM(t,e,e,Ib,Sb);n.colorSpace=C_.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,r=this._maxIndexCount;if(!1===this._geometryInitialized){for(const r in e.attributes){const i=e.getAttribute(r),{array:o,itemSize:a,normalized:s}=i,l=new o.constructor(n*a),c=new _S(l,a,s);t.setAttribute(r,c)}if(null!==e.getIndex()){const e=n>65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new _S(e,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(Boolean(e.getIndex())!==Boolean(t.getIndex()))throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const r=e.getAttribute(n),i=t.getAttribute(n);if(r.itemSize!==i.itemSize||r.normalized!==i.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||!1===t[e].active)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||!1===t[e].active)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new W_);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,r=t.length;n<r;n++){if(!1===t[n].active)continue;const r=t[n].geometryIndex;this.getMatrixAt(n,xE),this.getBoundingBoxAt(r,ME).applyMatrix4(xE),e.union(ME)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new lw);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,r=t.length;n<r;n++){if(!1===t[n].active)continue;const r=t[n].geometryIndex;this.getMatrixAt(n,xE),this.getBoundingSphereAt(r,EE).applyMatrix4(xE),e.union(EE)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const t={visible:!0,active:!0,geometryIndex:e};let n=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(gE),n=this._availableInstanceIds.shift(),this._instanceInfo[n]=t):(n=this._instanceInfo.length,this._instanceInfo.push(t));const r=this._matricesTexture;xE.identity().toArray(r.image.data,16*n),r.needsUpdate=!0;const i=this._colorsTexture;return i&&(_E.toArray(i.image.data,4*n),i.needsUpdate=!0),this._visibilityChanged=!0,n}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const r={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},i=this._geometryInfo;r.vertexStart=this._nextVertexStart,r.reservedVertexCount=-1===t?e.getAttribute("position").count:t;const o=e.getIndex();if(null!==o&&(r.indexStart=this._nextIndexStart,r.reservedIndexCount=-1===n?o.count:n),-1!==r.indexStart&&r.indexStart+r.reservedIndexCount>this._maxIndexCount||r.vertexStart+r.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let a;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(gE),a=this._availableGeometryIds.shift(),i[a]=r):(a=this._geometryCount,this._geometryCount++,i.push(r)),this.setGeometryAt(a,e),this._nextIndexStart=r.indexStart+r.reservedIndexCount,this._nextVertexStart=r.vertexStart+r.reservedVertexCount,a}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,r=null!==n.getIndex(),i=n.getIndex(),o=t.getIndex(),a=this._geometryInfo[e];if(r&&o.count>a.reservedIndexCount||t.attributes.position.count>a.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const s=a.vertexStart,l=a.reservedVertexCount;a.vertexCount=t.getAttribute("position").count;for(const c in n.attributes){const e=t.getAttribute(c),r=n.getAttribute(c);IE(e,r,s);const i=e.itemSize;for(let t=e.count,n=l;t<n;t++){const e=s+t;for(let t=0;t<i;t++)r.setComponent(e,t,0)}r.needsUpdate=!0,r.addUpdateRange(s*i,l*i)}if(r){const e=a.indexStart,n=a.reservedIndexCount;a.indexCount=t.getIndex().count;for(let t=0;t<o.count;t++)i.setX(e+t,s+o.getX(t));for(let t=o.count,r=n;t<r;t++)i.setX(e+t,s);i.needsUpdate=!0,i.addUpdateRange(e,a.reservedIndexCount)}return a.start=r?a.indexStart:a.vertexStart,a.count=r?a.indexCount:a.vertexCount,a.boundingBox=null,null!==t.boundingBox&&(a.boundingBox=t.boundingBox.clone()),a.boundingSphere=null,null!==t.boundingSphere&&(a.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||!1===t[e].active)return this;const n=this._instanceInfo;for(let r=0,i=n.length;r<i;r++)n[r].active&&n[r].geometryIndex===e&&this.deleteInstance(r);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0;const n=this._geometryInfo,r=n.map((e,t)=>t).sort((e,t)=>n[e].vertexStart-n[t].vertexStart),i=this.geometry;for(let o=0,a=n.length;o<a;o++){const a=r[o],s=n[a];if(!1!==s.active){if(null!==i.index){if(s.indexStart!==t){const{indexStart:n,vertexStart:r,reservedIndexCount:o}=s,a=i.index,l=a.array,c=e-r;for(let e=n;e<n+o;e++)l[e]=l[e]+c;a.array.copyWithin(t,n,n+o),a.addUpdateRange(t,o),a.needsUpdate=!0,s.indexStart=t}t+=s.reservedIndexCount}if(s.vertexStart!==e){const{vertexStart:t,reservedVertexCount:n}=s,r=i.attributes;for(const i in r){const o=r[i],{array:a,itemSize:s}=o;a.copyWithin(e*s,t*s,(t+n)*s),o.addUpdateRange(e*s,n*s),o.needsUpdate=!0}s.vertexStart=e}e+=s.reservedVertexCount,s.start=i.index?s.indexStart:s.vertexStart,this._nextIndexStart=i.index?s.indexStart+s.reservedIndexCount:0,this._nextVertexStart=s.vertexStart+s.reservedVertexCount}}return this._visibilityChanged=!0,this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,r=this._geometryInfo[e];if(null===r.boundingBox){const e=new W_,t=n.index,i=n.attributes.position;for(let n=r.start,o=r.start+r.count;n<o;n++){let r=n;t&&(r=t.getX(r)),e.expandByPoint(TE.fromBufferAttribute(i,r))}r.boundingBox=e}return t.copy(r.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,r=this._geometryInfo[e];if(null===r.boundingSphere){const t=new lw;this.getBoundingBoxAt(e,ME),ME.getCenter(t.center);const i=n.index,o=n.attributes.position;let a=0;for(let e=r.start,n=r.start+r.count;e<n;e++){let n=e;i&&(n=i.getX(n)),TE.fromBufferAttribute(o,n),a=Math.max(a,t.center.distanceToSquared(TE))}t.radius=Math.sqrt(a),r.boundingSphere=t}return t.copy(r.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const n=this._matricesTexture,r=this._matricesTexture.image.data;return t.toArray(r,16*e),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,16*e)}setColorAt(e,t){return this.validateInstanceId(e),null===this._colorsTexture&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,4*e),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),t.fromArray(this._colorsTexture.image.data,4*e)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t||(this._instanceInfo[e].visible=t,this._visibilityChanged=!0),this}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);const n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){const t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(gE);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(e<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const r=new Int32Array(e),i=new Int32Array(e);LE(this._multiDrawCounts,r),LE(this._multiDrawStarts,i),this._multiDrawCounts=r,this._multiDrawStarts=i,this._maxInstanceCount=e;const o=this._indirectTexture,a=this._matricesTexture,s=this._colorsTexture;o.dispose(),this._initIndirectTexture(),LE(o.image.data,this._indirectTexture.image.data),a.dispose(),this._initMatricesTexture(),LE(a.image.data,this._matricesTexture.image.data),s&&(s.dispose(),this._initColorsTexture(),LE(s.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const n=[...this._geometryInfo].filter(e=>e.active);if(Math.max(...n.map(e=>e.vertexStart+e.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index){if(Math.max(...n.map(e=>e.indexStart+e.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`)}const r=this.geometry;r.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new IS,this._initializeGeometry(r));const i=this.geometry;r.index&&LE(r.index.array,i.index.array);for(const o in r.attributes)LE(r.attributes[o].array,i.attributes[o].array)}raycast(e,t){const n=this._instanceInfo,r=this._geometryInfo,i=this.matrixWorld,o=this.geometry;RE.material=this.material,RE.geometry.index=o.index,RE.geometry.attributes=o.attributes,null===RE.geometry.boundingBox&&(RE.geometry.boundingBox=new W_),null===RE.geometry.boundingSphere&&(RE.geometry.boundingSphere=new lw);for(let a=0,s=n.length;a<s;a++){if(!n[a].visible||!n[a].active)continue;const o=n[a].geometryIndex,s=r[o];RE.geometry.setDrawRange(s.start,s.count),this.getMatrixAt(a,RE.matrixWorld).premultiply(i),this.getBoundingBoxAt(o,RE.geometry.boundingBox),this.getBoundingSphereAt(o,RE.geometry.boundingSphere),RE.raycast(e,PE);for(let e=0,n=PE.length;e<n;e++){const n=PE[e];n.object=this,n.batchId=a,t.push(n)}PE.length=0}RE.material=null,RE.geometry.index=null,RE.geometry.attributes={},RE.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=null!==e.boundingBox?e.boundingBox.clone():null,this.boundingSphere=null!==e.boundingSphere?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(e=>({...e,boundingBox:null!==e.boundingBox?e.boundingBox.clone():null,boundingSphere:null!==e.boundingSphere?e.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(e=>({...e})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,r,i){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=r.getIndex(),a=null===o?1:o.array.BYTES_PER_ELEMENT,s=this._instanceInfo,l=this._multiDrawStarts,c=this._multiDrawCounts,u=this._geometryInfo,d=this.perObjectFrustumCulled,h=this._indirectTexture,p=h.image.data,f=n.isArrayCamera?SE:wE;d&&!n.isArrayCamera&&(xE.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),wE.setFromProjectionMatrix(xE,n.coordinateSystem,n.reversedDepth));let m=0;if(this.sortObjects){xE.copy(this.matrixWorld).invert(),TE.setFromMatrixPosition(n.matrixWorld).applyMatrix4(xE),AE.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(xE);for(let r=0,i=s.length;r<i;r++)if(s[r].visible&&s[r].active){const e=s[r].geometryIndex;this.getMatrixAt(r,xE),this.getBoundingSphereAt(e,EE).applyMatrix4(xE);let t=!1;if(d&&(t=!f.intersectsSphere(EE,n)),!t){const t=u[e],n=CE.subVectors(EE.center,TE).dot(AE);kE.push(t.start,t.count,n,r)}}const e=kE.list,t=this.customSort;null===t?e.sort(i.transparent?yE:vE):t.call(this,e,n);for(let n=0,r=e.length;n<r;n++){const t=e[n];l[m]=t.start*a,c[m]=t.count,p[m]=t.index,m++}kE.reset()}else for(let g=0,v=s.length;g<v;g++)if(s[g].visible&&s[g].active){const e=s[g].geometryIndex;let t=!1;if(d&&(this.getMatrixAt(g,xE),this.getBoundingSphereAt(e,EE).applyMatrix4(xE),t=!f.intersectsSphere(EE,n)),!t){const t=u[e];l[m]=t.start*a,c[m]=t.count,p[m]=g,m++}}h.needsUpdate=!0,this._multiDrawCount=m,this._visibilityChanged=!1}onBeforeShadow(e,t,n,r,i,o){this.onBeforeRender(e,null,r,i,o)}}class OE extends hS{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new cS(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const DE=new x_,UE=new x_,FE=new vw,zE=new gw,BE=new lw,VE=new x_,jE=new x_;class HE extends Ww{constructor(e=new IS,t=new OE){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[0];for(let e=1,r=t.count;e<r;e++)DE.fromBufferAttribute(t,e-1),UE.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=DE.distanceTo(UE);e.setAttribute("lineDistance",new MS(n,1))}else r_("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold,o=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),BE.copy(n.boundingSphere),BE.applyMatrix4(r),BE.radius+=i,!1===e.ray.intersectsSphere(BE))return;FE.copy(r).invert(),zE.copy(e.ray).applyMatrix4(FE);const a=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=a*a,l=this.isLineSegments?2:1,c=n.index,u=n.attributes.position;if(null!==c){const n=Math.max(0,o.start),r=Math.min(c.count,o.start+o.count);for(let i=n,o=r-1;i<o;i+=l){const n=c.getX(i),r=c.getX(i+1),o=WE(this,e,zE,s,n,r,i);o&&t.push(o)}if(this.isLineLoop){const i=c.getX(r-1),o=c.getX(n),a=WE(this,e,zE,s,i,o,r-1);a&&t.push(a)}}else{const n=Math.max(0,o.start),r=Math.min(u.count,o.start+o.count);for(let i=n,o=r-1;i<o;i+=l){const n=WE(this,e,zE,s,i,i+1,i);n&&t.push(n)}if(this.isLineLoop){const i=WE(this,e,zE,s,r-1,n,r-1);i&&t.push(i)}}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function WE(e,t,n,r,i,o,a){const s=e.geometry.attributes.position;DE.fromBufferAttribute(s,i),UE.fromBufferAttribute(s,o);if(n.distanceSqToSegment(DE,UE,VE,jE)>r)return;VE.applyMatrix4(e.matrixWorld);const l=t.ray.origin.distanceTo(VE);return l<t.near||l>t.far?void 0:{distance:l,point:jE.clone().applyMatrix4(e.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:e}}const GE=new x_,XE=new x_;class qE extends HE{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,r=t.count;e<r;e+=2)GE.fromBufferAttribute(t,e),XE.fromBufferAttribute(t,e+1),n[e]=0===e?0:n[e-1],n[e+1]=n[e]+GE.distanceTo(XE);e.setAttribute("lineDistance",new MS(n,1))}else r_("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class $E extends HE{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class YE extends hS{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new cS(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const ZE=new vw,JE=new gw,KE=new lw,QE=new x_;class eT extends Ww{constructor(e=new IS,t=new YE){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,o=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),KE.copy(n.boundingSphere),KE.applyMatrix4(r),KE.radius+=i,!1===e.ray.intersectsSphere(KE))return;ZE.copy(r).invert(),JE.copy(e.ray).applyMatrix4(ZE);const a=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=a*a,l=n.index,c=n.attributes.position;if(null!==l){for(let n=Math.max(0,o.start),i=Math.min(l.count,o.start+o.count);n<i;n++){const i=l.getX(n);QE.fromBufferAttribute(c,i),tT(QE,i,s,r,e,t,this)}}else{for(let n=Math.max(0,o.start),i=Math.min(c.count,o.start+o.count);n<i;n++)QE.fromBufferAttribute(c,n),tT(QE,n,s,r,e,t,this)}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function tT(e,t,n,r,i,o,a){const s=JE.distanceSqToPoint(e);if(s<n){const n=new x_;JE.closestPointToPoint(e,n),n.applyMatrix4(r);const l=i.ray.origin.distanceTo(n);if(l<i.near||l>i.far)return;o.push({distance:l,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:a})}}class nT extends F_{constructor(e,t,n,r,i=1006,o=1006,a,s,l){super(e,t,n,r,i,o,a,s,l),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const c=this;"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(function t(){c.needsUpdate=!0,c._requestVideoFrameCallbackId=e.requestVideoFrameCallback(t)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;!1==="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class rT extends F_{constructor(e,t,n,r,i,o,a,s,l,c,u,d){super(null,o,a,s,l,c,r,i,u,d),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class iT extends F_{constructor(e,t,n=1014,r,i,o,a=1003,s=1003,l,c=1026,u=1){if(c!==Lb&&c!==Nb)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:e,height:t,depth:u},r,i,o,a,s,c,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new N_(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}class oT extends iT{constructor(e,t=1014,n=301,r,i,o=1003,a=1003,s,l=1026){const c={width:e,height:e,depth:1},u=[c,c,c,c,c,c];super(e,e,t,n,r,i,o,a,s,l),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class aT extends F_{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class sT extends IS{constructor(e=1,t=1,n=4,r=8,i=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:n,radialSegments:r,heightSegments:i},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),r=Math.max(3,Math.floor(r)),i=Math.max(1,Math.floor(i));const o=[],a=[],s=[],l=[],c=t/2,u=Math.PI/2*e,d=t,h=2*u+d,p=2*n+i,f=r+1,m=new x_,g=new x_;for(let v=0;v<=p;v++){let y=0,b=0,x=0,_=0;if(v<=n){const t=v/n,r=t*Math.PI/2;b=-c-e*Math.cos(r),x=e*Math.sin(r),_=-e*Math.cos(r),y=t*u}else if(v<=n+i){const r=(v-n)/i;b=r*t-c,x=e,_=0,y=u+r*d}else{const t=(v-n-i)/n,r=t*Math.PI/2;b=c+e*Math.sin(r),x=e*Math.cos(r),_=e*Math.sin(r),y=u+d+t*u}const w=Math.max(0,Math.min(1,y/h));let S=0;0===v?S=.5/r:v===p&&(S=-.5/r);for(let e=0;e<=r;e++){const t=e/r,n=t*Math.PI*2,i=Math.sin(n),o=Math.cos(n);g.x=-x*o,g.y=b,g.z=x*i,a.push(g.x,g.y,g.z),m.set(-x*o,_,x*i),m.normalize(),s.push(m.x,m.y,m.z),l.push(t+S,w)}if(v>0){const e=(v-1)*f;for(let t=0;t<r;t++){const n=e+t,r=e+t+1,i=v*f+t,a=v*f+t+1;o.push(n,r,i),o.push(r,a,i)}}}this.setIndex(o),this.setAttribute("position",new MS(a,3)),this.setAttribute("normal",new MS(s,3)),this.setAttribute("uv",new MS(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new sT(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class lT extends IS{constructor(e=1,t=32,n=0,r=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);const i=[],o=[],a=[],s=[],l=new x_,c=new y_;o.push(0,0,0),a.push(0,0,1),s.push(.5,.5);for(let u=0,d=3;u<=t;u++,d+=3){const i=n+u/t*r;l.x=e*Math.cos(i),l.y=e*Math.sin(i),o.push(l.x,l.y,l.z),a.push(0,0,1),c.x=(o[d]/e+1)/2,c.y=(o[d+1]/e+1)/2,s.push(c.x,c.y)}for(let u=1;u<=t;u++)i.push(u,u+1,0);this.setIndex(i),this.setAttribute("position",new MS(o,3)),this.setAttribute("normal",new MS(a,3)),this.setAttribute("uv",new MS(s,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new lT(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class cT extends IS{constructor(e=1,t=1,n=1,r=32,i=1,o=!1,a=0,s=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:o,thetaStart:a,thetaLength:s};const l=this;r=Math.floor(r),i=Math.floor(i);const c=[],u=[],d=[],h=[];let p=0;const f=[],m=n/2;let g=0;function v(n){const i=p,o=new y_,f=new x_;let v=0;const y=!0===n?e:t,b=!0===n?1:-1;for(let e=1;e<=r;e++)u.push(0,m*b,0),d.push(0,b,0),h.push(.5,.5),p++;const x=p;for(let e=0;e<=r;e++){const t=e/r*s+a,n=Math.cos(t),i=Math.sin(t);f.x=y*i,f.y=m*b,f.z=y*n,u.push(f.x,f.y,f.z),d.push(0,b,0),o.x=.5*n+.5,o.y=.5*i*b+.5,h.push(o.x,o.y),p++}for(let e=0;e<r;e++){const t=i+e,r=x+e;!0===n?c.push(r,r+1,t):c.push(r+1,r,t),v+=3}l.addGroup(g,v,!0===n?1:2),g+=v}!function(){const o=new x_,v=new x_;let y=0;const b=(t-e)/n;for(let l=0;l<=i;l++){const c=[],g=l/i,y=g*(t-e)+e;for(let e=0;e<=r;e++){const t=e/r,i=t*s+a,l=Math.sin(i),f=Math.cos(i);v.x=y*l,v.y=-g*n+m,v.z=y*f,u.push(v.x,v.y,v.z),o.set(l,b,f).normalize(),d.push(o.x,o.y,o.z),h.push(t,1-g),c.push(p++)}f.push(c)}for(let n=0;n<r;n++)for(let r=0;r<i;r++){const o=f[r][n],a=f[r+1][n],s=f[r+1][n+1],l=f[r][n+1];(e>0||0!==r)&&(c.push(o,a,l),y+=3),(t>0||r!==i-1)&&(c.push(a,s,l),y+=3)}l.addGroup(g,y,0),g+=y}(),!1===o&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(c),this.setAttribute("position",new MS(u,3)),this.setAttribute("normal",new MS(d,3)),this.setAttribute("uv",new MS(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new cT(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class uT extends cT{constructor(e=1,t=1,n=32,r=1,i=!1,o=0,a=2*Math.PI){super(0,e,t,n,r,i,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}static fromJSON(e){return new uT(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class dT extends IS{constructor(e=[],t=[],n=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r};const i=[],o=[];function a(e,t,n,r){const i=r+1,o=[];for(let a=0;a<=i;a++){o[a]=[];const r=e.clone().lerp(n,a/i),s=t.clone().lerp(n,a/i),l=i-a;for(let e=0;e<=l;e++)o[a][e]=0===e&&a===i?r:r.clone().lerp(s,e/l)}for(let a=0;a<i;a++)for(let e=0;e<2*(i-a)-1;e++){const t=Math.floor(e/2);e%2==0?(s(o[a][t+1]),s(o[a+1][t]),s(o[a][t])):(s(o[a][t+1]),s(o[a+1][t+1]),s(o[a+1][t]))}}function s(e){i.push(e.x,e.y,e.z)}function l(t,n){const r=3*t;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function c(e,t,n,r){r<0&&1===e.x&&(o[t]=e.x-1),0===n.x&&0===n.z&&(o[t]=r/2/Math.PI+.5)}function u(e){return Math.atan2(e.z,-e.x)}function d(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}!function(e){const n=new x_,r=new x_,i=new x_;for(let o=0;o<t.length;o+=3)l(t[o+0],n),l(t[o+1],r),l(t[o+2],i),a(n,r,i,e)}(r),function(e){const t=new x_;for(let n=0;n<i.length;n+=3)t.x=i[n+0],t.y=i[n+1],t.z=i[n+2],t.normalize().multiplyScalar(e),i[n+0]=t.x,i[n+1]=t.y,i[n+2]=t.z}(n),function(){const e=new x_;for(let t=0;t<i.length;t+=3){e.x=i[t+0],e.y=i[t+1],e.z=i[t+2];const n=u(e)/2/Math.PI+.5,r=d(e)/Math.PI+.5;o.push(n,1-r)}(function(){const e=new x_,t=new x_,n=new x_,r=new x_,a=new y_,s=new y_,l=new y_;for(let d=0,h=0;d<i.length;d+=9,h+=6){e.set(i[d+0],i[d+1],i[d+2]),t.set(i[d+3],i[d+4],i[d+5]),n.set(i[d+6],i[d+7],i[d+8]),a.set(o[h+0],o[h+1]),s.set(o[h+2],o[h+3]),l.set(o[h+4],o[h+5]),r.copy(e).add(t).add(n).divideScalar(3);const p=u(r);c(a,h+0,e,p),c(s,h+2,t,p),c(l,h+4,n,p)}})(),function(){for(let e=0;e<o.length;e+=6){const t=o[e+0],n=o[e+2],r=o[e+4],i=Math.max(t,n,r),a=Math.min(t,n,r);i>.9&&a<.1&&(t<.2&&(o[e+0]+=1),n<.2&&(o[e+2]+=1),r<.2&&(o[e+4]+=1))}}()}(),this.setAttribute("position",new MS(i,3)),this.setAttribute("normal",new MS(i.slice(),3)),this.setAttribute("uv",new MS(o,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new dT(e.vertices,e.indices,e.radius,e.detail)}}class hT extends dT{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,r=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new hT(e.radius,e.detail)}}const pT=new x_,fT=new x_,mT=new x_,gT=new iS;class vT extends IS{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},null!==e){const n=4,r=Math.pow(10,n),i=Math.cos(c_*t),o=e.getIndex(),a=e.getAttribute("position"),s=o?o.count:a.count,l=[0,0,0],c=["a","b","c"],u=new Array(3),d={},h=[];for(let e=0;e<s;e+=3){o?(l[0]=o.getX(e),l[1]=o.getX(e+1),l[2]=o.getX(e+2)):(l[0]=e,l[1]=e+1,l[2]=e+2);const{a:t,b:n,c:s}=gT;if(t.fromBufferAttribute(a,l[0]),n.fromBufferAttribute(a,l[1]),s.fromBufferAttribute(a,l[2]),gT.getNormal(mT),u[0]=`${Math.round(t.x*r)},${Math.round(t.y*r)},${Math.round(t.z*r)}`,u[1]=`${Math.round(n.x*r)},${Math.round(n.y*r)},${Math.round(n.z*r)}`,u[2]=`${Math.round(s.x*r)},${Math.round(s.y*r)},${Math.round(s.z*r)}`,u[0]!==u[1]&&u[1]!==u[2]&&u[2]!==u[0])for(let e=0;e<3;e++){const t=(e+1)%3,n=u[e],r=u[t],o=gT[c[e]],a=gT[c[t]],s=`${n}_${r}`,p=`${r}_${n}`;p in d&&d[p]?(mT.dot(d[p].normal)<=i&&(h.push(o.x,o.y,o.z),h.push(a.x,a.y,a.z)),d[p]=null):s in d||(d[s]={index0:l[e],index1:l[t],normal:mT.clone()})}}for(const e in d)if(d[e]){const{index0:t,index1:n}=d[e];pT.fromBufferAttribute(a,t),fT.fromBufferAttribute(a,n),h.push(pT.x,pT.y,pT.z),h.push(fT.x,fT.y,fT.z)}this.setAttribute("position",new MS(h,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class yT{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){r_("Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/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 n,r=this.getPoint(0),i=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),i+=n.distanceTo(r),t.push(i),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let r=0;const i=n.length;let o;o=t||e*n[i-1];let a,s=0,l=i-1;for(;s<=l;)if(r=Math.floor(s+(l-s)/2),a=n[r]-o,a<0)s=r+1;else{if(!(a>0)){l=r;break}l=r-1}if(r=l,n[r]===o)return r/(i-1);const c=n[r];return(r+(o-c)/(n[r+1]-c))/(i-1)}getTangent(e,t){const n=1e-4;let r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);const o=this.getPoint(r),a=this.getPoint(i),s=t||(o.isVector2?new y_:new x_);return s.copy(a).sub(o).normalize(),s}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new x_,r=[],i=[],o=[],a=new x_,s=new vw;for(let h=0;h<=e;h++){const t=h/e;r[h]=this.getTangentAt(t,new x_)}i[0]=new x_,o[0]=new x_;let l=Number.MAX_VALUE;const c=Math.abs(r[0].x),u=Math.abs(r[0].y),d=Math.abs(r[0].z);c<=l&&(l=c,n.set(1,0,0)),u<=l&&(l=u,n.set(0,1,0)),d<=l&&n.set(0,0,1),a.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],a),o[0].crossVectors(r[0],i[0]);for(let h=1;h<=e;h++){if(i[h]=i[h-1].clone(),o[h]=o[h-1].clone(),a.crossVectors(r[h-1],r[h]),a.length()>Number.EPSILON){a.normalize();const e=Math.acos(h_(r[h-1].dot(r[h]),-1,1));i[h].applyMatrix4(s.makeRotationAxis(a,e))}o[h].crossVectors(r[h],i[h])}if(!0===t){let t=Math.acos(h_(i[0].dot(i[e]),-1,1));t/=e,r[0].dot(a.crossVectors(i[0],i[e]))>0&&(t=-t);for(let n=1;n<=e;n++)i[n].applyMatrix4(s.makeRotationAxis(r[n],t*n)),o[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:o}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class bT extends yT{constructor(e=0,t=0,n=1,r=1,i=0,o=2*Math.PI,a=!1,s=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s}getPoint(e,t=new y_){const n=t,r=2*Math.PI;let i=this.aEndAngle-this.aStartAngle;const o=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=o?0:r),!0!==this.aClockwise||o||(i===r?i=-r:i-=r);const a=this.aStartAngle+e*i;let s=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){const e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=s-this.aX,r=l-this.aY;s=n*e-r*t+this.aX,l=n*t+r*e+this.aY}return n.set(s,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class xT extends bT{constructor(e,t,n,r,i,o){super(e,t,n,n,r,i,o),this.isArcCurve=!0,this.type="ArcCurve"}}function _T(){let e=0,t=0,n=0,r=0;function i(i,o,a,s){e=i,t=a,n=-3*i+3*o-2*a-s,r=2*i-2*o+a+s}return{initCatmullRom:function(e,t,n,r,o){i(t,n,o*(n-e),o*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,o,a,s){let l=(t-e)/o-(n-e)/(o+a)+(n-t)/a,c=(n-t)/a-(r-t)/(a+s)+(r-n)/s;l*=a,c*=a,i(t,n,l,c)},calc:function(i){const o=i*i;return e+t*i+n*o+r*(o*i)}}}const wT=new x_,ST=new _T,MT=new _T,ET=new _T;class TT extends yT{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new x_){const n=t,r=this.points,i=r.length,o=(i-(this.closed?0:1))*e;let a,s,l=Math.floor(o),c=o-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/i)+1)*i:0===c&&l===i-1&&(l=i-2,c=1),this.closed||l>0?a=r[(l-1)%i]:(wT.subVectors(r[0],r[1]).add(r[0]),a=wT);const u=r[l%i],d=r[(l+1)%i];if(this.closed||l+2<i?s=r[(l+2)%i]:(wT.subVectors(r[i-1],r[i-2]).add(r[i-1]),s=wT),"centripetal"===this.curveType||"chordal"===this.curveType){const e="chordal"===this.curveType?.5:.25;let t=Math.pow(a.distanceToSquared(u),e),n=Math.pow(u.distanceToSquared(d),e),r=Math.pow(d.distanceToSquared(s),e);n<1e-4&&(n=1),t<1e-4&&(t=n),r<1e-4&&(r=n),ST.initNonuniformCatmullRom(a.x,u.x,d.x,s.x,t,n,r),MT.initNonuniformCatmullRom(a.y,u.y,d.y,s.y,t,n,r),ET.initNonuniformCatmullRom(a.z,u.z,d.z,s.z,t,n,r)}else"catmullrom"===this.curveType&&(ST.initCatmullRom(a.x,u.x,d.x,s.x,this.tension),MT.initCatmullRom(a.y,u.y,d.y,s.y,this.tension),ET.initCatmullRom(a.z,u.z,d.z,s.z,this.tension));return n.set(ST.calc(c),MT.calc(c),ET.calc(c)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push((new x_).fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function AT(e,t,n,r,i){const o=.5*(r-t),a=.5*(i-n),s=e*e;return(2*n-2*r+o+a)*(e*s)+(-3*n+3*r-2*o-a)*s+o*e+n}function CT(e,t,n,r){return function(e,t){const n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,r)}function kT(e,t,n,r,i){return function(e,t){const n=1-e;return n*n*n*t}(e,t)+function(e,t){const n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,r)+function(e,t){return e*e*e*t}(e,i)}class RT extends yT{constructor(e=new y_,t=new y_,n=new y_,r=new y_){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new y_){const n=t,r=this.v0,i=this.v1,o=this.v2,a=this.v3;return n.set(kT(e,r.x,i.x,o.x,a.x),kT(e,r.y,i.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class PT extends yT{constructor(e=new x_,t=new x_,n=new x_,r=new x_){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new x_){const n=t,r=this.v0,i=this.v1,o=this.v2,a=this.v3;return n.set(kT(e,r.x,i.x,o.x,a.x),kT(e,r.y,i.y,o.y,a.y),kT(e,r.z,i.z,o.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class IT extends yT{constructor(e=new y_,t=new y_){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new y_){const n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new y_){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class LT extends yT{constructor(e=new x_,t=new x_){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new x_){const n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new x_){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class NT extends yT{constructor(e=new y_,t=new y_,n=new y_){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new y_){const n=t,r=this.v0,i=this.v1,o=this.v2;return n.set(CT(e,r.x,i.x,o.x),CT(e,r.y,i.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class OT extends yT{constructor(e=new x_,t=new x_,n=new x_){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new x_){const n=t,r=this.v0,i=this.v1,o=this.v2;return n.set(CT(e,r.x,i.x,o.x),CT(e,r.y,i.y,o.y),CT(e,r.z,i.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class DT extends yT{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new y_){const n=t,r=this.points,i=(r.length-1)*e,o=Math.floor(i),a=i-o,s=r[0===o?o:o-1],l=r[o],c=r[o>r.length-2?r.length-1:o+1],u=r[o>r.length-3?r.length-1:o+2];return n.set(AT(a,s.x,l.x,c.x,u.x),AT(a,s.y,l.y,c.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push(n.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push((new y_).fromArray(n))}return this}}var UT=Object.freeze({__proto__:null,ArcCurve:xT,CatmullRomCurve3:TT,CubicBezierCurve:RT,CubicBezierCurve3:PT,EllipseCurve:bT,LineCurve:IT,LineCurve3:LT,QuadraticBezierCurve:NT,QuadraticBezierCurve3:OT,SplineCurve:DT});class FT extends yT{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=!0===e.isVector2?"LineCurve":"LineCurve3";this.curves.push(new UT[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),r=this.getCurveLengths();let i=0;for(;i<r.length;){if(r[i]>=n){const e=r[i]-n,o=this.curves[i],a=o.getLength(),s=0===a?0:1-e/a;return o.getPointAt(s,t)}i++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let r=0,i=this.curves;r<i.length;r++){const o=i[r],a=o.isEllipseCurve?2*e:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,s=o.getPoints(a);for(let e=0;e<s.length;e++){const r=s[e];n&&n.equals(r)||(t.push(r),n=r)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const n=e.curves[t];this.curves.push((new UT[n.type]).fromJSON(n))}return this}}class zT extends FT{constructor(e){super(),this.type="Path",this.currentPoint=new y_,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new IT(this.currentPoint.clone(),new y_(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){const i=new NT(this.currentPoint.clone(),new y_(e,t),new y_(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,i,o){const a=new RT(this.currentPoint.clone(),new y_(e,t),new y_(n,r),new y_(i,o));return this.curves.push(a),this.currentPoint.set(i,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new DT(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,i,o){const a=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+a,t+s,n,r,i,o),this}absarc(e,t,n,r,i,o){return this.absellipse(e,t,n,n,r,i,o),this}ellipse(e,t,n,r,i,o,a,s){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(e+l,t+c,n,r,i,o,a,s),this}absellipse(e,t,n,r,i,o,a,s){const l=new bT(e,t,n,r,i,o,a,s);if(this.curves.length>0){const e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class BT extends zT{constructor(e){super(e),this.uuid=d_(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const n=e.holes[t];this.holes.push((new zT).fromJSON(n))}return this}}function VT(e,t,n=2){const r=t&&t.length,i=r?t[0]*n:e.length;let o=jT(e,0,i,n,!0);const a=[];if(!o||o.next===o.prev)return a;let s,l,c;if(r&&(o=function(e,t,n,r){const i=[];for(let o=0,a=t.length;o<a;o++){const n=jT(e,t[o]*r,o<a-1?t[o+1]*r:e.length,r,!1);n===n.next&&(n.steiner=!0),i.push(QT(n))}i.sort(YT);for(let o=0;o<i.length;o++)n=ZT(i[o],n);return n}(e,t,o,n)),e.length>80*n){s=e[0],l=e[1];let t=s,r=l;for(let o=n;o<i;o+=n){const n=e[o],i=e[o+1];n<s&&(s=n),i<l&&(l=i),n>t&&(t=n),i>r&&(r=i)}c=Math.max(t-s,r-l),c=0!==c?32767/c:0}return WT(o,a,n,s,l,c,0),a}function jT(e,t,n,r,i){let o;if(i===function(e,t,n,r){let i=0;for(let o=t,a=n-r;o<n;o+=r)i+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return i}(e,t,n,r)>0)for(let a=t;a<n;a+=r)o=uA(a/r|0,e[a],e[a+1],o);else for(let a=n-r;a>=t;a-=r)o=uA(a/r|0,e[a],e[a+1],o);return o&&iA(o,o.next)&&(dA(o),o=o.next),o}function HT(e,t){if(!e)return e;t||(t=e);let n,r=e;do{if(n=!1,r.steiner||!iA(r,r.next)&&0!==rA(r.prev,r,r.next))r=r.next;else{if(dA(r),r=t=r.prev,r===r.next)break;n=!0}}while(n||r!==t);return t}function WT(e,t,n,r,i,o,a){if(!e)return;!a&&o&&function(e,t,n,r){let i=e;do{0===i.z&&(i.z=KT(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){let t,n=1;do{let r,i=e;e=null;let o=null;for(t=0;i;){t++;let a=i,s=0;for(let e=0;e<n&&(s++,a=a.nextZ,a);e++);let l=n;for(;s>0||l>0&&a;)0!==s&&(0===l||!a||i.z<=a.z)?(r=i,i=i.nextZ,s--):(r=a,a=a.nextZ,l--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;i=a}o.nextZ=null,n*=2}while(t>1)}(i)}(e,r,i,o);let s=e;for(;e.prev!==e.next;){const l=e.prev,c=e.next;if(o?XT(e,r,i,o):GT(e))t.push(l.i,e.i,c.i),dA(e),e=c.next,s=c.next;else if((e=c)===s){a?1===a?WT(e=qT(HT(e),t),t,n,r,i,o,2):2===a&&$T(e,t,n,r,i,o):WT(HT(e),t,n,r,i,o,1);break}}}function GT(e){const t=e.prev,n=e,r=e.next;if(rA(t,n,r)>=0)return!1;const i=t.x,o=n.x,a=r.x,s=t.y,l=n.y,c=r.y,u=Math.min(i,o,a),d=Math.min(s,l,c),h=Math.max(i,o,a),p=Math.max(s,l,c);let f=r.next;for(;f!==t;){if(f.x>=u&&f.x<=h&&f.y>=d&&f.y<=p&&tA(i,s,o,l,a,c,f.x,f.y)&&rA(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function XT(e,t,n,r){const i=e.prev,o=e,a=e.next;if(rA(i,o,a)>=0)return!1;const s=i.x,l=o.x,c=a.x,u=i.y,d=o.y,h=a.y,p=Math.min(s,l,c),f=Math.min(u,d,h),m=Math.max(s,l,c),g=Math.max(u,d,h),v=KT(p,f,t,n,r),y=KT(m,g,t,n,r);let b=e.prevZ,x=e.nextZ;for(;b&&b.z>=v&&x&&x.z<=y;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==i&&b!==a&&tA(s,u,l,d,c,h,b.x,b.y)&&rA(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==i&&x!==a&&tA(s,u,l,d,c,h,x.x,x.y)&&rA(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;b&&b.z>=v;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==i&&b!==a&&tA(s,u,l,d,c,h,b.x,b.y)&&rA(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;x&&x.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==i&&x!==a&&tA(s,u,l,d,c,h,x.x,x.y)&&rA(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function qT(e,t){let n=e;do{const r=n.prev,i=n.next.next;!iA(r,i)&&oA(r,n,n.next,i)&&lA(r,i)&&lA(i,r)&&(t.push(r.i,n.i,i.i),dA(n),dA(n.next),n=e=i),n=n.next}while(n!==e);return HT(n)}function $T(e,t,n,r,i,o){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.i!==e.i&&nA(a,e)){let s=cA(a,e);return a=HT(a,a.next),s=HT(s,s.next),WT(a,t,n,r,i,o,0),void WT(s,t,n,r,i,o,0)}e=e.next}a=a.next}while(a!==e)}function YT(e,t){let n=e.x-t.x;if(0===n&&(n=e.y-t.y,0===n)){n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)}return n}function ZT(e,t){const n=function(e,t){let n=t;const r=e.x,i=e.y;let o,a=-1/0;if(iA(e,n))return n;do{if(iA(e,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>a&&(a=e,o=n.x<n.next.x?n:n.next,e===r))return o}n=n.next}while(n!==t);if(!o)return null;const s=o,l=o.x,c=o.y;let u=1/0;n=o;do{if(r>=n.x&&n.x>=l&&r!==n.x&&eA(i<c?r:a,i,l,c,i<c?a:r,i,n.x,n.y)){const t=Math.abs(i-n.y)/(r-n.x);lA(n,e)&&(t<u||t===u&&(n.x>o.x||n.x===o.x&&JT(o,n)))&&(o=n,u=t)}n=n.next}while(n!==s);return o}(e,t);if(!n)return t;const r=cA(n,e);return HT(r,r.next),HT(n,n.next)}function JT(e,t){return rA(e.prev,e,t.prev)<0&&rA(t.next,e,e.next)<0}function KT(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function QT(e){let t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function eA(e,t,n,r,i,o,a,s){return(i-a)*(t-s)>=(e-a)*(o-s)&&(e-a)*(r-s)>=(n-a)*(t-s)&&(n-a)*(o-s)>=(i-a)*(r-s)}function tA(e,t,n,r,i,o,a,s){return!(e===a&&t===s)&&eA(e,t,n,r,i,o,a,s)}function nA(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&oA(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(lA(e,t)&&lA(t,e)&&function(e,t){let n=e,r=!1;const i=(e.x+t.x)/2,o=(e.y+t.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(rA(e.prev,e,t.prev)||rA(e,t.prev,t))||iA(e,t)&&rA(e.prev,e,e.next)>0&&rA(t.prev,t,t.next)>0)}function rA(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function iA(e,t){return e.x===t.x&&e.y===t.y}function oA(e,t,n,r){const i=sA(rA(e,t,n)),o=sA(rA(e,t,r)),a=sA(rA(n,r,e)),s=sA(rA(n,r,t));return i!==o&&a!==s||(!(0!==i||!aA(e,n,t))||(!(0!==o||!aA(e,r,t))||(!(0!==a||!aA(n,e,r))||!(0!==s||!aA(n,t,r)))))}function aA(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function sA(e){return e>0?1:e<0?-1:0}function lA(e,t){return rA(e.prev,e,e.next)<0?rA(e,t,e.next)>=0&&rA(e,e.prev,t)>=0:rA(e,t,e.prev)<0||rA(e,e.next,t)<0}function cA(e,t){const n=hA(e.i,e.x,e.y),r=hA(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function uA(e,t,n,r){const i=hA(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function dA(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function hA(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class pA{static triangulate(e,t,n=2){return VT(e,t,n)}}class fA{static area(e){const t=e.length;let n=0;for(let r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return.5*n}static isClockWise(e){return fA.area(e)<0}static triangulateShape(e,t){const n=[],r=[],i=[];mA(e),gA(n,e);let o=e.length;t.forEach(mA);for(let s=0;s<t.length;s++)r.push(o),o+=t[s].length,gA(n,t[s]);const a=pA.triangulate(n,r);for(let s=0;s<a.length;s+=3)i.push(a.slice(s,s+3));return i}}function mA(e){const t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function gA(e,t){for(let n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}class vA extends IS{constructor(e=new BT([new y_(.5,.5),new y_(-.5,.5),new y_(-.5,-.5),new y_(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,r=[],i=[];for(let a=0,s=e.length;a<s;a++){o(e[a])}function o(e){const o=[],a=void 0!==t.curveSegments?t.curveSegments:12,s=void 0!==t.steps?t.steps:1,l=void 0!==t.depth?t.depth:1;let c=void 0===t.bevelEnabled||t.bevelEnabled,u=void 0!==t.bevelThickness?t.bevelThickness:.2,d=void 0!==t.bevelSize?t.bevelSize:u-.1,h=void 0!==t.bevelOffset?t.bevelOffset:0,p=void 0!==t.bevelSegments?t.bevelSegments:3;const f=t.extrudePath,m=void 0!==t.UVGenerator?t.UVGenerator:yA;let g,v,y,b,x,_=!1;if(f){g=f.getSpacedPoints(s),_=!0,c=!1;const e=!!f.isCatmullRomCurve3&&f.closed;v=f.computeFrenetFrames(s,e),y=new x_,b=new x_,x=new x_}c||(p=0,u=0,d=0,h=0);const w=e.extractPoints(a);let S=w.shape;const M=w.holes;if(!fA.isClockWise(S)){S=S.reverse();for(let e=0,t=M.length;e<t;e++){const t=M[e];fA.isClockWise(t)&&(M[e]=t.reverse())}}function E(e){const t=1e-10*1e-10;let n=e[0];for(let r=1;r<=e.length;r++){const i=r%e.length,o=e[i],a=o.x-n.x,s=o.y-n.y,l=a*a+s*s,c=Math.max(Math.abs(o.x),Math.abs(o.y),Math.abs(n.x),Math.abs(n.y));l<=t*c*c?(e.splice(i,1),r--):n=o}}E(S),M.forEach(E);const T=M.length,A=S;for(let t=0;t<T;t++){const e=M[t];S=S.concat(e)}function C(e,t,n){return t||i_("ExtrudeGeometry: vec does not exist"),e.clone().addScaledVector(t,n)}const k=S.length;function R(e,t,n){let r,i,o;const a=e.x-t.x,s=e.y-t.y,l=n.x-e.x,c=n.y-e.y,u=a*a+s*s,d=a*c-s*l;if(Math.abs(d)>Number.EPSILON){const d=Math.sqrt(u),h=Math.sqrt(l*l+c*c),p=t.x-s/d,f=t.y+a/d,m=((n.x-c/h-p)*c-(n.y+l/h-f)*l)/(a*c-s*l);r=p+a*m-e.x,i=f+s*m-e.y;const g=r*r+i*i;if(g<=2)return new y_(r,i);o=Math.sqrt(g/2)}else{let e=!1;a>Number.EPSILON?l>Number.EPSILON&&(e=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(s)===Math.sign(c)&&(e=!0),e?(r=-s,i=a,o=Math.sqrt(u)):(r=a,i=s,o=Math.sqrt(u/2))}return new y_(r/o,i/o)}const P=[];for(let t=0,n=A.length,r=n-1,i=t+1;t<n;t++,r++,i++)r===n&&(r=0),i===n&&(i=0),P[t]=R(A[t],A[r],A[i]);const I=[];let L,N,O=P.concat();for(let t=0,n=T;t<n;t++){const e=M[t];L=[];for(let t=0,n=e.length,r=n-1,i=t+1;t<n;t++,r++,i++)r===n&&(r=0),i===n&&(i=0),L[t]=R(e[t],e[r],e[i]);I.push(L),O=O.concat(L)}if(0===p)N=fA.triangulateShape(A,M);else{const e=[],t=[];for(let n=0;n<p;n++){const r=n/p,i=u*Math.cos(r*Math.PI/2),o=d*Math.sin(r*Math.PI/2)+h;for(let t=0,n=A.length;t<n;t++){const n=C(A[t],P[t],o);z(n.x,n.y,-i),0===r&&e.push(n)}for(let e=0,n=T;e<n;e++){const n=M[e];L=I[e];const a=[];for(let e=0,t=n.length;e<t;e++){const t=C(n[e],L[e],o);z(t.x,t.y,-i),0===r&&a.push(t)}0===r&&t.push(a)}}N=fA.triangulateShape(e,t)}const D=N.length,U=d+h;for(let t=0;t<k;t++){const e=c?C(S[t],O[t],U):S[t];_?(b.copy(v.normals[0]).multiplyScalar(e.x),y.copy(v.binormals[0]).multiplyScalar(e.y),x.copy(g[0]).add(b).add(y),z(x.x,x.y,x.z)):z(e.x,e.y,0)}for(let t=1;t<=s;t++)for(let e=0;e<k;e++){const n=c?C(S[e],O[e],U):S[e];_?(b.copy(v.normals[t]).multiplyScalar(n.x),y.copy(v.binormals[t]).multiplyScalar(n.y),x.copy(g[t]).add(b).add(y),z(x.x,x.y,x.z)):z(n.x,n.y,l/s*t)}for(let t=p-1;t>=0;t--){const e=t/p,n=u*Math.cos(e*Math.PI/2),r=d*Math.sin(e*Math.PI/2)+h;for(let t=0,i=A.length;t<i;t++){const e=C(A[t],P[t],r);z(e.x,e.y,l+n)}for(let t=0,i=M.length;t<i;t++){const e=M[t];L=I[t];for(let t=0,i=e.length;t<i;t++){const i=C(e[t],L[t],r);_?z(i.x,i.y+g[s-1].y,g[s-1].x+n):z(i.x,i.y,l+n)}}}function F(e,t){let n=e.length;for(;--n>=0;){const r=n;let i=n-1;i<0&&(i=e.length-1);for(let e=0,n=s+2*p;e<n;e++){const n=k*e,o=k*(e+1);V(t+r+n,t+i+n,t+i+o,t+r+o)}}}function z(e,t,n){o.push(e),o.push(t),o.push(n)}function B(e,t,i){j(e),j(t),j(i);const o=r.length/3,a=m.generateTopUV(n,r,o-3,o-2,o-1);H(a[0]),H(a[1]),H(a[2])}function V(e,t,i,o){j(e),j(t),j(o),j(t),j(i),j(o);const a=r.length/3,s=m.generateSideWallUV(n,r,a-6,a-3,a-2,a-1);H(s[0]),H(s[1]),H(s[3]),H(s[1]),H(s[2]),H(s[3])}function j(e){r.push(o[3*e+0]),r.push(o[3*e+1]),r.push(o[3*e+2])}function H(e){i.push(e.x),i.push(e.y)}!function(){const e=r.length/3;if(c){let e=0,t=k*e;for(let n=0;n<D;n++){const e=N[n];B(e[2]+t,e[1]+t,e[0]+t)}e=s+2*p,t=k*e;for(let n=0;n<D;n++){const e=N[n];B(e[0]+t,e[1]+t,e[2]+t)}}else{for(let e=0;e<D;e++){const t=N[e];B(t[2],t[1],t[0])}for(let e=0;e<D;e++){const t=N[e];B(t[0]+k*s,t[1]+k*s,t[2]+k*s)}}n.addGroup(e,r.length/3-e,0)}(),function(){const e=r.length/3;let t=0;F(A,t),t+=A.length;for(let n=0,r=M.length;n<r;n++){const e=M[n];F(e,t),t+=e.length}n.addGroup(e,r.length/3-e,1)}()}this.setAttribute("position",new MS(r,3)),this.setAttribute("uv",new MS(i,2)),this.computeVertexNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return function(e,t,n){if(n.shapes=[],Array.isArray(e))for(let r=0,i=e.length;r<i;r++){const t=e[r];n.shapes.push(t.uuid)}else n.shapes.push(e.uuid);n.options=Object.assign({},t),void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON());return n}(this.parameters.shapes,this.parameters.options,e)}static fromJSON(e,t){const n=[];for(let i=0,o=e.shapes.length;i<o;i++){const r=t[e.shapes[i]];n.push(r)}const r=e.options.extrudePath;return void 0!==r&&(e.options.extrudePath=(new UT[r.type]).fromJSON(r)),new vA(n,e.options)}}const yA={generateTopUV:function(e,t,n,r,i){const o=t[3*n],a=t[3*n+1],s=t[3*r],l=t[3*r+1],c=t[3*i],u=t[3*i+1];return[new y_(o,a),new y_(s,l),new y_(c,u)]},generateSideWallUV:function(e,t,n,r,i,o){const a=t[3*n],s=t[3*n+1],l=t[3*n+2],c=t[3*r],u=t[3*r+1],d=t[3*r+2],h=t[3*i],p=t[3*i+1],f=t[3*i+2],m=t[3*o],g=t[3*o+1],v=t[3*o+2];return Math.abs(s-u)<Math.abs(a-c)?[new y_(a,1-l),new y_(c,1-d),new y_(h,1-f),new y_(m,1-v)]:[new y_(s,1-l),new y_(u,1-d),new y_(p,1-f),new y_(g,1-v)]}};class bA extends dT{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2;super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new bA(e.radius,e.detail)}}class xA extends IS{constructor(e=[new y_(0,-.5),new y_(.5,0),new y_(0,.5)],t=12,n=0,r=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t),r=h_(r,0,2*Math.PI);const i=[],o=[],a=[],s=[],l=[],c=1/t,u=new x_,d=new y_,h=new x_,p=new x_,f=new x_;let m=0,g=0;for(let v=0;v<=e.length-1;v++)switch(v){case 0:m=e[v+1].x-e[v].x,g=e[v+1].y-e[v].y,h.x=1*g,h.y=-m,h.z=0*g,f.copy(h),h.normalize(),s.push(h.x,h.y,h.z);break;case e.length-1:s.push(f.x,f.y,f.z);break;default:m=e[v+1].x-e[v].x,g=e[v+1].y-e[v].y,h.x=1*g,h.y=-m,h.z=0*g,p.copy(h),h.x+=f.x,h.y+=f.y,h.z+=f.z,h.normalize(),s.push(h.x,h.y,h.z),f.copy(p)}for(let v=0;v<=t;v++){const i=n+v*c*r,h=Math.sin(i),p=Math.cos(i);for(let n=0;n<=e.length-1;n++){u.x=e[n].x*h,u.y=e[n].y,u.z=e[n].x*p,o.push(u.x,u.y,u.z),d.x=v/t,d.y=n/(e.length-1),a.push(d.x,d.y);const r=s[3*n+0]*h,i=s[3*n+1],c=s[3*n+0]*p;l.push(r,i,c)}}for(let v=0;v<t;v++)for(let t=0;t<e.length-1;t++){const n=t+v*e.length,r=n,o=n+e.length,a=n+e.length+1,s=n+1;i.push(r,o,s),i.push(a,s,o)}this.setIndex(i),this.setAttribute("position",new MS(o,3)),this.setAttribute("uv",new MS(a,2)),this.setAttribute("normal",new MS(l,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new xA(e.points,e.segments,e.phiStart,e.phiLength)}}class _A extends dT{constructor(e=1,t=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new _A(e.radius,e.detail)}}class wA extends IS{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const i=e/2,o=t/2,a=Math.floor(n),s=Math.floor(r),l=a+1,c=s+1,u=e/a,d=t/s,h=[],p=[],f=[],m=[];for(let g=0;g<c;g++){const e=g*d-o;for(let t=0;t<l;t++){const n=t*u-i;p.push(n,-e,0),f.push(0,0,1),m.push(t/a),m.push(1-g/s)}}for(let g=0;g<s;g++)for(let e=0;e<a;e++){const t=e+l*g,n=e+l*(g+1),r=e+1+l*(g+1),i=e+1+l*g;h.push(t,n,i),h.push(n,r,i)}this.setIndex(h),this.setAttribute("position",new MS(p,3)),this.setAttribute("normal",new MS(f,3)),this.setAttribute("uv",new MS(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new wA(e.width,e.height,e.widthSegments,e.heightSegments)}}class SA extends IS{constructor(e=.5,t=1,n=32,r=1,i=0,o=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:o},n=Math.max(3,n);const a=[],s=[],l=[],c=[];let u=e;const d=(t-e)/(r=Math.max(1,r)),h=new x_,p=new y_;for(let f=0;f<=r;f++){for(let e=0;e<=n;e++){const r=i+e/n*o;h.x=u*Math.cos(r),h.y=u*Math.sin(r),s.push(h.x,h.y,h.z),l.push(0,0,1),p.x=(h.x/t+1)/2,p.y=(h.y/t+1)/2,c.push(p.x,p.y)}u+=d}for(let f=0;f<r;f++){const e=f*(n+1);for(let t=0;t<n;t++){const r=t+e,i=r,o=r+n+1,s=r+n+2,l=r+1;a.push(i,o,l),a.push(o,s,l)}}this.setIndex(a),this.setAttribute("position",new MS(s,3)),this.setAttribute("normal",new MS(l,3)),this.setAttribute("uv",new MS(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new SA(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class MA extends IS{constructor(e=new BT([new y_(0,.5),new y_(-.5,-.5),new y_(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],r=[],i=[],o=[];let a=0,s=0;if(!1===Array.isArray(e))l(e);else for(let c=0;c<e.length;c++)l(e[c]),this.addGroup(a,s,c),a+=s,s=0;function l(e){const a=r.length/3,l=e.extractPoints(t);let c=l.shape;const u=l.holes;!1===fA.isClockWise(c)&&(c=c.reverse());for(let t=0,n=u.length;t<n;t++){const e=u[t];!0===fA.isClockWise(e)&&(u[t]=e.reverse())}const d=fA.triangulateShape(c,u);for(let t=0,n=u.length;t<n;t++){const e=u[t];c=c.concat(e)}for(let t=0,n=c.length;t<n;t++){const e=c[t];r.push(e.x,e.y,0),i.push(0,0,1),o.push(e.x,e.y)}for(let t=0,r=d.length;t<r;t++){const e=d[t],r=e[0]+a,i=e[1]+a,o=e[2]+a;n.push(r,i,o),s+=3}}this.setIndex(n),this.setAttribute("position",new MS(r,3)),this.setAttribute("normal",new MS(i,3)),this.setAttribute("uv",new MS(o,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return function(e,t){if(t.shapes=[],Array.isArray(e))for(let n=0,r=e.length;n<r;n++){const r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}static fromJSON(e,t){const n=[];for(let r=0,i=e.shapes.length;r<i;r++){const i=t[e.shapes[r]];n.push(i)}return new MA(n,e.curveSegments)}}class EA extends IS{constructor(e=1,t=32,n=16,r=0,i=2*Math.PI,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const s=Math.min(o+a,Math.PI);let l=0;const c=[],u=new x_,d=new x_,h=[],p=[],f=[],m=[];for(let g=0;g<=n;g++){const h=[],v=g/n;let y=0;0===g&&0===o?y=.5/t:g===n&&s===Math.PI&&(y=-.5/t);for(let n=0;n<=t;n++){const s=n/t;u.x=-e*Math.cos(r+s*i)*Math.sin(o+v*a),u.y=e*Math.cos(o+v*a),u.z=e*Math.sin(r+s*i)*Math.sin(o+v*a),p.push(u.x,u.y,u.z),d.copy(u).normalize(),f.push(d.x,d.y,d.z),m.push(s+y,1-v),h.push(l++)}c.push(h)}for(let g=0;g<n;g++)for(let e=0;e<t;e++){const t=c[g][e+1],r=c[g][e],i=c[g+1][e],a=c[g+1][e+1];(0!==g||o>0)&&h.push(t,r,a),(g!==n-1||s<Math.PI)&&h.push(r,i,a)}this.setIndex(h),this.setAttribute("position",new MS(p,3)),this.setAttribute("normal",new MS(f,3)),this.setAttribute("uv",new MS(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new EA(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class TA extends dT{constructor(e=1,t=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new TA(e.radius,e.detail)}}class AA extends IS{constructor(e=1,t=.4,n=12,r=48,i=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},n=Math.floor(n),r=Math.floor(r);const o=[],a=[],s=[],l=[],c=new x_,u=new x_,d=new x_;for(let h=0;h<=n;h++)for(let o=0;o<=r;o++){const p=o/r*i,f=h/n*Math.PI*2;u.x=(e+t*Math.cos(f))*Math.cos(p),u.y=(e+t*Math.cos(f))*Math.sin(p),u.z=t*Math.sin(f),a.push(u.x,u.y,u.z),c.x=e*Math.cos(p),c.y=e*Math.sin(p),d.subVectors(u,c).normalize(),s.push(d.x,d.y,d.z),l.push(o/r),l.push(h/n)}for(let h=1;h<=n;h++)for(let e=1;e<=r;e++){const t=(r+1)*h+e-1,n=(r+1)*(h-1)+e-1,i=(r+1)*(h-1)+e,a=(r+1)*h+e;o.push(t,n,a),o.push(n,i,a)}this.setIndex(o),this.setAttribute("position",new MS(a,3)),this.setAttribute("normal",new MS(s,3)),this.setAttribute("uv",new MS(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new AA(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class CA extends IS{constructor(e=1,t=.4,n=64,r=8,i=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:o},n=Math.floor(n),r=Math.floor(r);const a=[],s=[],l=[],c=[],u=new x_,d=new x_,h=new x_,p=new x_,f=new x_,m=new x_,g=new x_;for(let y=0;y<=n;++y){const a=y/n*i*Math.PI*2;v(a,i,o,e,h),v(a+.01,i,o,e,p),m.subVectors(p,h),g.addVectors(p,h),f.crossVectors(m,g),g.crossVectors(f,m),f.normalize(),g.normalize();for(let e=0;e<=r;++e){const i=e/r*Math.PI*2,o=-t*Math.cos(i),a=t*Math.sin(i);u.x=h.x+(o*g.x+a*f.x),u.y=h.y+(o*g.y+a*f.y),u.z=h.z+(o*g.z+a*f.z),s.push(u.x,u.y,u.z),d.subVectors(u,h).normalize(),l.push(d.x,d.y,d.z),c.push(y/n),c.push(e/r)}}for(let y=1;y<=n;y++)for(let e=1;e<=r;e++){const t=(r+1)*(y-1)+(e-1),n=(r+1)*y+(e-1),i=(r+1)*y+e,o=(r+1)*(y-1)+e;a.push(t,n,o),a.push(n,i,o)}function v(e,t,n,r,i){const o=Math.cos(e),a=Math.sin(e),s=n/t*e,l=Math.cos(s);i.x=r*(2+l)*.5*o,i.y=r*(2+l)*a*.5,i.z=r*Math.sin(s)*.5}this.setIndex(a),this.setAttribute("position",new MS(s,3)),this.setAttribute("normal",new MS(l,3)),this.setAttribute("uv",new MS(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new CA(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class kA extends IS{constructor(e=new OT(new x_(-1,-1,0),new x_(-1,1,0),new x_(1,1,0)),t=64,n=1,r=8,i=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i};const o=e.computeFrenetFrames(t,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new x_,s=new x_,l=new y_;let c=new x_;const u=[],d=[],h=[],p=[];function f(i){c=e.getPointAt(i/t,c);const l=o.normals[i],h=o.binormals[i];for(let e=0;e<=r;e++){const t=e/r*Math.PI*2,i=Math.sin(t),o=-Math.cos(t);s.x=o*l.x+i*h.x,s.y=o*l.y+i*h.y,s.z=o*l.z+i*h.z,s.normalize(),d.push(s.x,s.y,s.z),a.x=c.x+n*s.x,a.y=c.y+n*s.y,a.z=c.z+n*s.z,u.push(a.x,a.y,a.z)}}!function(){for(let e=0;e<t;e++)f(e);f(!1===i?t:0),function(){for(let e=0;e<=t;e++)for(let n=0;n<=r;n++)l.x=e/t,l.y=n/r,h.push(l.x,l.y)}(),function(){for(let e=1;e<=t;e++)for(let t=1;t<=r;t++){const n=(r+1)*(e-1)+(t-1),i=(r+1)*e+(t-1),o=(r+1)*e+t,a=(r+1)*(e-1)+t;p.push(n,i,a),p.push(i,o,a)}}()}(),this.setIndex(p),this.setAttribute("position",new MS(u,3)),this.setAttribute("normal",new MS(d,3)),this.setAttribute("uv",new MS(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new kA((new UT[e.path.type]).fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class RA extends IS{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},null!==e){const t=[],n=new Set,r=new x_,i=new x_;if(null!==e.index){const o=e.attributes.position,a=e.index;let s=e.groups;0===s.length&&(s=[{start:0,count:a.count,materialIndex:0}]);for(let e=0,l=s.length;e<l;++e){const l=s[e],c=l.start;for(let e=c,s=c+l.count;e<s;e+=3)for(let l=0;l<3;l++){const s=a.getX(e+l),c=a.getX(e+(l+1)%3);r.fromBufferAttribute(o,s),i.fromBufferAttribute(o,c),!0===PA(r,i,n)&&(t.push(r.x,r.y,r.z),t.push(i.x,i.y,i.z))}}}else{const o=e.attributes.position;for(let e=0,a=o.count/3;e<a;e++)for(let s=0;s<3;s++){const a=3*e+s,l=3*e+(s+1)%3;r.fromBufferAttribute(o,a),i.fromBufferAttribute(o,l),!0===PA(r,i,n)&&(t.push(r.x,r.y,r.z),t.push(i.x,i.y,i.z))}}this.setAttribute("position",new MS(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function PA(e,t,n){const r=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`,i=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`;return!0!==n.has(r)&&!0!==n.has(i)&&(n.add(r),n.add(i),!0)}var IA=Object.freeze({__proto__:null,BoxGeometry:XS,CapsuleGeometry:sT,CircleGeometry:lT,ConeGeometry:uT,CylinderGeometry:cT,DodecahedronGeometry:hT,EdgesGeometry:vT,ExtrudeGeometry:vA,IcosahedronGeometry:bA,LatheGeometry:xA,OctahedronGeometry:_A,PlaneGeometry:wA,PolyhedronGeometry:dT,RingGeometry:SA,ShapeGeometry:MA,SphereGeometry:EA,TetrahedronGeometry:TA,TorusGeometry:AA,TorusKnotGeometry:CA,TubeGeometry:kA,WireframeGeometry:RA});class LA extends hS{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new cS(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class NA extends JS{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class OA extends hS{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new cS(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new cS(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new y_(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Aw,this.envMapIntensity=1,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.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,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.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,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 DA extends OA{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new y_(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return h_(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new cS(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new cS(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new cS(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=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 UA extends hS{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new cS(16777215),this.specular=new cS(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new cS(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new y_(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Aw,this.combine=0,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 FA extends hS{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new cS(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new cS(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new y_(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,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.gradientMap=e.gradientMap,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.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class zA extends hS{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new y_(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 BA extends hS{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new cS(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new cS(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new y_(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Aw,this.combine=0,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}}class VA extends hS{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,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 jA extends hS{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}}class HA extends hS{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new cS(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new y_(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,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.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class WA extends OE{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function GA(e,t){return e&&e.constructor!==t?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function XA(e){const t=e.length,n=new Array(t);for(let r=0;r!==t;++r)n[r]=r;return n.sort(function(t,n){return e[t]-e[n]}),n}function qA(e,t,n){const r=e.length,i=new e.constructor(r);for(let o=0,a=0;a!==r;++o){const r=n[o]*t;for(let n=0;n!==t;++n)i[a++]=e[r+n]}return i}function $A(e,t,n,r){let i=1,o=e[0];for(;void 0!==o&&void 0===o[r];)o=e[i++];if(void 0===o)return;let a=o[r];if(void 0!==a)if(Array.isArray(a))do{a=o[r],void 0!==a&&(t.push(o.time),n.push(...a)),o=e[i++]}while(void 0!==o);else if(void 0!==a.toArray)do{a=o[r],void 0!==a&&(t.push(o.time),a.toArray(n,n.length)),o=e[i++]}while(void 0!==o);else do{a=o[r],void 0!==a&&(t.push(o.time),n.push(a)),o=e[i++]}while(void 0!==o)}class YA{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,r=t[n],i=t[n-1];e:{t:{let o;n:{r:if(!(e<r)){for(let o=n+2;;){if(void 0===r){if(e<i)break r;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(i=r,r=t[++n],e<r)break t}o=t.length;break n}if(!(e>=i)){const a=t[1];e<a&&(n=2,i=a);for(let o=n-2;;){if(void 0===i)return this._cachedIndex=0,this.copySampleValue_(0);if(n===o)break;if(r=i,i=t[--n-1],e>=i)break t}o=n,n=0;break n}break e}for(;n<o;){const r=n+o>>>1;e<t[r]?o=r:n=r+1}if(r=t[n],i=t[n-1],void 0===i)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===r)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r;for(let o=0;o!==r;++o)t[o]=n[i+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class ZA extends YA{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ex,endingEnd:Ex}}intervalChanged_(e,t,n){const r=this.parameterPositions;let i=e-2,o=e+1,a=r[i],s=r[o];if(void 0===a)switch(this.getSettings_().endingStart){case Tx:i=e,a=2*t-n;break;case Ax:i=r.length-2,a=t+r[i]-r[i+1];break;default:i=e,a=n}if(void 0===s)switch(this.getSettings_().endingEnd){case Tx:o=e,s=2*n-t;break;case Ax:o=1,s=n+r[1]-r[0];break;default:o=e-1,s=t}const l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-a),this._weightNext=l/(s-n),this._offsetPrev=i*c,this._offsetNext=o*c}interpolate_(e,t,n,r){const i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,l=s-a,c=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,h=this._weightNext,p=(n-t)/(r-t),f=p*p,m=f*p,g=-d*m+2*d*f-d*p,v=(1+d)*m+(-1.5-2*d)*f+(-.5+d)*p+1,y=(-1-h)*m+(1.5+h)*f+.5*p,b=h*m-h*f;for(let x=0;x!==a;++x)i[x]=g*o[c+x]+v*o[l+x]+y*o[s+x]+b*o[u+x];return i}}class JA extends YA{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,l=s-a,c=(n-t)/(r-t),u=1-c;for(let d=0;d!==a;++d)i[d]=o[l+d]*u+o[s+d]*c;return i}}class KA extends YA{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class QA{constructor(e,t,n,r){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=GA(t,this.TimeBufferType),this.values=GA(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:GA(e.times,Array),values:GA(e.values,Array)};const t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new KA(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new JA(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new ZA(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case wx:t=this.InterpolantFactoryMethodDiscrete;break;case Sx:t=this.InterpolantFactoryMethodLinear;break;case Mx:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){const t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(t);this.setInterpolation(this.DefaultInterpolation)}return r_("KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return wx;case this.InterpolantFactoryMethodLinear:return Sx;case this.InterpolantFactoryMethodSmooth:return Mx}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(1!==e){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){const n=this.times,r=n.length;let i=0,o=r-1;for(;i!==r&&n[i]<e;)++i;for(;-1!==o&&n[o]>t;)--o;if(++o,0!==i||o!==r){i>=o&&(o=Math.max(o,1),i=o-1);const e=this.getValueSize();this.times=n.slice(i,o),this.values=this.values.slice(i*e,o*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(i_("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,r=this.values,i=n.length;0===i&&(i_("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==i;a++){const t=n[a];if("number"==typeof t&&isNaN(t)){i_("KeyframeTrack: Time is not a valid number.",this,a,t),e=!1;break}if(null!==o&&o>t){i_("KeyframeTrack: Out of order keys.",this,a,t,o),e=!1;break}o=t}if(void 0!==r&&Jx(r))for(let a=0,s=r.length;a!==s;++a){const t=r[a];if(isNaN(t)){i_("KeyframeTrack: Value is not a valid number.",this,a,t),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===Mx,i=e.length-1;let o=1;for(let a=1;a<i;++a){let i=!1;const s=e[a];if(s!==e[a+1]&&(1!==a||s!==e[0]))if(r)i=!0;else{const e=a*n,r=e-n,o=e+n;for(let a=0;a!==n;++a){const n=t[e+a];if(n!==t[r+a]||n!==t[o+a]){i=!0;break}}}if(i){if(a!==o){e[o]=e[a];const r=a*n,i=o*n;for(let e=0;e!==n;++e)t[i+e]=t[r+e]}++o}}if(i>0){e[o]=e[i];for(let e=i*n,r=o*n,a=0;a!==n;++a)t[r+a]=t[e+a];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}QA.prototype.ValueTypeName="",QA.prototype.TimeBufferType=Float32Array,QA.prototype.ValueBufferType=Float32Array,QA.prototype.DefaultInterpolation=Sx;class eC extends QA{constructor(e,t,n){super(e,t,n)}}eC.prototype.ValueTypeName="bool",eC.prototype.ValueBufferType=Array,eC.prototype.DefaultInterpolation=wx,eC.prototype.InterpolantFactoryMethodLinear=void 0,eC.prototype.InterpolantFactoryMethodSmooth=void 0;class tC extends QA{constructor(e,t,n,r){super(e,t,n,r)}}tC.prototype.ValueTypeName="color";class nC extends QA{constructor(e,t,n,r){super(e,t,n,r)}}nC.prototype.ValueTypeName="number";class rC extends YA{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=(n-t)/(r-t);let l=e*a;for(let c=l+a;l!==c;l+=4)b_.slerpFlat(i,0,o,l-a,o,l,s);return i}}class iC extends QA{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new rC(this.times,this.values,this.getValueSize(),e)}}iC.prototype.ValueTypeName="quaternion",iC.prototype.InterpolantFactoryMethodSmooth=void 0;class oC extends QA{constructor(e,t,n){super(e,t,n)}}oC.prototype.ValueTypeName="string",oC.prototype.ValueBufferType=Array,oC.prototype.DefaultInterpolation=wx,oC.prototype.InterpolantFactoryMethodLinear=void 0,oC.prototype.InterpolantFactoryMethodSmooth=void 0;class aC extends QA{constructor(e,t,n,r){super(e,t,n,r)}}aC.prototype.ValueTypeName="vector";class sC{constructor(e="",t=-1,n=[],r=2500){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=d_(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,r=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(lC(n[o]).scale(r));const i=new this(e.name,e.duration,t,e.blendMode);return i.uuid=e.uuid,i.userData=JSON.parse(e.userData||"{}"),i}static toJSON(e){const t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let i=0,o=n.length;i!==o;++i)t.push(QA.toJSON(n[i]));return r}static CreateFromMorphTargetSequence(e,t,n,r){const i=t.length,o=[];for(let a=0;a<i;a++){let e=[],s=[];e.push((a+i-1)%i,a,(a+1)%i),s.push(0,1,0);const l=XA(e);e=qA(e,1,l),s=qA(s,1,l),r||0!==e[0]||(e.push(i),s.push(s[0])),o.push(new nC(".morphTargetInfluences["+t[a].name+"]",e,s).scale(1/n))}return new this(e,-1,o)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const t=e;n=t.geometry&&t.geometry.animations||t.animations}for(let r=0;r<n.length;r++)if(n[r].name===t)return n[r];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const r={},i=/^([\w-]*?)([\d]+)$/;for(let a=0,s=e.length;a<s;a++){const t=e[a],n=t.name.match(i);if(n&&n.length>1){const e=n[1];let i=r[e];i||(r[e]=i=[]),i.push(t)}}const o=[];for(const a in r)o.push(this.CreateFromMorphTargetSequence(a,r[a],t,n));return o}static parseAnimation(e,t){if(r_("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return i_("AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,r,i){if(0!==n.length){const o=[],a=[];$A(n,o,a,r),0!==o.length&&i.push(new e(t,o,a))}},r=[],i=e.name||"default",o=e.fps||30,a=e.blendMode;let s=e.length||-1;const l=e.hierarchy||[];for(let c=0;c<l.length;c++){const e=l[c].keys;if(e&&0!==e.length)if(e[0].morphTargets){const t={};let n;for(n=0;n<e.length;n++)if(e[n].morphTargets)for(let r=0;r<e[n].morphTargets.length;r++)t[e[n].morphTargets[r]]=-1;for(const i in t){const t=[],o=[];for(let r=0;r!==e[n].morphTargets.length;++r){const r=e[n];t.push(r.time),o.push(r.morphTarget===i?1:0)}r.push(new nC(".morphTargetInfluence["+i+"]",t,o))}s=t.length*o}else{const i=".bones["+t[c].name+"]";n(aC,i+".position",e,"pos",r),n(iC,i+".quaternion",e,"rot",r),n(aC,i+".scale",e,"scl",r)}}if(0===r.length)return null;return new this(i,s,r,a)}resetDuration(){let e=0;for(let t=0,n=this.tracks.length;t!==n;++t){const n=this.tracks[t];e=Math.max(e,n.times[n.times.length-1])}return this.duration=e,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());const t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function lC(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return nC;case"vector":case"vector2":case"vector3":case"vector4":return aC;case"color":return tC;case"quaternion":return iC;case"bool":case"boolean":return eC;case"string":return oC}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){const t=[],n=[];$A(e.keys,t,n,"value"),e.times=t,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}const cC={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};class uC{constructor(e,t,n){const r=this;let i,o=!1,a=0,s=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(e){s++,!1===o&&void 0!==r.onStart&&r.onStart(e,a,s),o=!0},this.itemEnd=function(e){a++,void 0!==r.onProgress&&r.onProgress(e,a,s),a===s&&(o=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)},this.resolveURL=function(e){return i?i(e):e},this.setURLModifier=function(e){return i=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){const t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=l.length;t<n;t+=2){const n=l[t],r=l[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return r}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const dC=new uC;class hC{constructor(e){this.manager=void 0!==e?e:dC,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(r,i){n.load(e,r,t,i)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}hC.DEFAULT_MATERIAL_NAME="__DEFAULT";const pC={};class fC extends Error{constructor(e,t){super(e),this.response=t}}class mC extends hC{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const i=cC.get(`file:${e}`);if(void 0!==i)return this.manager.itemStart(e),setTimeout(()=>{t&&t(i),this.manager.itemEnd(e)},0),i;if(void 0!==pC[e])return void pC[e].push({onLoad:t,onProgress:n,onError:r});pC[e]=[],pC[e].push({onLoad:t,onProgress:n,onError:r});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:"function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,s=this.responseType;fetch(o).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&r_("FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const n=pC[e],r=t.body.getReader(),i=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),o=i?parseInt(i):0,a=0!==o;let s=0;const l=new ReadableStream({start(e){!function t(){r.read().then(({done:r,value:i})=>{if(r)e.close();else{s+=i.byteLength;const r=new ProgressEvent("progress",{lengthComputable:a,loaded:s,total:o});for(let e=0,t=n.length;e<t;e++){const t=n[e];t.onProgress&&t.onProgress(r)}e.enqueue(i),t()}},t=>{e.error(t)})}()}});return new Response(l)}throw new fC(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(s){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>(new DOMParser).parseFromString(e,a));case"json":return e.json();default:if(""===a)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(a),n=t&&t[1]?t[1].toLowerCase():void 0,r=new TextDecoder(n);return e.arrayBuffer().then(e=>r.decode(e))}}}).then(t=>{cC.add(`file:${e}`,t);const n=pC[e];delete pC[e];for(let e=0,r=n.length;e<r;e++){const r=n[e];r.onLoad&&r.onLoad(t)}}).catch(t=>{const n=pC[e];if(void 0===n)throw this.manager.itemError(e),t;delete pC[e];for(let e=0,r=n.length;e<r;e++){const r=n[e];r.onError&&r.onError(t)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}const gC=new WeakMap;class vC extends hC{constructor(e){super(e)}load(e,t,n,r){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const i=this,o=cC.get(`image:${e}`);if(void 0!==o){if(!0===o.complete)i.manager.itemStart(e),setTimeout(function(){t&&t(o),i.manager.itemEnd(e)},0);else{let e=gC.get(o);void 0===e&&(e=[],gC.set(o,e)),e.push({onLoad:t,onError:r})}return o}const a=Kx("img");function s(){c(),t&&t(this);const n=gC.get(this)||[];for(let e=0;e<n.length;e++){const t=n[e];t.onLoad&&t.onLoad(this)}gC.delete(this),i.manager.itemEnd(e)}function l(t){c(),r&&r(t),cC.remove(`image:${e}`);const n=gC.get(this)||[];for(let e=0;e<n.length;e++){const r=n[e];r.onError&&r.onError(t)}gC.delete(this),i.manager.itemError(e),i.manager.itemEnd(e)}function c(){a.removeEventListener("load",s,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",s,!1),a.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),cC.add(`image:${e}`,a),i.manager.itemStart(e),a.src=e,a}}class yC extends hC{constructor(e){super(e)}load(e,t,n,r){const i=new F_,o=new vC(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(e){i.image=e,i.needsUpdate=!0,void 0!==t&&t(i)},n,r),i}}class bC extends Ww{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new cS(e),this.intensity=t}dispose(){this.dispatchEvent({type:"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,t}}class xC extends bC{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Ww.DEFAULT_UP),this.updateMatrix(),this.groundColor=new cS(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){const t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}const _C=new vw,wC=new x_,SC=new x_;class MC{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new y_(512,512),this.mapType=vb,this.map=null,this.mapPass=null,this.matrix=new vw,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new hE,this._frameExtents=new y_(1,1),this._viewportCount=1,this._viewports=[new z_(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;wC.setFromMatrixPosition(e.matrixWorld),t.position.copy(wC),SC.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(SC),t.updateMatrixWorld(),_C.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_C,t.coordinateSystem,t.reversedDepth),t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(_C)}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.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const e={};return 1!==this.intensity&&(e.intensity=this.intensity),0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class EC extends MC{constructor(){super(new nM(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=2*u_*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,i=e.distance||t.far;n===t.fov&&r===t.aspect&&i===t.far||(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class TC extends bC{constructor(e,t,n=0,r=Math.PI/3,i=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Ww.DEFAULT_UP),this.updateMatrix(),this.target=new Ww,this.distance=n,this.angle=r,this.penumbra=i,this.decay=o,this.map=null,this.shadow=new EC}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.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.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}}class AC extends MC{constructor(){super(new nM(90,1,.5,500)),this.isPointLightShadow=!0}}class CC extends bC{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new AC}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.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}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class kC extends KS{constructor(e=-1,t=1,n=1,r=-1,i=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=i,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=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,i,o){null===this.view&&(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=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let i=n-e,o=n+e,a=r+t,s=r-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=e*this.view.offsetX,o=i+e*this.view.width,a-=t*this.view.offsetY,s=a-t*this.view.height}this.projectionMatrix.makeOrthographic(i,o,a,s,this.near,this.far,this.coordinateSystem,this.reversedDepth),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,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}class RC extends MC{constructor(){super(new kC(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class PC extends bC{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ww.DEFAULT_UP),this.updateMatrix(),this.target=new Ww,this.shadow=new RC}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class IC extends bC{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class LC extends bC{constructor(e,t,n=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class NC{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new x_)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,r=e.y,i=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*i),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],n*r*1.092548),t.addScaledVector(o[5],r*i*1.092548),t.addScaledVector(o[6],.315392*(3*i*i-1)),t.addScaledVector(o[7],n*i*1.092548),t.addScaledVector(o[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){const n=e.x,r=e.y,i=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],1.023328*r),t.addScaledVector(o[2],1.023328*i),t.addScaledVector(o[3],1.023328*n),t.addScaledVector(o[4],.858086*n*r),t.addScaledVector(o[5],.858086*r*i),t.addScaledVector(o[6],.743125*i*i-.247708),t.addScaledVector(o[7],.858086*n*i),t.addScaledVector(o[8],.429043*(n*n-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+3*r);return this}toArray(e=[],t=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+3*r);return e}static getBasisAt(e,t){const n=e.x,r=e.y,i=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*i,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*i,t[6]=.315392*(3*i*i-1),t[7]=1.092548*n*i,t[8]=.546274*(n*n-r*r)}}class OC extends bC{constructor(e=new NC,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class DC extends hC{constructor(e){super(e),this.textures={}}load(e,t,n,r){const i=this,o=new mC(i.manager);o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(Dv){r?r(Dv):i_(Dv),i.manager.itemError(e)}},n,r)}parse(e){const t=this.textures;function n(e){return void 0===t[e]&&r_("MaterialLoader: Undefined texture",e),t[e]}const r=this.createMaterialFromType(e.type);if(void 0!==e.uuid&&(r.uuid=e.uuid),void 0!==e.name&&(r.name=e.name),void 0!==e.color&&void 0!==r.color&&r.color.setHex(e.color),void 0!==e.roughness&&(r.roughness=e.roughness),void 0!==e.metalness&&(r.metalness=e.metalness),void 0!==e.sheen&&(r.sheen=e.sheen),void 0!==e.sheenColor&&(r.sheenColor=(new cS).setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(r.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==r.emissive&&r.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==r.specular&&r.specular.setHex(e.specular),void 0!==e.specularIntensity&&(r.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==r.specularColor&&r.specularColor.setHex(e.specularColor),void 0!==e.shininess&&(r.shininess=e.shininess),void 0!==e.clearcoat&&(r.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(r.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.dispersion&&(r.dispersion=e.dispersion),void 0!==e.iridescence&&(r.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(r.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(r.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(r.transmission=e.transmission),void 0!==e.thickness&&(r.thickness=e.thickness),void 0!==e.attenuationDistance&&(r.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==r.attenuationColor&&r.attenuationColor.setHex(e.attenuationColor),void 0!==e.anisotropy&&(r.anisotropy=e.anisotropy),void 0!==e.anisotropyRotation&&(r.anisotropyRotation=e.anisotropyRotation),void 0!==e.fog&&(r.fog=e.fog),void 0!==e.flatShading&&(r.flatShading=e.flatShading),void 0!==e.blending&&(r.blending=e.blending),void 0!==e.combine&&(r.combine=e.combine),void 0!==e.side&&(r.side=e.side),void 0!==e.shadowSide&&(r.shadowSide=e.shadowSide),void 0!==e.opacity&&(r.opacity=e.opacity),void 0!==e.transparent&&(r.transparent=e.transparent),void 0!==e.alphaTest&&(r.alphaTest=e.alphaTest),void 0!==e.alphaHash&&(r.alphaHash=e.alphaHash),void 0!==e.depthFunc&&(r.depthFunc=e.depthFunc),void 0!==e.depthTest&&(r.depthTest=e.depthTest),void 0!==e.depthWrite&&(r.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(r.colorWrite=e.colorWrite),void 0!==e.blendSrc&&(r.blendSrc=e.blendSrc),void 0!==e.blendDst&&(r.blendDst=e.blendDst),void 0!==e.blendEquation&&(r.blendEquation=e.blendEquation),void 0!==e.blendSrcAlpha&&(r.blendSrcAlpha=e.blendSrcAlpha),void 0!==e.blendDstAlpha&&(r.blendDstAlpha=e.blendDstAlpha),void 0!==e.blendEquationAlpha&&(r.blendEquationAlpha=e.blendEquationAlpha),void 0!==e.blendColor&&void 0!==r.blendColor&&r.blendColor.setHex(e.blendColor),void 0!==e.blendAlpha&&(r.blendAlpha=e.blendAlpha),void 0!==e.stencilWriteMask&&(r.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(r.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(r.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(r.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(r.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(r.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(r.stencilZPass=e.stencilZPass),void 0!==e.stencilWrite&&(r.stencilWrite=e.stencilWrite),void 0!==e.wireframe&&(r.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(r.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(r.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(r.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(r.rotation=e.rotation),void 0!==e.linewidth&&(r.linewidth=e.linewidth),void 0!==e.dashSize&&(r.dashSize=e.dashSize),void 0!==e.gapSize&&(r.gapSize=e.gapSize),void 0!==e.scale&&(r.scale=e.scale),void 0!==e.polygonOffset&&(r.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(r.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(r.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(r.dithering=e.dithering),void 0!==e.alphaToCoverage&&(r.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(r.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.forceSinglePass&&(r.forceSinglePass=e.forceSinglePass),void 0!==e.allowOverride&&(r.allowOverride=e.allowOverride),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.toneMapped&&(r.toneMapped=e.toneMapped),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),void 0!==e.uniforms)for(const i in e.uniforms){const t=e.uniforms[i];switch(r.uniforms[i]={},t.type){case"t":r.uniforms[i].value=n(t.value);break;case"c":r.uniforms[i].value=(new cS).setHex(t.value);break;case"v2":r.uniforms[i].value=(new y_).fromArray(t.value);break;case"v3":r.uniforms[i].value=(new x_).fromArray(t.value);break;case"v4":r.uniforms[i].value=(new z_).fromArray(t.value);break;case"m3":r.uniforms[i].value=(new S_).fromArray(t.value);break;case"m4":r.uniforms[i].value=(new vw).fromArray(t.value);break;default:r.uniforms[i].value=t.value}}if(void 0!==e.defines&&(r.defines=e.defines),void 0!==e.vertexShader&&(r.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(r.fragmentShader=e.fragmentShader),void 0!==e.glslVersion&&(r.glslVersion=e.glslVersion),void 0!==e.extensions)for(const i in e.extensions)r.extensions[i]=e.extensions[i];if(void 0!==e.lights&&(r.lights=e.lights),void 0!==e.clipping&&(r.clipping=e.clipping),void 0!==e.size&&(r.size=e.size),void 0!==e.sizeAttenuation&&(r.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(r.map=n(e.map)),void 0!==e.matcap&&(r.matcap=n(e.matcap)),void 0!==e.alphaMap&&(r.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(r.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(r.bumpScale=e.bumpScale),void 0!==e.normalMap&&(r.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(r.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),r.normalScale=(new y_).fromArray(t)}return void 0!==e.displacementMap&&(r.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(r.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(r.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(r.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(r.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(r.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(r.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(r.specularMap=n(e.specularMap)),void 0!==e.specularIntensityMap&&(r.specularIntensityMap=n(e.specularIntensityMap)),void 0!==e.specularColorMap&&(r.specularColorMap=n(e.specularColorMap)),void 0!==e.envMap&&(r.envMap=n(e.envMap)),void 0!==e.envMapRotation&&r.envMapRotation.fromArray(e.envMapRotation),void 0!==e.envMapIntensity&&(r.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(r.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(r.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(r.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(r.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(r.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(r.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(r.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(r.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(r.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(r.clearcoatNormalScale=(new y_).fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(r.iridescenceMap=n(e.iridescenceMap)),void 0!==e.iridescenceThicknessMap&&(r.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),void 0!==e.transmissionMap&&(r.transmissionMap=n(e.transmissionMap)),void 0!==e.thicknessMap&&(r.thicknessMap=n(e.thicknessMap)),void 0!==e.anisotropyMap&&(r.anisotropyMap=n(e.anisotropyMap)),void 0!==e.sheenColorMap&&(r.sheenColorMap=n(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(r.sheenRoughnessMap=n(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return DC.createMaterialFromType(e)}static createMaterialFromType(e){return new{ShadowMaterial:LA,SpriteMaterial:gM,RawShaderMaterial:NA,ShaderMaterial:JS,PointsMaterial:YE,MeshPhysicalMaterial:DA,MeshStandardMaterial:OA,MeshPhongMaterial:UA,MeshToonMaterial:FA,MeshNormalMaterial:zA,MeshLambertMaterial:BA,MeshDepthMaterial:VA,MeshDistanceMaterial:jA,MeshBasicMaterial:pS,MeshMatcapMaterial:HA,LineDashedMaterial:WA,LineBasicMaterial:OE,Material:hS}[e]}}class UC{static extractUrlBase(e){const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class FC extends IS{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class zC extends hC{constructor(e){super(e)}load(e,t,n,r){const i=this,o=new mC(i.manager);o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(Dv){r?r(Dv):i_(Dv),i.manager.itemError(e)}},n,r)}parse(e){const t={},n={};function r(e,r){if(void 0!==t[r])return t[r];const i=e.interleavedBuffers[r],o=function(e,t){if(void 0!==n[t])return n[t];const r=e.arrayBuffers,i=r[t],o=new Uint32Array(i).buffer;return n[t]=o,o}(e,i.buffer),a=Zx(i.type,o),s=new pM(a,i.stride);return s.uuid=i.uuid,t[r]=s,s}const i=e.isInstancedBufferGeometry?new FC:new IS,o=e.data.index;if(void 0!==o){const e=Zx(o.type,o.array);i.setIndex(new _S(e,1))}const a=e.data.attributes;for(const u in a){const t=a[u];let n;if(t.isInterleavedBufferAttribute){const i=r(e.data,t.data);n=new mM(i,t.itemSize,t.offset,t.normalized)}else{const e=Zx(t.type,t.array);n=new(t.isInstancedBufferAttribute?ZM:_S)(e,t.itemSize,t.normalized)}void 0!==t.name&&(n.name=t.name),void 0!==t.usage&&n.setUsage(t.usage),i.setAttribute(u,n)}const s=e.data.morphAttributes;if(s)for(const u in s){const t=s[u],n=[];for(let i=0,o=t.length;i<o;i++){const o=t[i];let a;if(o.isInterleavedBufferAttribute){const t=r(e.data,o.data);a=new mM(t,o.itemSize,o.offset,o.normalized)}else{const e=Zx(o.type,o.array);a=new _S(e,o.itemSize,o.normalized)}void 0!==o.name&&(a.name=o.name),n.push(a)}i.morphAttributes[u]=n}e.data.morphTargetsRelative&&(i.morphTargetsRelative=!0);const l=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==l)for(let u=0,d=l.length;u!==d;++u){const e=l[u];i.addGroup(e.start,e.count,e.materialIndex)}const c=e.data.boundingSphere;return void 0!==c&&(i.boundingSphere=(new lw).fromJSON(c)),e.name&&(i.name=e.name),e.userData&&(i.userData=e.userData),i}}const BC={UVMapping:nb,CubeReflectionMapping:rb,CubeRefractionMapping:ib,EquirectangularReflectionMapping:ob,EquirectangularRefractionMapping:ab,CubeUVReflectionMapping:sb},VC={RepeatWrapping:lb,ClampToEdgeWrapping:cb,MirroredRepeatWrapping:ub},jC={NearestFilter:db,NearestMipmapNearestFilter:hb,NearestMipmapLinearFilter:pb,LinearFilter:fb,LinearMipmapNearestFilter:mb,LinearMipmapLinearFilter:gb},HC=new WeakMap;class WC extends hC{constructor(e){super(e),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&r_("ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&r_("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const i=this,o=cC.get(`image-bitmap:${e}`);if(void 0!==o)return i.manager.itemStart(e),o.then?void o.then(n=>{if(!0!==HC.has(o))return t&&t(n),i.manager.itemEnd(e),n;r&&r(HC.get(o)),i.manager.itemError(e),i.manager.itemEnd(e)}):(setTimeout(function(){t&&t(o),i.manager.itemEnd(e)},0),o);const a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader,a.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const s=fetch(e,a).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(i.options,{colorSpaceConversion:"none"}))}).then(function(n){return cC.add(`image-bitmap:${e}`,n),t&&t(n),i.manager.itemEnd(e),n}).catch(function(t){r&&r(t),HC.set(s,t),cC.remove(`image-bitmap:${e}`),i.manager.itemError(e),i.manager.itemEnd(e)});cC.add(`image-bitmap:${e}`,s),i.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let GC,XC=class{static getContext(){return void 0===GC&&(GC=new(window.AudioContext||window.webkitAudioContext)),GC}static setContext(e){GC=e}};const qC=new vw,$C=new vw,YC=new vw;class ZC extends nM{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class JC{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),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=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}const KC=new x_,QC=new b_,ek=new x_,tk=new x_,nk=new x_;let rk=class extends Ww{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(!0===this.isPlaying)return void r_("Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void r_("Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;r_("Audio: this Audio has no playback control.")}stop(e=0){if(!1!==this.hasPlaybackControl)return this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this;r_("Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(!1!==this._connected){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),!0===this._connected?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,!0===this.isPlaying&&void 0!==this.source.detune&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;r_("Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return!1===this.hasPlaybackControl?(r_("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;r_("Audio: this Audio has no playback control.")}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return super.copy(e,t),"buffer"!==e.sourceType?(r_("Audio: Audio source type cannot be copied."),this):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}};const ik=new x_,ok=new b_,ak=new x_,sk=new x_;class lk{constructor(e,t,n){let r,i,o;switch(this.binding=e,this.valueSize=n,t){case"quaternion":r=this._slerp,i=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":r=this._select,i=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:r=this._lerp,i=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,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 n=this.buffer,r=this.valueSize,i=e*r+r;let o=this.cumulativeWeight;if(0===o){for(let e=0;e!==r;++e)n[i+e]=n[e];o=t}else{o+=t;const e=t/o;this._mixBufferRegion(n,i,0,e,r)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,r=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){const e=t*this._origIndex;this._mixBufferRegion(n,r,e,1-i,t)}o>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(let s=t,l=t+t;s!==l;++s)if(n[s]!==n[s+t]){a.setValue(n,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(let i=n,o=r;i!==o;++i)t[i]=t[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,r,i){if(r>=.5)for(let o=0;o!==i;++o)e[t+o]=e[n+o]}_slerp(e,t,n,r){b_.slerpFlat(e,t,e,t,e,n,r)}_slerpAdditive(e,t,n,r,i){const o=this._workIndex*i;b_.multiplyQuaternionsFlat(e,o,e,t,e,n),b_.slerpFlat(e,t,e,t,e,o,r)}_lerp(e,t,n,r,i){const o=1-r;for(let a=0;a!==i;++a){const i=t+a;e[i]=e[i]*o+e[n+a]*r}}_lerpAdditive(e,t,n,r,i){for(let o=0;o!==i;++o){const i=t+o;e[i]=e[i]+e[n+o]*r}}}const ck="\\[\\]\\.:\\/",uk=new RegExp("["+ck+"]","g"),dk="[^"+ck+"]",hk="[^"+ck.replace("\\.","")+"]",pk=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",dk)+/(WCOD+)?/.source.replace("WCOD",hk)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",dk)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",dk)+"$"),fk=["material","materials","bones","map"];class mk{constructor(e,t,n){this.path=t,this.parsedPath=n||mk.parseTrackName(t),this.node=mk.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new mk.Composite(e,t,n):new mk(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(uk,"")}static parseTrackName(e){const t=pk.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){const e=n.nodeName.substring(r+1);-1!==fk.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let r=0;r<e.length;r++){const i=e[r];if(i.name===t||i.uuid===t)return i;const o=n(i.children);if(o)return o}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,r=t.propertyName;let i=t.propertyIndex;if(e||(e=mk.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void r_("PropertyBinding: No target node found for track: "+this.path+".");if(n){let r=t.objectIndex;switch(n){case"materials":if(!e.material)return void i_("PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void i_("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void i_("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===r){r=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material)return void i_("PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.map)return void i_("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);e=e.material.map;break;default:if(void 0===e[n])return void i_("PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==r){if(void 0===e[r])return void i_("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[r]}}const o=e[r];if(void 0===o){return void i_("PropertyBinding: Trying to update property for track: "+t.nodeName+"."+r+" but it wasn't found.",e)}let a=this.Versioning.None;this.targetObject=e,!0===e.isMaterial?a=this.Versioning.NeedsUpdate:!0===e.isObject3D&&(a=this.Versioning.MatrixWorldNeedsUpdate);let s=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===r){if(!e.geometry)return void i_("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.morphAttributes)return void i_("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[i]&&(i=e.morphTargetDictionary[i])}s=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=i}else void 0!==o.fromArray&&void 0!==o.toArray?(s=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(s=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[s],this.setValue=this.SetterByBindingTypeAndVersioning[s][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}mk.Composite=class{constructor(e,t,n){const r=n||mk.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},mk.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},mk.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},mk.prototype.GetterByBindingType=[mk.prototype._getValue_direct,mk.prototype._getValue_array,mk.prototype._getValue_arrayElement,mk.prototype._getValue_toArray],mk.prototype.SetterByBindingTypeAndVersioning=[[mk.prototype._setValue_direct,mk.prototype._setValue_direct_setNeedsUpdate,mk.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[mk.prototype._setValue_array,mk.prototype._setValue_array_setNeedsUpdate,mk.prototype._setValue_array_setMatrixWorldNeedsUpdate],[mk.prototype._setValue_arrayElement,mk.prototype._setValue_arrayElement_setNeedsUpdate,mk.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[mk.prototype._setValue_fromArray,mk.prototype._setValue_fromArray_setNeedsUpdate,mk.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class gk{constructor(e,t,n=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=r;const i=t.tracks,o=i.length,a=new Array(o),s={endingStart:Ex,endingEnd:Ex};for(let l=0;l!==o;++l){const e=i[l].createInterpolant(null);a[l]=e,e.settings=s}this._interpolantSettings=s,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),!0===n){const n=this._clip.duration,r=e._clip.duration,i=r/n,o=n/r;e.warp(1,i,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const r=this._mixer,i=r.time,o=this.timeScale;let a=this._timeScaleInterpolant;null===a&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);const s=a.parameterPositions,l=a.sampleValues;return s[0]=i,s[1]=i+n,l[0]=e/o,l[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,r){if(!this.enabled)return void this._updateWeight(e);const i=this._startTime;if(null!==i){const r=(e-i)*n;r<0||0===n?t=0:(this._startTime=null,t=n*r)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const e=this._interpolants,t=this._propertyBindings;if(this.blendMode===kx)for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(o),t[n].accumulateAdditive(a);else for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(o),t[n].accumulate(r,a)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(null!==n){const r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let r=this.time+e,i=this._loopCount;const o=2202===n;if(0===e)return-1===i||!o||1&~i?r:t-r;if(2200===n){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else{if(!(r<0)){this.time=r;break e}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===i&&(e>=0?(i=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),r>=t||r<0){const n=Math.floor(r/t);r-=t*n,i+=Math.abs(n);const a=this.repetitions-i;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===a){const t=e<0;this._setEndings(t,!t,o)}else this._setEndings(!1,!1,o);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=r;if(o&&!(1&~i))return t-r}return r}_setEndings(e,t,n){const r=this._interpolantSettings;n?(r.endingStart=Tx,r.endingEnd=Tx):(r.endingStart=e?this.zeroSlopeAtStart?Tx:Ex:Ax,r.endingEnd=t?this.zeroSlopeAtEnd?Tx:Ex:Ax)}_scheduleFading(e,t,n){const r=this._mixer,i=r.time;let o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,s=o.sampleValues;return a[0]=i,s[0]=t,a[1]=i+e,s[1]=n,this}}const vk=new Float32Array(1);class yk extends a_{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,o=e._propertyBindings,a=e._interpolants,s=n.uuid,l=this._bindingsByRootAndName;let c=l[s];void 0===c&&(c={},l[s]=c);for(let u=0;u!==i;++u){const e=r[u],i=e.name;let l=c[i];if(void 0!==l)++l.referenceCount,o[u]=l;else{if(l=o[u],void 0!==l){null===l._cacheIndex&&(++l.referenceCount,this._addInactiveBinding(l,s,i));continue}const r=t&&t._propertyBindings[u].binding.parsedPath;l=new lk(mk.create(n,i,r),e.ValueTypeName,e.getValueSize()),++l.referenceCount,this._addInactiveBinding(l,s,i),o[u]=l}a[u].resultBuffer=l.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){const t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0===n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0===--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}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 null!==t&&t<this._nActiveActions}_addInactiveAction(e,t,n){const r=this._actions,i=this._actionsByClip;let o=i[t];if(void 0===o)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=o;else{const t=o.knownActions;e._byClipCacheIndex=t.length,t.push(e)}e._cacheIndex=r.length,r.push(e),o.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;const i=e._clip.uuid,o=this._actionsByClip,a=o[i],s=a.knownActions,l=s[s.length-1],c=e._byClipCacheIndex;l._byClipCacheIndex=c,s[c]=l,s.pop(),e._byClipCacheIndex=null;delete a.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete o[i],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,r=t.length;n!==r;++n){const e=t[n];0===--e.referenceCount&&this._removeInactiveBinding(e)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}_addInactiveBinding(e,t,n){const r=this._bindingsByRootAndName,i=this._bindings;let o=r[t];void 0===o&&(o={},r[t]=o),o[n]=e,e._cacheIndex=i.length,i.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,r=n.rootNode.uuid,i=n.path,o=this._bindingsByRootAndName,a=o[r],s=t[t.length-1],l=e._cacheIndex;s._cacheIndex=l,t[l]=s,t.pop(),delete a[i],0===Object.keys(a).length&&delete o[r]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return void 0===n&&(n=new JA(new Float32Array(2),new Float32Array(2),1,vk),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,i=t[r];e.__cacheIndex=r,t[r]=e,i.__cacheIndex=n,t[n]=i}clipAction(e,t,n){const r=t||this._root,i=r.uuid;let o="string"==typeof e?sC.findByName(r,e):e;const a=null!==o?o.uuid:e,s=this._actionsByClip[a];let l=null;if(void 0===n&&(n=null!==o?o.blendMode:Cx),void 0!==s){const e=s.actionByRoot[i];if(void 0!==e&&e.blendMode===n)return e;l=s.knownActions[0],null===o&&(o=l._clip)}if(null===o)return null;const c=new gk(this,o,t,n);return this._bindAction(c,l),this._addInactiveAction(c,a,i),c}existingAction(e,t){const n=t||this._root,r=n.uuid,i="string"==typeof e?sC.findByName(n,e):e,o=i?i.uuid:e,a=this._actionsByClip[o];return void 0!==a&&a.actionByRoot[r]||null}stopAllAction(){const e=this._actions;for(let t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),o=this._accuIndex^=1;for(let l=0;l!==n;++l){t[l]._update(r,e,i,o)}const a=this._bindings,s=this._nActiveBindings;for(let l=0;l!==s;++l)a[l].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){const e=i.knownActions;for(let n=0,r=e.length;n!==r;++n){const r=e[n];this._deactivateAction(r);const i=r._cacheIndex,o=t[t.length-1];r._cacheIndex=null,r._byClipCacheIndex=null,o._cacheIndex=i,t[i]=o,t.pop(),this._removeInactiveBindingsForAction(r)}delete r[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const i in n){const e=n[i].actionByRoot[t];void 0!==e&&(this._deactivateAction(e),this._removeInactiveAction(e))}const r=this._bindingsByRootAndName[t];if(void 0!==r)for(const i in r){const e=r[i];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(e,t){const n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class bk{constructor(e){this.value=e}clone(){return new bk(void 0===this.value.clone?this.value:this.value.clone())}}let xk=0;class _k{constructor(e,t,n,r,i,o=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=r,this.count=i,this.normalized=o,this.version=0}set needsUpdate(e){!0===e&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const wk=new vw;class Sk{constructor(e,t,n=0,r=1/0){this.ray=new gw(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new Cw,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):i_("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return wk.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(wk),this}intersectObject(e,t=!0,n=[]){return Ek(e,this,n,t),n.sort(Mk),n}intersectObjects(e,t=!0,n=[]){for(let r=0,i=e.length;r<i;r++)Ek(e[r],this,n,t);return n.sort(Mk),n}}function Mk(e,t){return e.distance-t.distance}function Ek(e,t,n,r){let i=!0;if(e.layers.test(t.layers)){!1===e.raycast(t,n)&&(i=!1)}if(!0===i&&!0===r){const r=e.children;for(let e=0,i=r.length;e<i;e++)Ek(r[e],t,n,!0)}}function Tk(){!1===this._document.hidden&&this.reset()}class Ak{constructor(e,t,n,r){Ak.prototype.isMatrix2=!0,this.elements=[1,0,0,1],void 0!==e&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){const i=this.elements;return i[0]=e,i[2]=t,i[1]=n,i[3]=r,this}}const Ck=new y_;const kk=new x_,Rk=new x_,Pk=new x_,Ik=new x_,Lk=new x_,Nk=new x_,Ok=new x_;const Dk=new x_;const Uk=new x_,Fk=new vw,zk=new vw;function Bk(e){const t=[];!0===e.isBone&&t.push(e);for(let n=0;n<e.children.length;n++)t.push(...Bk(e.children[n]));return t}const Vk=new x_,jk=new cS,Hk=new cS;const Wk=new x_,Gk=new x_,Xk=new x_;const qk=new x_,$k=new KS;function Yk(e,t,n,r,i,o,a){qk.set(i,o,a).unproject(r);const s=t[e];if(void 0!==s){const e=n.getAttribute("position");for(let t=0,n=s.length;t<n;t++)e.setXYZ(s[t],qk.x,qk.y,qk.z)}}const Zk=new W_;const Jk=new x_;let Kk,Qk;class eR extends qE{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=new IS;n.setAttribute("position",new MS(t,3)),n.setAttribute("color",new MS([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));super(n,new OE({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(e,t,n){const r=new cS,i=this.geometry.attributes.color.array;return r.set(e),r.toArray(i,0),r.toArray(i,3),r.set(t),r.toArray(i,6),r.toArray(i,9),r.set(n),r.toArray(i,12),r.toArray(i,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function tR(e,t,n,r){const i=function(e){switch(e){case vb:case yb:return{byteLength:1,components:1};case xb:case bb:case Mb:return{byteLength:2,components:1};case Eb:case Tb:return{byteLength:2,components:4};case wb:case _b:case Sb:return{byteLength:4,components:1};case Cb:case kb:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${e}.`)}(r);switch(n){case Rb:return e*t;case Ob:case Db:return e*t/i.components*i.byteLength;case Ub:case Fb:return e*t*2/i.components*i.byteLength;case Pb:return e*t*3/i.components*i.byteLength;case Ib:case zb:return e*t*4/i.components*i.byteLength;case Bb:case Vb:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case jb:case Hb:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Gb:case qb:return Math.max(e,16)*Math.max(t,8)/4;case Wb:case Xb:return Math.max(e,8)*Math.max(t,8)/2;case $b:case Yb:case Jb:case Kb:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case Zb:case Qb:case ex:case tx:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case nx:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case rx:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case ix:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case ox:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case ax:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case sx:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case lx:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case cx:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case ux:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case dx:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case hx:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case px:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case fx:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case mx:case gx:case vx:return Math.ceil(e/4)*Math.ceil(t/4)*16;case yx:case bx:return Math.ceil(e/4)*Math.ceil(t/4)*8;case xx:case _x:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function nR(){let e=null,t=!1,n=null,r=null;function i(t,o){n(t,o),r=e.requestAnimationFrame(i)}return{start:function(){!0!==t&&null!==n&&(r=e.requestAnimationFrame(i),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function rR(e){const t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const r=t.get(n);r&&(e.deleteBuffer(r.buffer),t.delete(n))},update:function(n,r){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){const e=t.get(n);return void((!e||e.version<n.version)&&t.set(n,{buffer:n.buffer,type:n.type,bytesPerElement:n.elementSize,version:n.version}))}const i=t.get(n);if(void 0===i)t.set(n,function(t,n){const r=t.array,i=t.usage,o=r.byteLength,a=e.createBuffer();let s;if(e.bindBuffer(n,a),e.bufferData(n,r,i),t.onUploadCallback(),r instanceof Float32Array)s=e.FLOAT;else if("undefined"!=typeof Float16Array&&r instanceof Float16Array)s=e.HALF_FLOAT;else if(r instanceof Uint16Array)s=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(r instanceof Int16Array)s=e.SHORT;else if(r instanceof Uint32Array)s=e.UNSIGNED_INT;else if(r instanceof Int32Array)s=e.INT;else if(r instanceof Int8Array)s=e.BYTE;else if(r instanceof Uint8Array)s=e.UNSIGNED_BYTE;else{if(!(r instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+r);s=e.UNSIGNED_BYTE}return{buffer:a,type:s,bytesPerElement:r.BYTES_PER_ELEMENT,version:t.version,size:o}}(n,r));else if(i.version<n.version){if(i.size!==n.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(t,n,r){const i=n.array,o=n.updateRanges;if(e.bindBuffer(r,t),0===o.length)e.bufferSubData(r,0,i);else{o.sort((e,t)=>e.start-t.start);let t=0;for(let e=1;e<o.length;e++){const n=o[t],r=o[e];r.start<=n.start+n.count+1?n.count=Math.max(n.count,r.start+r.count-n.start):(++t,o[t]=r)}o.length=t+1;for(let n=0,a=o.length;n<a;n++){const t=o[n];e.bufferSubData(r,t.start*i.BYTES_PER_ELEMENT,i,t.start,t.count)}n.clearUpdateRanges()}n.onUploadCallback()}(i.buffer,n,r),i.version=n.version}}}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:hy}})),"undefined"!=typeof window&&(window.__THREE__?r_("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=hy);const iR={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn 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 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n\tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = vec3( 0.04 );\n\tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tvec3 diffuseContribution;\n\tvec3 specularColor;\n\tvec3 specularColorBlended;\n\tfloat roughness;\n\tfloat metalness;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t\tvec3 iridescenceFresnelDielectric;\n\t\tvec3 iridescenceFresnelMetallic;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn v;\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColorBlended;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat rInv = 1.0 / ( roughness + 0.1 );\n\tfloat a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n\tfloat b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n\tfloat DG = exp( a * dotNV + b );\n\treturn saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n\tvec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n\tvec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n\tvec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n\tfloat Ess_V = dfgV.x + dfgV.y;\n\tfloat Ess_L = dfgL.x + dfgL.y;\n\tfloat Ems_V = 1.0 - Ess_V;\n\tfloat Ems_L = 1.0 - Ess_L;\n\tvec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n\tvec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n\tfloat compensationFactor = Ems_V * Ems_L;\n\tvec3 multiScatter = Fms * compensationFactor;\n\treturn singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColorBlended * t2.x + ( vec3( 1.0 ) - material.specularColorBlended ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n \n \t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n \t\tfloat sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n \t\tfloat sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n \t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n \t\tirradiance *= sheenEnergyComp;\n \n \t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n\t#ifdef USE_SHEEN\n\t\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n\t\tdiffuse *= sheenEnergyComp;\n\t#endif\n\treflectedLight.indirectDiffuse += diffuse;\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n \t#endif\n\tvec3 singleScatteringDielectric = vec3( 0.0 );\n\tvec3 multiScatteringDielectric = vec3( 0.0 );\n\tvec3 singleScatteringMetallic = vec3( 0.0 );\n\tvec3 multiScatteringMetallic = vec3( 0.0 );\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n\t#endif\n\tvec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n\tvec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n\tvec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n\tvec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tvec3 indirectSpecular = radiance * singleScattering;\n\tindirectSpecular += multiScattering * cosineWeightedIrradiance;\n\tvec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n\t\tindirectSpecular *= sheenEnergyComp;\n\t\tindirectDiffuse *= sheenEnergyComp;\n\t#endif\n\treflectedLight.indirectSpecular += indirectSpecular;\n\treflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n\t\tmaterial.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\t#else\n\t\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\t#endif\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\t#else\n\t\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\t#endif\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\t#elif defined( SHADOWMAP_TYPE_BASIC )\n\t\t\tuniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\t#endif\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\tfloat interleavedGradientNoise( vec2 position ) {\n\t\t\treturn fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n\t\t}\n\t\tvec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n\t\t\tconst float goldenAngle = 2.399963229728653;\n\t\t\tfloat r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n\t\t\tfloat theta = float( sampleIndex ) * goldenAngle + phi;\n\t\t\treturn vec2( cos( theta ), sin( theta ) ) * r;\n\t\t}\n\t#endif\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\tfloat getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\tshadowCoord.z += shadowBias;\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\t\tfloat radius = shadowRadius * texelSize.x;\n\t\t\t\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n\t\t\t\t) * 0.2;\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\tshadowCoord.z += shadowBias;\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tvec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n\t\t\t\tfloat mean = distribution.x;\n\t\t\t\tfloat variance = distribution.y * distribution.y;\n\t\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\t\tfloat hard_shadow = step( mean, shadowCoord.z );\n\t\t\t\t#else\n\t\t\t\t\tfloat hard_shadow = step( shadowCoord.z, mean );\n\t\t\t\t#endif\n\t\t\t\tif ( hard_shadow == 1.0 ) {\n\t\t\t\t\tshadow = 1.0;\n\t\t\t\t} else {\n\t\t\t\t\tvariance = max( variance, 0.0000001 );\n\t\t\t\t\tfloat d = shadowCoord.z - mean;\n\t\t\t\t\tfloat p_max = variance / ( variance + d * d );\n\t\t\t\t\tp_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n\t\t\t\t\tshadow = max( hard_shadow, p_max );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#else\n\t\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\tshadowCoord.z += shadowBias;\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tfloat depth = texture2D( shadowMap, shadowCoord.xy ).r;\n\t\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\t\tshadow = step( depth, shadowCoord.z );\n\t\t\t\t#else\n\t\t\t\t\tshadow = step( shadowCoord.z, depth );\n\t\t\t\t#endif\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\tfloat getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tvec3 absVec = abs( lightToPosition );\n\t\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n\t\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\tdp += shadowBias;\n\t\t\tfloat texelSize = shadowRadius / shadowMapSize.x;\n\t\t\tvec3 absDir = abs( bd3D );\n\t\t\tvec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n\t\t\ttangent = normalize( cross( bd3D, tangent ) );\n\t\t\tvec3 bitangent = cross( bd3D, tangent );\n\t\t\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;\n\t\t\tshadow = (\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 0, 5, phi ).x + bitangent * vogelDiskSample( 0, 5, phi ).y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 1, 5, phi ).x + bitangent * vogelDiskSample( 1, 5, phi ).y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 2, 5, phi ).x + bitangent * vogelDiskSample( 2, 5, phi ).y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 3, 5, phi ).x + bitangent * vogelDiskSample( 3, 5, phi ).y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 4, 5, phi ).x + bitangent * vogelDiskSample( 4, 5, phi ).y ) * texelSize, dp ) )\n\t\t\t) * 0.2;\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\t#elif defined( SHADOWMAP_TYPE_BASIC )\n\tfloat getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tvec3 absVec = abs( lightToPosition );\n\t\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n\t\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\tdp += shadowBias;\n\t\t\tfloat depth = textureCube( shadowMap, bd3D ).r;\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tshadow = step( depth, dp );\n\t\t\t#else\n\t\t\t\tshadow = step( dp, depth );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\t#endif\n\t#endif\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t#else\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\tfloat fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n\t#else\n\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n\t#endif\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",distance_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distance_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n \n\t\toutgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n \t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},oR={common:{diffuse:{value:new cS(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new S_},alphaMap:{value:null},alphaMapTransform:{value:new S_},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new S_}},envmap:{envMap:{value:null},envMapRotation:{value:new S_},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new S_}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new S_}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new S_},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new S_},normalScale:{value:new y_(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new S_},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new S_}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new S_}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new S_}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new cS(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 cS(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new S_},alphaTest:{value:0},uvTransform:{value:new S_}},sprite:{diffuse:{value:new cS(16777215)},opacity:{value:1},center:{value:new y_(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new S_},alphaMap:{value:null},alphaMapTransform:{value:new S_},alphaTest:{value:0}}},aR={basic:{uniforms:$S([oR.common,oR.specularmap,oR.envmap,oR.aomap,oR.lightmap,oR.fog]),vertexShader:iR.meshbasic_vert,fragmentShader:iR.meshbasic_frag},lambert:{uniforms:$S([oR.common,oR.specularmap,oR.envmap,oR.aomap,oR.lightmap,oR.emissivemap,oR.bumpmap,oR.normalmap,oR.displacementmap,oR.fog,oR.lights,{emissive:{value:new cS(0)}}]),vertexShader:iR.meshlambert_vert,fragmentShader:iR.meshlambert_frag},phong:{uniforms:$S([oR.common,oR.specularmap,oR.envmap,oR.aomap,oR.lightmap,oR.emissivemap,oR.bumpmap,oR.normalmap,oR.displacementmap,oR.fog,oR.lights,{emissive:{value:new cS(0)},specular:{value:new cS(1118481)},shininess:{value:30}}]),vertexShader:iR.meshphong_vert,fragmentShader:iR.meshphong_frag},standard:{uniforms:$S([oR.common,oR.envmap,oR.aomap,oR.lightmap,oR.emissivemap,oR.bumpmap,oR.normalmap,oR.displacementmap,oR.roughnessmap,oR.metalnessmap,oR.fog,oR.lights,{emissive:{value:new cS(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:iR.meshphysical_vert,fragmentShader:iR.meshphysical_frag},toon:{uniforms:$S([oR.common,oR.aomap,oR.lightmap,oR.emissivemap,oR.bumpmap,oR.normalmap,oR.displacementmap,oR.gradientmap,oR.fog,oR.lights,{emissive:{value:new cS(0)}}]),vertexShader:iR.meshtoon_vert,fragmentShader:iR.meshtoon_frag},matcap:{uniforms:$S([oR.common,oR.bumpmap,oR.normalmap,oR.displacementmap,oR.fog,{matcap:{value:null}}]),vertexShader:iR.meshmatcap_vert,fragmentShader:iR.meshmatcap_frag},points:{uniforms:$S([oR.points,oR.fog]),vertexShader:iR.points_vert,fragmentShader:iR.points_frag},dashed:{uniforms:$S([oR.common,oR.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:iR.linedashed_vert,fragmentShader:iR.linedashed_frag},depth:{uniforms:$S([oR.common,oR.displacementmap]),vertexShader:iR.depth_vert,fragmentShader:iR.depth_frag},normal:{uniforms:$S([oR.common,oR.bumpmap,oR.normalmap,oR.displacementmap,{opacity:{value:1}}]),vertexShader:iR.meshnormal_vert,fragmentShader:iR.meshnormal_frag},sprite:{uniforms:$S([oR.sprite,oR.fog]),vertexShader:iR.sprite_vert,fragmentShader:iR.sprite_frag},background:{uniforms:{uvTransform:{value:new S_},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:iR.background_vert,fragmentShader:iR.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new S_}},vertexShader:iR.backgroundCube_vert,fragmentShader:iR.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:iR.cube_vert,fragmentShader:iR.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:iR.equirect_vert,fragmentShader:iR.equirect_frag},distance:{uniforms:$S([oR.common,oR.displacementmap,{referencePosition:{value:new x_},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:iR.distance_vert,fragmentShader:iR.distance_frag},shadow:{uniforms:$S([oR.lights,oR.fog,{color:{value:new cS(0)},opacity:{value:1}}]),vertexShader:iR.shadow_vert,fragmentShader:iR.shadow_frag}};aR.physical={uniforms:$S([aR.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new S_},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new S_},clearcoatNormalScale:{value:new y_(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new S_},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new S_},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new S_},sheen:{value:0},sheenColor:{value:new cS(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new S_},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new S_},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new S_},transmissionSamplerSize:{value:new y_},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new S_},attenuationDistance:{value:0},attenuationColor:{value:new cS(0)},specularColor:{value:new cS(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new S_},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new S_},anisotropyVector:{value:new y_},anisotropyMap:{value:null},anisotropyMapTransform:{value:new S_}}]),vertexShader:iR.meshphysical_vert,fragmentShader:iR.meshphysical_frag};const sR={r:0,b:0,g:0},lR=new Aw,cR=new vw;function uR(e,t,n,r,i,o,a){const s=new cS(0);let l,c,u=!0===o?0:1,d=null,h=0,p=null;function f(e){let r=!0===e.isScene?e.background:null;if(r&&r.isTexture){r=(e.backgroundBlurriness>0?n:t).get(r)}return r}function m(t,n){t.getRGB(sR,YS(e)),r.buffers.color.setClear(sR.r,sR.g,sR.b,n,a)}return{getClearColor:function(){return s},setClearColor:function(e,t=1){s.set(e),u=t,m(s,u)},getClearAlpha:function(){return u},setClearAlpha:function(e){u=e,m(s,u)},render:function(t){let n=!1;const i=f(t);null===i?m(s,u):i&&i.isColor&&(m(i,1),n=!0);const o=e.xr.getEnvironmentBlendMode();"additive"===o?r.buffers.color.setClear(0,0,0,1,a):"alpha-blend"===o&&r.buffers.color.setClear(0,0,0,0,a),(e.autoClear||n)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){const r=f(n);r&&(r.isCubeTexture||r.mapping===sb)?(void 0===c&&(c=new WS(new XS(1,1,1),new JS({name:"BackgroundCubeMaterial",uniforms:qS(aR.backgroundCube.uniforms),vertexShader:aR.backgroundCube.vertexShader,fragmentShader:aR.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c)),lR.copy(n.backgroundRotation),lR.x*=-1,lR.y*=-1,lR.z*=-1,r.isCubeTexture&&!1===r.isRenderTargetTexture&&(lR.y*=-1,lR.z*=-1),c.material.uniforms.envMap.value=r,c.material.uniforms.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(cR.makeRotationFromEuler(lR)),c.material.toneMapped=C_.getTransfer(r.colorSpace)!==Nx,d===r&&h===r.version&&p===e.toneMapping||(c.material.needsUpdate=!0,d=r,h=r.version,p=e.toneMapping),c.layers.enableAll(),t.unshift(c,c.geometry,c.material,0,0,null)):r&&r.isTexture&&(void 0===l&&(l=new WS(new wA(2,2),new JS({name:"BackgroundMaterial",uniforms:qS(aR.background.uniforms),vertexShader:aR.background.vertexShader,fragmentShader:aR.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=r,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=C_.getTransfer(r.colorSpace)!==Nx,!0===r.matrixAutoUpdate&&r.updateMatrix(),l.material.uniforms.uvTransform.value.copy(r.matrix),d===r&&h===r.version&&p===e.toneMapping||(l.material.needsUpdate=!0,d=r,h=r.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))},dispose:function(){void 0!==c&&(c.geometry.dispose(),c.material.dispose(),c=void 0),void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}}}function dR(e,t){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},i=c(null);let o=i,a=!1;function s(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function c(e){const t=[],r=[],i=[];for(let o=0;o<n;o++)t[o]=0,r[o]=0,i[o]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:r,attributeDivisors:i,object:e,attributes:{},index:null}}function u(){const e=o.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function d(e){h(e,0)}function h(t,n){const r=o.newAttributes,i=o.enabledAttributes,a=o.attributeDivisors;r[t]=1,0===i[t]&&(e.enableVertexAttribArray(t),i[t]=1),a[t]!==n&&(e.vertexAttribDivisor(t,n),a[t]=n)}function p(){const t=o.newAttributes,n=o.enabledAttributes;for(let r=0,i=n.length;r<i;r++)n[r]!==t[r]&&(e.disableVertexAttribArray(r),n[r]=0)}function f(t,n,r,i,o,a,s){!0===s?e.vertexAttribIPointer(t,n,r,o,a):e.vertexAttribPointer(t,n,r,i,o,a)}function m(){g(),a=!0,o!==i&&(o=i,s(o.object))}function g(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:function(n,i,l,m,g){let v=!1;const y=function(t,n,i){const o=!0===i.wireframe;let a=r[t.id];void 0===a&&(a={},r[t.id]=a);let s=a[n.id];void 0===s&&(s={},a[n.id]=s);let l=s[o];void 0===l&&(l=c(e.createVertexArray()),s[o]=l);return l}(m,l,i);o!==y&&(o=y,s(o.object)),v=function(e,t,n,r){const i=o.attributes,a=t.attributes;let s=0;const l=n.getAttributes();for(const o in l){if(l[o].location>=0){const t=i[o];let n=a[o];if(void 0===n&&("instanceMatrix"===o&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===o&&e.instanceColor&&(n=e.instanceColor)),void 0===t)return!0;if(t.attribute!==n)return!0;if(n&&t.data!==n.data)return!0;s++}}return o.attributesNum!==s||o.index!==r}(n,m,l,g),v&&function(e,t,n,r){const i={},a=t.attributes;let s=0;const l=n.getAttributes();for(const o in l){if(l[o].location>=0){let t=a[o];void 0===t&&("instanceMatrix"===o&&e.instanceMatrix&&(t=e.instanceMatrix),"instanceColor"===o&&e.instanceColor&&(t=e.instanceColor));const n={};n.attribute=t,t&&t.data&&(n.data=t.data),i[o]=n,s++}}o.attributes=i,o.attributesNum=s,o.index=r}(n,m,l,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(v||a)&&(a=!1,function(n,r,i,o){u();const a=o.attributes,s=i.getAttributes(),l=r.defaultAttributeValues;for(const c in s){const r=s[c];if(r.location>=0){let i=a[c];if(void 0===i&&("instanceMatrix"===c&&n.instanceMatrix&&(i=n.instanceMatrix),"instanceColor"===c&&n.instanceColor&&(i=n.instanceColor)),void 0!==i){const a=i.normalized,s=i.itemSize,l=t.get(i);if(void 0===l)continue;const c=l.buffer,u=l.type,p=l.bytesPerElement,m=u===e.INT||u===e.UNSIGNED_INT||i.gpuType===_b;if(i.isInterleavedBufferAttribute){const t=i.data,l=t.stride,g=i.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<r.locationSize;e++)h(r.location+e,t.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<r.locationSize;e++)d(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)f(r.location+e,s/r.locationSize,u,a,l*p,(g+s/r.locationSize*e)*p,m)}else{if(i.isInstancedBufferAttribute){for(let e=0;e<r.locationSize;e++)h(r.location+e,i.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=i.meshPerAttribute*i.count)}else for(let e=0;e<r.locationSize;e++)d(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)f(r.location+e,s/r.locationSize,u,a,s*p,s/r.locationSize*e*p,m)}}else if(void 0!==l){const t=l[c];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(r.location,t);break;case 3:e.vertexAttrib3fv(r.location,t);break;case 4:e.vertexAttrib4fv(r.location,t);break;default:e.vertexAttrib1fv(r.location,t)}}}}p()}(n,i,l,m),null!==g&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(g).buffer))},reset:m,resetDefaultState:g,dispose:function(){m();for(const e in r){const t=r[e];for(const e in t){const n=t[e];for(const e in n)l(n[e].object),delete n[e];delete t[e]}delete r[e]}},releaseStatesOfGeometry:function(e){if(void 0===r[e.id])return;const t=r[e.id];for(const n in t){const e=t[n];for(const t in e)l(e[t].object),delete e[t];delete t[n]}delete r[e.id]},releaseStatesOfProgram:function(e){for(const t in r){const n=r[t];if(void 0===n[e.id])continue;const i=n[e.id];for(const e in i)l(i[e].object),delete i[e];delete n[e.id]}},initAttributes:u,enableAttribute:d,disableUnusedAttributes:p}}function hR(e,t,n){let r;function i(t,i,o){0!==o&&(e.drawArraysInstanced(r,t,i,o),n.update(i,r,o))}this.setMode=function(e){r=e},this.render=function(t,i){e.drawArrays(r,t,i),n.update(i,r,1)},this.renderInstances=i,this.renderMultiDraw=function(e,i,o){if(0===o)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(r,e,0,i,0,o);let a=0;for(let t=0;t<o;t++)a+=i[t];n.update(a,r,1)},this.renderMultiDrawInstances=function(e,o,a,s){if(0===a)return;const l=t.get("WEBGL_multi_draw");if(null===l)for(let t=0;t<e.length;t++)i(e[t],o[t],s[t]);else{l.multiDrawArraysInstancedWEBGL(r,e,0,o,0,s,0,a);let t=0;for(let e=0;e<a;e++)t+=o[e]*s[e];n.update(t,r,1)}}}function pR(e,t,n,r){let i;function o(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let a=void 0!==n.precision?n.precision:"highp";const s=o(a);s!==a&&(r_("WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:o,textureFormatReadable:function(t){return t===Ib||r.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const i=n===Mb&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(n!==vb&&r.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==Sb&&!i)},precision:a,logarithmicDepthBuffer:!0===n.logarithmicDepthBuffer,reversedDepthBuffer:!0===n.reversedDepthBuffer&&t.has("EXT_clip_control"),maxTextures:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextures:e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),maxSamples:e.getParameter(e.MAX_SAMPLES),samples:e.getParameter(e.SAMPLES)}}function fR(e){const t=this;let n=null,r=0,i=!1,o=!1;const a=new lE,s=new S_,l={value:null,needsUpdate:!1};function c(e,n,r,i){const o=null!==e?e.length:0;let c=null;if(0!==o){if(c=l.value,!0!==i||null===c){const t=r+4*o,i=n.matrixWorldInverse;s.getNormalMatrix(i),(null===c||c.length<t)&&(c=new Float32Array(t));for(let n=0,l=r;n!==o;++n,l+=4)a.copy(e[n]).applyMatrix4(i,s),a.normal.toArray(c,l),c[l+3]=a.constant}l.value=c,l.needsUpdate=!0}return t.numPlanes=o,t.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){const n=0!==e.length||t||0!==r||i;return i=t,r=e.length,n},this.beginShadows=function(){o=!0,c(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(e,t){n=c(e,t,0)},this.setState=function(a,s,u){const d=a.clippingPlanes,h=a.clipIntersection,p=a.clipShadows,f=e.get(a);if(!i||null===d||0===d.length||o&&!p)o?c(null):function(){l.value!==n&&(l.value=n,l.needsUpdate=r>0);t.numPlanes=r,t.numIntersection=0}();else{const e=o?0:r,t=4*e;let i=f.clippingState||null;l.value=i,i=c(d,s,t,u);for(let r=0;r!==t;++r)i[r]=n[r];f.clippingState=i,this.numIntersection=h?this.numPlanes:0,this.numPlanes+=e}}}function mR(e){let t=new WeakMap;function n(e,t){return t===ob?e.mapping=rb:t===ab&&(e.mapping=ib),e}function r(e){const n=e.target;n.removeEventListener("dispose",r);const i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){const o=i.mapping;if(o===ob||o===ab){if(t.has(i)){return n(t.get(i).texture,i.mapping)}{const o=i.image;if(o&&o.height>0){const a=new aM(o.height);return a.fromEquirectangularTexture(e,i),t.set(i,a),i.addEventListener("dispose",r),n(a.texture,i.mapping)}return null}}}return i},dispose:function(){t=new WeakMap}}}const gR=[.125,.215,.35,.446,.526,.582],vR=20,yR=new kC,bR=new cS;let xR=null,_R=0,wR=0,SR=!1;const MR=new x_;class ER{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,i={}){const{size:o=256,position:a=MR}=i;xR=this._renderer.getRenderTarget(),_R=this._renderer.getActiveCubeFace(),wR=this._renderer.getActiveMipmapLevel(),SR=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s,a),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(){null===this._cubemapMaterial&&(this._cubemapMaterial=kR(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=CR(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(xR,_R,wR),this._renderer.xr.enabled=SR,e.scissorTest=!1,AR(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===rb||e.mapping===ib?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),xR=this._renderer.getRenderTarget(),_R=this._renderer.getActiveCubeFace(),wR=this._renderer.getActiveMipmapLevel(),SR=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:fb,minFilter:fb,generateMipmaps:!1,type:Mb,format:Ib,colorSpace:Ix,depthBuffer:!1},r=TR(e,t,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=TR(e,t,n);const{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=function(e){const t=[],n=[],r=[];let i=e;const o=e-4+1+gR.length;for(let a=0;a<o;a++){const o=Math.pow(2,i);t.push(o);let s=1/o;a>e-4?s=gR[a-e+4-1]:0===a&&(s=0),n.push(s);const l=1/(o-2),c=-l,u=1+l,d=[c,c,u,c,u,u,c,c,u,u,c,u],h=6,p=6,f=3,m=2,g=1,v=new Float32Array(f*p*h),y=new Float32Array(m*p*h),b=new Float32Array(g*p*h);for(let e=0;e<h;e++){const t=e%3*2/3-1,n=e>2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];v.set(r,f*p*e),y.set(d,m*p*e);const i=[e,e,e,e,e,e];b.set(i,g*p*e)}const x=new IS;x.setAttribute("position",new _S(v,f)),x.setAttribute("uv",new _S(y,m)),x.setAttribute("faceIndex",new _S(b,g)),r.push(new WS(x,null)),i>4&&i--}return{lodMeshes:r,sizeLods:t,sigmas:n}}(r)),this._blurMaterial=function(e,t,n){const r=new Float32Array(vR),i=new x_(0,1,0),o=new JS({name:"SphericalGaussianBlur",defines:{n:vR,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:RR(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1});return o}(r,e,t),this._ggxMaterial=function(e,t,n){const r=new JS({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:256,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:RR(),fragmentShader:'\n\n\t\t\tprecision highp float;\n\t\t\tprecision highp int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform float roughness;\n\t\t\tuniform float mipInt;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\t#define PI 3.14159265359\n\n\t\t\t// Van der Corput radical inverse\n\t\t\tfloat radicalInverse_VdC(uint bits) {\n\t\t\t\tbits = (bits << 16u) | (bits >> 16u);\n\t\t\t\tbits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);\n\t\t\t\tbits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);\n\t\t\t\tbits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);\n\t\t\t\tbits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);\n\t\t\t\treturn float(bits) * 2.3283064365386963e-10; // / 0x100000000\n\t\t\t}\n\n\t\t\t// Hammersley sequence\n\t\t\tvec2 hammersley(uint i, uint N) {\n\t\t\t\treturn vec2(float(i) / float(N), radicalInverse_VdC(i));\n\t\t\t}\n\n\t\t\t// GGX VNDF importance sampling (Eric Heitz 2018)\n\t\t\t// "Sampling the GGX Distribution of Visible Normals"\n\t\t\t// https://jcgt.org/published/0007/04/01/\n\t\t\tvec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {\n\t\t\t\tfloat alpha = roughness * roughness;\n\n\t\t\t\t// Section 3.2: Transform view direction to hemisphere configuration\n\t\t\t\tvec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z));\n\n\t\t\t\t// Section 4.1: Orthonormal basis\n\t\t\t\tfloat lensq = Vh.x * Vh.x + Vh.y * Vh.y;\n\t\t\t\tvec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0);\n\t\t\t\tvec3 T2 = cross(Vh, T1);\n\n\t\t\t\t// Section 4.2: Parameterization of projected area\n\t\t\t\tfloat r = sqrt(Xi.x);\n\t\t\t\tfloat phi = 2.0 * PI * Xi.y;\n\t\t\t\tfloat t1 = r * cos(phi);\n\t\t\t\tfloat t2 = r * sin(phi);\n\t\t\t\tfloat s = 0.5 * (1.0 + Vh.z);\n\t\t\t\tt2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;\n\n\t\t\t\t// Section 4.3: Reprojection onto hemisphere\n\t\t\t\tvec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh;\n\n\t\t\t\t// Section 3.4: Transform back to ellipsoid configuration\n\t\t\t\treturn normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));\n\t\t\t}\n\n\t\t\tvoid main() {\n\t\t\t\tvec3 N = normalize(vOutputDirection);\n\t\t\t\tvec3 V = N; // Assume view direction equals normal for pre-filtering\n\n\t\t\t\tvec3 prefilteredColor = vec3(0.0);\n\t\t\t\tfloat totalWeight = 0.0;\n\n\t\t\t\t// For very low roughness, just sample the environment directly\n\t\t\t\tif (roughness < 0.001) {\n\t\t\t\t\tgl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Tangent space basis for VNDF sampling\n\t\t\t\tvec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\n\t\t\t\tvec3 tangent = normalize(cross(up, N));\n\t\t\t\tvec3 bitangent = cross(N, tangent);\n\n\t\t\t\tfor(uint i = 0u; i < uint(GGX_SAMPLES); i++) {\n\t\t\t\t\tvec2 Xi = hammersley(i, uint(GGX_SAMPLES));\n\n\t\t\t\t\t// For PMREM, V = N, so in tangent space V is always (0, 0, 1)\n\t\t\t\t\tvec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);\n\n\t\t\t\t\t// Transform H back to world space\n\t\t\t\t\tvec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);\n\t\t\t\t\tvec3 L = normalize(2.0 * dot(V, H) * H - V);\n\n\t\t\t\t\tfloat NdotL = max(dot(N, L), 0.0);\n\n\t\t\t\t\tif(NdotL > 0.0) {\n\t\t\t\t\t\t// Sample environment at fixed mip level\n\t\t\t\t\t\t// VNDF importance sampling handles the distribution filtering\n\t\t\t\t\t\tvec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);\n\n\t\t\t\t\t\t// Weight by NdotL for the split-sum approximation\n\t\t\t\t\t\t// VNDF PDF naturally accounts for the visible microfacet distribution\n\t\t\t\t\t\tprefilteredColor += sampleColor * NdotL;\n\t\t\t\t\t\ttotalWeight += NdotL;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (totalWeight > 0.0) {\n\t\t\t\t\tprefilteredColor = prefilteredColor / totalWeight;\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = vec4(prefilteredColor, 1.0);\n\t\t\t}\n\t\t',blending:0,depthTest:!1,depthWrite:!1});return r}(r,e,t)}return r}_compileMaterial(e){const t=new WS(new IS,e);this._renderer.compile(t,yR)}_sceneToCubeUV(e,t,n,r,i){const o=new nM(90,1,t,n),a=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],l=this._renderer,c=l.autoClear,u=l.toneMapping;l.getClearColor(bR),l.toneMapping=0,l.autoClear=!1;l.state.buffers.depth.getReversed()&&(l.setRenderTarget(r),l.clearDepth(),l.setRenderTarget(null)),null===this._backgroundBox&&(this._backgroundBox=new WS(new XS,new pS({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1})));const d=this._backgroundBox,h=d.material;let p=!1;const f=e.background;f?f.isColor&&(h.color.copy(f),e.background=null,p=!0):(h.color.copy(bR),p=!0);for(let m=0;m<6;m++){const t=m%3;0===t?(o.up.set(0,a[m],0),o.position.set(i.x,i.y,i.z),o.lookAt(i.x+s[m],i.y,i.z)):1===t?(o.up.set(0,0,a[m]),o.position.set(i.x,i.y,i.z),o.lookAt(i.x,i.y+s[m],i.z)):(o.up.set(0,a[m],0),o.position.set(i.x,i.y,i.z),o.lookAt(i.x,i.y,i.z+s[m]));const n=this._cubeSize;AR(r,t*n,m>2?n:0,n,n),l.setRenderTarget(r),p&&l.render(d,o),l.render(e,o)}l.toneMapping=u,l.autoClear=c,e.background=f}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===rb||e.mapping===ib;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=kR()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=CR());const i=r?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=i;i.uniforms.envMap.value=e;const a=this._cubeSize;AR(t,0,0,3*a,2*a),n.setRenderTarget(t),n.render(o,yR)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodMeshes.length;for(let i=1;i<r;i++)this._applyGGXFilter(e,i-1,i);t.autoClear=n}_applyGGXFilter(e,t,n){const r=this._renderer,i=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;const s=o.uniforms,l=n/(this._lodMeshes.length-1),c=t/(this._lodMeshes.length-1),u=Math.sqrt(l*l-c*c)*(0+1.25*l),{_lodMax:d}=this,h=this._sizeLods[n],p=3*h*(n>d-4?n-d+4:0),f=4*(this._cubeSize-h);s.envMap.value=e.texture,s.roughness.value=u,s.mipInt.value=d-t,AR(i,p,f,3*h,2*h),r.setRenderTarget(i),r.render(a,yR),s.envMap.value=i.texture,s.roughness.value=0,s.mipInt.value=d-n,AR(e,p,f,3*h,2*h),r.setRenderTarget(e),r.render(a,yR)}_blur(e,t,n,r,i){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",i),this._halfBlur(o,e,n,n,r,"longitudinal",i)}_halfBlur(e,t,n,r,i,o,a){const s=this._renderer,l=this._blurMaterial;"latitudinal"!==o&&"longitudinal"!==o&&i_("blur direction must be either latitudinal or longitudinal!");const c=this._lodMeshes[r];c.material=l;const u=l.uniforms,d=this._sizeLods[n]-1,h=isFinite(i)?Math.PI/(2*d):2*Math.PI/39,p=i/h,f=isFinite(i)?1+Math.floor(3*p):vR;f>vR&&r_(`sigmaRadians, ${i}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const m=[];let g=0;for(let b=0;b<vR;++b){const e=b/p,t=Math.exp(-e*e/2);m.push(t),0===b?g+=t:b<f&&(g+=2*t)}for(let b=0;b<m.length;b++)m[b]=m[b]/g;u.envMap.value=e.texture,u.samples.value=f,u.weights.value=m,u.latitudinal.value="latitudinal"===o,a&&(u.poleAxis.value=a);const{_lodMax:v}=this;u.dTheta.value=h,u.mipInt.value=v-n;const y=this._sizeLods[r];AR(t,3*y*(r>v-4?r-v+4:0),4*(this._cubeSize-y),3*y,2*y),s.setRenderTarget(t),s.render(c,yR)}}function TR(e,t,n){const r=new V_(e,t,n);return r.texture.mapping=sb,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function AR(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function CR(){return new JS({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:RR(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function kR(){return new JS({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:RR(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function RR(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function PR(e){let t=new WeakMap,n=null;function r(e){const n=e.target;n.removeEventListener("dispose",r);const i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){const o=i.mapping,a=o===ob||o===ab,s=o===rb||o===ib;if(a||s){let o=t.get(i);const l=void 0!==o?o.texture.pmremVersion:0;if(i.isRenderTargetTexture&&i.pmremVersion!==l)return null===n&&(n=new ER(e)),o=a?n.fromEquirectangular(i,o):n.fromCubemap(i,o),o.texture.pmremVersion=i.pmremVersion,t.set(i,o),o.texture;if(void 0!==o)return o.texture;{const l=i.image;return a&&l&&l.height>0||s&&l&&function(e){let t=0;const n=6;for(let r=0;r<n;r++)void 0!==e[r]&&t++;return t===n}(l)?(null===n&&(n=new ER(e)),o=a?n.fromEquirectangular(i):n.fromCubemap(i),o.texture.pmremVersion=i.pmremVersion,t.set(i,o),i.addEventListener("dispose",r),o.texture):null}}}return i},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function IR(e){const t={};function n(n){if(void 0!==t[n])return t[n];const r=e.getExtension(n);return t[n]=r,r}return{has:function(e){return null!==n(e)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(e){const t=n(e);return null===t&&o_("WebGLRenderer: "+e+" extension not supported."),t}}}function LR(e,t,n,r){const i={},o=new WeakMap;function a(e){const s=e.target;null!==s.index&&t.remove(s.index);for(const n in s.attributes)t.remove(s.attributes[n]);s.removeEventListener("dispose",a),delete i[s.id];const l=o.get(s);l&&(t.remove(l),o.delete(s)),r.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(e){const n=[],r=e.index,i=e.attributes.position;let a=0;if(null!==r){const e=r.array;a=r.version;for(let t=0,r=e.length;t<r;t+=3){const r=e[t+0],i=e[t+1],o=e[t+2];n.push(r,i,i,o,o,r)}}else{if(void 0===i)return;{const e=i.array;a=i.version;for(let t=0,r=e.length/3-1;t<r;t+=3){const e=t+0,r=t+1,i=t+2;n.push(e,r,r,i,i,e)}}}const s=new($x(n)?SS:wS)(n,1);s.version=a;const l=o.get(e);l&&t.remove(l),o.set(e,s)}return{get:function(e,t){return!0===i[t.id]||(t.addEventListener("dispose",a),i[t.id]=!0,n.memory.geometries++),t},update:function(n){const r=n.attributes;for(const i in r)t.update(r[i],e.ARRAY_BUFFER)},getWireframeAttribute:function(e){const t=o.get(e);if(t){const n=e.index;null!==n&&t.version<n.version&&s(e)}else s(e);return o.get(e)}}}function NR(e,t,n){let r,i,o;function a(t,a,s){0!==s&&(e.drawElementsInstanced(r,a,i,t*o,s),n.update(a,r,s))}this.setMode=function(e){r=e},this.setIndex=function(e){i=e.type,o=e.bytesPerElement},this.render=function(t,a){e.drawElements(r,a,i,t*o),n.update(a,r,1)},this.renderInstances=a,this.renderMultiDraw=function(e,o,a){if(0===a)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(r,o,0,i,e,0,a);let s=0;for(let t=0;t<a;t++)s+=o[t];n.update(s,r,1)},this.renderMultiDrawInstances=function(e,s,l,c){if(0===l)return;const u=t.get("WEBGL_multi_draw");if(null===u)for(let t=0;t<e.length;t++)a(e[t]/o,s[t],c[t]);else{u.multiDrawElementsInstancedWEBGL(r,s,0,i,e,0,c,0,l);let t=0;for(let e=0;e<l;e++)t+=s[e]*c[e];n.update(t,r,1)}}}function OR(e){const t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(n,r,i){switch(t.calls++,r){case e.TRIANGLES:t.triangles+=i*(n/3);break;case e.LINES:t.lines+=i*(n/2);break;case e.LINE_STRIP:t.lines+=i*(n-1);break;case e.LINE_LOOP:t.lines+=i*n;break;case e.POINTS:t.points+=i*n;break;default:i_("WebGLInfo: Unknown draw mode:",r)}}}}function DR(e,t,n){const r=new WeakMap,i=new z_;return{update:function(o,a,s){const l=o.morphTargetInfluences,c=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,u=void 0!==c?c.length:0;let d=r.get(a);if(void 0===d||d.count!==u){let e=function(){v.dispose(),r.delete(a),a.removeEventListener("dispose",e)};void 0!==d&&d.texture.dispose();const n=void 0!==a.morphAttributes.position,o=void 0!==a.morphAttributes.normal,s=void 0!==a.morphAttributes.color,l=a.morphAttributes.position||[],c=a.morphAttributes.normal||[],h=a.morphAttributes.color||[];let p=0;!0===n&&(p=1),!0===o&&(p=2),!0===s&&(p=3);let f=a.attributes.position.count*p,m=1;f>t.maxTextureSize&&(m=Math.ceil(f/t.maxTextureSize),f=t.maxTextureSize);const g=new Float32Array(f*m*4*u),v=new j_(g,f,m,u);v.type=Sb,v.needsUpdate=!0;const y=4*p;for(let t=0;t<u;t++){const e=l[t],r=c[t],a=h[t],u=f*m*4*t;for(let t=0;t<e.count;t++){const l=t*y;!0===n&&(i.fromBufferAttribute(e,t),g[u+l+0]=i.x,g[u+l+1]=i.y,g[u+l+2]=i.z,g[u+l+3]=0),!0===o&&(i.fromBufferAttribute(r,t),g[u+l+4]=i.x,g[u+l+5]=i.y,g[u+l+6]=i.z,g[u+l+7]=0),!0===s&&(i.fromBufferAttribute(a,t),g[u+l+8]=i.x,g[u+l+9]=i.y,g[u+l+10]=i.z,g[u+l+11]=4===a.itemSize?i.w:1)}}d={count:u,texture:v,size:new y_(f,m)},r.set(a,d),a.addEventListener("dispose",e)}if(!0===o.isInstancedMesh&&null!==o.morphTexture)s.getUniforms().setValue(e,"morphTexture",o.morphTexture,n);else{let t=0;for(let e=0;e<l.length;e++)t+=l[e];const n=a.morphTargetsRelative?1:1-t;s.getUniforms().setValue(e,"morphTargetBaseInfluence",n),s.getUniforms().setValue(e,"morphTargetInfluences",l)}s.getUniforms().setValue(e,"morphTargetsTexture",d.texture,n),s.getUniforms().setValue(e,"morphTargetsTextureSize",d.size)}}}function UR(e,t,n,r){let i=new WeakMap;function o(e){const t=e.target;t.removeEventListener("dispose",o),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(a){const s=r.render.frame,l=a.geometry,c=t.get(a,l);if(i.get(c)!==s&&(t.update(c),i.set(c,s)),a.isInstancedMesh&&(!1===a.hasEventListener("dispose",o)&&a.addEventListener("dispose",o),i.get(a)!==s&&(n.update(a.instanceMatrix,e.ARRAY_BUFFER),null!==a.instanceColor&&n.update(a.instanceColor,e.ARRAY_BUFFER),i.set(a,s))),a.isSkinnedMesh){const e=a.skeleton;i.get(e)!==s&&(e.update(),i.set(e,s))}return c},dispose:function(){i=new WeakMap}}}const FR={[qy]:"LINEAR_TONE_MAPPING",[$y]:"REINHARD_TONE_MAPPING",[Yy]:"CINEON_TONE_MAPPING",[Zy]:"ACES_FILMIC_TONE_MAPPING",[Ky]:"AGX_TONE_MAPPING",[Qy]:"NEUTRAL_TONE_MAPPING",[Jy]:"CUSTOM_TONE_MAPPING"};function zR(e,t,n,r,i){const o=new V_(t,n,{type:e,depthBuffer:r,stencilBuffer:i}),a=new V_(t,n,{type:Mb,depthBuffer:!1,stencilBuffer:!1}),s=new IS;s.setAttribute("position",new MS([-1,3,0,-1,-1,0,3,-1,0],3)),s.setAttribute("uv",new MS([0,2,0,0,2,0],2));const l=new NA({uniforms:{tDiffuse:{value:null}},vertexShader:"\n\t\t\tprecision highp float;\n\n\t\t\tuniform mat4 modelViewMatrix;\n\t\t\tuniform mat4 projectionMatrix;\n\n\t\t\tattribute vec3 position;\n\t\t\tattribute vec2 uv;\n\n\t\t\tvarying vec2 vUv;\n\n\t\t\tvoid main() {\n\t\t\t\tvUv = uv;\n\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t}",fragmentShader:"\n\t\t\tprecision highp float;\n\n\t\t\tuniform sampler2D tDiffuse;\n\n\t\t\tvarying vec2 vUv;\n\n\t\t\t#include <tonemapping_pars_fragment>\n\t\t\t#include <colorspace_pars_fragment>\n\n\t\t\tvoid main() {\n\t\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\n\t\t\t\t#ifdef LINEAR_TONE_MAPPING\n\t\t\t\t\tgl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( REINHARD_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( CINEON_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( ACES_FILMIC_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( AGX_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( NEUTRAL_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( CUSTOM_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );\n\t\t\t\t#endif\n\n\t\t\t\t#ifdef SRGB_TRANSFER\n\t\t\t\t\tgl_FragColor = sRGBTransferOETF( gl_FragColor );\n\t\t\t\t#endif\n\t\t\t}",depthTest:!1,depthWrite:!1}),c=new WS(s,l),u=new kC(-1,1,1,-1,0,1);let d,h=null,p=null,f=!1,m=null,g=[],v=!1;this.setSize=function(e,t){o.setSize(e,t),a.setSize(e,t);for(let n=0;n<g.length;n++){const r=g[n];r.setSize&&r.setSize(e,t)}},this.setEffects=function(e){g=e,v=g.length>0&&!0===g[0].isRenderPass;const t=o.width,n=o.height;for(let r=0;r<g.length;r++){const e=g[r];e.setSize&&e.setSize(t,n)}},this.begin=function(e,t){if(f)return!1;if(0===e.toneMapping&&0===g.length)return!1;if(m=t,null!==t){const e=t.width,n=t.height;o.width===e&&o.height===n||this.setSize(e,n)}return!1===v&&e.setRenderTarget(o),d=e.toneMapping,e.toneMapping=0,!0},this.hasRenderPass=function(){return v},this.end=function(e,t){e.toneMapping=d,f=!0;let n=o,r=a;for(let i=0;i<g.length;i++){const o=g[i];if(!1!==o.enabled&&(o.render(e,r,n,t),!1!==o.needsSwap)){const e=n;n=r,r=e}}if(h!==e.outputColorSpace||p!==e.toneMapping){h=e.outputColorSpace,p=e.toneMapping,l.defines={},C_.getTransfer(h)===Nx&&(l.defines.SRGB_TRANSFER="");const t=FR[p];t&&(l.defines[t]=""),l.needsUpdate=!0}l.uniforms.tDiffuse.value=n.texture,e.setRenderTarget(m),e.render(c,u),m=null,f=!1},this.isCompositing=function(){return f},this.dispose=function(){o.dispose(),a.dispose(),s.dispose(),l.dispose()}}const BR=new F_,VR=new iT(1,1),jR=new j_,HR=new H_,WR=new oM,GR=[],XR=[],qR=new Float32Array(16),$R=new Float32Array(9),YR=new Float32Array(4);function ZR(e,t,n){const r=e[0];if(r<=0||r>0)return e;const i=t*n;let o=GR[i];if(void 0===o&&(o=new Float32Array(i),GR[i]=o),0!==t){r.toArray(o,0);for(let r=1,i=0;r!==t;++r)i+=n,e[r].toArray(o,i)}return o}function JR(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function KR(e,t){for(let n=0,r=t.length;n<r;n++)e[n]=t[n]}function QR(e,t){let n=XR[t];void 0===n&&(n=new Int32Array(t),XR[t]=n);for(let r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function eP(e,t){const n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function tP(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(JR(n,t))return;e.uniform2fv(this.addr,t),KR(n,t)}}function nP(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(JR(n,t))return;e.uniform3fv(this.addr,t),KR(n,t)}}function rP(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(JR(n,t))return;e.uniform4fv(this.addr,t),KR(n,t)}}function iP(e,t){const n=this.cache,r=t.elements;if(void 0===r){if(JR(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),KR(n,t)}else{if(JR(n,r))return;YR.set(r),e.uniformMatrix2fv(this.addr,!1,YR),KR(n,r)}}function oP(e,t){const n=this.cache,r=t.elements;if(void 0===r){if(JR(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),KR(n,t)}else{if(JR(n,r))return;$R.set(r),e.uniformMatrix3fv(this.addr,!1,$R),KR(n,r)}}function aP(e,t){const n=this.cache,r=t.elements;if(void 0===r){if(JR(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),KR(n,t)}else{if(JR(n,r))return;qR.set(r),e.uniformMatrix4fv(this.addr,!1,qR),KR(n,r)}}function sP(e,t){const n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function lP(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(JR(n,t))return;e.uniform2iv(this.addr,t),KR(n,t)}}function cP(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(JR(n,t))return;e.uniform3iv(this.addr,t),KR(n,t)}}function uP(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(JR(n,t))return;e.uniform4iv(this.addr,t),KR(n,t)}}function dP(e,t){const n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function hP(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(JR(n,t))return;e.uniform2uiv(this.addr,t),KR(n,t)}}function pP(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(JR(n,t))return;e.uniform3uiv(this.addr,t),KR(n,t)}}function fP(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(JR(n,t))return;e.uniform4uiv(this.addr,t),KR(n,t)}}function mP(e,t,n){const r=this.cache,i=n.allocateTextureUnit();let o;r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),this.type===e.SAMPLER_2D_SHADOW?(VR.compareFunction=n.isReversedDepthBuffer()?jx:zx,o=VR):o=BR,n.setTexture2D(t||o,i)}function gP(e,t,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||HR,i)}function vP(e,t,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(t||WR,i)}function yP(e,t,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||jR,i)}function bP(e,t){e.uniform1fv(this.addr,t)}function xP(e,t){const n=ZR(t,this.size,2);e.uniform2fv(this.addr,n)}function _P(e,t){const n=ZR(t,this.size,3);e.uniform3fv(this.addr,n)}function wP(e,t){const n=ZR(t,this.size,4);e.uniform4fv(this.addr,n)}function SP(e,t){const n=ZR(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function MP(e,t){const n=ZR(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function EP(e,t){const n=ZR(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function TP(e,t){e.uniform1iv(this.addr,t)}function AP(e,t){e.uniform2iv(this.addr,t)}function CP(e,t){e.uniform3iv(this.addr,t)}function kP(e,t){e.uniform4iv(this.addr,t)}function RP(e,t){e.uniform1uiv(this.addr,t)}function PP(e,t){e.uniform2uiv(this.addr,t)}function IP(e,t){e.uniform3uiv(this.addr,t)}function LP(e,t){e.uniform4uiv(this.addr,t)}function NP(e,t,n){const r=this.cache,i=t.length,o=QR(n,i);let a;JR(r,o)||(e.uniform1iv(this.addr,o),KR(r,o)),a=this.type===e.SAMPLER_2D_SHADOW?VR:BR;for(let s=0;s!==i;++s)n.setTexture2D(t[s]||a,o[s])}function OP(e,t,n){const r=this.cache,i=t.length,o=QR(n,i);JR(r,o)||(e.uniform1iv(this.addr,o),KR(r,o));for(let a=0;a!==i;++a)n.setTexture3D(t[a]||HR,o[a])}function DP(e,t,n){const r=this.cache,i=t.length,o=QR(n,i);JR(r,o)||(e.uniform1iv(this.addr,o),KR(r,o));for(let a=0;a!==i;++a)n.setTextureCube(t[a]||WR,o[a])}function UP(e,t,n){const r=this.cache,i=t.length,o=QR(n,i);JR(r,o)||(e.uniform1iv(this.addr,o),KR(r,o));for(let a=0;a!==i;++a)n.setTexture2DArray(t[a]||jR,o[a])}class FP{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return eP;case 35664:return tP;case 35665:return nP;case 35666:return rP;case 35674:return iP;case 35675:return oP;case 35676:return aP;case 5124:case 35670:return sP;case 35667:case 35671:return lP;case 35668:case 35672:return cP;case 35669:case 35673:return uP;case 5125:return dP;case 36294:return hP;case 36295:return pP;case 36296:return fP;case 35678:case 36198:case 36298:case 36306:case 35682:return mP;case 35679:case 36299:case 36307:return gP;case 35680:case 36300:case 36308:case 36293:return vP;case 36289:case 36303:case 36311:case 36292:return yP}}(t.type)}}class zP{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return bP;case 35664:return xP;case 35665:return _P;case 35666:return wP;case 35674:return SP;case 35675:return MP;case 35676:return EP;case 5124:case 35670:return TP;case 35667:case 35671:return AP;case 35668:case 35672:return CP;case 35669:case 35673:return kP;case 5125:return RP;case 36294:return PP;case 36295:return IP;case 36296:return LP;case 35678:case 36198:case 36298:case 36306:case 35682:return NP;case 35679:case 36299:case 36307:return OP;case 35680:case 36300:case 36308:case 36293:return DP;case 36289:case 36303:case 36311:case 36292:return UP}}(t.type)}}class BP{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let i=0,o=r.length;i!==o;++i){const o=r[i];o.setValue(e,t[o.id],n)}}}const VP=/(\w+)(\])?(\[|\.)?/g;function jP(e,t){e.seq.push(t),e.map[t.id]=t}function HP(e,t,n){const r=e.name,i=r.length;for(VP.lastIndex=0;;){const o=VP.exec(r),a=VP.lastIndex;let s=o[1];const l="]"===o[2],c=o[3];if(l&&(s|=0),void 0===c||"["===c&&a+2===i){jP(n,void 0===c?new FP(s,e,t):new zP(s,e,t));break}{let e=n.map[s];void 0===e&&(e=new BP(s),jP(n,e)),n=e}}}class WP{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let o=0;o<n;++o){const n=e.getActiveUniform(t,o);HP(n,e.getUniformLocation(t,n.name),this)}const r=[],i=[];for(const o of this.seq)o.type===e.SAMPLER_2D_SHADOW||o.type===e.SAMPLER_CUBE_SHADOW||o.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(o):i.push(o);r.length>0&&(this.seq=r.concat(i))}setValue(e,t,n,r){const i=this.map[t];void 0!==i&&i.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];void 0!==r&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let i=0,o=t.length;i!==o;++i){const o=t[i],a=n[o.id];!1!==a.needsUpdate&&o.setValue(e,a.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,i=e.length;r!==i;++r){const i=e[r];i.id in t&&n.push(i)}return n}}function GP(e,t,n){const r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}let XP=0;const qP=new S_;function $P(e,t,n){const r=e.getShaderParameter(t,e.COMPILE_STATUS),i=(e.getShaderInfoLog(t)||"").trim();if(r&&""===i)return"";const o=/ERROR: 0:(\d+)/.exec(i);if(o){const r=parseInt(o[1]);return n.toUpperCase()+"\n\n"+i+"\n\n"+function(e,t){const n=e.split("\n"),r=[],i=Math.max(t-6,0),o=Math.min(t+6,n.length);for(let a=i;a<o;a++){const e=a+1;r.push(`${e===t?">":" "} ${e}: ${n[a]}`)}return r.join("\n")}(e.getShaderSource(t),r)}return i}function YP(e,t){const n=function(e){C_._getMatrix(qP,C_.workingColorSpace,e);const t=`mat3( ${qP.elements.map(e=>e.toFixed(4))} )`;switch(C_.getTransfer(e)){case Lx:return[t,"LinearTransferOETF"];case Nx:return[t,"sRGBTransferOETF"];default:return r_("WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}(t);return[`vec4 ${e}( vec4 value ) {`,`\treturn ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join("\n")}const ZP={[qy]:"Linear",[$y]:"Reinhard",[Yy]:"Cineon",[Zy]:"ACESFilmic",[Ky]:"AgX",[Qy]:"Neutral",[Jy]:"Custom"};function JP(e,t){const n=ZP[t];return void 0===n?(r_("WebGLProgram: Unsupported toneMapping:",t),"vec3 "+e+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const KP=new x_;function QP(){C_.getLuminanceCoefficients(KP);return["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${KP.x.toFixed(4)}, ${KP.y.toFixed(4)}, ${KP.z.toFixed(4)} );`,"\treturn dot( weights, rgb );","}"].join("\n")}function eI(e){return""!==e}function tI(e,t){const n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function nI(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const rI=/^[ \t]*#include +<([\w\d./]+)>/gm;function iI(e){return e.replace(rI,aI)}const oI=new Map;function aI(e,t){let n=iR[t];if(void 0===n){const e=oI.get(t);if(void 0===e)throw new Error("Can not resolve #include <"+t+">");n=iR[e],r_('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e)}return iI(n)}const sI=/#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 lI(e){return e.replace(sI,cI)}function cI(e,t,n,r){let i="";for(let o=parseInt(t);o<parseInt(n);o++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+o+" ]").replace(/UNROLLED_LOOP_INDEX/g,o);return i}function uI(e){let t=`precision ${e.precision} float;\n\tprecision ${e.precision} int;\n\tprecision ${e.precision} sampler2D;\n\tprecision ${e.precision} samplerCube;\n\tprecision ${e.precision} sampler3D;\n\tprecision ${e.precision} sampler2DArray;\n\tprecision ${e.precision} sampler2DShadow;\n\tprecision ${e.precision} samplerCubeShadow;\n\tprecision ${e.precision} sampler2DArrayShadow;\n\tprecision ${e.precision} isampler2D;\n\tprecision ${e.precision} isampler3D;\n\tprecision ${e.precision} isamplerCube;\n\tprecision ${e.precision} isampler2DArray;\n\tprecision ${e.precision} usampler2D;\n\tprecision ${e.precision} usampler3D;\n\tprecision ${e.precision} usamplerCube;\n\tprecision ${e.precision} usampler2DArray;\n\t`;return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}const dI={[py]:"SHADOWMAP_TYPE_PCF",[fy]:"SHADOWMAP_TYPE_VSM"};const hI={[rb]:"ENVMAP_TYPE_CUBE",[ib]:"ENVMAP_TYPE_CUBE",[sb]:"ENVMAP_TYPE_CUBE_UV"};const pI={[ib]:"ENVMAP_MODE_REFRACTION"};const fI={[Wy]:"ENVMAP_BLENDING_MULTIPLY",[Gy]:"ENVMAP_BLENDING_MIX",[Xy]:"ENVMAP_BLENDING_ADD"};function mI(e,t,n,r){const i=e.getContext(),o=n.defines;let a=n.vertexShader,s=n.fragmentShader;const l=function(e){return dI[e.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}(n),c=function(e){return!1===e.envMap?"ENVMAP_TYPE_CUBE":hI[e.envMapMode]||"ENVMAP_TYPE_CUBE"}(n),u=function(e){return!1===e.envMap?"ENVMAP_MODE_REFLECTION":pI[e.envMapMode]||"ENVMAP_MODE_REFLECTION"}(n),d=function(e){return!1===e.envMap?"ENVMAP_BLENDING_NONE":fI[e.combine]||"ENVMAP_BLENDING_NONE"}(n),h=function(e){const t=e.envMapCubeUVHeight;if(null===t)return null;const n=Math.log2(t)-2,r=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:r,maxMip:n}}(n),p=function(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(eI).join("\n")}(n),f=function(e){const t=[];for(const n in e){const r=e[n];!1!==r&&t.push("#define "+n+" "+r)}return t.join("\n")}(o),m=i.createProgram();let g,v,y=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f].filter(eI).join("\n"),g.length>0&&(g+="\n"),v=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f].filter(eI).join("\n"),v.length>0&&(v+="\n")):(g=[uI(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(eI).join("\n"),v=[uI(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+u:"",n.envMap?"#define "+d:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?iR.tonemapping_pars_fragment:"",0!==n.toneMapping?JP("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",iR.colorspace_pars_fragment,YP("linearToOutputTexel",n.outputColorSpace),QP(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(eI).join("\n")),a=iI(a),a=tI(a,n),a=nI(a,n),s=iI(s),s=tI(s,n),s=nI(s,n),a=lI(a),s=lI(s),!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",g=[p,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,v=["#define varying in",n.glslVersion===Gx?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Gx?"":"#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("\n")+"\n"+v);const b=y+g+a,x=y+v+s,_=GP(i,i.VERTEX_SHADER,b),w=GP(i,i.FRAGMENT_SHADER,x);function S(t){if(e.debug.checkShaderErrors){const n=i.getProgramInfoLog(m)||"",r=i.getShaderInfoLog(_)||"",o=i.getShaderInfoLog(w)||"",a=n.trim(),s=r.trim(),l=o.trim();let c=!0,u=!0;if(!1===i.getProgramParameter(m,i.LINK_STATUS))if(c=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(i,m,_,w);else{const e=$P(i,_,"vertex"),n=$P(i,w,"fragment");i_("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(m,i.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+a+"\n"+e+"\n"+n)}else""!==a?r_("WebGLProgram: Program Info Log:",a):""!==s&&""!==l||(u=!1);u&&(t.diagnostics={runnable:c,programLog:a,vertexShader:{log:s,prefix:g},fragmentShader:{log:l,prefix:v}})}i.deleteShader(_),i.deleteShader(w),M=new WP(i,m),E=function(e,t){const n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let i=0;i<r;i++){const r=e.getActiveAttrib(t,i),o=r.name;let a=1;r.type===e.FLOAT_MAT2&&(a=2),r.type===e.FLOAT_MAT3&&(a=3),r.type===e.FLOAT_MAT4&&(a=4),n[o]={type:r.type,location:e.getAttribLocation(t,o),locationSize:a}}return n}(i,m)}let M,E;i.attachShader(m,_),i.attachShader(m,w),void 0!==n.index0AttributeName?i.bindAttribLocation(m,0,n.index0AttributeName):!0===n.morphTargets&&i.bindAttribLocation(m,0,"position"),i.linkProgram(m),this.getUniforms=function(){return void 0===M&&S(this),M},this.getAttributes=function(){return void 0===E&&S(this),E};let T=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===T&&(T=i.getProgramParameter(m,37297)),T},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(m),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=XP++,this.cacheKey=t,this.usedTimes=1,this.program=m,this.vertexShader=_,this.fragmentShader=w,this}let gI=0;class vI{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),i=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return!1===o.has(r)&&(o.add(r),r.usedTimes++),!1===o.has(i)&&(o.add(i),i.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,0===n.usedTimes&&this.shaderCache.delete(n.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 n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return void 0===n&&(n=new yI(e),t.set(e,n)),n}}class yI{constructor(e){this.id=gI++,this.code=e,this.usedTimes=0}}function bI(e,t,n,r,i,o,a){const s=new Cw,l=new vI,c=new Set,u=[],d=new Map,h=i.logarithmicDepthBuffer;let p=i.precision;const f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",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 m(e){return c.add(e),0===e?"uv":`uv${e}`}return{getParameters:function(o,s,u,d,g){const v=d.fog,y=g.geometry,b=o.isMeshStandardMaterial?d.environment:null,x=(o.isMeshStandardMaterial?n:t).get(o.envMap||b),_=x&&x.mapping===sb?x.image.height:null,w=f[o.type];null!==o.precision&&(p=i.getMaxPrecision(o.precision),p!==o.precision&&r_("WebGLProgram.getParameters:",o.precision,"not supported, using",p,"instead."));const S=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,M=void 0!==S?S.length:0;let E,T,A,C,k=0;if(void 0!==y.morphAttributes.position&&(k=1),void 0!==y.morphAttributes.normal&&(k=2),void 0!==y.morphAttributes.color&&(k=3),w){const e=aR[w];E=e.vertexShader,T=e.fragmentShader}else E=o.vertexShader,T=o.fragmentShader,l.update(o),A=l.getVertexShaderID(o),C=l.getFragmentShaderID(o);const R=e.getRenderTarget(),P=e.state.buffers.depth.getReversed(),I=!0===g.isInstancedMesh,L=!0===g.isBatchedMesh,N=!!o.map,O=!!o.matcap,D=!!x,U=!!o.aoMap,F=!!o.lightMap,z=!!o.bumpMap,B=!!o.normalMap,V=!!o.displacementMap,j=!!o.emissiveMap,H=!!o.metalnessMap,W=!!o.roughnessMap,G=o.anisotropy>0,X=o.clearcoat>0,q=o.dispersion>0,$=o.iridescence>0,Y=o.sheen>0,Z=o.transmission>0,J=G&&!!o.anisotropyMap,K=X&&!!o.clearcoatMap,Q=X&&!!o.clearcoatNormalMap,ee=X&&!!o.clearcoatRoughnessMap,te=$&&!!o.iridescenceMap,ne=$&&!!o.iridescenceThicknessMap,re=Y&&!!o.sheenColorMap,ie=Y&&!!o.sheenRoughnessMap,oe=!!o.specularMap,ae=!!o.specularColorMap,se=!!o.specularIntensityMap,le=Z&&!!o.transmissionMap,ce=Z&&!!o.thicknessMap,ue=!!o.gradientMap,de=!!o.alphaMap,he=o.alphaTest>0,pe=!!o.alphaHash,fe=!!o.extensions;let me=0;o.toneMapped&&(null!==R&&!0!==R.isXRRenderTarget||(me=e.toneMapping));const ge={shaderID:w,shaderType:o.type,shaderName:o.name,vertexShader:E,fragmentShader:T,defines:o.defines,customVertexShaderID:A,customFragmentShaderID:C,isRawShaderMaterial:!0===o.isRawShaderMaterial,glslVersion:o.glslVersion,precision:p,batching:L,batchingColor:L&&null!==g._colorsTexture,instancing:I,instancingColor:I&&null!==g.instanceColor,instancingMorph:I&&null!==g.morphTexture,outputColorSpace:null===R?e.outputColorSpace:!0===R.isXRRenderTarget?R.texture.colorSpace:Ix,alphaToCoverage:!!o.alphaToCoverage,map:N,matcap:O,envMap:D,envMapMode:D&&x.mapping,envMapCubeUVHeight:_,aoMap:U,lightMap:F,bumpMap:z,normalMap:B,displacementMap:V,emissiveMap:j,normalMapObjectSpace:B&&1===o.normalMapType,normalMapTangentSpace:B&&0===o.normalMapType,metalnessMap:H,roughnessMap:W,anisotropy:G,anisotropyMap:J,clearcoat:X,clearcoatMap:K,clearcoatNormalMap:Q,clearcoatRoughnessMap:ee,dispersion:q,iridescence:$,iridescenceMap:te,iridescenceThicknessMap:ne,sheen:Y,sheenColorMap:re,sheenRoughnessMap:ie,specularMap:oe,specularColorMap:ae,specularIntensityMap:se,transmission:Z,transmissionMap:le,thicknessMap:ce,gradientMap:ue,opaque:!1===o.transparent&&1===o.blending&&!1===o.alphaToCoverage,alphaMap:de,alphaTest:he,alphaHash:pe,combine:o.combine,mapUv:N&&m(o.map.channel),aoMapUv:U&&m(o.aoMap.channel),lightMapUv:F&&m(o.lightMap.channel),bumpMapUv:z&&m(o.bumpMap.channel),normalMapUv:B&&m(o.normalMap.channel),displacementMapUv:V&&m(o.displacementMap.channel),emissiveMapUv:j&&m(o.emissiveMap.channel),metalnessMapUv:H&&m(o.metalnessMap.channel),roughnessMapUv:W&&m(o.roughnessMap.channel),anisotropyMapUv:J&&m(o.anisotropyMap.channel),clearcoatMapUv:K&&m(o.clearcoatMap.channel),clearcoatNormalMapUv:Q&&m(o.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ee&&m(o.clearcoatRoughnessMap.channel),iridescenceMapUv:te&&m(o.iridescenceMap.channel),iridescenceThicknessMapUv:ne&&m(o.iridescenceThicknessMap.channel),sheenColorMapUv:re&&m(o.sheenColorMap.channel),sheenRoughnessMapUv:ie&&m(o.sheenRoughnessMap.channel),specularMapUv:oe&&m(o.specularMap.channel),specularColorMapUv:ae&&m(o.specularColorMap.channel),specularIntensityMapUv:se&&m(o.specularIntensityMap.channel),transmissionMapUv:le&&m(o.transmissionMap.channel),thicknessMapUv:ce&&m(o.thicknessMap.channel),alphaMapUv:de&&m(o.alphaMap.channel),vertexTangents:!!y.attributes.tangent&&(B||G),vertexColors:o.vertexColors,vertexAlphas:!0===o.vertexColors&&!!y.attributes.color&&4===y.attributes.color.itemSize,pointsUvs:!0===g.isPoints&&!!y.attributes.uv&&(N||de),fog:!!v,useFog:!0===o.fog,fogExp2:!!v&&v.isFogExp2,flatShading:!0===o.flatShading&&!1===o.wireframe,sizeAttenuation:!0===o.sizeAttenuation,logarithmicDepthBuffer:h,reversedDepthBuffer:P,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==y.morphAttributes.position,morphNormals:void 0!==y.morphAttributes.normal,morphColors:void 0!==y.morphAttributes.color,morphTargetsCount:M,morphTextureStride:k,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numLightProbes:s.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:o.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:me,decodeVideoTexture:N&&!0===o.map.isVideoTexture&&C_.getTransfer(o.map.colorSpace)===Nx,decodeVideoTextureEmissive:j&&!0===o.emissiveMap.isVideoTexture&&C_.getTransfer(o.emissiveMap.colorSpace)===Nx,premultipliedAlpha:o.premultipliedAlpha,doubleSided:2===o.side,flipSided:1===o.side,useDepthPacking:o.depthPacking>=0,depthPacking:o.depthPacking||0,index0AttributeName:o.index0AttributeName,extensionClipCullDistance:fe&&!0===o.extensions.clipCullDistance&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(fe&&!0===o.extensions.multiDraw||L)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:o.customProgramCacheKey()};return ge.vertexUv1s=c.has(1),ge.vertexUv2s=c.has(2),ge.vertexUv3s=c.has(3),c.clear(),ge},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(!function(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){s.disableAll(),t.instancing&&s.enable(0);t.instancingColor&&s.enable(1);t.instancingMorph&&s.enable(2);t.matcap&&s.enable(3);t.envMap&&s.enable(4);t.normalMapObjectSpace&&s.enable(5);t.normalMapTangentSpace&&s.enable(6);t.clearcoat&&s.enable(7);t.iridescence&&s.enable(8);t.alphaTest&&s.enable(9);t.vertexColors&&s.enable(10);t.vertexAlphas&&s.enable(11);t.vertexUv1s&&s.enable(12);t.vertexUv2s&&s.enable(13);t.vertexUv3s&&s.enable(14);t.vertexTangents&&s.enable(15);t.anisotropy&&s.enable(16);t.alphaHash&&s.enable(17);t.batching&&s.enable(18);t.dispersion&&s.enable(19);t.batchingColor&&s.enable(20);t.gradientMap&&s.enable(21);e.push(s.mask),s.disableAll(),t.fog&&s.enable(0);t.useFog&&s.enable(1);t.flatShading&&s.enable(2);t.logarithmicDepthBuffer&&s.enable(3);t.reversedDepthBuffer&&s.enable(4);t.skinning&&s.enable(5);t.morphTargets&&s.enable(6);t.morphNormals&&s.enable(7);t.morphColors&&s.enable(8);t.premultipliedAlpha&&s.enable(9);t.shadowMapEnabled&&s.enable(10);t.doubleSided&&s.enable(11);t.flipSided&&s.enable(12);t.useDepthPacking&&s.enable(13);t.dithering&&s.enable(14);t.transmission&&s.enable(15);t.sheen&&s.enable(16);t.opaque&&s.enable(17);t.pointsUvs&&s.enable(18);t.decodeVideoTexture&&s.enable(19);t.decodeVideoTextureEmissive&&s.enable(20);t.alphaToCoverage&&s.enable(21);e.push(s.mask)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=f[e.type];let n;if(t){const e=aR[t];n=ZS.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let r=d.get(n);return void 0!==r?++r.usedTimes:(r=new mI(e,n,t,o),u.push(r),d.set(n,r)),r},releaseProgram:function(e){if(0===--e.usedTimes){const t=u.indexOf(e);u[t]=u[u.length-1],u.pop(),d.delete(e.cacheKey),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:u,dispose:function(){l.dispose()}}}function xI(){let e=new WeakMap;return{has:function(t){return e.has(t)},get:function(t){let n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,r){e.get(t)[n]=r},dispose:function(){e=new WeakMap}}}function _I(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function wI(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function SI(){const e=[];let t=0;const n=[],r=[],i=[];function o(n,r,i,o,a,s){let l=e[t];return void 0===l?(l={id:n.id,object:n,geometry:r,material:i,groupOrder:o,renderOrder:n.renderOrder,z:a,group:s},e[t]=l):(l.id=n.id,l.object=n,l.geometry=r,l.material=i,l.groupOrder=o,l.renderOrder=n.renderOrder,l.z=a,l.group=s),t++,l}return{opaque:n,transmissive:r,transparent:i,init:function(){t=0,n.length=0,r.length=0,i.length=0},push:function(e,t,a,s,l,c){const u=o(e,t,a,s,l,c);a.transmission>0?r.push(u):!0===a.transparent?i.push(u):n.push(u)},unshift:function(e,t,a,s,l,c){const u=o(e,t,a,s,l,c);a.transmission>0?r.unshift(u):!0===a.transparent?i.unshift(u):n.unshift(u)},finish:function(){for(let n=t,r=e.length;n<r;n++){const t=e[n];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){n.length>1&&n.sort(e||_I),r.length>1&&r.sort(t||wI),i.length>1&&i.sort(t||wI)}}}function MI(){let e=new WeakMap;return{get:function(t,n){const r=e.get(t);let i;return void 0===r?(i=new SI,e.set(t,[i])):n>=r.length?(i=new SI,r.push(i)):i=r[n],i},dispose:function(){e=new WeakMap}}}function EI(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new x_,color:new cS};break;case"SpotLight":n={position:new x_,direction:new x_,color:new cS,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new x_,color:new cS,distance:0,decay:0};break;case"HemisphereLight":n={direction:new x_,skyColor:new cS,groundColor:new cS};break;case"RectAreaLight":n={color:new cS,position:new x_,halfWidth:new x_,halfHeight:new x_}}return e[t.id]=n,n}}}let TI=0;function AI(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function CI(e){const t=new EI,n=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new y_};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new y_,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),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 s=0;s<9;s++)r.probe.push(new x_);const i=new x_,o=new vw,a=new vw;return{setup:function(i){let o=0,a=0,s=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let l=0,c=0,u=0,d=0,h=0,p=0,f=0,m=0,g=0,v=0,y=0;i.sort(AI);for(let e=0,x=i.length;e<x;e++){const b=i[e],x=b.color,_=b.intensity,w=b.distance;let S=null;if(b.shadow&&b.shadow.map&&(S=b.shadow.map.texture.format===Ub?b.shadow.map.texture:b.shadow.map.depthTexture||b.shadow.map.texture),b.isAmbientLight)o+=x.r*_,a+=x.g*_,s+=x.b*_;else if(b.isLightProbe){for(let e=0;e<9;e++)r.probe[e].addScaledVector(b.sh.coefficients[e],_);y++}else if(b.isDirectionalLight){const e=t.get(b);if(e.color.copy(b.color).multiplyScalar(b.intensity),b.castShadow){const e=b.shadow,t=n.get(b);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,r.directionalShadow[l]=t,r.directionalShadowMap[l]=S,r.directionalShadowMatrix[l]=b.shadow.matrix,p++}r.directional[l]=e,l++}else if(b.isSpotLight){const e=t.get(b);e.position.setFromMatrixPosition(b.matrixWorld),e.color.copy(x).multiplyScalar(_),e.distance=w,e.coneCos=Math.cos(b.angle),e.penumbraCos=Math.cos(b.angle*(1-b.penumbra)),e.decay=b.decay,r.spot[u]=e;const i=b.shadow;if(b.map&&(r.spotLightMap[g]=b.map,g++,i.updateMatrices(b),b.castShadow&&v++),r.spotLightMatrix[u]=i.matrix,b.castShadow){const e=n.get(b);e.shadowIntensity=i.intensity,e.shadowBias=i.bias,e.shadowNormalBias=i.normalBias,e.shadowRadius=i.radius,e.shadowMapSize=i.mapSize,r.spotShadow[u]=e,r.spotShadowMap[u]=S,m++}u++}else if(b.isRectAreaLight){const e=t.get(b);e.color.copy(x).multiplyScalar(_),e.halfWidth.set(.5*b.width,0,0),e.halfHeight.set(0,.5*b.height,0),r.rectArea[d]=e,d++}else if(b.isPointLight){const e=t.get(b);if(e.color.copy(b.color).multiplyScalar(b.intensity),e.distance=b.distance,e.decay=b.decay,b.castShadow){const e=b.shadow,t=n.get(b);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,r.pointShadow[c]=t,r.pointShadowMap[c]=S,r.pointShadowMatrix[c]=b.shadow.matrix,f++}r.point[c]=e,c++}else if(b.isHemisphereLight){const e=t.get(b);e.skyColor.copy(b.color).multiplyScalar(_),e.groundColor.copy(b.groundColor).multiplyScalar(_),r.hemi[h]=e,h++}}d>0&&(!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=oR.LTC_FLOAT_1,r.rectAreaLTC2=oR.LTC_FLOAT_2):(r.rectAreaLTC1=oR.LTC_HALF_1,r.rectAreaLTC2=oR.LTC_HALF_2)),r.ambient[0]=o,r.ambient[1]=a,r.ambient[2]=s;const b=r.hash;b.directionalLength===l&&b.pointLength===c&&b.spotLength===u&&b.rectAreaLength===d&&b.hemiLength===h&&b.numDirectionalShadows===p&&b.numPointShadows===f&&b.numSpotShadows===m&&b.numSpotMaps===g&&b.numLightProbes===y||(r.directional.length=l,r.spot.length=u,r.rectArea.length=d,r.point.length=c,r.hemi.length=h,r.directionalShadow.length=p,r.directionalShadowMap.length=p,r.pointShadow.length=f,r.pointShadowMap.length=f,r.spotShadow.length=m,r.spotShadowMap.length=m,r.directionalShadowMatrix.length=p,r.pointShadowMatrix.length=f,r.spotLightMatrix.length=m+g-v,r.spotLightMap.length=g,r.numSpotLightShadowsWithMaps=v,r.numLightProbes=y,b.directionalLength=l,b.pointLength=c,b.spotLength=u,b.rectAreaLength=d,b.hemiLength=h,b.numDirectionalShadows=p,b.numPointShadows=f,b.numSpotShadows=m,b.numSpotMaps=g,b.numLightProbes=y,r.version=TI++)},setupView:function(e,t){let n=0,s=0,l=0,c=0,u=0;const d=t.matrixWorldInverse;for(let h=0,p=e.length;h<p;h++){const t=e[h];if(t.isDirectionalLight){const e=r.directional[n];e.direction.setFromMatrixPosition(t.matrixWorld),i.setFromMatrixPosition(t.target.matrixWorld),e.direction.sub(i),e.direction.transformDirection(d),n++}else if(t.isSpotLight){const e=r.spot[l];e.position.setFromMatrixPosition(t.matrixWorld),e.position.applyMatrix4(d),e.direction.setFromMatrixPosition(t.matrixWorld),i.setFromMatrixPosition(t.target.matrixWorld),e.direction.sub(i),e.direction.transformDirection(d),l++}else if(t.isRectAreaLight){const e=r.rectArea[c];e.position.setFromMatrixPosition(t.matrixWorld),e.position.applyMatrix4(d),a.identity(),o.copy(t.matrixWorld),o.premultiply(d),a.extractRotation(o),e.halfWidth.set(.5*t.width,0,0),e.halfHeight.set(0,.5*t.height,0),e.halfWidth.applyMatrix4(a),e.halfHeight.applyMatrix4(a),c++}else if(t.isPointLight){const e=r.point[s];e.position.setFromMatrixPosition(t.matrixWorld),e.position.applyMatrix4(d),s++}else if(t.isHemisphereLight){const e=r.hemi[u];e.direction.setFromMatrixPosition(t.matrixWorld),e.direction.transformDirection(d),u++}}},state:r}}function kI(e){const t=new CI(e),n=[],r=[];const i={lightsArray:n,shadowsArray:r,camera:null,lights:t,transmissionRenderTarget:{}};return{init:function(e){i.camera=e,n.length=0,r.length=0},state:i,setupLights:function(){t.setup(n)},setupLightsView:function(e){t.setupView(n,e)},pushLight:function(e){n.push(e)},pushShadow:function(e){r.push(e)}}}function RI(e){let t=new WeakMap;return{get:function(n,r=0){const i=t.get(n);let o;return void 0===i?(o=new kI(e),t.set(n,[o])):r>=i.length?(o=new kI(e),i.push(o)):o=i[r],o},dispose:function(){t=new WeakMap}}}const PI=[new x_(1,0,0),new x_(-1,0,0),new x_(0,1,0),new x_(0,-1,0),new x_(0,0,1),new x_(0,0,-1)],II=[new x_(0,-1,0),new x_(0,-1,0),new x_(0,0,1),new x_(0,0,-1),new x_(0,-1,0),new x_(0,-1,0)],LI=new vw,NI=new x_,OI=new x_;function DI(e,t,n){let r=new hE;const i=new y_,o=new y_,a=new z_,s=new VA,l=new jA,c={},u=n.maxTextureSize,d={[my]:1,[gy]:0,[vy]:2},h=new JS({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new y_},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );\n\tgl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\n}"}),p=h.clone();p.defines.HORIZONTAL_PASS=1;const f=new IS;f.setAttribute("position",new _S(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new WS(f,h),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let v=this.type;function y(n,r){const o=t.update(m);h.defines.VSM_SAMPLES!==n.blurSamples&&(h.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,h.needsUpdate=!0,p.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new V_(i.x,i.y,{format:Ub,type:Mb})),h.uniforms.shadow_pass.value=n.map.depthTexture,h.uniforms.resolution.value=n.mapSize,h.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,o,h,m,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,o,p,m,null)}function b(t,n,r,i){let o=null;const a=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==a)o=a;else if(o=!0===r.isPointLight?l:s,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||!0===n.alphaToCoverage){const e=o.uuid,t=n.uuid;let r=c[e];void 0===r&&(r={},c[e]=r);let i=r[t];void 0===i&&(i=o.clone(),r[t]=i,n.addEventListener("dispose",_)),o=i}if(o.visible=n.visible,o.wireframe=n.wireframe,o.side=3===i?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:d[n.side],o.alphaMap=n.alphaMap,o.alphaTest=!0===n.alphaToCoverage?.5:n.alphaTest,o.map=n.map,o.clipShadows=n.clipShadows,o.clippingPlanes=n.clippingPlanes,o.clipIntersection=n.clipIntersection,o.displacementMap=n.displacementMap,o.displacementScale=n.displacementScale,o.displacementBias=n.displacementBias,o.wireframeLinewidth=n.wireframeLinewidth,o.linewidth=n.linewidth,!0===r.isPointLight&&!0===o.isMeshDistanceMaterial){e.properties.get(o).light=r}return o}function x(n,i,o,a,s){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===s)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,n.matrixWorld);const r=t.update(n),l=n.material;if(Array.isArray(l)){const t=r.groups;for(let c=0,u=t.length;c<u;c++){const u=t[c],d=l[u.materialIndex];if(d&&d.visible){const t=b(n,d,a,s);n.onBeforeShadow(e,n,i,o,r,t,u),e.renderBufferDirect(o,null,r,t,n,u),n.onAfterShadow(e,n,i,o,r,t,u)}}}else if(l.visible){const t=b(n,l,a,s);n.onBeforeShadow(e,n,i,o,r,t,null),e.renderBufferDirect(o,null,r,t,n,null),n.onAfterShadow(e,n,i,o,r,t,null)}}const l=n.children;for(let e=0,t=l.length;e<t;e++)x(l[e],i,o,a,s)}function _(e){e.target.removeEventListener("dispose",_);for(const t in c){const n=c[t],r=e.target.uuid;if(r in n){n[r].dispose(),delete n[r]}}}this.render=function(t,n,s){if(!1===g.enabled)return;if(!1===g.autoUpdate&&!1===g.needsUpdate)return;if(0===t.length)return;2===t.type&&(r_("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),t.type=1);const l=e.getRenderTarget(),c=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),h=e.state;h.setBlending(0),!0===h.buffers.depth.getReversed()?h.buffers.color.setClear(0,0,0,0):h.buffers.color.setClear(1,1,1,1),h.buffers.depth.setTest(!0),h.setScissorTest(!1);const p=v!==this.type;p&&n.traverse(function(e){e.material&&(Array.isArray(e.material)?e.material.forEach(e=>e.needsUpdate=!0):e.material.needsUpdate=!0)});for(let f=0,m=t.length;f<m;f++){const l=t[f],c=l.shadow;if(void 0===c){r_("WebGLShadowMap:",l,"has no shadow.");continue}if(!1===c.autoUpdate&&!1===c.needsUpdate)continue;i.copy(c.mapSize);const d=c.getFrameExtents();if(i.multiply(d),o.copy(c.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(o.x=Math.floor(u/d.x),i.x=o.x*d.x,c.mapSize.x=o.x),i.y>u&&(o.y=Math.floor(u/d.y),i.y=o.y*d.y,c.mapSize.y=o.y)),null===c.map||!0===p){if(null!==c.map&&(null!==c.map.depthTexture&&(c.map.depthTexture.dispose(),c.map.depthTexture=null),c.map.dispose()),3===this.type){if(l.isPointLight){r_("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}c.map=new V_(i.x,i.y,{format:Ub,type:Mb,minFilter:fb,magFilter:fb,generateMipmaps:!1}),c.map.texture.name=l.name+".shadowMap",c.map.depthTexture=new iT(i.x,i.y,Sb),c.map.depthTexture.name=l.name+".shadowMapDepth",c.map.depthTexture.format=Lb,c.map.depthTexture.compareFunction=null,c.map.depthTexture.minFilter=db,c.map.depthTexture.magFilter=db}else{l.isPointLight?(c.map=new aM(i.x),c.map.depthTexture=new oT(i.x,wb)):(c.map=new V_(i.x,i.y),c.map.depthTexture=new iT(i.x,i.y,wb)),c.map.depthTexture.name=l.name+".shadowMap",c.map.depthTexture.format=Lb;const t=e.state.buffers.depth.getReversed();1===this.type?(c.map.depthTexture.compareFunction=t?jx:zx,c.map.depthTexture.minFilter=fb,c.map.depthTexture.magFilter=fb):(c.map.depthTexture.compareFunction=null,c.map.depthTexture.minFilter=db,c.map.depthTexture.magFilter=db)}c.camera.updateProjectionMatrix()}const m=c.map.isWebGLCubeRenderTarget?6:1;for(let t=0;t<m;t++){if(c.map.isWebGLCubeRenderTarget)e.setRenderTarget(c.map,t),e.clear();else{0===t&&(e.setRenderTarget(c.map),e.clear());const n=c.getViewport(t);a.set(o.x*n.x,o.y*n.y,o.x*n.z,o.y*n.w),h.viewport(a)}if(l.isPointLight){const e=c.camera,n=c.matrix,r=l.distance||e.far;r!==e.far&&(e.far=r,e.updateProjectionMatrix()),NI.setFromMatrixPosition(l.matrixWorld),e.position.copy(NI),OI.copy(e.position),OI.add(PI[t]),e.up.copy(II[t]),e.lookAt(OI),e.updateMatrixWorld(),n.makeTranslation(-NI.x,-NI.y,-NI.z),LI.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),c._frustum.setFromProjectionMatrix(LI,e.coordinateSystem,e.reversedDepth)}else c.updateMatrices(l);r=c.getFrustum(),x(n,s,c.camera,l,this.type)}!0!==c.isPointLightShadow&&3===this.type&&y(c,s),c.needsUpdate=!1}v=this.type,g.needsUpdate=!1,e.setRenderTarget(l,c,d)}}const UI={[Dy]:1,[Fy]:6,[By]:7,[zy]:5,[Uy]:0,[jy]:2,[Hy]:4,[Vy]:3};function FI(e,t){const n=new function(){let t=!1;const n=new z_;let r=null;const i=new z_(0,0,0,0);return{setMask:function(n){r===n||t||(e.colorMask(n,n,n,n),r=n)},setLocked:function(e){t=e},setClear:function(t,r,o,a,s){!0===s&&(t*=a,r*=a,o*=a),n.set(t,r,o,a),!1===i.equals(n)&&(e.clearColor(t,r,o,a),i.copy(n))},reset:function(){t=!1,r=null,i.set(-1,0,0,0)}}},r=new function(){let n=!1,r=!1,i=null,o=null,a=null;return{setReversed:function(e){if(r!==e){const n=t.get("EXT_clip_control");e?n.clipControlEXT(n.LOWER_LEFT_EXT,n.ZERO_TO_ONE_EXT):n.clipControlEXT(n.LOWER_LEFT_EXT,n.NEGATIVE_ONE_TO_ONE_EXT),r=e;const i=a;a=null,this.setClear(i)}},getReversed:function(){return r},setTest:function(t){t?B(e.DEPTH_TEST):V(e.DEPTH_TEST)},setMask:function(t){i===t||n||(e.depthMask(t),i=t)},setFunc:function(t){if(r&&(t=UI[t]),o!==t){switch(t){case 0:e.depthFunc(e.NEVER);break;case 1:e.depthFunc(e.ALWAYS);break;case 2:e.depthFunc(e.LESS);break;case 3:default:e.depthFunc(e.LEQUAL);break;case 4:e.depthFunc(e.EQUAL);break;case 5:e.depthFunc(e.GEQUAL);break;case 6:e.depthFunc(e.GREATER);break;case 7:e.depthFunc(e.NOTEQUAL)}o=t}},setLocked:function(e){n=e},setClear:function(t){a!==t&&(r&&(t=1-t),e.clearDepth(t),a=t)},reset:function(){n=!1,i=null,o=null,a=null,r=!1}}},i=new function(){let t=!1,n=null,r=null,i=null,o=null,a=null,s=null,l=null,c=null;return{setTest:function(n){t||(n?B(e.STENCIL_TEST):V(e.STENCIL_TEST))},setMask:function(r){n===r||t||(e.stencilMask(r),n=r)},setFunc:function(t,n,a){r===t&&i===n&&o===a||(e.stencilFunc(t,n,a),r=t,i=n,o=a)},setOp:function(t,n,r){a===t&&s===n&&l===r||(e.stencilOp(t,n,r),a=t,s=n,l=r)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,r=null,i=null,o=null,a=null,s=null,l=null,c=null}}},o=new WeakMap,a=new WeakMap;let s={},l={},c=new WeakMap,u=[],d=null,h=!1,p=null,f=null,m=null,g=null,v=null,y=null,b=null,x=new cS(0,0,0),_=0,w=!1,S=null,M=null,E=null,T=null,A=null;const C=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let k=!1,R=0;const P=e.getParameter(e.VERSION);-1!==P.indexOf("WebGL")?(R=parseFloat(/^WebGL (\d)/.exec(P)[1]),k=R>=1):-1!==P.indexOf("OpenGL ES")&&(R=parseFloat(/^OpenGL ES (\d)/.exec(P)[1]),k=R>=2);let I=null,L={};const N=e.getParameter(e.SCISSOR_BOX),O=e.getParameter(e.VIEWPORT),D=(new z_).fromArray(N),U=(new z_).fromArray(O);function F(t,n,r,i){const o=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let s=0;s<r;s++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(n,0,e.RGBA,1,1,i,0,e.RGBA,e.UNSIGNED_BYTE,o):e.texImage2D(n+s,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,o);return a}const z={};function B(t){!0!==s[t]&&(e.enable(t),s[t]=!0)}function V(t){!1!==s[t]&&(e.disable(t),s[t]=!1)}z[e.TEXTURE_2D]=F(e.TEXTURE_2D,e.TEXTURE_2D,1),z[e.TEXTURE_CUBE_MAP]=F(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),z[e.TEXTURE_2D_ARRAY]=F(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),z[e.TEXTURE_3D]=F(e.TEXTURE_3D,e.TEXTURE_3D,1,1),n.setClear(0,0,0,1),r.setClear(1),i.setClear(0),B(e.DEPTH_TEST),r.setFunc(3),G(!1),X(1),B(e.CULL_FACE),W(0);const j={[yy]:e.FUNC_ADD,[by]:e.FUNC_SUBTRACT,[xy]:e.FUNC_REVERSE_SUBTRACT};j[103]=e.MIN,j[104]=e.MAX;const H={[_y]:e.ZERO,[wy]:e.ONE,[Sy]:e.SRC_COLOR,[Ey]:e.SRC_ALPHA,[Py]:e.SRC_ALPHA_SATURATE,[ky]:e.DST_COLOR,[Ay]:e.DST_ALPHA,[My]:e.ONE_MINUS_SRC_COLOR,[Ty]:e.ONE_MINUS_SRC_ALPHA,[Ry]:e.ONE_MINUS_DST_COLOR,[Cy]:e.ONE_MINUS_DST_ALPHA,[Iy]:e.CONSTANT_COLOR,[Ly]:e.ONE_MINUS_CONSTANT_COLOR,[Ny]:e.CONSTANT_ALPHA,[Oy]:e.ONE_MINUS_CONSTANT_ALPHA};function W(t,n,r,i,o,a,s,l,c,u){if(0!==t){if(!1===h&&(B(e.BLEND),h=!0),5===t)o=o||n,a=a||r,s=s||i,n===f&&o===v||(e.blendEquationSeparate(j[n],j[o]),f=n,v=o),r===m&&i===g&&a===y&&s===b||(e.blendFuncSeparate(H[r],H[i],H[a],H[s]),m=r,g=i,y=a,b=s),!1!==l.equals(x)&&c===_||(e.blendColor(l.r,l.g,l.b,c),x.copy(l),_=c),p=t,w=!1;else if(t!==p||u!==w){if(f===yy&&v===yy||(e.blendEquation(e.FUNC_ADD),f=yy,v=yy),u)switch(t){case 1:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.ONE,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;default:i_("WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case 3:i_("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case 4:i_("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:i_("WebGLState: Invalid blending: ",t)}m=null,g=null,y=null,b=null,x.set(0,0,0),_=0,p=t,w=u}}else!0===h&&(V(e.BLEND),h=!1)}function G(t){S!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),S=t)}function X(t){0!==t?(B(e.CULL_FACE),t!==M&&(1===t?e.cullFace(e.BACK):2===t?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):V(e.CULL_FACE),M=t}function q(t,n,r){t?(B(e.POLYGON_OFFSET_FILL),T===n&&A===r||(e.polygonOffset(n,r),T=n,A=r)):V(e.POLYGON_OFFSET_FILL)}return{buffers:{color:n,depth:r,stencil:i},enable:B,disable:V,bindFramebuffer:function(t,n){return l[t]!==n&&(e.bindFramebuffer(t,n),l[t]=n,t===e.DRAW_FRAMEBUFFER&&(l[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(l[e.DRAW_FRAMEBUFFER]=n),!0)},drawBuffers:function(t,n){let r=u,i=!1;if(t){r=c.get(n),void 0===r&&(r=[],c.set(n,r));const o=t.textures;if(r.length!==o.length||r[0]!==e.COLOR_ATTACHMENT0){for(let t=0,n=o.length;t<n;t++)r[t]=e.COLOR_ATTACHMENT0+t;r.length=o.length,i=!0}}else r[0]!==e.BACK&&(r[0]=e.BACK,i=!0);i&&e.drawBuffers(r)},useProgram:function(t){return d!==t&&(e.useProgram(t),d=t,!0)},setBlending:W,setMaterial:function(t,o){2===t.side?V(e.CULL_FACE):B(e.CULL_FACE);let a=1===t.side;o&&(a=!a),G(a),1===t.blending&&!1===t.transparent?W(0):W(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.blendColor,t.blendAlpha,t.premultipliedAlpha),r.setFunc(t.depthFunc),r.setTest(t.depthTest),r.setMask(t.depthWrite),n.setMask(t.colorWrite);const s=t.stencilWrite;i.setTest(s),s&&(i.setMask(t.stencilWriteMask),i.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),i.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),q(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?B(e.SAMPLE_ALPHA_TO_COVERAGE):V(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:G,setCullFace:X,setLineWidth:function(t){t!==E&&(k&&e.lineWidth(t),E=t)},setPolygonOffset:q,setScissorTest:function(t){t?B(e.SCISSOR_TEST):V(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+C-1),I!==t&&(e.activeTexture(t),I=t)},bindTexture:function(t,n,r){void 0===r&&(r=null===I?e.TEXTURE0+C-1:I);let i=L[r];void 0===i&&(i={type:void 0,texture:void 0},L[r]=i),i.type===t&&i.texture===n||(I!==r&&(e.activeTexture(r),I=r),e.bindTexture(t,n||z[t]),i.type=t,i.texture=n)},unbindTexture:function(){const t=L[I];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D(...arguments)}catch(Dv){i_("WebGLState:",Dv)}},compressedTexImage3D:function(){try{e.compressedTexImage3D(...arguments)}catch(Dv){i_("WebGLState:",Dv)}},texImage2D:function(){try{e.texImage2D(...arguments)}catch(Dv){i_("WebGLState:",Dv)}},texImage3D:function(){try{e.texImage3D(...arguments)}catch(Dv){i_("WebGLState:",Dv)}},updateUBOMapping:function(t,n){let r=a.get(n);void 0===r&&(r=new WeakMap,a.set(n,r));let i=r.get(t);void 0===i&&(i=e.getUniformBlockIndex(n,t.name),r.set(t,i))},uniformBlockBinding:function(t,n){const r=a.get(n).get(t);o.get(n)!==r&&(e.uniformBlockBinding(n,r,t.__bindingPointIndex),o.set(n,r))},texStorage2D:function(){try{e.texStorage2D(...arguments)}catch(Dv){i_("WebGLState:",Dv)}},texStorage3D:function(){try{e.texStorage3D(...arguments)}catch(Dv){i_("WebGLState:",Dv)}},texSubImage2D:function(){try{e.texSubImage2D(...arguments)}catch(Dv){i_("WebGLState:",Dv)}},texSubImage3D:function(){try{e.texSubImage3D(...arguments)}catch(Dv){i_("WebGLState:",Dv)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D(...arguments)}catch(Dv){i_("WebGLState:",Dv)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D(...arguments)}catch(Dv){i_("WebGLState:",Dv)}},scissor:function(t){!1===D.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),D.copy(t))},viewport:function(t){!1===U.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),U.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),r.setReversed(!1),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),s={},I=null,L={},l={},c=new WeakMap,u=[],d=null,h=!1,p=null,f=null,m=null,g=null,v=null,y=null,b=null,x=new cS(0,0,0),_=0,w=!1,S=null,M=null,E=null,T=null,A=null,D.set(0,0,e.canvas.width,e.canvas.height),U.set(0,0,e.canvas.width,e.canvas.height),n.reset(),r.reset(),i.reset()}}}function zI(e,t,n,r,i,o,a){const s=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=new y_,u=new WeakMap;let d;const h=new WeakMap;let p=!1;try{p="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(dz){}function f(e,t){return p?new OffscreenCanvas(e,t):Kx("canvas")}function m(e,t,n){let r=1;const i=H(e);if((i.width>n||i.height>n)&&(r=n/Math.max(i.width,i.height)),r<1){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){const n=Math.floor(r*i.width),o=Math.floor(r*i.height);void 0===d&&(d=f(n,o));const a=t?f(n,o):d;a.width=n,a.height=o;return a.getContext("2d").drawImage(e,0,0,n,o),r_("WebGLRenderer: Texture has been resized from ("+i.width+"x"+i.height+") to ("+n+"x"+o+")."),a}return"data"in e&&r_("WebGLRenderer: Image in DataTexture is too big ("+i.width+"x"+i.height+")."),e}return e}function g(e){return e.generateMipmaps}function v(t){e.generateMipmap(t)}function y(t){return t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function b(n,r,i,o,a=!1){if(null!==n){if(void 0!==e[n])return e[n];r_("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let s=r;if(r===e.RED&&(i===e.FLOAT&&(s=e.R32F),i===e.HALF_FLOAT&&(s=e.R16F),i===e.UNSIGNED_BYTE&&(s=e.R8)),r===e.RED_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.R8UI),i===e.UNSIGNED_SHORT&&(s=e.R16UI),i===e.UNSIGNED_INT&&(s=e.R32UI),i===e.BYTE&&(s=e.R8I),i===e.SHORT&&(s=e.R16I),i===e.INT&&(s=e.R32I)),r===e.RG&&(i===e.FLOAT&&(s=e.RG32F),i===e.HALF_FLOAT&&(s=e.RG16F),i===e.UNSIGNED_BYTE&&(s=e.RG8)),r===e.RG_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RG8UI),i===e.UNSIGNED_SHORT&&(s=e.RG16UI),i===e.UNSIGNED_INT&&(s=e.RG32UI),i===e.BYTE&&(s=e.RG8I),i===e.SHORT&&(s=e.RG16I),i===e.INT&&(s=e.RG32I)),r===e.RGB_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RGB8UI),i===e.UNSIGNED_SHORT&&(s=e.RGB16UI),i===e.UNSIGNED_INT&&(s=e.RGB32UI),i===e.BYTE&&(s=e.RGB8I),i===e.SHORT&&(s=e.RGB16I),i===e.INT&&(s=e.RGB32I)),r===e.RGBA_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RGBA8UI),i===e.UNSIGNED_SHORT&&(s=e.RGBA16UI),i===e.UNSIGNED_INT&&(s=e.RGBA32UI),i===e.BYTE&&(s=e.RGBA8I),i===e.SHORT&&(s=e.RGBA16I),i===e.INT&&(s=e.RGBA32I)),r===e.RGB&&(i===e.UNSIGNED_INT_5_9_9_9_REV&&(s=e.RGB9_E5),i===e.UNSIGNED_INT_10F_11F_11F_REV&&(s=e.R11F_G11F_B10F)),r===e.RGBA){const t=a?Lx:C_.getTransfer(o);i===e.FLOAT&&(s=e.RGBA32F),i===e.HALF_FLOAT&&(s=e.RGBA16F),i===e.UNSIGNED_BYTE&&(s=t===Nx?e.SRGB8_ALPHA8:e.RGBA8),i===e.UNSIGNED_SHORT_4_4_4_4&&(s=e.RGBA4),i===e.UNSIGNED_SHORT_5_5_5_1&&(s=e.RGB5_A1)}return s!==e.R16F&&s!==e.R32F&&s!==e.RG16F&&s!==e.RG32F&&s!==e.RGBA16F&&s!==e.RGBA32F||t.get("EXT_color_buffer_float"),s}function x(t,n){let r;return t?null===n||n===wb||n===Ab?r=e.DEPTH24_STENCIL8:n===Sb?r=e.DEPTH32F_STENCIL8:n===xb&&(r=e.DEPTH24_STENCIL8,r_("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===wb||n===Ab?r=e.DEPTH_COMPONENT24:n===Sb?r=e.DEPTH_COMPONENT32F:n===xb&&(r=e.DEPTH_COMPONENT16),r}function _(e,t){return!0===g(e)||e.isFramebufferTexture&&e.minFilter!==db&&e.minFilter!==fb?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function w(e){const t=e.target;t.removeEventListener("dispose",w),function(e){const t=r.get(e);if(void 0===t.__webglInit)return;const n=e.source,i=h.get(n);if(i){const r=i[t.__cacheKey];r.usedTimes--,0===r.usedTimes&&M(e),0===Object.keys(i).length&&h.delete(n)}r.remove(e)}(t),t.isVideoTexture&&u.delete(t)}function S(t){const n=t.target;n.removeEventListener("dispose",S),function(t){const n=r.get(t);t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture));if(t.isWebGLCubeRenderTarget)for(let r=0;r<6;r++){if(Array.isArray(n.__webglFramebuffer[r]))for(let t=0;t<n.__webglFramebuffer[r].length;t++)e.deleteFramebuffer(n.__webglFramebuffer[r][t]);else e.deleteFramebuffer(n.__webglFramebuffer[r]);n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[r])}else{if(Array.isArray(n.__webglFramebuffer))for(let t=0;t<n.__webglFramebuffer.length;t++)e.deleteFramebuffer(n.__webglFramebuffer[t]);else e.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let t=0;t<n.__webglColorRenderbuffer.length;t++)n.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(n.__webglColorRenderbuffer[t]);n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer)}const i=t.textures;for(let o=0,s=i.length;o<s;o++){const t=r.get(i[o]);t.__webglTexture&&(e.deleteTexture(t.__webglTexture),a.memory.textures--),r.remove(i[o])}r.remove(t)}(n)}function M(t){const n=r.get(t);e.deleteTexture(n.__webglTexture);const i=t.source;delete h.get(i)[n.__cacheKey],a.memory.textures--}let E=0;function T(t,i){const o=r.get(t);if(t.isVideoTexture&&function(e){const t=a.render.frame;u.get(e)!==t&&(u.set(e,t),e.update())}(t),!1===t.isRenderTargetTexture&&!0!==t.isExternalTexture&&t.version>0&&o.__version!==t.version){const e=t.image;if(null===e)r_("WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void L(o,t,i);r_("WebGLRenderer: Texture marked for update but image is incomplete")}}else t.isExternalTexture&&(o.__webglTexture=t.sourceTexture?t.sourceTexture:null);n.bindTexture(e.TEXTURE_2D,o.__webglTexture,e.TEXTURE0+i)}const A={[lb]:e.REPEAT,[cb]:e.CLAMP_TO_EDGE,[ub]:e.MIRRORED_REPEAT},C={[db]:e.NEAREST,[hb]:e.NEAREST_MIPMAP_NEAREST,[pb]:e.NEAREST_MIPMAP_LINEAR,[fb]:e.LINEAR,[mb]:e.LINEAR_MIPMAP_NEAREST,[gb]:e.LINEAR_MIPMAP_LINEAR},k={[Dx]:e.NEVER,[Hx]:e.ALWAYS,[Ux]:e.LESS,[zx]:e.LEQUAL,[Fx]:e.EQUAL,[jx]:e.GEQUAL,[Bx]:e.GREATER,[Vx]:e.NOTEQUAL};function R(n,o){if(o.type!==Sb||!1!==t.has("OES_texture_float_linear")||o.magFilter!==fb&&o.magFilter!==mb&&o.magFilter!==pb&&o.magFilter!==gb&&o.minFilter!==fb&&o.minFilter!==mb&&o.minFilter!==pb&&o.minFilter!==gb||r_("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(n,e.TEXTURE_WRAP_S,A[o.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,A[o.wrapT]),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,A[o.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,C[o.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,C[o.minFilter]),o.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,k[o.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){if(o.magFilter===db)return;if(o.minFilter!==pb&&o.minFilter!==gb)return;if(o.type===Sb&&!1===t.has("OES_texture_float_linear"))return;if(o.anisotropy>1||r.get(o).__currentAnisotropy){const a=t.get("EXT_texture_filter_anisotropic");e.texParameterf(n,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,i.getMaxAnisotropy())),r.get(o).__currentAnisotropy=o.anisotropy}}}function P(t,n){let r=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",w));const i=n.source;let o=h.get(i);void 0===o&&(o={},h.set(i,o));const s=function(e){const t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(s!==t.__cacheKey){void 0===o[s]&&(o[s]={texture:e.createTexture(),usedTimes:0},a.memory.textures++,r=!0),o[s].usedTimes++;const i=o[t.__cacheKey];void 0!==i&&(o[t.__cacheKey].usedTimes--,0===i.usedTimes&&M(n)),t.__cacheKey=s,t.__webglTexture=o[s].texture}return r}function I(e,t,n){return Math.floor(Math.floor(e/n)/t)}function L(t,a,s){let l=e.TEXTURE_2D;(a.isDataArrayTexture||a.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),a.isData3DTexture&&(l=e.TEXTURE_3D);const c=P(t,a),u=a.source;n.bindTexture(l,t.__webglTexture,e.TEXTURE0+s);const d=r.get(u);if(u.version!==d.__version||!0===c){n.activeTexture(e.TEXTURE0+s);const t=C_.getPrimaries(C_.workingColorSpace),r=a.colorSpace===Rx?null:C_.getPrimaries(a.colorSpace),h=a.colorSpace===Rx||t===r?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,a.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,a.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,h);let p=m(a.image,!1,i.maxTextureSize);p=j(a,p);const f=o.convert(a.format,a.colorSpace),y=o.convert(a.type);let w,S=b(a.internalFormat,f,y,a.colorSpace,a.isVideoTexture);R(l,a);const M=a.mipmaps,E=!0!==a.isVideoTexture,T=void 0===d.__version||!0===c,A=u.dataReady,C=_(a,p);if(a.isDepthTexture)S=x(a.format===Nb,a.type),T&&(E?n.texStorage2D(e.TEXTURE_2D,1,S,p.width,p.height):n.texImage2D(e.TEXTURE_2D,0,S,p.width,p.height,0,f,y,null));else if(a.isDataTexture)if(M.length>0){E&&T&&n.texStorage2D(e.TEXTURE_2D,C,S,M[0].width,M[0].height);for(let t=0,r=M.length;t<r;t++)w=M[t],E?A&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,w.width,w.height,f,y,w.data):n.texImage2D(e.TEXTURE_2D,t,S,w.width,w.height,0,f,y,w.data);a.generateMipmaps=!1}else E?(T&&n.texStorage2D(e.TEXTURE_2D,C,S,p.width,p.height),A&&function(t,r,i,o){const a=t.updateRanges;if(0===a.length)n.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,i,o,r.data);else{a.sort((e,t)=>e.start-t.start);let s=0;for(let e=1;e<a.length;e++){const t=a[s],n=a[e],i=t.start+t.count,o=I(n.start,r.width,4),l=I(t.start,r.width,4);n.start<=i+1&&o===l&&I(n.start+n.count-1,r.width,4)===o?t.count=Math.max(t.count,n.start+n.count-t.start):(++s,a[s]=n)}a.length=s+1;const l=e.getParameter(e.UNPACK_ROW_LENGTH),c=e.getParameter(e.UNPACK_SKIP_PIXELS),u=e.getParameter(e.UNPACK_SKIP_ROWS);e.pixelStorei(e.UNPACK_ROW_LENGTH,r.width);for(let t=0,d=a.length;t<d;t++){const s=a[t],l=Math.floor(s.start/4),c=Math.ceil(s.count/4),u=l%r.width,d=Math.floor(l/r.width),h=c,p=1;e.pixelStorei(e.UNPACK_SKIP_PIXELS,u),e.pixelStorei(e.UNPACK_SKIP_ROWS,d),n.texSubImage2D(e.TEXTURE_2D,0,u,d,h,p,i,o,r.data)}t.clearUpdateRanges(),e.pixelStorei(e.UNPACK_ROW_LENGTH,l),e.pixelStorei(e.UNPACK_SKIP_PIXELS,c),e.pixelStorei(e.UNPACK_SKIP_ROWS,u)}}(a,p,f,y)):n.texImage2D(e.TEXTURE_2D,0,S,p.width,p.height,0,f,y,p.data);else if(a.isCompressedTexture)if(a.isCompressedArrayTexture){E&&T&&n.texStorage3D(e.TEXTURE_2D_ARRAY,C,S,M[0].width,M[0].height,p.depth);for(let t=0,r=M.length;t<r;t++)if(w=M[t],a.format!==Ib)if(null!==f)if(E){if(A)if(a.layerUpdates.size>0){const r=tR(w.width,w.height,a.format,a.type);for(const i of a.layerUpdates){const o=w.data.subarray(i*r/w.data.BYTES_PER_ELEMENT,(i+1)*r/w.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,i,w.width,w.height,1,f,o)}a.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,w.width,w.height,p.depth,f,w.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,S,w.width,w.height,p.depth,0,w.data,0,0);else r_("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else E?A&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,w.width,w.height,p.depth,f,y,w.data):n.texImage3D(e.TEXTURE_2D_ARRAY,t,S,w.width,w.height,p.depth,0,f,y,w.data)}else{E&&T&&n.texStorage2D(e.TEXTURE_2D,C,S,M[0].width,M[0].height);for(let t=0,r=M.length;t<r;t++)w=M[t],a.format!==Ib?null!==f?E?A&&n.compressedTexSubImage2D(e.TEXTURE_2D,t,0,0,w.width,w.height,f,w.data):n.compressedTexImage2D(e.TEXTURE_2D,t,S,w.width,w.height,0,w.data):r_("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):E?A&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,w.width,w.height,f,y,w.data):n.texImage2D(e.TEXTURE_2D,t,S,w.width,w.height,0,f,y,w.data)}else if(a.isDataArrayTexture)if(E){if(T&&n.texStorage3D(e.TEXTURE_2D_ARRAY,C,S,p.width,p.height,p.depth),A)if(a.layerUpdates.size>0){const t=tR(p.width,p.height,a.format,a.type);for(const r of a.layerUpdates){const i=p.data.subarray(r*t/p.data.BYTES_PER_ELEMENT,(r+1)*t/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,r,p.width,p.height,1,f,y,i)}a.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,f,y,p.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,S,p.width,p.height,p.depth,0,f,y,p.data);else if(a.isData3DTexture)E?(T&&n.texStorage3D(e.TEXTURE_3D,C,S,p.width,p.height,p.depth),A&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,f,y,p.data)):n.texImage3D(e.TEXTURE_3D,0,S,p.width,p.height,p.depth,0,f,y,p.data);else if(a.isFramebufferTexture){if(T)if(E)n.texStorage2D(e.TEXTURE_2D,C,S,p.width,p.height);else{let t=p.width,r=p.height;for(let i=0;i<C;i++)n.texImage2D(e.TEXTURE_2D,i,S,t,r,0,f,y,null),t>>=1,r>>=1}}else if(M.length>0){if(E&&T){const t=H(M[0]);n.texStorage2D(e.TEXTURE_2D,C,S,t.width,t.height)}for(let t=0,r=M.length;t<r;t++)w=M[t],E?A&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,f,y,w):n.texImage2D(e.TEXTURE_2D,t,S,f,y,w);a.generateMipmaps=!1}else if(E){if(T){const t=H(p);n.texStorage2D(e.TEXTURE_2D,C,S,t.width,t.height)}A&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,f,y,p)}else n.texImage2D(e.TEXTURE_2D,0,S,f,y,p);g(a)&&v(l),d.__version=u.version,a.onUpdate&&a.onUpdate(a)}t.__version=a.version}function N(t,i,a,l,c,u){const d=o.convert(a.format,a.colorSpace),h=o.convert(a.type),p=b(a.internalFormat,d,h,a.colorSpace),f=r.get(i),m=r.get(a);if(m.__renderTarget=i,!f.__hasExternalTextures){const t=Math.max(1,i.width>>u),r=Math.max(1,i.height>>u);c===e.TEXTURE_3D||c===e.TEXTURE_2D_ARRAY?n.texImage3D(c,u,p,t,r,i.depth,0,d,h,null):n.texImage2D(c,u,p,t,r,0,d,h,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),V(i)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,l,c,m.__webglTexture,0,B(i)):(c===e.TEXTURE_2D||c>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,l,c,m.__webglTexture,u),n.bindFramebuffer(e.FRAMEBUFFER,null)}function O(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){const i=n.depthTexture,o=i&&i.isDepthTexture?i.type:null,a=x(n.stencilBuffer,o),l=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;V(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,B(n),a,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,B(n),a,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,a,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,t)}else{const t=n.textures;for(let i=0;i<t.length;i++){const a=t[i],l=o.convert(a.format,a.colorSpace),c=o.convert(a.type),u=b(a.internalFormat,l,c,a.colorSpace);V(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,B(n),u,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,B(n),u,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,u,n.width,n.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function D(t,i,a){const l=!0===i.isWebGLCubeRenderTarget;if(n.bindFramebuffer(e.FRAMEBUFFER,t),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const c=r.get(i.depthTexture);if(c.__renderTarget=i,c.__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),l){if(void 0===c.__webglInit&&(c.__webglInit=!0,i.depthTexture.addEventListener("dispose",w)),void 0===c.__webglTexture){c.__webglTexture=e.createTexture(),n.bindTexture(e.TEXTURE_CUBE_MAP,c.__webglTexture),R(e.TEXTURE_CUBE_MAP,i.depthTexture);const t=o.convert(i.depthTexture.format),r=o.convert(i.depthTexture.type);let a;i.depthTexture.format===Lb?a=e.DEPTH_COMPONENT24:i.depthTexture.format===Nb&&(a=e.DEPTH24_STENCIL8);for(let n=0;n<6;n++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,a,i.width,i.height,0,t,r,null)}}else T(i.depthTexture,0);const u=c.__webglTexture,d=B(i),h=l?e.TEXTURE_CUBE_MAP_POSITIVE_X+a:e.TEXTURE_2D,p=i.depthTexture.format===Nb?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(i.depthTexture.format===Lb)V(i)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,h,u,0,d):e.framebufferTexture2D(e.FRAMEBUFFER,p,h,u,0);else{if(i.depthTexture.format!==Nb)throw new Error("Unknown depthTexture format");V(i)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,h,u,0,d):e.framebufferTexture2D(e.FRAMEBUFFER,p,h,u,0)}}function U(t){const i=r.get(t),o=!0===t.isWebGLCubeRenderTarget;if(i.__boundDepthTexture!==t.depthTexture){const e=t.depthTexture;if(i.__depthDisposeCallback&&i.__depthDisposeCallback(),e){const t=()=>{delete i.__boundDepthTexture,delete i.__depthDisposeCallback,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),i.__depthDisposeCallback=t}i.__boundDepthTexture=e}if(t.depthTexture&&!i.__autoAllocateDepthBuffer)if(o)for(let e=0;e<6;e++)D(i.__webglFramebuffer[e],t,e);else{const e=t.texture.mipmaps;e&&e.length>0?D(i.__webglFramebuffer[0],t,0):D(i.__webglFramebuffer,t,0)}else if(o){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[r]),void 0===i.__webglDepthbuffer[r])i.__webglDepthbuffer[r]=e.createRenderbuffer(),O(i.__webglDepthbuffer[r],t,!1);else{const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,o=i.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,o),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,o)}}else{const r=t.texture.mipmaps;if(r&&r.length>0?n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),void 0===i.__webglDepthbuffer)i.__webglDepthbuffer=e.createRenderbuffer(),O(i.__webglDepthbuffer,t,!1);else{const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=i.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,r)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}const F=[],z=[];function B(e){return Math.min(i.maxSamples,e.samples)}function V(e){const n=r.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function j(e,t){const n=e.colorSpace,r=e.format,i=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==Ix&&n!==Rx&&(C_.getTransfer(n)===Nx?r===Ib&&i===vb||r_("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):i_("WebGLTextures: Unsupported texture color space:",n)),t}function H(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(c.width=e.naturalWidth||e.width,c.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(c.width=e.displayWidth,c.height=e.displayHeight):(c.width=e.width,c.height=e.height),c}this.allocateTextureUnit=function(){const e=E;return e>=i.maxTextures&&r_("WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+i.maxTextures),E+=1,e},this.resetTextureUnits=function(){E=0},this.setTexture2D=T,this.setTexture2DArray=function(t,i){const o=r.get(t);!1===t.isRenderTargetTexture&&t.version>0&&o.__version!==t.version?L(o,t,i):(t.isExternalTexture&&(o.__webglTexture=t.sourceTexture?t.sourceTexture:null),n.bindTexture(e.TEXTURE_2D_ARRAY,o.__webglTexture,e.TEXTURE0+i))},this.setTexture3D=function(t,i){const o=r.get(t);!1===t.isRenderTargetTexture&&t.version>0&&o.__version!==t.version?L(o,t,i):n.bindTexture(e.TEXTURE_3D,o.__webglTexture,e.TEXTURE0+i)},this.setTextureCube=function(t,a){const s=r.get(t);!0!==t.isCubeDepthTexture&&t.version>0&&s.__version!==t.version?function(t,a,s){if(6!==a.image.length)return;const l=P(t,a),c=a.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+s);const u=r.get(c);if(c.version!==u.__version||!0===l){n.activeTexture(e.TEXTURE0+s);const t=C_.getPrimaries(C_.workingColorSpace),r=a.colorSpace===Rx?null:C_.getPrimaries(a.colorSpace),d=a.colorSpace===Rx||t===r?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,a.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,a.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);const h=a.isCompressedTexture||a.image[0].isCompressedTexture,p=a.image[0]&&a.image[0].isDataTexture,f=[];for(let e=0;e<6;e++)f[e]=h||p?p?a.image[e].image:a.image[e]:m(a.image[e],!0,i.maxCubemapSize),f[e]=j(a,f[e]);const y=f[0],x=o.convert(a.format,a.colorSpace),w=o.convert(a.type),S=b(a.internalFormat,x,w,a.colorSpace),M=!0!==a.isVideoTexture,E=void 0===u.__version||!0===l,T=c.dataReady;let A,C=_(a,y);if(R(e.TEXTURE_CUBE_MAP,a),h){M&&E&&n.texStorage2D(e.TEXTURE_CUBE_MAP,C,S,y.width,y.height);for(let t=0;t<6;t++){A=f[t].mipmaps;for(let r=0;r<A.length;r++){const i=A[r];a.format!==Ib?null!==x?M?T&&n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r,0,0,i.width,i.height,x,i.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r,S,i.width,i.height,0,i.data):r_("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):M?T&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r,0,0,i.width,i.height,x,w,i.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r,S,i.width,i.height,0,x,w,i.data)}}}else{if(A=a.mipmaps,M&&E){A.length>0&&C++;const t=H(f[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,C,S,t.width,t.height)}for(let t=0;t<6;t++)if(p){M?T&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,f[t].width,f[t].height,x,w,f[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,S,f[t].width,f[t].height,0,x,w,f[t].data);for(let r=0;r<A.length;r++){const i=A[r].image[t].image;M?T&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r+1,0,0,i.width,i.height,x,w,i.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r+1,S,i.width,i.height,0,x,w,i.data)}}else{M?T&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,x,w,f[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,S,x,w,f[t]);for(let r=0;r<A.length;r++){const i=A[r];M?T&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r+1,0,0,x,w,i.image[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r+1,S,x,w,i.image[t])}}}g(a)&&v(e.TEXTURE_CUBE_MAP),u.__version=c.version,a.onUpdate&&a.onUpdate(a)}t.__version=a.version}(s,t,a):n.bindTexture(e.TEXTURE_CUBE_MAP,s.__webglTexture,e.TEXTURE0+a)},this.rebindTextures=function(t,n,i){const o=r.get(t);void 0!==n&&N(o.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==i&&U(t)},this.setupRenderTarget=function(t){const i=t.texture,s=r.get(t),l=r.get(i);t.addEventListener("dispose",S);const c=t.textures,u=!0===t.isWebGLCubeRenderTarget,d=c.length>1;if(d||(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=i.version,a.memory.textures++),u){s.__webglFramebuffer=[];for(let t=0;t<6;t++)if(i.mipmaps&&i.mipmaps.length>0){s.__webglFramebuffer[t]=[];for(let n=0;n<i.mipmaps.length;n++)s.__webglFramebuffer[t][n]=e.createFramebuffer()}else s.__webglFramebuffer[t]=e.createFramebuffer()}else{if(i.mipmaps&&i.mipmaps.length>0){s.__webglFramebuffer=[];for(let t=0;t<i.mipmaps.length;t++)s.__webglFramebuffer[t]=e.createFramebuffer()}else s.__webglFramebuffer=e.createFramebuffer();if(d)for(let t=0,n=c.length;t<n;t++){const n=r.get(c[t]);void 0===n.__webglTexture&&(n.__webglTexture=e.createTexture(),a.memory.textures++)}if(t.samples>0&&!1===V(t)){s.__webglMultisampledFramebuffer=e.createFramebuffer(),s.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,s.__webglMultisampledFramebuffer);for(let n=0;n<c.length;n++){const r=c[n];s.__webglColorRenderbuffer[n]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,s.__webglColorRenderbuffer[n]);const i=o.convert(r.format,r.colorSpace),a=o.convert(r.type),l=b(r.internalFormat,i,a,r.colorSpace,!0===t.isXRRenderTarget),u=B(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,u,l,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+n,e.RENDERBUFFER,s.__webglColorRenderbuffer[n])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(s.__webglDepthRenderbuffer=e.createRenderbuffer(),O(s.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(u){n.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),R(e.TEXTURE_CUBE_MAP,i);for(let n=0;n<6;n++)if(i.mipmaps&&i.mipmaps.length>0)for(let r=0;r<i.mipmaps.length;r++)N(s.__webglFramebuffer[n][r],t,i,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r);else N(s.__webglFramebuffer[n],t,i,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);g(i)&&v(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(d){for(let i=0,o=c.length;i<o;i++){const o=c[i],a=r.get(o);let l=e.TEXTURE_2D;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(l=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(l,a.__webglTexture),R(l,o),N(s.__webglFramebuffer,t,o,e.COLOR_ATTACHMENT0+i,l,0),g(o)&&v(l)}n.unbindTexture()}else{let r=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(r=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(r,l.__webglTexture),R(r,i),i.mipmaps&&i.mipmaps.length>0)for(let n=0;n<i.mipmaps.length;n++)N(s.__webglFramebuffer[n],t,i,e.COLOR_ATTACHMENT0,r,n);else N(s.__webglFramebuffer,t,i,e.COLOR_ATTACHMENT0,r,0);g(i)&&v(r),n.unbindTexture()}t.depthBuffer&&U(t)},this.updateRenderTargetMipmap=function(e){const t=e.textures;for(let i=0,o=t.length;i<o;i++){const o=t[i];if(g(o)){const t=y(e),i=r.get(o).__webglTexture;n.bindTexture(t,i),v(t),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0)if(!1===V(t)){const i=t.textures,o=t.width,a=t.height;let s=e.COLOR_BUFFER_BIT;const c=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,u=r.get(t),d=i.length>1;if(d)for(let t=0;t<i.length;t++)n.bindFramebuffer(e.FRAMEBUFFER,u.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,u.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,u.__webglMultisampledFramebuffer);const h=t.texture.mipmaps;h&&h.length>0?n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer[0]):n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer);for(let n=0;n<i.length;n++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(s|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(s|=e.STENCIL_BUFFER_BIT)),d){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,u.__webglColorRenderbuffer[n]);const t=r.get(i[n]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,o,a,0,0,o,a,s,e.NEAREST),!0===l&&(F.length=0,z.length=0,F.push(e.COLOR_ATTACHMENT0+n),t.depthBuffer&&!1===t.resolveDepthBuffer&&(F.push(c),z.push(c),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,z)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,F))}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),d)for(let t=0;t<i.length;t++){n.bindFramebuffer(e.FRAMEBUFFER,u.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,u.__webglColorRenderbuffer[t]);const o=r.get(i[t]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,u.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,o,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.resolveDepthBuffer&&l){const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[n])}},this.setupDepthRenderbuffer=U,this.setupFrameBufferTexture=N,this.useMultisampledRTT=V,this.isReversedDepthBuffer=function(){return n.buffers.depth.getReversed()}}function BI(e,t){return{convert:function(n,r=""){let i;const o=C_.getTransfer(r);if(n===vb)return e.UNSIGNED_BYTE;if(n===Eb)return e.UNSIGNED_SHORT_4_4_4_4;if(n===Tb)return e.UNSIGNED_SHORT_5_5_5_1;if(n===Cb)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===kb)return e.UNSIGNED_INT_10F_11F_11F_REV;if(n===yb)return e.BYTE;if(n===bb)return e.SHORT;if(n===xb)return e.UNSIGNED_SHORT;if(n===_b)return e.INT;if(n===wb)return e.UNSIGNED_INT;if(n===Sb)return e.FLOAT;if(n===Mb)return e.HALF_FLOAT;if(n===Rb)return e.ALPHA;if(n===Pb)return e.RGB;if(n===Ib)return e.RGBA;if(n===Lb)return e.DEPTH_COMPONENT;if(n===Nb)return e.DEPTH_STENCIL;if(n===Ob)return e.RED;if(n===Db)return e.RED_INTEGER;if(n===Ub)return e.RG;if(n===Fb)return e.RG_INTEGER;if(n===zb)return e.RGBA_INTEGER;if(n===Bb||n===Vb||n===jb||n===Hb)if(o===Nx){if(i=t.get("WEBGL_compressed_texture_s3tc_srgb"),null===i)return null;if(n===Bb)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Vb)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===jb)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Hb)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(i=t.get("WEBGL_compressed_texture_s3tc"),null===i)return null;if(n===Bb)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Vb)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===jb)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Hb)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===Wb||n===Gb||n===Xb||n===qb){if(i=t.get("WEBGL_compressed_texture_pvrtc"),null===i)return null;if(n===Wb)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Gb)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Xb)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===qb)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===$b||n===Yb||n===Zb||n===Jb||n===Kb||n===Qb||n===ex){if(i=t.get("WEBGL_compressed_texture_etc"),null===i)return null;if(n===$b||n===Yb)return o===Nx?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===Zb)return o===Nx?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC;if(n===Jb)return i.COMPRESSED_R11_EAC;if(n===Kb)return i.COMPRESSED_SIGNED_R11_EAC;if(n===Qb)return i.COMPRESSED_RG11_EAC;if(n===ex)return i.COMPRESSED_SIGNED_RG11_EAC}if(n===tx||n===nx||n===rx||n===ix||n===ox||n===ax||n===sx||n===lx||n===cx||n===ux||n===dx||n===hx||n===px||n===fx){if(i=t.get("WEBGL_compressed_texture_astc"),null===i)return null;if(n===tx)return o===Nx?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===nx)return o===Nx?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===rx)return o===Nx?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===ix)return o===Nx?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ox)return o===Nx?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===ax)return o===Nx?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===sx)return o===Nx?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===lx)return o===Nx?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===cx)return o===Nx?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===ux)return o===Nx?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===dx)return o===Nx?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===hx)return o===Nx?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===px)return o===Nx?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===fx)return o===Nx?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===mx||n===gx||n===vx){if(i=t.get("EXT_texture_compression_bptc"),null===i)return null;if(n===mx)return o===Nx?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===gx)return i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===vx)return i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(n===yx||n===bx||n===xx||n===_x){if(i=t.get("EXT_texture_compression_rgtc"),null===i)return null;if(n===yx)return i.COMPRESSED_RED_RGTC1_EXT;if(n===bx)return i.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===xx)return i.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===_x)return i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===Ab?e.UNSIGNED_INT_24_8:void 0!==e[n]?e[n]:null}}}class VI{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(null===this.texture){const n=new aT(e.texture);e.depthNear===t.depthNear&&e.depthFar===t.depthFar||(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(null!==this.texture&&null===this.mesh){const t=e.cameras[0].viewport,n=new JS({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new WS(new wA(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class jI extends a_{constructor(e,t){super();const n=this;let r=null,i=1,o=null,a="local-floor",s=1,l=null,c=null,u=null,d=null,h=null,p=null;const f="undefined"!=typeof XRWebGLBinding,m=new VI,g={},v=t.getContextAttributes();let y=null,b=null;const x=[],_=[],w=new y_;let S=null;const M=new nM;M.viewport=new z_;const E=new nM;E.viewport=new z_;const T=[M,E],A=new ZC;let C=null,k=null;function R(e){const t=_.indexOf(e.inputSource);if(-1===t)return;const n=x[t];void 0!==n&&(n.update(e.inputSource,e.frame,l||o),n.dispatchEvent({type:e.type,data:e.inputSource}))}function P(){r.removeEventListener("select",R),r.removeEventListener("selectstart",R),r.removeEventListener("selectend",R),r.removeEventListener("squeeze",R),r.removeEventListener("squeezestart",R),r.removeEventListener("squeezeend",R),r.removeEventListener("end",P),r.removeEventListener("inputsourceschange",I);for(let e=0;e<x.length;e++){const t=_[e];null!==t&&(_[e]=null,x[e].disconnect(t))}C=null,k=null,m.reset();for(const e in g)delete g[e];e.setRenderTarget(y),h=null,d=null,u=null,r=null,b=null,U.stop(),n.isPresenting=!1,e.setPixelRatio(S),e.setSize(w.width,w.height,!1),n.dispatchEvent({type:"sessionend"})}function I(e){for(let t=0;t<e.removed.length;t++){const n=e.removed[t],r=_.indexOf(n);r>=0&&(_[r]=null,x[r].disconnect(n))}for(let t=0;t<e.added.length;t++){const n=e.added[t];let r=_.indexOf(n);if(-1===r){for(let e=0;e<x.length;e++){if(e>=_.length){_.push(n),r=e;break}if(null===_[e]){_[e]=n,r=e;break}}if(-1===r)break}const i=x[r];i&&i.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=x[e];return void 0===t&&(t=new cM,x[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=x[e];return void 0===t&&(t=new cM,x[e]=t),t.getGripSpace()},this.getHand=function(e){let t=x[e];return void 0===t&&(t=new cM,x[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){i=e,!0===n.isPresenting&&r_("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){a=e,!0===n.isPresenting&&r_("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==d?d:h},this.getBinding=function(){return null===u&&f&&(u=new XRWebGLBinding(r,t)),u},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(c){if(r=c,null!==r){y=e.getRenderTarget(),r.addEventListener("select",R),r.addEventListener("selectstart",R),r.addEventListener("selectend",R),r.addEventListener("squeeze",R),r.addEventListener("squeezestart",R),r.addEventListener("squeezeend",R),r.addEventListener("end",P),r.addEventListener("inputsourceschange",I),!0!==v.xrCompatible&&await t.makeXRCompatible(),S=e.getPixelRatio(),e.getSize(w);if(f&&"createProjectionLayer"in XRWebGLBinding.prototype){let n=null,o=null,a=null;v.depth&&(a=v.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=v.stencil?Nb:Lb,o=v.stencil?Ab:wb);const s={colorFormat:t.RGBA8,depthFormat:a,scaleFactor:i};u=this.getBinding(),d=u.createProjectionLayer(s),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),b=new V_(d.textureWidth,d.textureHeight,{format:Ib,type:vb,depthTexture:new iT(d.textureWidth,d.textureHeight,o,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,samples:v.antialias?4:0,resolveDepthBuffer:!1===d.ignoreDepthValues,resolveStencilBuffer:!1===d.ignoreDepthValues})}else{const n={antialias:v.antialias,alpha:!0,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:i};h=new XRWebGLLayer(r,t,n),r.updateRenderState({baseLayer:h}),e.setPixelRatio(1),e.setSize(h.framebufferWidth,h.framebufferHeight,!1),b=new V_(h.framebufferWidth,h.framebufferHeight,{format:Ib,type:vb,colorSpace:e.outputColorSpace,stencilBuffer:v.stencil,resolveDepthBuffer:!1===h.ignoreDepthValues,resolveStencilBuffer:!1===h.ignoreDepthValues})}b.isXRRenderTarget=!0,this.setFoveation(s),l=null,o=await r.requestReferenceSpace(a),U.setContext(r),U.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==r)return r.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};const L=new x_,N=new x_;function O(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===r)return;let t=e.near,n=e.far;null!==m.texture&&(m.depthNear>0&&(t=m.depthNear),m.depthFar>0&&(n=m.depthFar)),A.near=E.near=M.near=t,A.far=E.far=M.far=n,C===A.near&&k===A.far||(r.updateRenderState({depthNear:A.near,depthFar:A.far}),C=A.near,k=A.far),A.layers.mask=6|e.layers.mask,M.layers.mask=3&A.layers.mask,E.layers.mask=5&A.layers.mask;const i=e.parent,o=A.cameras;O(A,i);for(let r=0;r<o.length;r++)O(o[r],i);2===o.length?function(e,t,n){L.setFromMatrixPosition(t.matrixWorld),N.setFromMatrixPosition(n.matrixWorld);const r=L.distanceTo(N),i=t.projectionMatrix.elements,o=n.projectionMatrix.elements,a=i[14]/(i[10]-1),s=i[14]/(i[10]+1),l=(i[9]+1)/i[5],c=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(o[8]+1)/o[0],h=a*u,p=a*d,f=r/(-u+d),m=f*-u;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(m),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),-1===i[10])e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{const t=a+f,n=s+f,i=h-m,o=p+(r-m),u=l*s/n*t,d=c*s/n*t;e.projectionMatrix.makePerspective(i,o,u,d,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}(A,M,E):A.projectionMatrix.copy(M.projectionMatrix),function(e,t,n){null===n?e.matrix.copy(t.matrixWorld):(e.matrix.copy(n.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld));e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0),e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=2*u_*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}(e,A,i)},this.getCamera=function(){return A},this.getFoveation=function(){if(null!==d||null!==h)return s},this.setFoveation=function(e){s=e,null!==d&&(d.fixedFoveation=e),null!==h&&void 0!==h.fixedFoveation&&(h.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==m.texture},this.getDepthSensingMesh=function(){return m.getMesh(A)},this.getCameraTexture=function(e){return g[e]};let D=null;const U=new nR;U.setAnimationLoop(function(t,i){if(c=i.getViewerPose(l||o),p=i,null!==c){const t=c.views;null!==h&&(e.setRenderTargetFramebuffer(b,h.framebuffer),e.setRenderTarget(b));let i=!1;t.length!==A.cameras.length&&(A.cameras.length=0,i=!0);for(let n=0;n<t.length;n++){const r=t[n];let o=null;if(null!==h)o=h.getViewport(r);else{const t=u.getViewSubImage(d,r);o=t.viewport,0===n&&(e.setRenderTargetTextures(b,t.colorTexture,t.depthStencilTexture),e.setRenderTarget(b))}let a=T[n];void 0===a&&(a=new nM,a.layers.enable(n),a.viewport=new z_,T[n]=a),a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.quaternion,a.scale),a.projectionMatrix.fromArray(r.projectionMatrix),a.projectionMatrixInverse.copy(a.projectionMatrix).invert(),a.viewport.set(o.x,o.y,o.width,o.height),0===n&&(A.matrix.copy(a.matrix),A.matrix.decompose(A.position,A.quaternion,A.scale)),!0===i&&A.cameras.push(a)}const o=r.enabledFeatures;if(o&&o.includes("depth-sensing")&&"gpu-optimized"==r.depthUsage&&f){u=n.getBinding();const e=u.getDepthInformation(t[0]);e&&e.isValid&&e.texture&&m.init(e,r.renderState)}if(o&&o.includes("camera-access")&&f){e.state.unbindTexture(),u=n.getBinding();for(let e=0;e<t.length;e++){const n=t[e].camera;if(n){let e=g[n];e||(e=new aT,g[n]=e);const t=u.getCameraImage(n);e.sourceTexture=t}}}}for(let e=0;e<x.length;e++){const t=_[e],n=x[e];null!==t&&void 0!==n&&n.update(t,i,l||o)}D&&D(t,i),i.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:i}),p=null}),this.setAnimationLoop=function(e){D=e},this.dispose=function(){}}}const HI=new Aw,WI=new vw;function GI(e,t){function n(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function r(e,r){e.opacity.value=r.opacity,r.color&&e.diffuse.value.copy(r.color),r.emissive&&e.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(e.map.value=r.map,n(r.map,e.mapTransform)),r.alphaMap&&(e.alphaMap.value=r.alphaMap,n(r.alphaMap,e.alphaMapTransform)),r.bumpMap&&(e.bumpMap.value=r.bumpMap,n(r.bumpMap,e.bumpMapTransform),e.bumpScale.value=r.bumpScale,1===r.side&&(e.bumpScale.value*=-1)),r.normalMap&&(e.normalMap.value=r.normalMap,n(r.normalMap,e.normalMapTransform),e.normalScale.value.copy(r.normalScale),1===r.side&&e.normalScale.value.negate()),r.displacementMap&&(e.displacementMap.value=r.displacementMap,n(r.displacementMap,e.displacementMapTransform),e.displacementScale.value=r.displacementScale,e.displacementBias.value=r.displacementBias),r.emissiveMap&&(e.emissiveMap.value=r.emissiveMap,n(r.emissiveMap,e.emissiveMapTransform)),r.specularMap&&(e.specularMap.value=r.specularMap,n(r.specularMap,e.specularMapTransform)),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest);const i=t.get(r),o=i.envMap,a=i.envMapRotation;o&&(e.envMap.value=o,HI.copy(a),HI.x*=-1,HI.y*=-1,HI.z*=-1,o.isCubeTexture&&!1===o.isRenderTargetTexture&&(HI.y*=-1,HI.z*=-1),e.envMapRotation.value.setFromMatrix4(WI.makeRotationFromEuler(HI)),e.flipEnvMap.value=o.isCubeTexture&&!1===o.isRenderTargetTexture?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,YS(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,i,o,a,s){i.isMeshBasicMaterial||i.isMeshLambertMaterial?r(e,i):i.isMeshToonMaterial?(r(e,i),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,i)):i.isMeshPhongMaterial?(r(e,i),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,i)):i.isMeshStandardMaterial?(r(e,i),function(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform));e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform));t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}(e,i),i.isMeshPhysicalMaterial&&function(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform)));t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),1===t.side&&e.clearcoatNormalScale.value.negate()));t.dispersion>0&&(e.dispersion.value=t.dispersion);t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform)));t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor));t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform)));e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform));t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,i,s)):i.isMeshMatcapMaterial?(r(e,i),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,i)):i.isMeshDepthMaterial?r(e,i):i.isMeshDistanceMaterial?(r(e,i),function(e,n){const r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}(e,i)):i.isMeshNormalMaterial?r(e,i):i.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,i),i.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,i)):i.isPointsMaterial?function(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=.5*i,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,i,o,a):i.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,i):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function XI(e,t,n,r){let i={},o={},a=[];const s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e,t,n,r){const i=e.value,o=t+"_"+n;if(void 0===r[o])return r[o]="number"==typeof i||"boolean"==typeof i?i:i.clone(),!0;{const e=r[o];if("number"==typeof i||"boolean"==typeof i){if(e!==i)return r[o]=i,!0}else if(!1===e.equals(i))return e.copy(i),!0}return!1}function c(e){const t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?r_("WebGLRenderer: Texture samplers can not be part of an uniforms group."):r_("WebGLRenderer: Unsupported uniform value type.",e),t}function u(t){const n=t.target;n.removeEventListener("dispose",u);const r=a.indexOf(n.__bindingPointIndex);a.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete o[n.id]}return{bind:function(e,t){const n=t.program;r.uniformBlockBinding(e,n)},update:function(n,d){let h=i[n.id];void 0===h&&(!function(e){const t=e.uniforms;let n=0;const r=16;for(let o=0,a=t.length;o<a;o++){const e=Array.isArray(t[o])?t[o]:[t[o]];for(let t=0,i=e.length;t<i;t++){const i=e[t],o=Array.isArray(i.value)?i.value:[i.value];for(let e=0,t=o.length;e<t;e++){const t=c(o[e]),a=n%r,s=a%t.boundary,l=a+s;n+=s,0!==l&&r-l<t.storage&&(n+=r-l),i.__data=new Float32Array(t.storage/Float32Array.BYTES_PER_ELEMENT),i.__offset=n,n+=t.storage}}}const i=n%r;i>0&&(n+=r-i);e.__size=n,e.__cache={}}(n),h=function(t){const n=function(){for(let e=0;e<s;e++)if(-1===a.indexOf(e))return a.push(e),e;return i_("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=n;const r=e.createBuffer(),i=t.__size,o=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,i,o),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,r),r}(n),i[n.id]=h,n.addEventListener("dispose",u));const p=d.program;r.updateUBOMapping(n,p);const f=t.render.frame;o[n.id]!==f&&(!function(t){const n=i[t.id],r=t.uniforms,o=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let i=0,a=r.length;i<a;i++){const t=Array.isArray(r[i])?r[i]:[r[i]];for(let n=0,r=t.length;n<r;n++){const r=t[n];if(!0===l(r,i,n,o)){const t=r.__offset,n=Array.isArray(r.value)?r.value:[r.value];let i=0;for(let o=0;o<n.length;o++){const a=n[o],s=c(a);"number"==typeof a||"boolean"==typeof a?(r.__data[0]=a,e.bufferSubData(e.UNIFORM_BUFFER,t+i,r.__data)):a.isMatrix3?(r.__data[0]=a.elements[0],r.__data[1]=a.elements[1],r.__data[2]=a.elements[2],r.__data[3]=0,r.__data[4]=a.elements[3],r.__data[5]=a.elements[4],r.__data[6]=a.elements[5],r.__data[7]=0,r.__data[8]=a.elements[6],r.__data[9]=a.elements[7],r.__data[10]=a.elements[8],r.__data[11]=0):(a.toArray(r.__data,i),i+=s.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,r.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(n),o[n.id]=f)},dispose:function(){for(const t in i)e.deleteBuffer(i[t]);a=[],i={},o={}}}}const qI=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let $I=null;class YI{constructor(e={}){const{canvas:t=Qx(),context:n=null,depth:r=!0,stencil:i=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:l=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:d=!1,outputBufferType:h=vb}=e;let p;if(this.isWebGLRenderer=!0,null!==n){if("undefined"!=typeof WebGLRenderingContext&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=n.getContextAttributes().alpha}else p=o;const f=h,m=new Set([zb,Fb,Db]),g=new Set([vb,wb,xb,Ab,Eb,Tb]),v=new Uint32Array(4),y=new Int32Array(4);let b=null,x=null;const _=[],w=[];let S=null;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.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const M=this;let E=!1;this._outputColorSpace=Px;let T=0,A=0,C=null,k=-1,R=null;const P=new z_,I=new z_;let L=null;const N=new cS(0);let O=0,D=t.width,U=t.height,F=1,z=null,B=null;const V=new z_(0,0,D,U),j=new z_(0,0,D,U);let H=!1;const W=new hE;let G=!1,X=!1;const q=new vw,$=new x_,Y=new z_,Z={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let J=!1;function K(){return null===C?F:1}let Q,ee,te,ne,re,ie,oe,ae,se,le,ce,ue,de,he,pe,fe,me,ge,ve,ye,be,xe,_e,we,Se=n;function Me(e,n){return t.getContext(e,n)}try{const e={alpha:!0,depth:r,stencil:i,antialias:a,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${hy}`),t.addEventListener("webglcontextlost",Ae,!1),t.addEventListener("webglcontextrestored",Ce,!1),t.addEventListener("webglcontextcreationerror",ke,!1),null===Se){const t="webgl2";if(Se=Me(t,e),null===Se)throw Me(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(Dv){throw i_("WebGLRenderer: "+Dv.message),Dv}function Ee(){Q=new IR(Se),Q.init(),xe=new BI(Se,Q),ee=new pR(Se,Q,e,xe),te=new FI(Se,Q),ee.reversedDepthBuffer&&d&&te.buffers.depth.setReversed(!0),ne=new OR(Se),re=new xI,ie=new zI(Se,Q,te,re,ee,xe,ne),oe=new mR(M),ae=new PR(M),se=new rR(Se),_e=new dR(Se,se),le=new LR(Se,se,ne,_e),ce=new UR(Se,le,se,ne),ve=new DR(Se,ee,ie),fe=new fR(re),ue=new bI(M,oe,ae,Q,ee,_e,fe),de=new GI(M,re),he=new MI,pe=new RI(Q),ge=new uR(M,oe,ae,te,ce,p,s),me=new DI(M,ce,ee),we=new XI(Se,ne,ee,te),ye=new hR(Se,Q,ne),be=new NR(Se,Q,ne),ne.programs=ue.programs,M.capabilities=ee,M.extensions=Q,M.properties=re,M.renderLists=he,M.shadowMap=me,M.state=te,M.info=ne}Ee(),f!==vb&&(S=new zR(f,t.width,t.height,r,i));const Te=new jI(M,Se);function Ae(e){e.preventDefault(),n_("WebGLRenderer: Context Lost."),E=!0}function Ce(){n_("WebGLRenderer: Context Restored."),E=!1;const e=ne.autoReset,t=me.enabled,n=me.autoUpdate,r=me.needsUpdate,i=me.type;Ee(),ne.autoReset=e,me.enabled=t,me.autoUpdate=n,me.needsUpdate=r,me.type=i}function ke(e){i_("WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function Re(e){const t=e.target;t.removeEventListener("dispose",Re),function(e){(function(e){const t=re.get(e).programs;void 0!==t&&(t.forEach(function(e){ue.releaseProgram(e)}),e.isShaderMaterial&&ue.releaseShaderCache(e))})(e),re.remove(e)}(t)}function Pe(e,t,n){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,Ve(e,t,n),e.side=0,e.needsUpdate=!0,Ve(e,t,n),e.side=2):Ve(e,t,n)}this.xr=Te,this.getContext=function(){return Se},this.getContextAttributes=function(){return Se.getContextAttributes()},this.forceContextLoss=function(){const e=Q.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){const e=Q.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return F},this.setPixelRatio=function(e){void 0!==e&&(F=e,this.setSize(D,U,!1))},this.getSize=function(e){return e.set(D,U)},this.setSize=function(e,n,r=!0){Te.isPresenting?r_("WebGLRenderer: Can't change size while VR device is presenting."):(D=e,U=n,t.width=Math.floor(e*F),t.height=Math.floor(n*F),!0===r&&(t.style.width=e+"px",t.style.height=n+"px"),null!==S&&S.setSize(t.width,t.height),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return e.set(D*F,U*F).floor()},this.setDrawingBufferSize=function(e,n,r){D=e,U=n,F=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.setEffects=function(e){if(f!==vb){if(e)for(let t=0;t<e.length;t++)if(!0===e[t].isOutputPass){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}S.setEffects(e||[])}else console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.")},this.getCurrentViewport=function(e){return e.copy(P)},this.getViewport=function(e){return e.copy(V)},this.setViewport=function(e,t,n,r){e.isVector4?V.set(e.x,e.y,e.z,e.w):V.set(e,t,n,r),te.viewport(P.copy(V).multiplyScalar(F).round())},this.getScissor=function(e){return e.copy(j)},this.setScissor=function(e,t,n,r){e.isVector4?j.set(e.x,e.y,e.z,e.w):j.set(e,t,n,r),te.scissor(I.copy(j).multiplyScalar(F).round())},this.getScissorTest=function(){return H},this.setScissorTest=function(e){te.setScissorTest(H=e)},this.setOpaqueSort=function(e){z=e},this.setTransparentSort=function(e){B=e},this.getClearColor=function(e){return e.copy(ge.getClearColor())},this.setClearColor=function(){ge.setClearColor(...arguments)},this.getClearAlpha=function(){return ge.getClearAlpha()},this.setClearAlpha=function(){ge.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,n=!0){let r=0;if(e){let e=!1;if(null!==C){const t=C.texture.format;e=m.has(t)}if(e){const e=C.texture.type,t=g.has(e),n=ge.getClearColor(),r=ge.getClearAlpha(),i=n.r,o=n.g,a=n.b;t?(v[0]=i,v[1]=o,v[2]=a,v[3]=r,Se.clearBufferuiv(Se.COLOR,0,v)):(y[0]=i,y[1]=o,y[2]=a,y[3]=r,Se.clearBufferiv(Se.COLOR,0,y))}else r|=Se.COLOR_BUFFER_BIT}t&&(r|=Se.DEPTH_BUFFER_BIT),n&&(r|=Se.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Se.clear(r)},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",Ae,!1),t.removeEventListener("webglcontextrestored",Ce,!1),t.removeEventListener("webglcontextcreationerror",ke,!1),ge.dispose(),he.dispose(),pe.dispose(),re.dispose(),oe.dispose(),ae.dispose(),ce.dispose(),_e.dispose(),we.dispose(),ue.dispose(),Te.dispose(),Te.removeEventListener("sessionstart",Le),Te.removeEventListener("sessionend",Ne),Oe.stop()},this.renderBufferDirect=function(e,t,n,r,i,o){null===t&&(t=Z);const a=i.isMesh&&i.matrixWorld.determinant()<0,s=function(e,t,n,r,i){!0!==t.isScene&&(t=Z);ie.resetTextureUnits();const o=t.fog,a=r.isMeshStandardMaterial?t.environment:null,s=null===C?M.outputColorSpace:!0===C.isXRRenderTarget?C.texture.colorSpace:Ix,l=(r.isMeshStandardMaterial?ae:oe).get(r.envMap||a),c=!0===r.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,u=!!n.attributes.tangent&&(!!r.normalMap||r.anisotropy>0),d=!!n.morphAttributes.position,h=!!n.morphAttributes.normal,p=!!n.morphAttributes.color;let f=0;r.toneMapped&&(null!==C&&!0!==C.isXRRenderTarget||(f=M.toneMapping));const m=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,g=void 0!==m?m.length:0,v=re.get(r),y=x.state.lights;if(!0===G&&(!0===X||e!==R)){const t=e===R&&r.id===k;fe.setState(r,e,t)}let b=!1;r.version===v.__version?v.needsLights&&v.lightsStateVersion!==y.state.version||v.outputColorSpace!==s||i.isBatchedMesh&&!1===v.batching?b=!0:i.isBatchedMesh||!0!==v.batching?i.isBatchedMesh&&!0===v.batchingColor&&null===i.colorTexture||i.isBatchedMesh&&!1===v.batchingColor&&null!==i.colorTexture||i.isInstancedMesh&&!1===v.instancing?b=!0:i.isInstancedMesh||!0!==v.instancing?i.isSkinnedMesh&&!1===v.skinning?b=!0:i.isSkinnedMesh||!0!==v.skinning?i.isInstancedMesh&&!0===v.instancingColor&&null===i.instanceColor||i.isInstancedMesh&&!1===v.instancingColor&&null!==i.instanceColor||i.isInstancedMesh&&!0===v.instancingMorph&&null===i.morphTexture||i.isInstancedMesh&&!1===v.instancingMorph&&null!==i.morphTexture||v.envMap!==l||!0===r.fog&&v.fog!==o?b=!0:void 0===v.numClippingPlanes||v.numClippingPlanes===fe.numPlanes&&v.numIntersection===fe.numIntersection?(v.vertexAlphas!==c||v.vertexTangents!==u||v.morphTargets!==d||v.morphNormals!==h||v.morphColors!==p||v.toneMapping!==f||v.morphTargetsCount!==g)&&(b=!0):b=!0:b=!0:b=!0:b=!0:(b=!0,v.__version=r.version);let _=v.currentProgram;!0===b&&(_=Ve(r,t,i));let w=!1,S=!1,E=!1;const T=_.getUniforms(),A=v.uniforms;te.useProgram(_.program)&&(w=!0,S=!0,E=!0);r.id!==k&&(k=r.id,S=!0);if(w||R!==e){te.buffers.depth.getReversed()&&!0!==e.reversedDepth&&(e._reversedDepth=!0,e.updateProjectionMatrix()),T.setValue(Se,"projectionMatrix",e.projectionMatrix),T.setValue(Se,"viewMatrix",e.matrixWorldInverse);const t=T.map.cameraPosition;void 0!==t&&t.setValue(Se,$.setFromMatrixPosition(e.matrixWorld)),ee.logarithmicDepthBuffer&&T.setValue(Se,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&T.setValue(Se,"isOrthographic",!0===e.isOrthographicCamera),R!==e&&(R=e,S=!0,E=!0)}v.needsLights&&(y.state.directionalShadowMap.length>0&&T.setValue(Se,"directionalShadowMap",y.state.directionalShadowMap,ie),y.state.spotShadowMap.length>0&&T.setValue(Se,"spotShadowMap",y.state.spotShadowMap,ie),y.state.pointShadowMap.length>0&&T.setValue(Se,"pointShadowMap",y.state.pointShadowMap,ie));if(i.isSkinnedMesh){T.setOptional(Se,i,"bindMatrix"),T.setOptional(Se,i,"bindMatrixInverse");const e=i.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),T.setValue(Se,"boneTexture",e.boneTexture,ie))}i.isBatchedMesh&&(T.setOptional(Se,i,"batchingTexture"),T.setValue(Se,"batchingTexture",i._matricesTexture,ie),T.setOptional(Se,i,"batchingIdTexture"),T.setValue(Se,"batchingIdTexture",i._indirectTexture,ie),T.setOptional(Se,i,"batchingColorTexture"),null!==i._colorsTexture&&T.setValue(Se,"batchingColorTexture",i._colorsTexture,ie));const P=n.morphAttributes;void 0===P.position&&void 0===P.normal&&void 0===P.color||ve.update(i,n,_);(S||v.receiveShadow!==i.receiveShadow)&&(v.receiveShadow=i.receiveShadow,T.setValue(Se,"receiveShadow",i.receiveShadow));r.isMeshGouraudMaterial&&null!==r.envMap&&(A.envMap.value=l,A.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1);r.isMeshStandardMaterial&&null===r.envMap&&null!==t.environment&&(A.envMapIntensity.value=t.environmentIntensity);void 0!==A.dfgLUT&&(A.dfgLUT.value=(null===$I&&($I=new XM(qI,16,16,Ub,Mb),$I.name="DFG_LUT",$I.minFilter=fb,$I.magFilter=fb,$I.wrapS=cb,$I.wrapT=cb,$I.generateMipmaps=!1,$I.needsUpdate=!0),$I));S&&(T.setValue(Se,"toneMappingExposure",M.toneMappingExposure),v.needsLights&&(L=E,(I=A).ambientLightColor.needsUpdate=L,I.lightProbe.needsUpdate=L,I.directionalLights.needsUpdate=L,I.directionalLightShadows.needsUpdate=L,I.pointLights.needsUpdate=L,I.pointLightShadows.needsUpdate=L,I.spotLights.needsUpdate=L,I.spotLightShadows.needsUpdate=L,I.rectAreaLights.needsUpdate=L,I.hemisphereLights.needsUpdate=L),o&&!0===r.fog&&de.refreshFogUniforms(A,o),de.refreshMaterialUniforms(A,r,F,U,x.state.transmissionRenderTarget[e.id]),WP.upload(Se,je(v),A,ie));var I,L;r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(WP.upload(Se,je(v),A,ie),r.uniformsNeedUpdate=!1);r.isSpriteMaterial&&T.setValue(Se,"center",i.center);if(T.setValue(Se,"modelViewMatrix",i.modelViewMatrix),T.setValue(Se,"normalMatrix",i.normalMatrix),T.setValue(Se,"modelMatrix",i.matrixWorld),r.isShaderMaterial||r.isRawShaderMaterial){const e=r.uniformsGroups;for(let t=0,n=e.length;t<n;t++){const n=e[t];we.update(n,_),we.bind(n,_)}}return _}(e,t,n,r,i);te.setMaterial(r,a);let l=n.index,c=1;if(!0===r.wireframe){if(l=le.getWireframeAttribute(n),void 0===l)return;c=2}const u=n.drawRange,d=n.attributes.position;let h=u.start*c,p=(u.start+u.count)*c;null!==o&&(h=Math.max(h,o.start*c),p=Math.min(p,(o.start+o.count)*c)),null!==l?(h=Math.max(h,0),p=Math.min(p,l.count)):null!=d&&(h=Math.max(h,0),p=Math.min(p,d.count));const f=p-h;if(f<0||f===1/0)return;let m;_e.setup(i,r,s,n,l);let g=ye;if(null!==l&&(m=se.get(l),g=be,g.setIndex(m)),i.isMesh)!0===r.wireframe?(te.setLineWidth(r.wireframeLinewidth*K()),g.setMode(Se.LINES)):g.setMode(Se.TRIANGLES);else if(i.isLine){let e=r.linewidth;void 0===e&&(e=1),te.setLineWidth(e*K()),i.isLineSegments?g.setMode(Se.LINES):i.isLineLoop?g.setMode(Se.LINE_LOOP):g.setMode(Se.LINE_STRIP)}else i.isPoints?g.setMode(Se.POINTS):i.isSprite&&g.setMode(Se.TRIANGLES);if(i.isBatchedMesh)if(null!==i._multiDrawInstances)o_("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),g.renderMultiDrawInstances(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount,i._multiDrawInstances);else if(Q.get("WEBGL_multi_draw"))g.renderMultiDraw(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount);else{const e=i._multiDrawStarts,t=i._multiDrawCounts,n=i._multiDrawCount,o=l?se.get(l).bytesPerElement:1,a=re.get(r).currentProgram.getUniforms();for(let r=0;r<n;r++)a.setValue(Se,"_gl_DrawID",r),g.render(e[r]/o,t[r])}else if(i.isInstancedMesh)g.renderInstances(h,f,i.count);else if(n.isInstancedBufferGeometry){const e=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,t=Math.min(n.instanceCount,e);g.renderInstances(h,f,t)}else g.render(h,f)},this.compile=function(e,t,n=null){null===n&&(n=e),x=pe.get(n),x.init(t),w.push(x),n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(x.pushLight(e),e.castShadow&&x.pushShadow(e))}),e!==n&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(x.pushLight(e),e.castShadow&&x.pushShadow(e))}),x.setupLights();const r=new Set;return e.traverse(function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;const t=e.material;if(t)if(Array.isArray(t))for(let i=0;i<t.length;i++){const o=t[i];Pe(o,n,e),r.add(o)}else Pe(t,n,e),r.add(t)}),x=w.pop(),r},this.compileAsync=function(e,t,n=null){const r=this.compile(e,t,n);return new Promise(t=>{function n(){r.forEach(function(e){re.get(e).currentProgram.isReady()&&r.delete(e)}),0!==r.size?setTimeout(n,10):t(e)}null!==Q.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)})};let Ie=null;function Le(){Oe.stop()}function Ne(){Oe.start()}const Oe=new nR;function De(e,t,n,r){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)x.pushLight(e),e.castShadow&&x.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||W.intersectsSprite(e)){r&&Y.setFromMatrixPosition(e.matrixWorld).applyMatrix4(q);const t=ce.update(e),i=e.material;i.visible&&b.push(e,t,i,n,Y.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||W.intersectsObject(e))){const t=ce.update(e),i=e.material;if(r&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),Y.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),Y.copy(t.boundingSphere.center)),Y.applyMatrix4(e.matrixWorld).applyMatrix4(q)),Array.isArray(i)){const r=t.groups;for(let o=0,a=r.length;o<a;o++){const a=r[o],s=i[a.materialIndex];s&&s.visible&&b.push(e,t,s,n,Y.z,a)}}else i.visible&&b.push(e,t,i,n,Y.z,null)}const i=e.children;for(let o=0,a=i.length;o<a;o++)De(i[o],t,n,r)}function Ue(e,t,n,r){const{opaque:i,transmissive:o,transparent:a}=e;x.setupLightsView(n),!0===G&&fe.setGlobalState(M.clippingPlanes,n),r&&te.viewport(P.copy(r)),i.length>0&&ze(i,t,n),o.length>0&&ze(o,t,n),a.length>0&&ze(a,t,n),te.buffers.depth.setTest(!0),te.buffers.depth.setMask(!0),te.buffers.color.setMask(!0),te.setPolygonOffset(!1)}function Fe(e,t,n,r){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;if(void 0===x.state.transmissionRenderTarget[r.id]){const e=Q.has("EXT_color_buffer_half_float")||Q.has("EXT_color_buffer_float");x.state.transmissionRenderTarget[r.id]=new V_(1,1,{generateMipmaps:!0,type:e?Mb:vb,minFilter:gb,samples:ee.samples,stencilBuffer:i,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:C_.workingColorSpace})}const o=x.state.transmissionRenderTarget[r.id],a=r.viewport||P;o.setSize(a.z*M.transmissionResolutionScale,a.w*M.transmissionResolutionScale);const s=M.getRenderTarget(),l=M.getActiveCubeFace(),c=M.getActiveMipmapLevel();M.setRenderTarget(o),M.getClearColor(N),O=M.getClearAlpha(),O<1&&M.setClearColor(16777215,.5),M.clear(),J&&ge.render(n);const u=M.toneMapping;M.toneMapping=0;const d=r.viewport;if(void 0!==r.viewport&&(r.viewport=void 0),x.setupLightsView(r),!0===G&&fe.setGlobalState(M.clippingPlanes,r),ze(e,n,r),ie.updateMultisampleRenderTarget(o),ie.updateRenderTargetMipmap(o),!1===Q.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let i=0,o=t.length;i<o;i++){const o=t[i],{object:a,geometry:s,material:l,group:c}=o;if(2===l.side&&a.layers.test(r.layers)){const t=l.side;l.side=1,l.needsUpdate=!0,Be(a,n,r,s,l,c),l.side=t,l.needsUpdate=!0,e=!0}}!0===e&&(ie.updateMultisampleRenderTarget(o),ie.updateRenderTargetMipmap(o))}M.setRenderTarget(s,l,c),M.setClearColor(N,O),void 0!==d&&(r.viewport=d),M.toneMapping=u}function ze(e,t,n){const r=!0===t.isScene?t.overrideMaterial:null;for(let i=0,o=e.length;i<o;i++){const o=e[i],{object:a,geometry:s,group:l}=o;let c=o.material;!0===c.allowOverride&&null!==r&&(c=r),a.layers.test(n.layers)&&Be(a,t,n,s,c,l)}}function Be(e,t,n,r,i,o){e.onBeforeRender(M,t,n,r,i,o),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),i.onBeforeRender(M,t,n,r,e,o),!0===i.transparent&&2===i.side&&!1===i.forceSinglePass?(i.side=1,i.needsUpdate=!0,M.renderBufferDirect(n,t,r,i,e,o),i.side=0,i.needsUpdate=!0,M.renderBufferDirect(n,t,r,i,e,o),i.side=2):M.renderBufferDirect(n,t,r,i,e,o),e.onAfterRender(M,t,n,r,i,o)}function Ve(e,t,n){!0!==t.isScene&&(t=Z);const r=re.get(e),i=x.state.lights,o=x.state.shadowsArray,a=i.state.version,s=ue.getParameters(e,i.state,o,t,n),l=ue.getProgramCacheKey(s);let c=r.programs;r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.envMap=(e.isMeshStandardMaterial?ae:oe).get(e.envMap||r.environment),r.envMapRotation=null!==r.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===c&&(e.addEventListener("dispose",Re),c=new Map,r.programs=c);let u=c.get(l);if(void 0!==u){if(r.currentProgram===u&&r.lightsStateVersion===a)return He(e,s),u}else s.uniforms=ue.getUniforms(e),e.onBeforeCompile(s,M),u=ue.acquireProgram(s,l),c.set(l,u),r.uniforms=s.uniforms;const d=r.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(d.clippingPlanes=fe.uniform),He(e,s),r.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),r.lightsStateVersion=a,r.needsLights&&(d.ambientLightColor.value=i.state.ambient,d.lightProbe.value=i.state.probe,d.directionalLights.value=i.state.directional,d.directionalLightShadows.value=i.state.directionalShadow,d.spotLights.value=i.state.spot,d.spotLightShadows.value=i.state.spotShadow,d.rectAreaLights.value=i.state.rectArea,d.ltc_1.value=i.state.rectAreaLTC1,d.ltc_2.value=i.state.rectAreaLTC2,d.pointLights.value=i.state.point,d.pointLightShadows.value=i.state.pointShadow,d.hemisphereLights.value=i.state.hemi,d.directionalShadowMap.value=i.state.directionalShadowMap,d.directionalShadowMatrix.value=i.state.directionalShadowMatrix,d.spotShadowMap.value=i.state.spotShadowMap,d.spotLightMatrix.value=i.state.spotLightMatrix,d.spotLightMap.value=i.state.spotLightMap,d.pointShadowMap.value=i.state.pointShadowMap,d.pointShadowMatrix.value=i.state.pointShadowMatrix),r.currentProgram=u,r.uniformsList=null,u}function je(e){if(null===e.uniformsList){const t=e.currentProgram.getUniforms();e.uniformsList=WP.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function He(e,t){const n=re.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}Oe.setAnimationLoop(function(e){Ie&&Ie(e)}),"undefined"!=typeof self&&Oe.setContext(self),this.setAnimationLoop=function(e){Ie=e,Te.setAnimationLoop(e),null===e?Oe.stop():Oe.start()},Te.addEventListener("sessionstart",Le),Te.addEventListener("sessionend",Ne),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void i_("WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===E)return;const n=!0===Te.enabled&&!0===Te.isPresenting,r=null!==S&&(null===C||n)&&S.begin(M,C);if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0!==Te.enabled||!0!==Te.isPresenting||null!==S&&!1!==S.isCompositing()||(!0===Te.cameraAutoUpdate&&Te.updateCamera(t),t=Te.getCamera()),!0===e.isScene&&e.onBeforeRender(M,e,t,C),x=pe.get(e,w.length),x.init(t),w.push(x),q.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),W.setFromProjectionMatrix(q,Xx,t.reversedDepth),X=this.localClippingEnabled,G=fe.init(this.clippingPlanes,X),b=he.get(e,_.length),b.init(),_.push(b),!0===Te.enabled&&!0===Te.isPresenting){const e=M.xr.getDepthSensingMesh();null!==e&&De(e,t,-1/0,M.sortObjects)}De(e,t,0,M.sortObjects),b.finish(),!0===M.sortObjects&&b.sort(z,B),J=!1===Te.enabled||!1===Te.isPresenting||!1===Te.hasDepthSensing(),J&&ge.addToRenderList(b,e),this.info.render.frame++,!0===G&&fe.beginShadows();const i=x.state.shadowsArray;me.render(i,e,t),!0===G&&fe.endShadows(),!0===this.info.autoReset&&this.info.reset();if(!1===(r&&S.hasRenderPass())){const n=b.opaque,r=b.transmissive;if(x.setupLights(),t.isArrayCamera){const i=t.cameras;if(r.length>0)for(let t=0,o=i.length;t<o;t++){Fe(n,r,e,i[t])}J&&ge.render(e);for(let t=0,n=i.length;t<n;t++){const n=i[t];Ue(b,e,n,n.viewport)}}else r.length>0&&Fe(n,r,e,t),J&&ge.render(e),Ue(b,e,t)}null!==C&&0===A&&(ie.updateMultisampleRenderTarget(C),ie.updateRenderTargetMipmap(C)),r&&S.end(M),!0===e.isScene&&e.onAfterRender(M,e,t),_e.resetDefaultState(),k=-1,R=null,w.pop(),w.length>0?(x=w[w.length-1],!0===G&&fe.setGlobalState(M.clippingPlanes,x.state.camera)):x=null,_.pop(),b=_.length>0?_[_.length-1]:null},this.getActiveCubeFace=function(){return T},this.getActiveMipmapLevel=function(){return A},this.getRenderTarget=function(){return C},this.setRenderTargetTextures=function(e,t,n){const r=re.get(e);r.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===r.__autoAllocateDepthBuffer&&(r.__useRenderToTexture=!1),re.get(e.texture).__webglTexture=t,re.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:n,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){const n=re.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t};const We=Se.createFramebuffer();this.setRenderTarget=function(e,t=0,n=0){C=e,T=t,A=n;let r=null,i=!1,o=!1;if(e){const a=re.get(e);if(void 0!==a.__useDefaultFramebuffer)return te.bindFramebuffer(Se.FRAMEBUFFER,a.__webglFramebuffer),P.copy(e.viewport),I.copy(e.scissor),L=e.scissorTest,te.viewport(P),te.scissor(I),te.setScissorTest(L),void(k=-1);if(void 0===a.__webglFramebuffer)ie.setupRenderTarget(e);else if(a.__hasExternalTextures)ie.rebindTextures(e,re.get(e.texture).__webglTexture,re.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){const t=e.depthTexture;if(a.__boundDepthTexture!==t){if(null!==t&&re.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");ie.setupDepthRenderbuffer(e)}}const s=e.texture;(s.isData3DTexture||s.isDataArrayTexture||s.isCompressedArrayTexture)&&(o=!0);const l=re.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(l[t])?l[t][n]:l[t],i=!0):r=e.samples>0&&!1===ie.useMultisampledRTT(e)?re.get(e).__webglMultisampledFramebuffer:Array.isArray(l)?l[n]:l,P.copy(e.viewport),I.copy(e.scissor),L=e.scissorTest}else P.copy(V).multiplyScalar(F).floor(),I.copy(j).multiplyScalar(F).floor(),L=H;0!==n&&(r=We);if(te.bindFramebuffer(Se.FRAMEBUFFER,r)&&te.drawBuffers(e,r),te.viewport(P),te.scissor(I),te.setScissorTest(L),i){const r=re.get(e.texture);Se.framebufferTexture2D(Se.FRAMEBUFFER,Se.COLOR_ATTACHMENT0,Se.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(o){const r=t;for(let t=0;t<e.textures.length;t++){const i=re.get(e.textures[t]);Se.framebufferTextureLayer(Se.FRAMEBUFFER,Se.COLOR_ATTACHMENT0+t,i.__webglTexture,n,r)}}else if(null!==e&&0!==n){const t=re.get(e.texture);Se.framebufferTexture2D(Se.FRAMEBUFFER,Se.COLOR_ATTACHMENT0,Se.TEXTURE_2D,t.__webglTexture,n)}k=-1},this.readRenderTargetPixels=function(e,t,n,r,i,o,a,s=0){if(!e||!e.isWebGLRenderTarget)return void i_("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let l=re.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==a&&(l=l[a]),l){te.bindFramebuffer(Se.FRAMEBUFFER,l);try{const a=e.textures[s],l=a.format,c=a.type;if(!ee.textureFormatReadable(l))return void i_("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!ee.textureTypeReadable(c))return void i_("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&(e.textures.length>1&&Se.readBuffer(Se.COLOR_ATTACHMENT0+s),Se.readPixels(t,n,r,i,xe.convert(l),xe.convert(c),o))}finally{const e=null!==C?re.get(C).__webglFramebuffer:null;te.bindFramebuffer(Se.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,r,i,o,a,s=0){if(!e||!e.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let l=re.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==a&&(l=l[a]),l){if(t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i){te.bindFramebuffer(Se.FRAMEBUFFER,l);const a=e.textures[s],c=a.format,u=a.type;if(!ee.textureFormatReadable(c))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ee.textureTypeReadable(u))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const d=Se.createBuffer();Se.bindBuffer(Se.PIXEL_PACK_BUFFER,d),Se.bufferData(Se.PIXEL_PACK_BUFFER,o.byteLength,Se.STREAM_READ),e.textures.length>1&&Se.readBuffer(Se.COLOR_ATTACHMENT0+s),Se.readPixels(t,n,r,i,xe.convert(c),xe.convert(u),0);const h=null!==C?re.get(C).__webglFramebuffer:null;te.bindFramebuffer(Se.FRAMEBUFFER,h);const p=Se.fenceSync(Se.SYNC_GPU_COMMANDS_COMPLETE,0);return Se.flush(),await function(e,t,n){return new Promise(function(r,i){setTimeout(function o(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(o,n);break;default:r()}},n)})}(Se,p,4),Se.bindBuffer(Se.PIXEL_PACK_BUFFER,d),Se.getBufferSubData(Se.PIXEL_PACK_BUFFER,0,o),Se.deleteBuffer(d),Se.deleteSync(p),o}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(e,t=null,n=0){const r=Math.pow(2,-n),i=Math.floor(e.image.width*r),o=Math.floor(e.image.height*r),a=null!==t?t.x:0,s=null!==t?t.y:0;ie.setTexture2D(e,0),Se.copyTexSubImage2D(Se.TEXTURE_2D,n,0,0,a,s,i,o),te.unbindTexture()};const Ge=Se.createFramebuffer(),Xe=Se.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,o=null){let a,s,l,c,u,d,h,p,f;null===o&&(0!==i?(o_("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),o=i,i=0):o=0);const m=e.isCompressedTexture?e.mipmaps[o]:e.image;if(null!==n)a=n.max.x-n.min.x,s=n.max.y-n.min.y,l=n.isBox3?n.max.z-n.min.z:1,c=n.min.x,u=n.min.y,d=n.isBox3?n.min.z:0;else{const t=Math.pow(2,-i);a=Math.floor(m.width*t),s=Math.floor(m.height*t),l=e.isDataArrayTexture?m.depth:e.isData3DTexture?Math.floor(m.depth*t):1,c=0,u=0,d=0}null!==r?(h=r.x,p=r.y,f=r.z):(h=0,p=0,f=0);const g=xe.convert(t.format),v=xe.convert(t.type);let y;t.isData3DTexture?(ie.setTexture3D(t,0),y=Se.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(ie.setTexture2DArray(t,0),y=Se.TEXTURE_2D_ARRAY):(ie.setTexture2D(t,0),y=Se.TEXTURE_2D),Se.pixelStorei(Se.UNPACK_FLIP_Y_WEBGL,t.flipY),Se.pixelStorei(Se.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),Se.pixelStorei(Se.UNPACK_ALIGNMENT,t.unpackAlignment);const b=Se.getParameter(Se.UNPACK_ROW_LENGTH),x=Se.getParameter(Se.UNPACK_IMAGE_HEIGHT),_=Se.getParameter(Se.UNPACK_SKIP_PIXELS),w=Se.getParameter(Se.UNPACK_SKIP_ROWS),S=Se.getParameter(Se.UNPACK_SKIP_IMAGES);Se.pixelStorei(Se.UNPACK_ROW_LENGTH,m.width),Se.pixelStorei(Se.UNPACK_IMAGE_HEIGHT,m.height),Se.pixelStorei(Se.UNPACK_SKIP_PIXELS,c),Se.pixelStorei(Se.UNPACK_SKIP_ROWS,u),Se.pixelStorei(Se.UNPACK_SKIP_IMAGES,d);const M=e.isDataArrayTexture||e.isData3DTexture,E=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){const n=re.get(e),r=re.get(t),m=re.get(n.__renderTarget),g=re.get(r.__renderTarget);te.bindFramebuffer(Se.READ_FRAMEBUFFER,m.__webglFramebuffer),te.bindFramebuffer(Se.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let v=0;v<l;v++)M&&(Se.framebufferTextureLayer(Se.READ_FRAMEBUFFER,Se.COLOR_ATTACHMENT0,re.get(e).__webglTexture,i,d+v),Se.framebufferTextureLayer(Se.DRAW_FRAMEBUFFER,Se.COLOR_ATTACHMENT0,re.get(t).__webglTexture,o,f+v)),Se.blitFramebuffer(c,u,a,s,h,p,a,s,Se.DEPTH_BUFFER_BIT,Se.NEAREST);te.bindFramebuffer(Se.READ_FRAMEBUFFER,null),te.bindFramebuffer(Se.DRAW_FRAMEBUFFER,null)}else if(0!==i||e.isRenderTargetTexture||re.has(e)){const n=re.get(e),r=re.get(t);te.bindFramebuffer(Se.READ_FRAMEBUFFER,Ge),te.bindFramebuffer(Se.DRAW_FRAMEBUFFER,Xe);for(let e=0;e<l;e++)M?Se.framebufferTextureLayer(Se.READ_FRAMEBUFFER,Se.COLOR_ATTACHMENT0,n.__webglTexture,i,d+e):Se.framebufferTexture2D(Se.READ_FRAMEBUFFER,Se.COLOR_ATTACHMENT0,Se.TEXTURE_2D,n.__webglTexture,i),E?Se.framebufferTextureLayer(Se.DRAW_FRAMEBUFFER,Se.COLOR_ATTACHMENT0,r.__webglTexture,o,f+e):Se.framebufferTexture2D(Se.DRAW_FRAMEBUFFER,Se.COLOR_ATTACHMENT0,Se.TEXTURE_2D,r.__webglTexture,o),0!==i?Se.blitFramebuffer(c,u,a,s,h,p,a,s,Se.COLOR_BUFFER_BIT,Se.NEAREST):E?Se.copyTexSubImage3D(y,o,h,p,f+e,c,u,a,s):Se.copyTexSubImage2D(y,o,h,p,c,u,a,s);te.bindFramebuffer(Se.READ_FRAMEBUFFER,null),te.bindFramebuffer(Se.DRAW_FRAMEBUFFER,null)}else E?e.isDataTexture||e.isData3DTexture?Se.texSubImage3D(y,o,h,p,f,a,s,l,g,v,m.data):t.isCompressedArrayTexture?Se.compressedTexSubImage3D(y,o,h,p,f,a,s,l,g,m.data):Se.texSubImage3D(y,o,h,p,f,a,s,l,g,v,m):e.isDataTexture?Se.texSubImage2D(Se.TEXTURE_2D,o,h,p,a,s,g,v,m.data):e.isCompressedTexture?Se.compressedTexSubImage2D(Se.TEXTURE_2D,o,h,p,m.width,m.height,g,m.data):Se.texSubImage2D(Se.TEXTURE_2D,o,h,p,a,s,g,v,m);Se.pixelStorei(Se.UNPACK_ROW_LENGTH,b),Se.pixelStorei(Se.UNPACK_IMAGE_HEIGHT,x),Se.pixelStorei(Se.UNPACK_SKIP_PIXELS,_),Se.pixelStorei(Se.UNPACK_SKIP_ROWS,w),Se.pixelStorei(Se.UNPACK_SKIP_IMAGES,S),0===o&&t.generateMipmaps&&Se.generateMipmap(y),te.unbindTexture()},this.initRenderTarget=function(e){void 0===re.get(e).__webglFramebuffer&&ie.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?ie.setTextureCube(e,0):e.isData3DTexture?ie.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?ie.setTexture2DArray(e,0):ie.setTexture2D(e,0),te.unbindTexture()},this.resetState=function(){T=0,A=0,C=null,te.reset(),_e.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Xx}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=C_._getDrawingBufferColorSpace(e),t.unpackColorSpace=C_._getUnpackColorSpace()}}const ZI=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:4,AddEquation:yy,AddOperation:2,AdditiveAnimationBlendMode:kx,AdditiveBlending:2,AgXToneMapping:6,AlphaFormat:Rb,AlwaysCompare:519,AlwaysDepth:1,AlwaysStencilFunc:519,AmbientLight:IC,AnimationAction:gk,AnimationClip:sC,AnimationLoader:class extends hC{constructor(e){super(e)}load(e,t,n,r){const i=this,o=new mC(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(Dv){r?r(Dv):i_(Dv),i.manager.itemError(e)}},n,r)}parse(e){const t=[];for(let n=0;n<e.length;n++){const r=sC.parse(e[n]);t.push(r)}return t}},AnimationMixer:yk,AnimationObjectGroup:class{constructor(){this.isAnimationObjectGroup=!0,this.uuid=d_(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,r=arguments.length;n!==r;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,r=this._parsedPaths,i=this._bindings,o=i.length;let a,s=e.length,l=this.nCachedObjects_;for(let c=0,u=arguments.length;c!==u;++c){const u=arguments[c],d=u.uuid;let h=t[d];if(void 0===h){h=s++,t[d]=h,e.push(u);for(let e=0,t=o;e!==t;++e)i[e].push(new mk(u,n[e],r[e]))}else if(h<l){a=e[h];const s=--l,c=e[s];t[c.uuid]=h,e[h]=c,t[d]=s,e[s]=u;for(let e=0,t=o;e!==t;++e){const t=i[e],o=t[s];let a=t[h];t[h]=o,void 0===a&&(a=new mk(u,n[e],r[e])),t[s]=a}}else e[h]!==a&&i_("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length;let i=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o],s=a.uuid,l=t[s];if(void 0!==l&&l>=i){const o=i++,c=e[o];t[c.uuid]=l,e[l]=c,t[s]=o,e[o]=a;for(let e=0,t=r;e!==t;++e){const t=n[e],r=t[o],i=t[l];t[l]=r,t[o]=i}}}this.nCachedObjects_=i}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length;let i=this.nCachedObjects_,o=e.length;for(let a=0,s=arguments.length;a!==s;++a){const s=arguments[a].uuid,l=t[s];if(void 0!==l)if(delete t[s],l<i){const a=--i,s=e[a],c=--o,u=e[c];t[s.uuid]=l,e[l]=s,t[u.uuid]=a,e[a]=u,e.pop();for(let e=0,t=r;e!==t;++e){const t=n[e],r=t[a],i=t[c];t[l]=r,t[a]=i,t.pop()}}else{const i=--o,a=e[i];i>0&&(t[a.uuid]=l),e[l]=a,e.pop();for(let e=0,t=r;e!==t;++e){const t=n[e];t[l]=t[i],t.pop()}}}this.nCachedObjects_=i}subscribe_(e,t){const n=this._bindingsIndicesByPath;let r=n[e];const i=this._bindings;if(void 0!==r)return i[r];const o=this._paths,a=this._parsedPaths,s=this._objects,l=s.length,c=this.nCachedObjects_,u=new Array(l);r=i.length,n[e]=r,o.push(e),a.push(t),i.push(u);for(let d=c,h=s.length;d!==h;++d){const n=s[d];u[d]=new mk(n,e,t)}return u}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){const r=this._paths,i=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a];t[e[a]]=n,o[n]=s,o.pop(),i[n]=i[a],i.pop(),r[n]=r[a],r.pop()}}},AnimationUtils:class{static convertArray(e,t){return GA(e,t)}static isTypedArray(e){return Jx(e)}static getKeyframeOrder(e){return XA(e)}static sortedArray(e,t,n){return qA(e,t,n)}static flattenJSON(e,t,n,r){$A(e,t,n,r)}static subclip(e,t,n,r,i=30){return function(e,t,n,r,i=30){const o=e.clone();o.name=t;const a=[];for(let l=0;l<o.tracks.length;++l){const e=o.tracks[l],t=e.getValueSize(),s=[],c=[];for(let o=0;o<e.times.length;++o){const a=e.times[o]*i;if(!(a<n||a>=r)){s.push(e.times[o]);for(let n=0;n<t;++n)c.push(e.values[o*t+n])}}0!==s.length&&(e.times=GA(s,e.times.constructor),e.values=GA(c,e.values.constructor),a.push(e))}o.tracks=a;let s=1/0;for(let l=0;l<o.tracks.length;++l)s>o.tracks[l].times[0]&&(s=o.tracks[l].times[0]);for(let l=0;l<o.tracks.length;++l)o.tracks[l].shift(-1*s);return o.resetDuration(),o}(e,t,n,r,i)}static makeClipAdditive(e,t=0,n=e,r=30){return function(e,t=0,n=e,r=30){r<=0&&(r=30);const i=n.tracks.length,o=t/r;for(let a=0;a<i;++a){const t=n.tracks[a],r=t.ValueTypeName;if("bool"===r||"string"===r)continue;const i=e.tracks.find(function(e){return e.name===t.name&&e.ValueTypeName===r});if(void 0===i)continue;let s=0;const l=t.getValueSize();t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(s=l/3);let c=0;const u=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=u/3);const d=t.times.length-1;let h;if(o<=t.times[0]){const e=s,n=l-s;h=t.values.slice(e,n)}else if(o>=t.times[d]){const e=d*l+s,n=e+l-s;h=t.values.slice(e,n)}else{const e=t.createInterpolant(),n=s,r=l-s;e.evaluate(o),h=e.resultBuffer.slice(n,r)}"quaternion"===r&&(new b_).fromArray(h).normalize().conjugate().toArray(h);const p=i.times.length;for(let e=0;e<p;++e){const t=e*u+c;if("quaternion"===r)b_.multiplyQuaternionsFlat(i.values,t,h,0,i.values,t);else{const e=u-2*c;for(let n=0;n<e;++n)i.values[t+n]-=h[n]}}}return e.blendMode=kx,e}(e,t,n,r)}},ArcCurve:xT,ArrayCamera:ZC,ArrowHelper:class extends Ww{constructor(e=new x_(0,0,1),t=new x_(0,0,0),n=1,r=16776960,i=.2*n,o=.2*i){super(),this.type="ArrowHelper",void 0===Kk&&(Kk=new IS,Kk.setAttribute("position",new MS([0,0,0,0,1,0],3)),Qk=new uT(.5,1,5,1),Qk.translate(0,-.5,0)),this.position.copy(t),this.line=new HE(Kk,new OE({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new WS(Qk,new pS({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,i,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Jk.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Jk,t)}}setLength(e,t=.2*e,n=.2*t){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}},AttachedBindMode:eb,Audio:rk,AudioAnalyser:class{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}},AudioContext:XC,AudioListener:class extends Ww{constructor(){super(),this.type="AudioListener",this.context=XC.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new JC}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(KC,QC,ek),tk.set(0,0,-1).applyQuaternion(QC),nk.set(0,1,0).applyQuaternion(QC),t.positionX){const e=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(KC.x,e),t.positionY.linearRampToValueAtTime(KC.y,e),t.positionZ.linearRampToValueAtTime(KC.z,e),t.forwardX.linearRampToValueAtTime(tk.x,e),t.forwardY.linearRampToValueAtTime(tk.y,e),t.forwardZ.linearRampToValueAtTime(tk.z,e),t.upX.linearRampToValueAtTime(nk.x,e),t.upY.linearRampToValueAtTime(nk.y,e),t.upZ.linearRampToValueAtTime(nk.z,e)}else t.setPosition(KC.x,KC.y,KC.z),t.setOrientation(tk.x,tk.y,tk.z,nk.x,nk.y,nk.z)}},AudioLoader:class extends hC{constructor(e){super(e)}load(e,t,n,r){const i=this,o=new mC(this.manager);function a(t){r?r(t):i_(t),i.manager.itemError(e)}o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(e){try{const n=e.slice(0);XC.getContext().decodeAudioData(n,function(e){t(e)}).catch(a)}catch(Dv){a(Dv)}},n,r)}},AxesHelper:eR,BackSide:1,BasicDepthPacking:3200,BasicShadowMap:0,BatchedMesh:NE,Bone:GM,BooleanKeyframeTrack:eC,Box2:class{constructor(e=new y_(1/0,1/0),t=new y_(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Ck.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}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}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))}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}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ck).distanceTo(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}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)}},Box3:W_,Box3Helper:class extends qE{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new IS;r.setIndex(new _S(n,1)),r.setAttribute("position",new MS([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(r,new OE({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}},BoxGeometry:XS,BoxHelper:class extends qE{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),i=new IS;i.setIndex(new _S(n,1)),i.setAttribute("position",new _S(r,3)),super(i,new OE({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(void 0!==this.object&&Zk.setFromObject(this.object),Zk.isEmpty())return;const e=Zk.min,t=Zk.max,n=this.geometry.attributes.position,r=n.array;r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=e.x,r[4]=t.y,r[5]=t.z,r[6]=e.x,r[7]=e.y,r[8]=t.z,r[9]=t.x,r[10]=e.y,r[11]=t.z,r[12]=t.x,r[13]=t.y,r[14]=e.z,r[15]=e.x,r[16]=t.y,r[17]=e.z,r[18]=e.x,r[19]=e.y,r[20]=e.z,r[21]=t.x,r[22]=e.y,r[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}},BufferAttribute:_S,BufferGeometry:IS,BufferGeometryLoader:zC,ByteType:yb,Cache:cC,Camera:KS,CameraHelper:class extends qE{constructor(e){const t=new IS,n=new OE({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],i=[],o={};function a(e,t){s(e),s(t)}function s(e){r.push(0,0,0),i.push(0,0,0),void 0===o[e]&&(o[e]=[]),o[e].push(r.length/3-1)}a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4"),t.setAttribute("position",new MS(r,3)),t.setAttribute("color",new MS(i,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const l=new cS(16755200),c=new cS(16711680),u=new cS(43775),d=new cS(16777215),h=new cS(3355443);this.setColors(l,c,u,d,h)}setColors(e,t,n,r,i){const o=this.geometry.getAttribute("color");return o.setXYZ(0,e.r,e.g,e.b),o.setXYZ(1,e.r,e.g,e.b),o.setXYZ(2,e.r,e.g,e.b),o.setXYZ(3,e.r,e.g,e.b),o.setXYZ(4,e.r,e.g,e.b),o.setXYZ(5,e.r,e.g,e.b),o.setXYZ(6,e.r,e.g,e.b),o.setXYZ(7,e.r,e.g,e.b),o.setXYZ(8,e.r,e.g,e.b),o.setXYZ(9,e.r,e.g,e.b),o.setXYZ(10,e.r,e.g,e.b),o.setXYZ(11,e.r,e.g,e.b),o.setXYZ(12,e.r,e.g,e.b),o.setXYZ(13,e.r,e.g,e.b),o.setXYZ(14,e.r,e.g,e.b),o.setXYZ(15,e.r,e.g,e.b),o.setXYZ(16,e.r,e.g,e.b),o.setXYZ(17,e.r,e.g,e.b),o.setXYZ(18,e.r,e.g,e.b),o.setXYZ(19,e.r,e.g,e.b),o.setXYZ(20,e.r,e.g,e.b),o.setXYZ(21,e.r,e.g,e.b),o.setXYZ(22,e.r,e.g,e.b),o.setXYZ(23,e.r,e.g,e.b),o.setXYZ(24,t.r,t.g,t.b),o.setXYZ(25,t.r,t.g,t.b),o.setXYZ(26,t.r,t.g,t.b),o.setXYZ(27,t.r,t.g,t.b),o.setXYZ(28,t.r,t.g,t.b),o.setXYZ(29,t.r,t.g,t.b),o.setXYZ(30,t.r,t.g,t.b),o.setXYZ(31,t.r,t.g,t.b),o.setXYZ(32,n.r,n.g,n.b),o.setXYZ(33,n.r,n.g,n.b),o.setXYZ(34,n.r,n.g,n.b),o.setXYZ(35,n.r,n.g,n.b),o.setXYZ(36,n.r,n.g,n.b),o.setXYZ(37,n.r,n.g,n.b),o.setXYZ(38,r.r,r.g,r.b),o.setXYZ(39,r.r,r.g,r.b),o.setXYZ(40,i.r,i.g,i.b),o.setXYZ(41,i.r,i.g,i.b),o.setXYZ(42,i.r,i.g,i.b),o.setXYZ(43,i.r,i.g,i.b),o.setXYZ(44,i.r,i.g,i.b),o.setXYZ(45,i.r,i.g,i.b),o.setXYZ(46,i.r,i.g,i.b),o.setXYZ(47,i.r,i.g,i.b),o.setXYZ(48,i.r,i.g,i.b),o.setXYZ(49,i.r,i.g,i.b),o.needsUpdate=!0,this}update(){const e=this.geometry,t=this.pointMap;let n,r;if($k.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),!0===this.camera.reversedDepth)n=1,r=0;else if(this.camera.coordinateSystem===Xx)n=-1,r=1;else{if(this.camera.coordinateSystem!==qx)throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);n=0,r=1}Yk("c",t,e,$k,0,0,n),Yk("t",t,e,$k,0,0,r),Yk("n1",t,e,$k,-1,-1,n),Yk("n2",t,e,$k,1,-1,n),Yk("n3",t,e,$k,-1,1,n),Yk("n4",t,e,$k,1,1,n),Yk("f1",t,e,$k,-1,-1,r),Yk("f2",t,e,$k,1,-1,r),Yk("f3",t,e,$k,-1,1,r),Yk("f4",t,e,$k,1,1,r),Yk("u1",t,e,$k,.7,1.1,n),Yk("u2",t,e,$k,-.7,1.1,n),Yk("u3",t,e,$k,0,2,n),Yk("cf1",t,e,$k,-1,0,r),Yk("cf2",t,e,$k,1,0,r),Yk("cf3",t,e,$k,0,-1,r),Yk("cf4",t,e,$k,0,1,r),Yk("cn1",t,e,$k,-1,0,n),Yk("cn2",t,e,$k,1,0,n),Yk("cn3",t,e,$k,0,-1,n),Yk("cn4",t,e,$k,0,1,n),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},CanvasTexture:class extends F_{constructor(e,t,n,r,i,o,a,s,l){super(e,t,n,r,i,o,a,s,l),this.isCanvasTexture=!0,this.needsUpdate=!0}},CapsuleGeometry:sT,CatmullRomCurve3:TT,CineonToneMapping:3,CircleGeometry:lT,ClampToEdgeWrapping:cb,Clock:JC,Color:cS,ColorKeyframeTrack:tC,ColorManagement:C_,CompressedArrayTexture:class extends rT{constructor(e,t,n,r,i,o){super(e,t,n,i,o),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=cb,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},CompressedCubeTexture:class extends rT{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,rb),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}},CompressedTexture:rT,CompressedTextureLoader:class extends hC{constructor(e){super(e)}load(e,t,n,r){const i=this,o=[],a=new rT,s=new mC(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(i.withCredentials);let l=0;function c(c){s.load(e[c],function(e){const n=i.parse(e,!0);o[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,6===l&&(1===n.mipmapCount&&(a.minFilter=fb),a.image=o,a.format=n.format,a.needsUpdate=!0,t&&t(a))},n,r)}if(Array.isArray(e))for(let u=0,d=e.length;u<d;++u)c(u);else s.load(e,function(e){const n=i.parse(e,!0);if(n.isCubemap){const e=n.mipmaps.length/n.mipmapCount;for(let t=0;t<e;t++){o[t]={mipmaps:[]};for(let e=0;e<n.mipmapCount;e++)o[t].mipmaps.push(n.mipmaps[t*n.mipmapCount+e]),o[t].format=n.format,o[t].width=n.width,o[t].height=n.height}a.image=o}else a.image.width=n.width,a.image.height=n.height,a.mipmaps=n.mipmaps;1===n.mipmapCount&&(a.minFilter=fb),a.format=n.format,a.needsUpdate=!0,t&&t(a)},n,r);return a}},ConeGeometry:uT,ConstantAlphaFactor:213,ConstantColorFactor:211,Controls:class extends a_{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){void 0!==e?(null!==this.domElement&&this.disconnect(),this.domElement=e):r_("Controls: connect() now requires an element.")}disconnect(){}dispose(){}update(){}},CubeCamera:iM,CubeDepthTexture:oT,CubeReflectionMapping:rb,CubeRefractionMapping:ib,CubeTexture:oM,CubeTextureLoader:class extends hC{constructor(e){super(e)}load(e,t,n,r){const i=new oM;i.colorSpace=Px;const o=new vC(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function s(n){o.load(e[n],function(e){i.images[n]=e,a++,6===a&&(i.needsUpdate=!0,t&&t(i))},void 0,r)}for(let l=0;l<e.length;++l)s(l);return i}},CubeUVReflectionMapping:sb,CubicBezierCurve:RT,CubicBezierCurve3:PT,CubicInterpolant:ZA,CullFaceBack:1,CullFaceFront:2,CullFaceFrontBack:3,CullFaceNone:0,Curve:yT,CurvePath:FT,CustomBlending:5,CustomToneMapping:5,CylinderGeometry:cT,Cylindrical:class{constructor(e=1,t=0,n=0){this.radius=e,this.theta=t,this.y=n}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return(new this.constructor).copy(this)}},Data3DTexture:H_,DataArrayTexture:j_,DataTexture:XM,DataTextureLoader:class extends hC{constructor(e){super(e)}load(e,t,n,r){const i=this,o=new XM,a=new mC(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(i.withCredentials),a.load(e,function(e){let n;try{n=i.parse(e)}catch(a){if(void 0===r)return void a(a);r(a)}void 0!==n.image?o.image=n.image:void 0!==n.data&&(o.image.width=n.width,o.image.height=n.height,o.image.data=n.data),o.wrapS=void 0!==n.wrapS?n.wrapS:cb,o.wrapT=void 0!==n.wrapT?n.wrapT:cb,o.magFilter=void 0!==n.magFilter?n.magFilter:fb,o.minFilter=void 0!==n.minFilter?n.minFilter:fb,o.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace&&(o.colorSpace=n.colorSpace),void 0!==n.flipY&&(o.flipY=n.flipY),void 0!==n.format&&(o.format=n.format),void 0!==n.type&&(o.type=n.type),void 0!==n.mipmaps&&(o.mipmaps=n.mipmaps,o.minFilter=gb),1===n.mipmapCount&&(o.minFilter=fb),void 0!==n.generateMipmaps&&(o.generateMipmaps=n.generateMipmaps),o.needsUpdate=!0,t&&t(o,n)},n,r),o}},DataUtils:class{static toHalfFloat(e){return gS(e)}static fromHalfFloat(e){return vS(e)}},DecrementStencilOp:7683,DecrementWrapStencilOp:34056,DefaultLoadingManager:dC,DepthFormat:Lb,DepthStencilFormat:Nb,DepthTexture:iT,DetachedBindMode:tb,DirectionalLight:PC,DirectionalLightHelper:class extends Ww{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",void 0===t&&(t=1);let r=new IS;r.setAttribute("position",new MS([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const i=new OE({fog:!1,toneMapped:!1});this.lightPlane=new HE(r,i),this.add(this.lightPlane),r=new IS,r.setAttribute("position",new MS([0,0,0,0,0,1],3)),this.targetLine=new HE(r,i),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),Wk.setFromMatrixPosition(this.light.matrixWorld),Gk.setFromMatrixPosition(this.light.target.matrixWorld),Xk.subVectors(Gk,Wk),this.lightPlane.lookAt(Gk),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Gk),this.targetLine.scale.z=Xk.length()}},DiscreteInterpolant:KA,DodecahedronGeometry:hT,DoubleSide:2,DstAlphaFactor:206,DstColorFactor:208,DynamicCopyUsage:35050,DynamicDrawUsage:35048,DynamicReadUsage:35049,EdgesGeometry:vT,EllipseCurve:bT,EqualCompare:514,EqualDepth:4,EqualStencilFunc:514,EquirectangularReflectionMapping:ob,EquirectangularRefractionMapping:ab,Euler:Aw,EventDispatcher:a_,ExternalTexture:aT,ExtrudeGeometry:vA,FileLoader:mC,Float16BufferAttribute:class extends _S{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=vS(this.array[e*this.itemSize]);return this.normalized&&(t=m_(t,this.array)),t}setX(e,t){return this.normalized&&(t=g_(t,this.array)),this.array[e*this.itemSize]=gS(t),this}getY(e){let t=vS(this.array[e*this.itemSize+1]);return this.normalized&&(t=m_(t,this.array)),t}setY(e,t){return this.normalized&&(t=g_(t,this.array)),this.array[e*this.itemSize+1]=gS(t),this}getZ(e){let t=vS(this.array[e*this.itemSize+2]);return this.normalized&&(t=m_(t,this.array)),t}setZ(e,t){return this.normalized&&(t=g_(t,this.array)),this.array[e*this.itemSize+2]=gS(t),this}getW(e){let t=vS(this.array[e*this.itemSize+3]);return this.normalized&&(t=m_(t,this.array)),t}setW(e,t){return this.normalized&&(t=g_(t,this.array)),this.array[e*this.itemSize+3]=gS(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=g_(t,this.array),n=g_(n,this.array)),this.array[e+0]=gS(t),this.array[e+1]=gS(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=g_(t,this.array),n=g_(n,this.array),r=g_(r,this.array)),this.array[e+0]=gS(t),this.array[e+1]=gS(n),this.array[e+2]=gS(r),this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=g_(t,this.array),n=g_(n,this.array),r=g_(r,this.array),i=g_(i,this.array)),this.array[e+0]=gS(t),this.array[e+1]=gS(n),this.array[e+2]=gS(r),this.array[e+3]=gS(i),this}},Float32BufferAttribute:MS,FloatType:Sb,Fog:dM,FogExp2:uM,FramebufferTexture:class extends F_{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=db,this.minFilter=db,this.generateMipmaps=!1,this.needsUpdate=!0}},FrontSide:0,Frustum:hE,FrustumArray:mE,GLBufferAttribute:_k,GLSL1:"100",GLSL3:Gx,GreaterCompare:516,GreaterDepth:6,GreaterEqualCompare:jx,GreaterEqualDepth:5,GreaterEqualStencilFunc:518,GreaterStencilFunc:516,GridHelper:class extends qE{constructor(e=10,t=10,n=4473924,r=8947848){n=new cS(n),r=new cS(r);const i=t/2,o=e/t,a=e/2,s=[],l=[];for(let u=0,d=0,h=-a;u<=t;u++,h+=o){s.push(-a,0,h,a,0,h),s.push(h,0,-a,h,0,a);const e=u===i?n:r;e.toArray(l,d),d+=3,e.toArray(l,d),d+=3,e.toArray(l,d),d+=3,e.toArray(l,d),d+=3}const c=new IS;c.setAttribute("position",new MS(s,3)),c.setAttribute("color",new MS(l,3));super(c,new OE({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}},Group:sM,HalfFloatType:Mb,HemisphereLight:xC,HemisphereLightHelper:class extends Ww{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const r=new _A(t);r.rotateY(.5*Math.PI),this.material=new pS({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const i=r.getAttribute("position"),o=new Float32Array(3*i.count);r.setAttribute("color",new _S(o,3)),this.add(new WS(r,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");jk.copy(this.light.color),Hk.copy(this.light.groundColor);for(let e=0,n=t.count;e<n;e++){const r=e<n/2?jk:Hk;t.setXYZ(e,r.r,r.g,r.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(Vk.setFromMatrixPosition(this.light.matrixWorld).negate())}},IcosahedronGeometry:bA,ImageBitmapLoader:WC,ImageLoader:vC,ImageUtils:I_,IncrementStencilOp:7682,IncrementWrapStencilOp:34055,InstancedBufferAttribute:ZM,InstancedBufferGeometry:FC,InstancedInterleavedBuffer:class extends pM{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}},InstancedMesh:iE,Int16BufferAttribute:class extends _S{constructor(e,t,n){super(new Int16Array(e),t,n)}},Int32BufferAttribute:class extends _S{constructor(e,t,n){super(new Int32Array(e),t,n)}},Int8BufferAttribute:class extends _S{constructor(e,t,n){super(new Int8Array(e),t,n)}},IntType:_b,InterleavedBuffer:pM,InterleavedBufferAttribute:mM,Interpolant:YA,InterpolateDiscrete:wx,InterpolateLinear:Sx,InterpolateSmooth:Mx,InterpolationSamplingMode:{NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},InterpolationSamplingType:{PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},InvertStencilOp:5386,KeepStencilOp:Ox,KeyframeTrack:QA,LOD:NM,LatheGeometry:xA,Layers:Cw,LessCompare:513,LessDepth:2,LessEqualCompare:zx,LessEqualDepth:3,LessEqualStencilFunc:515,LessStencilFunc:513,Light:bC,LightProbe:OC,Line:HE,Line3:class{constructor(e=new x_,t=new x_){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){kk.subVectors(e,this.start),Rk.subVectors(this.end,this.start);const n=Rk.dot(Rk);let r=Rk.dot(kk)/n;return t&&(r=h_(r,0,1)),r}closestPointToPoint(e,t,n){const r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=Nk,n=Ok){const r=1e-8*1e-8;let i,o;const a=this.start,s=e.start,l=this.end,c=e.end;Pk.subVectors(l,a),Ik.subVectors(c,s),Lk.subVectors(a,s);const u=Pk.dot(Pk),d=Ik.dot(Ik),h=Ik.dot(Lk);if(u<=r&&d<=r)return t.copy(a),n.copy(s),t.sub(n),t.dot(t);if(u<=r)i=0,o=h/d,o=h_(o,0,1);else{const e=Pk.dot(Lk);if(d<=r)o=0,i=h_(-e/u,0,1);else{const t=Pk.dot(Ik),n=u*d-t*t;i=0!==n?h_((t*h-e*d)/n,0,1):0,o=(t*i+h)/d,o<0?(o=0,i=h_(-e/u,0,1)):o>1&&(o=1,i=h_((t-e)/u,0,1))}}return t.copy(a).add(Pk.multiplyScalar(i)),n.copy(s).add(Ik.multiplyScalar(o)),t.sub(n),t.dot(t)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}},LineBasicMaterial:OE,LineCurve:IT,LineCurve3:LT,LineDashedMaterial:WA,LineLoop:$E,LineSegments:qE,LinearFilter:fb,LinearInterpolant:JA,LinearMipMapLinearFilter:1008,LinearMipMapNearestFilter:1007,LinearMipmapLinearFilter:gb,LinearMipmapNearestFilter:mb,LinearSRGBColorSpace:Ix,LinearToneMapping:1,LinearTransfer:Lx,Loader:hC,LoaderUtils:UC,LoadingManager:uC,LoopOnce:2200,LoopPingPong:2202,LoopRepeat:2201,MOUSE:{LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Material:hS,MaterialLoader:DC,MathUtils:v_,Matrix2:Ak,Matrix3:S_,Matrix4:vw,MaxEquation:104,Mesh:WS,MeshBasicMaterial:pS,MeshDepthMaterial:VA,MeshDistanceMaterial:jA,MeshLambertMaterial:BA,MeshMatcapMaterial:HA,MeshNormalMaterial:zA,MeshPhongMaterial:UA,MeshPhysicalMaterial:DA,MeshStandardMaterial:OA,MeshToonMaterial:FA,MinEquation:103,MirroredRepeatWrapping:ub,MixOperation:1,MultiplyBlending:4,MultiplyOperation:0,NearestFilter:db,NearestMipMapLinearFilter:1005,NearestMipMapNearestFilter:1004,NearestMipmapLinearFilter:pb,NearestMipmapNearestFilter:hb,NeutralToneMapping:7,NeverCompare:512,NeverDepth:0,NeverStencilFunc:512,NoBlending:0,NoColorSpace:Rx,NoNormalPacking:"",NoToneMapping:0,NormalAnimationBlendMode:Cx,NormalBlending:1,NormalGAPacking:"ga",NormalRGPacking:"rg",NotEqualCompare:517,NotEqualDepth:7,NotEqualStencilFunc:517,NumberKeyframeTrack:nC,Object3D:Ww,ObjectLoader:class extends hC{constructor(e){super(e)}load(e,t,n,r){const i=this,o=""===this.path?UC.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new mC(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(n){let o=null;try{o=JSON.parse(n)}catch(s){return void 0!==r&&r(s),void s("ObjectLoader: Can't parse "+e+".",s.message)}const a=o.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())return void 0!==r&&r(new Error("THREE.ObjectLoader: Can't load "+e)),void i_("ObjectLoader: Can't load "+e);i.parse(o,t)},n,r)}async loadAsync(e,t){const n=""===this.path?UC.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||n;const r=new mC(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials);const i=await r.loadAsync(e,t),o=JSON.parse(i),a=o.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+e);return await this.parseAsync(o)}parse(e,t){const n=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,r),o=this.parseImages(e.images,function(){void 0!==t&&t(l)}),a=this.parseTextures(e.textures,o),s=this.parseMaterials(e.materials,a),l=this.parseObject(e.object,i,s,a,n),c=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,c),this.bindLightTargets(l),void 0!==t){let e=!1;for(const t in o)if(o[t].data instanceof HTMLImageElement){e=!0;break}!1===e&&t(l)}return l}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,n),i=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,i),a=this.parseMaterials(e.materials,o),s=this.parseObject(e.object,r,a,o,t),l=this.parseSkeletons(e.skeletons,s);return this.bindSkeletons(s,l),this.bindLightTargets(s),s}parseShapes(e){const t={};if(void 0!==e)for(let n=0,r=e.length;n<r;n++){const r=(new BT).fromJSON(e[n]);t[r.uuid]=r}return t}parseSkeletons(e,t){const n={},r={};if(t.traverse(function(e){e.isBone&&(r[e.uuid]=e)}),void 0!==e)for(let i=0,o=e.length;i<o;i++){const t=(new YM).fromJSON(e[i],r);n[t.uuid]=t}return n}parseGeometries(e,t){const n={};if(void 0!==e){const r=new zC;for(let i=0,o=e.length;i<o;i++){let o;const a=e[i];switch(a.type){case"BufferGeometry":case"InstancedBufferGeometry":o=r.parse(a);break;default:a.type in IA?o=IA[a.type].fromJSON(a,t):r_(`ObjectLoader: Unsupported geometry type "${a.type}"`)}o.uuid=a.uuid,void 0!==a.name&&(o.name=a.name),void 0!==a.userData&&(o.userData=a.userData),n[a.uuid]=o}}return n}parseMaterials(e,t){const n={},r={};if(void 0!==e){const i=new DC;i.setTextures(t);for(let t=0,o=e.length;t<o;t++){const o=e[t];void 0===n[o.uuid]&&(n[o.uuid]=i.parse(o)),r[o.uuid]=n[o.uuid]}}return r}parseAnimations(e){const t={};if(void 0!==e)for(let n=0;n<e.length;n++){const r=e[n],i=sC.parse(r);t[i.uuid]=i}return t}parseImages(e,t){const n=this,r={};let i;function o(e){if("string"==typeof e){const t=e;return function(e){return n.manager.itemStart(e),i.load(e,function(){n.manager.itemEnd(e)},void 0,function(){n.manager.itemError(e),n.manager.itemEnd(e)})}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t)?t:n.resourcePath+t)}return e.data?{data:Zx(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){const n=new uC(t);i=new vC(n),i.setCrossOrigin(this.crossOrigin);for(let t=0,i=e.length;t<i;t++){const n=e[t],i=n.url;if(Array.isArray(i)){const e=[];for(let t=0,n=i.length;t<n;t++){const n=o(i[t]);null!==n&&(n instanceof HTMLImageElement?e.push(n):e.push(new XM(n.data,n.width,n.height)))}r[n.uuid]=new N_(e)}else{const e=o(n.url);r[n.uuid]=new N_(e)}}}return r}async parseImagesAsync(e){const t=this,n={};let r;async function i(e){if("string"==typeof e){const n=e,i=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(n)?n:t.resourcePath+n;return await r.loadAsync(i)}return e.data?{data:Zx(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){r=new vC(this.manager),r.setCrossOrigin(this.crossOrigin);for(let t=0,r=e.length;t<r;t++){const r=e[t],o=r.url;if(Array.isArray(o)){const e=[];for(let t=0,n=o.length;t<n;t++){const n=o[t],r=await i(n);null!==r&&(r instanceof HTMLImageElement?e.push(r):e.push(new XM(r.data,r.width,r.height)))}n[r.uuid]=new N_(e)}else{const e=await i(r.url);n[r.uuid]=new N_(e)}}}return n}parseTextures(e,t){function n(e,t){return"number"==typeof e?e:(r_("ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}const r={};if(void 0!==e)for(let i=0,o=e.length;i<o;i++){const o=e[i];void 0===o.image&&r_('ObjectLoader: No "image" specified for',o.uuid),void 0===t[o.image]&&r_("ObjectLoader: Undefined image",o.image);const a=t[o.image],s=a.data;let l;Array.isArray(s)?(l=new oM,6===s.length&&(l.needsUpdate=!0)):(l=s&&s.data?new XM:new F_,s&&(l.needsUpdate=!0)),l.source=a,l.uuid=o.uuid,void 0!==o.name&&(l.name=o.name),void 0!==o.mapping&&(l.mapping=n(o.mapping,BC)),void 0!==o.channel&&(l.channel=o.channel),void 0!==o.offset&&l.offset.fromArray(o.offset),void 0!==o.repeat&&l.repeat.fromArray(o.repeat),void 0!==o.center&&l.center.fromArray(o.center),void 0!==o.rotation&&(l.rotation=o.rotation),void 0!==o.wrap&&(l.wrapS=n(o.wrap[0],VC),l.wrapT=n(o.wrap[1],VC)),void 0!==o.format&&(l.format=o.format),void 0!==o.internalFormat&&(l.internalFormat=o.internalFormat),void 0!==o.type&&(l.type=o.type),void 0!==o.colorSpace&&(l.colorSpace=o.colorSpace),void 0!==o.minFilter&&(l.minFilter=n(o.minFilter,jC)),void 0!==o.magFilter&&(l.magFilter=n(o.magFilter,jC)),void 0!==o.anisotropy&&(l.anisotropy=o.anisotropy),void 0!==o.flipY&&(l.flipY=o.flipY),void 0!==o.generateMipmaps&&(l.generateMipmaps=o.generateMipmaps),void 0!==o.premultiplyAlpha&&(l.premultiplyAlpha=o.premultiplyAlpha),void 0!==o.unpackAlignment&&(l.unpackAlignment=o.unpackAlignment),void 0!==o.compareFunction&&(l.compareFunction=o.compareFunction),void 0!==o.userData&&(l.userData=o.userData),r[o.uuid]=l}return r}parseObject(e,t,n,r,i){let o,a,s;function l(e){return void 0===t[e]&&r_("ObjectLoader: Undefined geometry",e),t[e]}function c(e){if(void 0!==e){if(Array.isArray(e)){const t=[];for(let r=0,i=e.length;r<i;r++){const i=e[r];void 0===n[i]&&r_("ObjectLoader: Undefined material",i),t.push(n[i])}return t}return void 0===n[e]&&r_("ObjectLoader: Undefined material",e),n[e]}}function u(e){return void 0===r[e]&&r_("ObjectLoader: Undefined texture",e),r[e]}switch(e.type){case"Scene":o=new hM,void 0!==e.background&&(Number.isInteger(e.background)?o.background=new cS(e.background):o.background=u(e.background)),void 0!==e.environment&&(o.environment=u(e.environment)),void 0!==e.fog&&("Fog"===e.fog.type?o.fog=new dM(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(o.fog=new uM(e.fog.color,e.fog.density)),""!==e.fog.name&&(o.fog.name=e.fog.name)),void 0!==e.backgroundBlurriness&&(o.backgroundBlurriness=e.backgroundBlurriness),void 0!==e.backgroundIntensity&&(o.backgroundIntensity=e.backgroundIntensity),void 0!==e.backgroundRotation&&o.backgroundRotation.fromArray(e.backgroundRotation),void 0!==e.environmentIntensity&&(o.environmentIntensity=e.environmentIntensity),void 0!==e.environmentRotation&&o.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":o=new nM(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(o.focus=e.focus),void 0!==e.zoom&&(o.zoom=e.zoom),void 0!==e.filmGauge&&(o.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(o.filmOffset=e.filmOffset),void 0!==e.view&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new kC(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(o.zoom=e.zoom),void 0!==e.view&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new IC(e.color,e.intensity);break;case"DirectionalLight":o=new PC(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new CC(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new LC(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new TC(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new xC(e.color,e.groundColor,e.intensity);break;case"LightProbe":const t=(new NC).fromArray(e.sh);o=new OC(t,e.intensity);break;case"SkinnedMesh":a=l(e.geometry),s=c(e.material),o=new WM(a,s),void 0!==e.bindMode&&(o.bindMode=e.bindMode),void 0!==e.bindMatrix&&o.bindMatrix.fromArray(e.bindMatrix),void 0!==e.skeleton&&(o.skeleton=e.skeleton);break;case"Mesh":a=l(e.geometry),s=c(e.material),o=new WS(a,s);break;case"InstancedMesh":a=l(e.geometry),s=c(e.material);const n=e.count,r=e.instanceMatrix,i=e.instanceColor;o=new iE(a,s,n),o.instanceMatrix=new ZM(new Float32Array(r.array),16),void 0!==i&&(o.instanceColor=new ZM(new Float32Array(i.array),i.itemSize));break;case"BatchedMesh":a=l(e.geometry),s=c(e.material),o=new NE(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,s),o.geometry=a,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._geometryInfo=e.geometryInfo.map(e=>{let t=null,n=null;return void 0!==e.boundingBox&&(t=(new W_).fromJSON(e.boundingBox)),void 0!==e.boundingSphere&&(n=(new lw).fromJSON(e.boundingSphere)),{...e,boundingBox:t,boundingSphere:n}}),o._instanceInfo=e.instanceInfo,o._availableInstanceIds=e._availableInstanceIds,o._availableGeometryIds=e._availableGeometryIds,o._nextIndexStart=e.nextIndexStart,o._nextVertexStart=e.nextVertexStart,o._geometryCount=e.geometryCount,o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._matricesTexture=u(e.matricesTexture.uuid),o._indirectTexture=u(e.indirectTexture.uuid),void 0!==e.colorsTexture&&(o._colorsTexture=u(e.colorsTexture.uuid)),void 0!==e.boundingSphere&&(o.boundingSphere=(new lw).fromJSON(e.boundingSphere)),void 0!==e.boundingBox&&(o.boundingBox=(new W_).fromJSON(e.boundingBox));break;case"LOD":o=new NM;break;case"Line":o=new HE(l(e.geometry),c(e.material));break;case"LineLoop":o=new $E(l(e.geometry),c(e.material));break;case"LineSegments":o=new qE(l(e.geometry),c(e.material));break;case"PointCloud":case"Points":o=new eT(l(e.geometry),c(e.material));break;case"Sprite":o=new RM(c(e.material));break;case"Group":o=new sM;break;case"Bone":o=new GM;break;default:o=new Ww}if(o.uuid=e.uuid,void 0!==e.name&&(o.name=e.name),void 0!==e.matrix?(o.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(void 0!==e.position&&o.position.fromArray(e.position),void 0!==e.rotation&&o.rotation.fromArray(e.rotation),void 0!==e.quaternion&&o.quaternion.fromArray(e.quaternion),void 0!==e.scale&&o.scale.fromArray(e.scale)),void 0!==e.up&&o.up.fromArray(e.up),void 0!==e.castShadow&&(o.castShadow=e.castShadow),void 0!==e.receiveShadow&&(o.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.intensity&&(o.shadow.intensity=e.shadow.intensity),void 0!==e.shadow.bias&&(o.shadow.bias=e.shadow.bias),void 0!==e.shadow.normalBias&&(o.shadow.normalBias=e.shadow.normalBias),void 0!==e.shadow.radius&&(o.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&o.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(o.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(o.visible=e.visible),void 0!==e.frustumCulled&&(o.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(o.renderOrder=e.renderOrder),void 0!==e.userData&&(o.userData=e.userData),void 0!==e.layers&&(o.layers.mask=e.layers),void 0!==e.children){const a=e.children;for(let e=0;e<a.length;e++)o.add(this.parseObject(a[e],t,n,r,i))}if(void 0!==e.animations){const t=e.animations;for(let e=0;e<t.length;e++){const n=t[e];o.animations.push(i[n])}}if("LOD"===e.type){void 0!==e.autoUpdate&&(o.autoUpdate=e.autoUpdate);const t=e.levels;for(let e=0;e<t.length;e++){const n=t[e],r=o.getObjectByProperty("uuid",n.object);void 0!==r&&o.addLevel(r,n.distance,n.hysteresis)}}return o}bindSkeletons(e,t){0!==Object.keys(t).length&&e.traverse(function(e){if(!0===e.isSkinnedMesh&&void 0!==e.skeleton){const n=t[e.skeleton];void 0===n?r_("ObjectLoader: No skeleton found with UUID:",e.skeleton):e.bind(n,e.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,r=e.getObjectByProperty("uuid",n);t.target=void 0!==r?r:new Ww}})}},ObjectSpaceNormalMap:1,OctahedronGeometry:_A,OneFactor:201,OneMinusConstantAlphaFactor:214,OneMinusConstantColorFactor:212,OneMinusDstAlphaFactor:207,OneMinusDstColorFactor:209,OneMinusSrcAlphaFactor:Ty,OneMinusSrcColorFactor:203,OrthographicCamera:kC,PCFShadowMap:1,PCFSoftShadowMap:2,PMREMGenerator:ER,Path:zT,PerspectiveCamera:nM,Plane:lE,PlaneGeometry:wA,PlaneHelper:class extends HE{constructor(e,t=1,n=16776960){const r=n,i=new IS;i.setAttribute("position",new MS([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),i.computeBoundingSphere(),super(i,new OE({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const o=new IS;o.setAttribute("position",new MS([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),o.computeBoundingSphere(),this.add(new WS(o,new pS({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}},PointLight:CC,PointLightHelper:class extends WS{constructor(e,t,n){super(new EA(t,4,2),new pS({wireframe:!0,fog:!1,toneMapped:!1})),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}},Points:eT,PointsMaterial:YE,PolarGridHelper:class extends qE{constructor(e=10,t=16,n=8,r=64,i=4473924,o=8947848){i=new cS(i),o=new cS(o);const a=[],s=[];if(t>1)for(let c=0;c<t;c++){const n=c/t*(2*Math.PI),r=Math.sin(n)*e,l=Math.cos(n)*e;a.push(0,0,0),a.push(r,0,l);const u=1&c?i:o;s.push(u.r,u.g,u.b),s.push(u.r,u.g,u.b)}for(let c=0;c<n;c++){const t=1&c?i:o,l=e-e/n*c;for(let e=0;e<r;e++){let n=e/r*(2*Math.PI),i=Math.sin(n)*l,o=Math.cos(n)*l;a.push(i,0,o),s.push(t.r,t.g,t.b),n=(e+1)/r*(2*Math.PI),i=Math.sin(n)*l,o=Math.cos(n)*l,a.push(i,0,o),s.push(t.r,t.g,t.b)}}const l=new IS;l.setAttribute("position",new MS(a,3)),l.setAttribute("color",new MS(s,3));super(l,new OE({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}},PolyhedronGeometry:dT,PositionalAudio:class extends rk{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(ik,ok,ak),sk.set(0,0,1).applyQuaternion(ok);const t=this.panner;if(t.positionX){const e=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(ik.x,e),t.positionY.linearRampToValueAtTime(ik.y,e),t.positionZ.linearRampToValueAtTime(ik.z,e),t.orientationX.linearRampToValueAtTime(sk.x,e),t.orientationY.linearRampToValueAtTime(sk.y,e),t.orientationZ.linearRampToValueAtTime(sk.z,e)}else t.setPosition(ik.x,ik.y,ik.z),t.setOrientation(sk.x,sk.y,sk.z)}},PropertyBinding:mk,PropertyMixer:lk,QuadraticBezierCurve:NT,QuadraticBezierCurve3:OT,Quaternion:b_,QuaternionKeyframeTrack:iC,QuaternionLinearInterpolant:rC,R11_EAC_Format:Jb,RED_GREEN_RGTC2_Format:xx,RED_RGTC1_Format:yx,REVISION:hy,RG11_EAC_Format:Qb,RGBADepthPacking:3201,RGBAFormat:Ib,RGBAIntegerFormat:zb,RGBA_ASTC_10x10_Format:hx,RGBA_ASTC_10x5_Format:cx,RGBA_ASTC_10x6_Format:ux,RGBA_ASTC_10x8_Format:dx,RGBA_ASTC_12x10_Format:px,RGBA_ASTC_12x12_Format:fx,RGBA_ASTC_4x4_Format:tx,RGBA_ASTC_5x4_Format:nx,RGBA_ASTC_5x5_Format:rx,RGBA_ASTC_6x5_Format:ix,RGBA_ASTC_6x6_Format:ox,RGBA_ASTC_8x5_Format:ax,RGBA_ASTC_8x6_Format:sx,RGBA_ASTC_8x8_Format:lx,RGBA_BPTC_Format:mx,RGBA_ETC2_EAC_Format:Zb,RGBA_PVRTC_2BPPV1_Format:qb,RGBA_PVRTC_4BPPV1_Format:Xb,RGBA_S3TC_DXT1_Format:Vb,RGBA_S3TC_DXT3_Format:jb,RGBA_S3TC_DXT5_Format:Hb,RGBDepthPacking:3202,RGBFormat:Pb,RGBIntegerFormat:1032,RGB_BPTC_SIGNED_Format:gx,RGB_BPTC_UNSIGNED_Format:vx,RGB_ETC1_Format:$b,RGB_ETC2_Format:Yb,RGB_PVRTC_2BPPV1_Format:Gb,RGB_PVRTC_4BPPV1_Format:Wb,RGB_S3TC_DXT1_Format:Bb,RGDepthPacking:3203,RGFormat:Ub,RGIntegerFormat:Fb,RawShaderMaterial:NA,Ray:gw,Raycaster:Sk,RectAreaLight:LC,RedFormat:Ob,RedIntegerFormat:Db,ReinhardToneMapping:2,RenderTarget:B_,RenderTarget3D:class extends B_{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isRenderTarget3D=!0,this.depth=n,this.texture=new H_(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}},RepeatWrapping:lb,ReplaceStencilOp:7681,ReverseSubtractEquation:102,RingGeometry:SA,SIGNED_R11_EAC_Format:Kb,SIGNED_RED_GREEN_RGTC2_Format:_x,SIGNED_RED_RGTC1_Format:bx,SIGNED_RG11_EAC_Format:ex,SRGBColorSpace:Px,SRGBTransfer:Nx,Scene:hM,ShaderChunk:iR,ShaderLib:aR,ShaderMaterial:JS,ShadowMaterial:LA,Shape:BT,ShapeGeometry:MA,ShapePath:class{constructor(){this.type="ShapePath",this.color=new cS,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new zT,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,i,o){return this.currentPath.bezierCurveTo(e,t,n,r,i,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(e,t){const n=t.length;let r=!1;for(let i=n-1,o=0;o<n;i=o++){let n=t[i],a=t[o],s=a.x-n.x,l=a.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=t[o],s=-s,a=t[i],l=-l),e.y<n.y||e.y>a.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{const t=l*(e.x-n.x)-s*(e.y-n.y);if(0===t)return!0;if(t<0)continue;r=!r}}else{if(e.y!==n.y)continue;if(a.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=a.x)return!0}}return r}const n=fA.isClockWise,r=this.subPaths;if(0===r.length)return[];let i,o,a;const s=[];if(1===r.length)return o=r[0],a=new BT,a.curves=o.curves,s.push(a),s;let l=!n(r[0].getPoints());l=e?!l:l;const c=[],u=[];let d,h,p=[],f=0;u[f]=void 0,p[f]=[];for(let m=0,g=r.length;m<g;m++)o=r[m],d=o.getPoints(),i=n(d),i=e?!i:i,i?(!l&&u[f]&&f++,u[f]={s:new BT,p:d},u[f].s.curves=o.curves,l&&f++,p[f]=[]):p[f].push({h:o,p:d[0]});if(!u[0])return function(e){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n],i=new BT;i.curves=r.curves,t.push(i)}return t}(r);if(u.length>1){let e=!1,n=0;for(let t=0,r=u.length;t<r;t++)c[t]=[];for(let r=0,i=u.length;r<i;r++){const i=p[r];for(let o=0;o<i.length;o++){const a=i[o];let s=!0;for(let i=0;i<u.length;i++)t(a.p,u[i].p)&&(r!==i&&n++,s?(s=!1,c[i].push(a)):e=!0);s&&c[r].push(a)}}n>0&&!1===e&&(p=c)}for(let m=0,g=u.length;m<g;m++){a=u[m].s,s.push(a),h=p[m];for(let e=0,t=h.length;e<t;e++)a.holes.push(h[e].h)}return s}},ShapeUtils:fA,ShortType:bb,Skeleton:YM,SkeletonHelper:class extends qE{constructor(e){const t=Bk(e),n=new IS,r=[],i=[];for(let s=0;s<t.length;s++){const e=t[s];e.parent&&e.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(0,0,0),i.push(0,0,0))}n.setAttribute("position",new MS(r,3)),n.setAttribute("color",new MS(i,3));super(n,new OE({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const o=new cS(255),a=new cS(65280);this.setColors(o,a)}updateMatrixWorld(e){const t=this.bones,n=this.geometry,r=n.getAttribute("position");zk.copy(this.root.matrixWorld).invert();for(let i=0,o=0;i<t.length;i++){const e=t[i];e.parent&&e.parent.isBone&&(Fk.multiplyMatrices(zk,e.matrixWorld),Uk.setFromMatrixPosition(Fk),r.setXYZ(o,Uk.x,Uk.y,Uk.z),Fk.multiplyMatrices(zk,e.parent.matrixWorld),Uk.setFromMatrixPosition(Fk),r.setXYZ(o+1,Uk.x,Uk.y,Uk.z),o+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){const n=this.geometry.getAttribute("color");for(let r=0;r<n.count;r+=2)n.setXYZ(r,e.r,e.g,e.b),n.setXYZ(r+1,t.r,t.g,t.b);return n.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},SkinnedMesh:WM,Source:N_,Sphere:lw,SphereGeometry:EA,Spherical:class{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){const e=1e-6;return this.phi=h_(this.phi,e,Math.PI-e),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(h_(t/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}},SphericalHarmonics3:NC,SplineCurve:DT,SpotLight:TC,SpotLightHelper:class extends Ww{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new IS,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,s=32;o<s;o++,a++){const e=o/s*Math.PI*2,t=a/s*Math.PI*2;r.push(Math.cos(e),Math.sin(e),1,Math.cos(t),Math.sin(t),1)}n.setAttribute("position",new MS(r,3));const i=new OE({fog:!1,toneMapped:!1});this.cone=new qE(n,i),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Dk.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Dk),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},Sprite:RM,SpriteMaterial:gM,SrcAlphaFactor:Ey,SrcAlphaSaturateFactor:210,SrcColorFactor:202,StaticCopyUsage:35046,StaticDrawUsage:Wx,StaticReadUsage:35045,StereoCamera:class{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new nM,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new nM,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,YC.copy(e.projectionMatrix);const n=t.eyeSep/2,r=n*t.near/t.focus,i=t.near*Math.tan(c_*t.fov*.5)/t.zoom;let o,a;$C.elements[12]=-n,qC.elements[12]=n,o=-i*t.aspect+r,a=i*t.aspect+r,YC.elements[0]=2*t.near/(a-o),YC.elements[8]=(a+o)/(a-o),this.cameraL.projectionMatrix.copy(YC),o=-i*t.aspect-r,a=i*t.aspect-r,YC.elements[0]=2*t.near/(a-o),YC.elements[8]=(a+o)/(a-o),this.cameraR.projectionMatrix.copy(YC)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply($C),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(qC)}},StreamCopyUsage:35042,StreamDrawUsage:35040,StreamReadUsage:35041,StringKeyframeTrack:oC,SubtractEquation:101,SubtractiveBlending:3,TOUCH:{ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},TangentSpaceNormalMap:0,TetrahedronGeometry:TA,Texture:F_,TextureLoader:yC,TextureUtils:class{static contain(e,t){return function(e,t){const n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2):(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0),e}(e,t)}static cover(e,t){return function(e,t){const n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0):(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2),e}(e,t)}static fill(e){return function(e){return e.repeat.x=1,e.repeat.y=1,e.offset.x=0,e.offset.y=0,e}(e)}static getByteLength(e,t,n,r){return tR(e,t,n,r)}},Timer:class{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,void 0!==e.hidden&&(this._pageVisibilityHandler=Tk.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){null!==this._pageVisibilityHandler&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return null!==this._pageVisibilityHandler&&!0===this._document.hidden?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(void 0!==e?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}},TimestampQuery:{COMPUTE:"compute",RENDER:"render"},TorusGeometry:AA,TorusKnotGeometry:CA,Triangle:iS,TriangleFanDrawMode:2,TriangleStripDrawMode:1,TrianglesDrawMode:0,TubeGeometry:kA,UVMapping:nb,Uint16BufferAttribute:wS,Uint32BufferAttribute:SS,Uint8BufferAttribute:class extends _S{constructor(e,t,n){super(new Uint8Array(e),t,n)}},Uint8ClampedBufferAttribute:class extends _S{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}},Uniform:bk,UniformsGroup:class extends a_{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:xk++}),this.name="",this.usage=Wx,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return-1!==t&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,r=t.length;n<r;n++){const e=Array.isArray(t[n])?t[n]:[t[n]];for(let t=0;t<e.length;t++)this.uniforms.push(e[t].clone())}return this}clone(){return(new this.constructor).copy(this)}},UniformsLib:oR,UniformsUtils:ZS,UnsignedByteType:vb,UnsignedInt101111Type:kb,UnsignedInt248Type:Ab,UnsignedInt5999Type:Cb,UnsignedIntType:wb,UnsignedShort4444Type:Eb,UnsignedShort5551Type:Tb,UnsignedShortType:xb,VSMShadowMap:3,Vector2:y_,Vector3:x_,Vector4:z_,VectorKeyframeTrack:aC,VideoFrameTexture:class extends nT{constructor(e,t,n,r,i,o,a,s){super({},e,t,n,r,i,o,a,s),this.isVideoFrameTexture=!0}update(){}clone(){return(new this.constructor).copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}},VideoTexture:nT,WebGL3DRenderTarget:class extends V_{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new H_(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}},WebGLArrayRenderTarget:class extends V_{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new j_(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}},WebGLCoordinateSystem:Xx,WebGLCubeRenderTarget:aM,WebGLRenderTarget:V_,WebGLRenderer:YI,WebGLUtils:BI,WebGPUCoordinateSystem:qx,WebXRController:cM,WireframeGeometry:RA,WrapAroundEnding:Ax,ZeroCurvatureEnding:Ex,ZeroFactor:200,ZeroSlopeEnding:Tx,ZeroStencilOp:0,createCanvasElement:Qx,error:i_,getConsoleFunction:function(){return t_},log:n_,setConsoleFunction:function(e){t_=e},warn:r_,warnOnce:o_},Symbol.toStringTag,{value:"Module"}));var JI,KI,QI={exports:{}},eL={};var tL=(KI||(KI=1,QI.exports=(JI||(JI=1,eL.ConcurrentRoot=1,eL.ContinuousEventPriority=4,eL.DefaultEventPriority=16,eL.DiscreteEventPriority=1,eL.IdleEventPriority=536870912,eL.LegacyRoot=0),eL)),QI.exports);function nL(e){let t;const n=new Set,r=(e,r)=>{const i="function"==typeof e?e(t):e;if(i!==t){const e=t;t=r?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,o={setState:r,getState:i,subscribe:(e,r,o)=>r||o?((e,r=i,o=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let a=r(t);function s(){const n=r(t);if(!o(a,n)){const t=a;e(a=n,t)}}return n.add(s),()=>n.delete(s)})(e,r,o):(n.add(e),()=>n.delete(e)),destroy:()=>n.clear()};return t=e(r,i,o),o}const rL="undefined"==typeof window||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent)?w.useEffect:w.useLayoutEffect;var iL,oL,aL,sL,lL,cL={exports:{}},uL={exports:{}},dL={};function hL(){return oL||(oL=1,uL.exports=(iL||(iL=1,function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<i(o,t)))break e;e[r]=t,e[n]=o,n=r}}function n(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,a=o>>>1;r<a;){var s=2*(r+1)-1,l=e[s],c=s+1,u=e[c];if(0>i(l,n))c<o&&0>i(u,l)?(e[r]=u,e[c]=n,r=c):(e[r]=l,e[s]=n,r=s);else{if(!(c<o&&0>i(u,n)))break e;e[r]=u,e[c]=n,r=c}}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,s=a.now();e.unstable_now=function(){return a.now()-s}}var l=[],c=[],u=1,d=null,h=3,p=!1,f=!1,m=!1,g="function"==typeof setTimeout?setTimeout:null,v="function"==typeof clearTimeout?clearTimeout:null,y="undefined"!=typeof setImmediate?setImmediate:null;function b(e){for(var i=n(c);null!==i;){if(null===i.callback)r(c);else{if(!(i.startTime<=e))break;r(c),i.sortIndex=i.expirationTime,t(l,i)}i=n(c)}}function x(e){if(m=!1,b(e),!f)if(null!==n(l))f=!0,I(_);else{var t=n(c);null!==t&&L(x,t.startTime-e)}}function _(t,i){f=!1,m&&(m=!1,v(E),E=-1),p=!0;var o=h;try{for(b(i),d=n(l);null!==d&&(!(d.expirationTime>i)||t&&!C());){var a=d.callback;if("function"==typeof a){d.callback=null,h=d.priorityLevel;var s=a(d.expirationTime<=i);i=e.unstable_now(),"function"==typeof s?d.callback=s:d===n(l)&&r(l),b(i)}else r(l);d=n(l)}if(null!==d)var u=!0;else{var g=n(c);null!==g&&L(x,g.startTime-i),u=!1}return u}finally{d=null,h=o,p=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var w,S=!1,M=null,E=-1,T=5,A=-1;function C(){return!(e.unstable_now()-A<T)}function k(){if(null!==M){var t=e.unstable_now();A=t;var n=!0;try{n=M(!0,t)}finally{n?w():(S=!1,M=null)}}else S=!1}if("function"==typeof y)w=function(){y(k)};else if("undefined"!=typeof MessageChannel){var R=new MessageChannel,P=R.port2;R.port1.onmessage=k,w=function(){P.postMessage(null)}}else w=function(){g(k,0)};function I(e){M=e,S||(S=!0,w())}function L(t,n){E=g(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){f||p||(f=!0,I(_))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(e){switch(h){case 1:case 2:case 3:var t=3;break;default:t=h}var n=h;h=t;try{return e()}finally{h=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=h;h=e;try{return t()}finally{h=n}},e.unstable_scheduleCallback=function(r,i,o){var a=e.unstable_now();switch(o="object"==typeof o&&null!==o&&"number"==typeof(o=o.delay)&&0<o?a+o:a,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return r={id:u++,callback:i,priorityLevel:r,startTime:o,expirationTime:s=o+s,sortIndex:-1},o>a?(r.sortIndex=o,t(c,r),null===n(l)&&r===n(c)&&(m?(v(E),E=-1):m=!0,L(x,o-a))):(r.sortIndex=s,t(l,r),f||p||(f=!0,I(_))),r},e.unstable_shouldYield=C,e.unstable_wrapCallback=function(e){var t=h;return function(){var n=h;h=t;try{return e.apply(this,arguments)}finally{h=n}}}}(dL)),dL)),uL.exports}function pL(){return sL||(sL=1,aL=function(e){var t={},n=u(),r=hL(),i=Object.assign;function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var a=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,s=Symbol.for("react.element"),l=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),p=Symbol.for("react.provider"),f=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),_=Symbol.iterator;function w(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=_&&e[_]||e["@@iterator"])?e:null}function S(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case c:return"Fragment";case l:return"Portal";case h:return"Profiler";case d:return"StrictMode";case g:return"Suspense";case v:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case f:return(e.displayName||"Context")+".Consumer";case p:return(e._context.displayName||"Context")+".Provider";case m:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case y:return null!==(t=e.displayName||null)?t:S(e.type)||"Memo";case b:t=e._payload,e=e._init;try{return S(e(t))}catch(n){}}return null}function M(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return S(t);case 8:return t===d?"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("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}function E(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function T(e){if(E(e)!==e)throw Error(o(188))}function A(e){var t=e.alternate;if(!t){if(null===(t=E(e)))throw Error(o(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var a=i.alternate;if(null===a){if(null!==(r=i.return)){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return T(i),e;if(a===r)return T(i),t;a=a.sibling}throw Error(o(188))}if(n.return!==r.return)n=i,r=a;else{for(var s=!1,l=i.child;l;){if(l===n){s=!0,n=i,r=a;break}if(l===r){s=!0,r=i,n=a;break}l=l.sibling}if(!s){for(l=a.child;l;){if(l===n){s=!0,n=a,r=i;break}if(l===r){s=!0,r=a,n=i;break}l=l.sibling}if(!s)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(3!==n.tag)throw Error(o(188));return n.stateNode.current===n?e:t}function C(e){return null!==(e=A(e))?k(e):null}function k(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=k(e);if(null!==t)return t;e=e.sibling}return null}function R(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){if(4!==e.tag){var t=R(e);if(null!==t)return t}e=e.sibling}return null}var P,I=Array.isArray,L=e.getPublicInstance,N=e.getRootHostContext,O=e.getChildHostContext,D=e.prepareForCommit,U=e.resetAfterCommit,F=e.createInstance,z=e.appendInitialChild,B=e.finalizeInitialChildren,V=e.prepareUpdate,j=e.shouldSetTextContent,H=e.createTextInstance,W=e.scheduleTimeout,G=e.cancelTimeout,X=e.noTimeout,q=e.isPrimaryRenderer,$=e.supportsMutation,Y=e.supportsPersistence,Z=e.supportsHydration,J=e.getInstanceFromNode,K=e.preparePortalMount,Q=e.getCurrentEventPriority,ee=e.detachDeletedInstance,te=e.supportsMicrotasks,ne=e.scheduleMicrotask,re=e.supportsTestSelectors,ie=e.findFiberRoot,oe=e.getBoundingRect,ae=e.getTextContent,se=e.isHiddenSubtree,le=e.matchAccessibilityRole,ce=e.setFocusIfFocusable,ue=e.setupIntersectionObserver,de=e.appendChild,he=e.appendChildToContainer,pe=e.commitTextUpdate,fe=e.commitMount,me=e.commitUpdate,ge=e.insertBefore,ve=e.insertInContainerBefore,ye=e.removeChild,be=e.removeChildFromContainer,xe=e.resetTextContent,_e=e.hideInstance,we=e.hideTextInstance,Se=e.unhideInstance,Me=e.unhideTextInstance,Ee=e.clearContainer,Te=e.cloneInstance,Ae=e.createContainerChildSet,Ce=e.appendChildToContainerChildSet,ke=e.finalizeContainerChildren,Re=e.replaceContainerChildren,Pe=e.cloneHiddenInstance,Ie=e.cloneHiddenTextInstance,Le=e.canHydrateInstance,Ne=e.canHydrateTextInstance,Oe=e.canHydrateSuspenseInstance,De=e.isSuspenseInstancePending,Ue=e.isSuspenseInstanceFallback,Fe=e.registerSuspenseInstanceRetry,ze=e.getNextHydratableSibling,Be=e.getFirstHydratableChild,Ve=e.getFirstHydratableChildWithinContainer,je=e.getFirstHydratableChildWithinSuspenseInstance,He=e.hydrateInstance,We=e.hydrateTextInstance,Ge=e.hydrateSuspenseInstance,Xe=e.getNextHydratableInstanceAfterSuspenseInstance,qe=e.commitHydratedContainer,$e=e.commitHydratedSuspenseInstance,Ye=e.clearSuspenseBoundary,Ze=e.clearSuspenseBoundaryFromContainer,Je=e.shouldDeleteUnhydratedTailInstances,Ke=e.didNotMatchHydratedContainerTextInstance,Qe=e.didNotMatchHydratedTextInstance;function et(e){if(void 0===P)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);P=t&&t[1]||""}return"\n"+P+e}var tt=!1;function nt(e,t){if(!e||tt)return"";tt=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&"string"==typeof c.stack){for(var i=c.stack.split("\n"),o=r.stack.split("\n"),a=i.length-1,s=o.length-1;1<=a&&0<=s&&i[a]!==o[s];)s--;for(;1<=a&&0<=s;a--,s--)if(i[a]!==o[s]){if(1!==a||1!==s)do{if(a--,0>--s||i[a]!==o[s]){var l="\n"+i[a].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}}while(1<=a&&0<=s);break}}}finally{tt=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?et(e):""}var rt=Object.prototype.hasOwnProperty,it=[],ot=-1;function at(e){return{current:e}}function st(e){0>ot||(e.current=it[ot],it[ot]=null,ot--)}function lt(e,t){ot++,it[ot]=e.current,e.current=t}var ct={},ut=at(ct),dt=at(!1),ht=ct;function pt(e,t){var n=e.type.contextTypes;if(!n)return ct;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in n)o[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function ft(e){return null!=(e=e.childContextTypes)}function mt(){st(dt),st(ut)}function gt(e,t,n){if(ut.current!==ct)throw Error(o(168));lt(ut,t),lt(dt,n)}function vt(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var a in r=r.getChildContext())if(!(a in t))throw Error(o(108,M(e)||"Unknown",a));return i({},n,r)}function yt(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ct,ht=ut.current,lt(ut,e),lt(dt,dt.current),!0}function bt(e,t,n){var r=e.stateNode;if(!r)throw Error(o(169));n?(e=vt(e,t,ht),r.__reactInternalMemoizedMergedChildContext=e,st(dt),st(ut),lt(ut,e)):st(dt),lt(dt,n)}var xt=Math.clz32?Math.clz32:function(e){return 0===(e>>>=0)?32:31-(_t(e)/wt|0)|0},_t=Math.log,wt=Math.LN2;var St=64,Mt=4194304;function Et(e){switch(e&-e){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 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Tt(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,a=268435455&n;if(0!==a){var s=a&~i;0!==s?r=Et(s):0!==(o&=a)&&(r=Et(o))}else 0!==(a=n&~i)?r=Et(a):0!==o&&(r=Et(o));if(0===r)return 0;if(0!==t&&t!==r&&0===(t&i)&&((i=r&-r)>=(o=t&-t)||16===i&&4194240&o))return t;if(4&r&&(r|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)i=1<<(n=31-xt(t)),r|=e[n],t&=~i;return r}function At(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 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 t+5e3;default:return-1}}function Ct(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function kt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Rt(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-xt(t)]=n}function Pt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-xt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var It=0;function Lt(e){return 1<(e&=-e)?4<e?268435455&e?16:536870912:4:1}var Nt=r.unstable_scheduleCallback,Ot=r.unstable_cancelCallback,Dt=r.unstable_shouldYield,Ut=r.unstable_requestPaint,Ft=r.unstable_now,zt=r.unstable_ImmediatePriority,Bt=r.unstable_UserBlockingPriority,Vt=r.unstable_NormalPriority,jt=r.unstable_IdlePriority,Ht=null,Wt=null;var Gt="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},Xt=null,qt=!1,$t=!1;function Yt(e){null===Xt?Xt=[e]:Xt.push(e)}function Zt(){if(!$t&&null!==Xt){$t=!0;var e=0,t=It;try{var n=Xt;for(It=1;e<n.length;e++){var r=n[e];do{r=r(!0)}while(null!==r)}Xt=null,qt=!1}catch(Dv){throw null!==Xt&&(Xt=Xt.slice(e+1)),Nt(zt,Zt),Dv}finally{It=t,$t=!1}}return null}var Jt=a.ReactCurrentBatchConfig;function Kt(e,t){if(Gt(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!rt.call(t,i)||!Gt(e[i],t[i]))return!1}return!0}function Qt(e){switch(e.tag){case 5:return et(e.type);case 16:return et("Lazy");case 13:return et("Suspense");case 19:return et("SuspenseList");case 0:case 2:case 15:return e=nt(e.type,!1);case 11:return e=nt(e.type.render,!1);case 1:return e=nt(e.type,!0);default:return""}}function en(e,t){if(e&&e.defaultProps){for(var n in t=i({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}var tn=at(null),nn=null,rn=null,on=null;function an(){on=rn=nn=null}function sn(e,t,n){q?(lt(tn,t._currentValue),t._currentValue=n):(lt(tn,t._currentValue2),t._currentValue2=n)}function ln(e){var t=tn.current;st(tn),q?e._currentValue=t:e._currentValue2=t}function cn(e,t,n){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==r&&(r.childLanes|=t)):null!==r&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function un(e,t){nn=e,on=rn=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(Di=!0),e.firstContext=null)}function dn(e){var t=q?e._currentValue:e._currentValue2;if(on!==e)if(e={context:e,memoizedValue:t,next:null},null===rn){if(null===nn)throw Error(o(308));rn=e,nn.dependencies={lanes:0,firstContext:e}}else rn=rn.next=e;return t}var hn=null,pn=!1;function fn(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function mn(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function gn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function vn(e,t){var n=e.updateQueue;null!==n&&(n=n.shared,null!==Yo&&1&e.mode&&!(2&$o)?(null===(e=n.interleaved)?(t.next=t,null===hn?hn=[n]:hn.push(n)):(t.next=e.next,e.next=t),n.interleaved=t):(null===(e=n.pending)?t.next=t:(t.next=e.next,e.next=t),n.pending=t))}function yn(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,4194240&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,Pt(e,n)}}function bn(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var i=null,o=null;if(null!==(n=n.firstBaseUpdate)){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===o?i=o=a:o=o.next=a,n=n.next}while(null!==n);null===o?i=o=t:o=o.next=t}else i=o=t;return n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function xn(e,t,n,r){var o=e.updateQueue;pn=!1;var a=o.firstBaseUpdate,s=o.lastBaseUpdate,l=o.shared.pending;if(null!==l){o.shared.pending=null;var c=l,u=c.next;c.next=null,null===s?a=u:s.next=u,s=c;var d=e.alternate;null!==d&&((l=(d=d.updateQueue).lastBaseUpdate)!==s&&(null===l?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(null!==a){var h=o.baseState;for(s=0,d=u=c=null,l=a;;){var p=l.lane,f=l.eventTime;if((r&p)===p){null!==d&&(d=d.next={eventTime:f,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=e,g=l;switch(p=t,f=n,g.tag){case 1:if("function"==typeof(m=g.payload)){h=m.call(f,h,p);break e}h=m;break e;case 3:m.flags=-65537&m.flags|128;case 0:if(null==(p="function"==typeof(m=g.payload)?m.call(f,h,p):m))break e;h=i({},h,p);break e;case 2:pn=!0}}null!==l.callback&&0!==l.lane&&(e.flags|=64,null===(p=o.effects)?o.effects=[l]:p.push(l))}else f={eventTime:f,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},null===d?(u=d=f,c=h):d=d.next=f,s|=p;if(null===(l=l.next)){if(null===(l=o.shared.pending))break;l=(p=l).next,p.next=null,o.lastBaseUpdate=p,o.shared.pending=null}}if(null===d&&(c=h),o.baseState=c,o.firstBaseUpdate=u,o.lastBaseUpdate=d,null!==(t=o.shared.interleaved)){o=t;do{s|=o.lane,o=o.next}while(o!==t)}else null===a&&(o.shared.lanes=0);na|=s,e.lanes=s,e.memoizedState=h}}function _n(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(null!==i){if(r.callback=null,r=n,"function"!=typeof i)throw Error(o(191,i));i.call(r)}}}var wn=(new n.Component).refs;function Sn(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:i({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var Mn={isMounted:function(e){return!!(e=e._reactInternals)&&E(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=_a(),i=wa(e),o=gn(r,i);o.payload=t,null!=n&&(o.callback=n),vn(e,o),null!==(t=Sa(e,i,r))&&yn(t,e,i)},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=_a(),i=wa(e),o=gn(r,i);o.tag=1,o.payload=t,null!=n&&(o.callback=n),vn(e,o),null!==(t=Sa(e,i,r))&&yn(t,e,i)},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=_a(),r=wa(e),i=gn(n,r);i.tag=2,null!=t&&(i.callback=t),vn(e,i),null!==(t=Sa(e,r,n))&&yn(t,e,r)}};function En(e,t,n,r,i,o,a){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,o,a):!t.prototype||!t.prototype.isPureReactComponent||(!Kt(n,r)||!Kt(i,o))}function Tn(e,t,n){var r=!1,i=ct,o=t.contextType;return"object"==typeof o&&null!==o?o=dn(o):(i=ft(t)?ht:ut.current,o=(r=null!=(r=t.contextTypes))?pt(e,i):ct),t=new t(n,o),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=Mn,e.stateNode=t,t._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=o),t}function An(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Mn.enqueueReplaceState(t,t.state,null)}function Cn(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs=wn,fn(e);var o=t.contextType;"object"==typeof o&&null!==o?i.context=dn(o):(o=ft(t)?ht:ut.current,i.context=pt(e,o)),i.state=e.memoizedState,"function"==typeof(o=t.getDerivedStateFromProps)&&(Sn(e,t,o,n),i.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof i.getSnapshotBeforeUpdate||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||(t=i.state,"function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),t!==i.state&&Mn.enqueueReplaceState(i,i.state,null),xn(e,n,i,r),i.state=e.memoizedState),"function"==typeof i.componentDidMount&&(e.flags|=4194308)}var kn=[],Rn=0,Pn=null,In=0,Ln=[],Nn=0,On=null,Dn=1,Un="";function Fn(e,t){kn[Rn++]=In,kn[Rn++]=Pn,Pn=e,In=t}function zn(e,t,n){Ln[Nn++]=Dn,Ln[Nn++]=Un,Ln[Nn++]=On,On=e;var r=Dn;e=Un;var i=32-xt(r)-1;r&=~(1<<i),n+=1;var o=32-xt(t)+i;if(30<o){var a=i-i%5;o=(r&(1<<a)-1).toString(32),r>>=a,i-=a,Dn=1<<32-xt(t)+i|n<<i|r,Un=o+e}else Dn=1<<o|n<<i|r,Un=e}function Bn(e){null!==e.return&&(Fn(e,1),zn(e,1,0))}function Vn(e){for(;e===Pn;)Pn=kn[--Rn],kn[Rn]=null,In=kn[--Rn],kn[Rn]=null;for(;e===On;)On=Ln[--Nn],Ln[Nn]=null,Un=Ln[--Nn],Ln[Nn]=null,Dn=Ln[--Nn],Ln[Nn]=null}var jn=null,Hn=null,Wn=!1,Gn=!1,Xn=null;function qn(e,t){var n=Ka(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,null===(t=e.deletions)?(e.deletions=[n],e.flags|=16):t.push(n)}function $n(e,t){switch(e.tag){case 5:return null!==(t=Le(t,e.type,e.pendingProps))&&(e.stateNode=t,jn=e,Hn=Be(t),!0);case 6:return null!==(t=Ne(t,e.pendingProps))&&(e.stateNode=t,jn=e,Hn=null,!0);case 13:if(null!==(t=Oe(t))){var n=null!==On?{id:Dn,overflow:Un}:null;return e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},(n=Ka(18,null,null,0)).stateNode=t,n.return=e,e.child=n,jn=e,Hn=null,!0}return!1;default:return!1}}function Yn(e){return!(!(1&e.mode)||128&e.flags)}function Zn(e){if(Wn){var t=Hn;if(t){var n=t;if(!$n(e,t)){if(Yn(e))throw Error(o(418));t=ze(n);var r=jn;t&&$n(e,t)?qn(r,n):(e.flags=-4097&e.flags|2,Wn=!1,jn=e)}}else{if(Yn(e))throw Error(o(418));e.flags=-4097&e.flags|2,Wn=!1,jn=e}}}function Jn(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;jn=e}function Kn(e){if(!Z||e!==jn)return!1;if(!Wn)return Jn(e),Wn=!0,!1;if(3!==e.tag&&(5!==e.tag||Je(e.type)&&!j(e.type,e.memoizedProps))){var t=Hn;if(t){if(Yn(e)){for(e=Hn;e;)e=ze(e);throw Error(o(418))}for(;t;)qn(e,t),t=ze(t)}}if(Jn(e),13===e.tag){if(!Z)throw Error(o(316));if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(o(317));Hn=Xe(e)}else Hn=jn?ze(e.stateNode):null;return!0}function Qn(){Z&&(Hn=jn=null,Gn=Wn=!1)}function er(e){null===Xn?Xn=[e]:Xn.push(e)}function tr(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!=typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(o(309));var r=n.stateNode}if(!r)throw Error(o(147,e));var i=r,a=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===a?t.ref:((t=function(e){var t=i.refs;t===wn&&(t=i.refs={}),null===e?delete t[a]:t[a]=e})._stringRef=a,t)}if("string"!=typeof e)throw Error(o(284));if(!n._owner)throw Error(o(290,e))}return e}function nr(e,t){throw e=Object.prototype.toString.call(t),Error(o(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function rr(e){return(0,e._init)(e._payload)}function ir(e){function t(t,n){if(e){var r=t.deletions;null===r?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function i(e,t){return(e=es(e,t)).index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags|=2,n):r:(t.flags|=2,n):(t.flags|=1048576,n)}function u(t){return e&&null===t.alternate&&(t.flags|=2),t}function d(e,t,n,r){return null===t||6!==t.tag?((t=is(n,e.mode,r)).return=e,t):((t=i(t,n)).return=e,t)}function h(e,t,n,r){var o=n.type;return o===c?f(e,t,n.props.children,r,n.key):null!==t&&(t.elementType===o||"object"==typeof o&&null!==o&&o.$$typeof===b&&rr(o)===t.type)?((r=i(t,n.props)).ref=tr(e,t,n),r.return=e,r):((r=ts(n.type,n.key,n.props,null,e.mode,r)).ref=tr(e,t,n),r.return=e,r)}function p(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=os(n,e.mode,r)).return=e,t):((t=i(t,n.children||[])).return=e,t)}function f(e,t,n,r,o){return null===t||7!==t.tag?((t=ns(n,e.mode,r,o)).return=e,t):((t=i(t,n)).return=e,t)}function m(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t)return(t=is(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case s:return(n=ts(t.type,t.key,t.props,null,e.mode,n)).ref=tr(e,null,t),n.return=e,n;case l:return(t=os(t,e.mode,n)).return=e,t;case b:return m(e,(0,t._init)(t._payload),n)}if(I(t)||w(t))return(t=ns(t,e.mode,n,null)).return=e,t;nr(e,t)}return null}function g(e,t,n,r){var i=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n)return null!==i?null:d(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case s:return n.key===i?h(e,t,n,r):null;case l:return n.key===i?p(e,t,n,r):null;case b:return g(e,t,(i=n._init)(n._payload),r)}if(I(n)||w(n))return null!==i?null:f(e,t,n,r,null);nr(e,n)}return null}function v(e,t,n,r,i){if("string"==typeof r&&""!==r||"number"==typeof r)return d(t,e=e.get(n)||null,""+r,i);if("object"==typeof r&&null!==r){switch(r.$$typeof){case s:return h(t,e=e.get(null===r.key?n:r.key)||null,r,i);case l:return p(t,e=e.get(null===r.key?n:r.key)||null,r,i);case b:return v(e,t,n,(0,r._init)(r._payload),i)}if(I(r)||w(r))return f(t,e=e.get(n)||null,r,i,null);nr(t,r)}return null}return function d(h,p,f,y){if("object"==typeof f&&null!==f&&f.type===c&&null===f.key&&(f=f.props.children),"object"==typeof f&&null!==f){switch(f.$$typeof){case s:e:{for(var x=f.key,_=p;null!==_;){if(_.key===x){if((x=f.type)===c){if(7===_.tag){n(h,_.sibling),(p=i(_,f.props.children)).return=h,h=p;break e}}else if(_.elementType===x||"object"==typeof x&&null!==x&&x.$$typeof===b&&rr(x)===_.type){n(h,_.sibling),(p=i(_,f.props)).ref=tr(h,_,f),p.return=h,h=p;break e}n(h,_);break}t(h,_),_=_.sibling}f.type===c?((p=ns(f.props.children,h.mode,y,f.key)).return=h,h=p):((y=ts(f.type,f.key,f.props,null,h.mode,y)).ref=tr(h,p,f),y.return=h,h=y)}return u(h);case l:e:{for(_=f.key;null!==p;){if(p.key===_){if(4===p.tag&&p.stateNode.containerInfo===f.containerInfo&&p.stateNode.implementation===f.implementation){n(h,p.sibling),(p=i(p,f.children||[])).return=h,h=p;break e}n(h,p);break}t(h,p),p=p.sibling}(p=os(f,h.mode,y)).return=h,h=p}return u(h);case b:return d(h,p,(_=f._init)(f._payload),y)}if(I(f))return function(i,o,s,l){for(var c=null,u=null,d=o,h=o=0,p=null;null!==d&&h<s.length;h++){d.index>h?(p=d,d=null):p=d.sibling;var f=g(i,d,s[h],l);if(null===f){null===d&&(d=p);break}e&&d&&null===f.alternate&&t(i,d),o=a(f,o,h),null===u?c=f:u.sibling=f,u=f,d=p}if(h===s.length)return n(i,d),Wn&&Fn(i,h),c;if(null===d){for(;h<s.length;h++)null!==(d=m(i,s[h],l))&&(o=a(d,o,h),null===u?c=d:u.sibling=d,u=d);return Wn&&Fn(i,h),c}for(d=r(i,d);h<s.length;h++)null!==(p=v(d,i,h,s[h],l))&&(e&&null!==p.alternate&&d.delete(null===p.key?h:p.key),o=a(p,o,h),null===u?c=p:u.sibling=p,u=p);return e&&d.forEach(function(e){return t(i,e)}),Wn&&Fn(i,h),c}(h,p,f,y);if(w(f))return function(i,s,l,c){var u=w(l);if("function"!=typeof u)throw Error(o(150));if(null==(l=u.call(l)))throw Error(o(151));for(var d=u=null,h=s,p=s=0,f=null,y=l.next();null!==h&&!y.done;p++,y=l.next()){h.index>p?(f=h,h=null):f=h.sibling;var b=g(i,h,y.value,c);if(null===b){null===h&&(h=f);break}e&&h&&null===b.alternate&&t(i,h),s=a(b,s,p),null===d?u=b:d.sibling=b,d=b,h=f}if(y.done)return n(i,h),Wn&&Fn(i,p),u;if(null===h){for(;!y.done;p++,y=l.next())null!==(y=m(i,y.value,c))&&(s=a(y,s,p),null===d?u=y:d.sibling=y,d=y);return Wn&&Fn(i,p),u}for(h=r(i,h);!y.done;p++,y=l.next())null!==(y=v(h,i,p,y.value,c))&&(e&&null!==y.alternate&&h.delete(null===y.key?p:y.key),s=a(y,s,p),null===d?u=y:d.sibling=y,d=y);return e&&h.forEach(function(e){return t(i,e)}),Wn&&Fn(i,p),u}(h,p,f,y);nr(h,f)}return"string"==typeof f&&""!==f||"number"==typeof f?(f=""+f,null!==p&&6===p.tag?(n(h,p.sibling),(p=i(p,f)).return=h,h=p):(n(h,p),(p=is(f,h.mode,y)).return=h,h=p),u(h)):n(h,p)}}var or=ir(!0),ar=ir(!1),sr={},lr=at(sr),cr=at(sr),ur=at(sr);function dr(e){if(e===sr)throw Error(o(174));return e}function hr(e,t){lt(ur,t),lt(cr,e),lt(lr,sr),e=N(t),st(lr),lt(lr,e)}function pr(){st(lr),st(cr),st(ur)}function fr(e){var t=dr(ur.current),n=dr(lr.current);n!==(t=O(n,e.type,t))&&(lt(cr,e),lt(lr,t))}function mr(e){cr.current===e&&(st(lr),st(cr))}var gr=at(0);function vr(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||De(n)||Ue(n)))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(128&t.flags)return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var yr=[];function br(){for(var e=0;e<yr.length;e++){var t=yr[e];q?t._workInProgressVersionPrimary=null:t._workInProgressVersionSecondary=null}yr.length=0}var xr=a.ReactCurrentDispatcher,_r=a.ReactCurrentBatchConfig,wr=0,Sr=null,Mr=null,Er=null,Tr=!1,Ar=!1,Cr=0,kr=0;function Rr(){throw Error(o(321))}function Pr(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Gt(e[n],t[n]))return!1;return!0}function Ir(e,t,n,r,i,a){if(wr=a,Sr=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,xr.current=null===e||null===e.memoizedState?fi:mi,e=n(r,i),Ar){a=0;do{if(Ar=!1,Cr=0,25<=a)throw Error(o(301));a+=1,Er=Mr=null,t.updateQueue=null,xr.current=gi,e=n(r,i)}while(Ar)}if(xr.current=pi,t=null!==Mr&&null!==Mr.next,wr=0,Er=Mr=Sr=null,Tr=!1,t)throw Error(o(300));return e}function Lr(){var e=0!==Cr;return Cr=0,e}function Nr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===Er?Sr.memoizedState=Er=e:Er=Er.next=e,Er}function Or(){if(null===Mr){var e=Sr.alternate;e=null!==e?e.memoizedState:null}else e=Mr.next;var t=null===Er?Sr.memoizedState:Er.next;if(null!==t)Er=t,Mr=e;else{if(null===e)throw Error(o(310));e={memoizedState:(Mr=e).memoizedState,baseState:Mr.baseState,baseQueue:Mr.baseQueue,queue:Mr.queue,next:null},null===Er?Sr.memoizedState=Er=e:Er=Er.next=e}return Er}function Dr(e,t){return"function"==typeof t?t(e):t}function Ur(e){var t=Or(),n=t.queue;if(null===n)throw Error(o(311));n.lastRenderedReducer=e;var r=Mr,i=r.baseQueue,a=n.pending;if(null!==a){if(null!==i){var s=i.next;i.next=a.next,a.next=s}r.baseQueue=i=a,n.pending=null}if(null!==i){a=i.next,r=r.baseState;var l=s=null,c=null,u=a;do{var d=u.lane;if((wr&d)===d)null!==c&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var h={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};null===c?(l=c=h,s=r):c=c.next=h,Sr.lanes|=d,na|=d}u=u.next}while(null!==u&&u!==a);null===c?s=r:c.next=l,Gt(r,t.memoizedState)||(Di=!0),t.memoizedState=r,t.baseState=s,t.baseQueue=c,n.lastRenderedState=r}if(null!==(e=n.interleaved)){i=e;do{a=i.lane,Sr.lanes|=a,na|=a,i=i.next}while(i!==e)}else null===i&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Fr(e){var t=Or(),n=t.queue;if(null===n)throw Error(o(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(null!==i){n.pending=null;var s=i=i.next;do{a=e(a,s.action),s=s.next}while(s!==i);Gt(a,t.memoizedState)||(Di=!0),t.memoizedState=a,null===t.baseQueue&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function zr(){}function Br(e,t){var n=Sr,r=Or(),i=t(),a=!Gt(r.memoizedState,i);if(a&&(r.memoizedState=i,Di=!0),r=r.queue,Jr(Hr.bind(null,n,r,e),[e]),r.getSnapshot!==t||a||null!==Er&&1&Er.memoizedState.tag){if(n.flags|=2048,Xr(9,jr.bind(null,n,r,i,t),void 0,null),null===Yo)throw Error(o(349));30&wr||Vr(n,t,i)}return i}function Vr(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=Sr.updateQueue)?(t={lastEffect:null,stores:null},Sr.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function jr(e,t,n,r){t.value=n,t.getSnapshot=r,Wr(t)&&Sa(e,1,-1)}function Hr(e,t,n){return n(function(){Wr(t)&&Sa(e,1,-1)})}function Wr(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Gt(e,n)}catch(r){return!0}}function Gr(e){var t=Nr();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Dr,lastRenderedState:e},t.queue=e,e=e.dispatch=li.bind(null,Sr,e),[t.memoizedState,e]}function Xr(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=Sr.updateQueue)?(t={lastEffect:null,stores:null},Sr.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function qr(){return Or().memoizedState}function $r(e,t,n,r){var i=Nr();Sr.flags|=e,i.memoizedState=Xr(1|t,n,void 0,void 0===r?null:r)}function Yr(e,t,n,r){var i=Or();r=void 0===r?null:r;var o=void 0;if(null!==Mr){var a=Mr.memoizedState;if(o=a.destroy,null!==r&&Pr(r,a.deps))return void(i.memoizedState=Xr(t,n,o,r))}Sr.flags|=e,i.memoizedState=Xr(1|t,n,o,r)}function Zr(e,t){return $r(8390656,8,e,t)}function Jr(e,t){return Yr(2048,8,e,t)}function Kr(e,t){return Yr(4,2,e,t)}function Qr(e,t){return Yr(4,4,e,t)}function ei(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function ti(e,t,n){return n=null!=n?n.concat([e]):null,Yr(4,4,ei.bind(null,t,e),n)}function ni(){}function ri(e,t){var n=Or();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&Pr(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ii(e,t){var n=Or();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&Pr(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function oi(e,t){var n=It;It=0!==n&&4>n?n:4,e(!0);var r=_r.transition;_r.transition={};try{e(!1),t()}finally{It=n,_r.transition=r}}function ai(){return Or().memoizedState}function si(e,t,n){var r=wa(e);n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ci(e)?ui(t,n):(di(e,t,n),null!==(e=Sa(e,r,n=_a()))&&hi(e,t,r))}function li(e,t,n){var r=wa(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ci(e))ui(t,i);else{di(e,t,i);var o=e.alternate;if(0===e.lanes&&(null===o||0===o.lanes)&&null!==(o=t.lastRenderedReducer))try{var a=t.lastRenderedState,s=o(a,n);if(i.hasEagerState=!0,i.eagerState=s,Gt(s,a))return}catch(l){}null!==(e=Sa(e,r,n=_a()))&&hi(e,t,r)}}function ci(e){var t=e.alternate;return e===Sr||null!==t&&t===Sr}function ui(e,t){Ar=Tr=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function di(e,t,n){null!==Yo&&1&e.mode&&!(2&$o)?(null===(e=t.interleaved)?(n.next=n,null===hn?hn=[t]:hn.push(t)):(n.next=e.next,e.next=n),t.interleaved=n):(null===(e=t.pending)?n.next=n:(n.next=e.next,e.next=n),t.pending=n)}function hi(e,t,n){if(4194240&n){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,Pt(e,n)}}var pi={readContext:dn,useCallback:Rr,useContext:Rr,useEffect:Rr,useImperativeHandle:Rr,useInsertionEffect:Rr,useLayoutEffect:Rr,useMemo:Rr,useReducer:Rr,useRef:Rr,useState:Rr,useDebugValue:Rr,useDeferredValue:Rr,useTransition:Rr,useMutableSource:Rr,useSyncExternalStore:Rr,useId:Rr,unstable_isNewReconciler:!1},fi={readContext:dn,useCallback:function(e,t){return Nr().memoizedState=[e,void 0===t?null:t],e},useContext:dn,useEffect:Zr,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,$r(4194308,4,ei.bind(null,t,e),n)},useLayoutEffect:function(e,t){return $r(4194308,4,e,t)},useInsertionEffect:function(e,t){return $r(4,2,e,t)},useMemo:function(e,t){var n=Nr();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Nr();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=si.bind(null,Sr,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},Nr().memoizedState=e},useState:Gr,useDebugValue:ni,useDeferredValue:function(e){var t=Gr(e),n=t[0],r=t[1];return Zr(function(){var t=_r.transition;_r.transition={};try{r(e)}finally{_r.transition=t}},[e]),n},useTransition:function(){var e=Gr(!1),t=e[0];return e=oi.bind(null,e[1]),Nr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Sr,i=Nr();if(Wn){if(void 0===n)throw Error(o(407));n=n()}else{if(n=t(),null===Yo)throw Error(o(349));30&wr||Vr(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,Zr(Hr.bind(null,r,a,e),[e]),r.flags|=2048,Xr(9,jr.bind(null,r,a,n,t),void 0,null),n},useId:function(){var e=Nr(),t=Yo.identifierPrefix;if(Wn){var n=Un;t=":"+t+"R"+(n=(Dn&~(1<<32-xt(Dn)-1)).toString(32)+n),0<(n=Cr++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=kr++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},mi={readContext:dn,useCallback:ri,useContext:dn,useEffect:Jr,useImperativeHandle:ti,useInsertionEffect:Kr,useLayoutEffect:Qr,useMemo:ii,useReducer:Ur,useRef:qr,useState:function(){return Ur(Dr)},useDebugValue:ni,useDeferredValue:function(e){var t=Ur(Dr),n=t[0],r=t[1];return Jr(function(){var t=_r.transition;_r.transition={};try{r(e)}finally{_r.transition=t}},[e]),n},useTransition:function(){return[Ur(Dr)[0],Or().memoizedState]},useMutableSource:zr,useSyncExternalStore:Br,useId:ai,unstable_isNewReconciler:!1},gi={readContext:dn,useCallback:ri,useContext:dn,useEffect:Jr,useImperativeHandle:ti,useInsertionEffect:Kr,useLayoutEffect:Qr,useMemo:ii,useReducer:Fr,useRef:qr,useState:function(){return Fr(Dr)},useDebugValue:ni,useDeferredValue:function(e){var t=Fr(Dr),n=t[0],r=t[1];return Jr(function(){var t=_r.transition;_r.transition={};try{r(e)}finally{_r.transition=t}},[e]),n},useTransition:function(){return[Fr(Dr)[0],Or().memoizedState]},useMutableSource:zr,useSyncExternalStore:Br,useId:ai,unstable_isNewReconciler:!1};function vi(e,t){try{var n="",r=t;do{n+=Qt(r),r=r.return}while(r);var i=n}catch(o){i="\nError generating stack: "+o.message+"\n"+o.stack}return{value:e,source:t,stack:i}}function yi(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var bi,xi,_i,wi,Si="function"==typeof WeakMap?WeakMap:Map;function Mi(e,t,n){(n=gn(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){da||(da=!0,ha=r),yi(0,t)},n}function Ei(e,t,n){(n=gn(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){yi(0,t)}}var o=e.stateNode;return null!==o&&"function"==typeof o.componentDidCatch&&(n.callback=function(){yi(0,t),"function"!=typeof r&&(null===pa?pa=new Set([this]):pa.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function Ti(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new Si;var i=new Set;r.set(t,i)}else void 0===(i=r.get(t))&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=Xa.bind(null,e,t,n),t.then(e,e))}function Ai(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function Ci(e,t,n,r,i){return 1&e.mode?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=gn(-1,1)).tag=2,vn(n,t))),n.lanes|=1),e)}function ki(e){e.flags|=4}function Ri(e,t){if(null!==e&&e.child===t.child)return!0;if(16&t.flags)return!1;for(e=t.child;null!==e;){if(12854&e.flags||12854&e.subtreeFlags)return!1;e=e.sibling}return!0}if($)bi=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)z(e,n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},xi=function(){},_i=function(e,t,n,r,i){if((e=e.memoizedProps)!==r){var o=t.stateNode,a=dr(lr.current);n=V(o,n,e,r,i,a),(t.updateQueue=n)&&ki(t)}},wi=function(e,t,n,r){n!==r&&ki(t)};else if(Y){bi=function(e,t,n,r){for(var i=t.child;null!==i;){if(5===i.tag){var o=i.stateNode;n&&r&&(o=Pe(o,i.type,i.memoizedProps,i)),z(e,o)}else if(6===i.tag)o=i.stateNode,n&&r&&(o=Ie(o,i.memoizedProps,i)),z(e,o);else if(4!==i.tag)if(22===i.tag&&null!==i.memoizedState)null!==(o=i.child)&&(o.return=i),bi(e,i,!0,!0);else if(null!==i.child){i.child.return=i,i=i.child;continue}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};var Pi=function(e,t,n,r){for(var i=t.child;null!==i;){if(5===i.tag){var o=i.stateNode;n&&r&&(o=Pe(o,i.type,i.memoizedProps,i)),Ce(e,o)}else if(6===i.tag)o=i.stateNode,n&&r&&(o=Ie(o,i.memoizedProps,i)),Ce(e,o);else if(4!==i.tag)if(22===i.tag&&null!==i.memoizedState)null!==(o=i.child)&&(o.return=i),Pi(e,i,!0,!0);else if(null!==i.child){i.child.return=i,i=i.child;continue}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};xi=function(e,t){var n=t.stateNode;if(!Ri(e,t)){e=n.containerInfo;var r=Ae(e);Pi(r,t,!1,!1),n.pendingChildren=r,ki(t),ke(e,r)}},_i=function(e,t,n,r,i){var o=e.stateNode,a=e.memoizedProps;if((e=Ri(e,t))&&a===r)t.stateNode=o;else{var s=t.stateNode,l=dr(lr.current),c=null;a!==r&&(c=V(s,n,a,r,i,l)),e&&null===c?t.stateNode=o:(o=Te(o,c,n,a,r,t,e,s),B(o,n,r,i,l)&&ki(t),t.stateNode=o,e?ki(t):bi(o,t,!1,!1))}},wi=function(e,t,n,r){n!==r?(e=dr(ur.current),n=dr(lr.current),t.stateNode=H(r,e,n,t),ki(t)):t.stateNode=e.stateNode}}else xi=function(){},_i=function(){},wi=function(){};function Ii(e,t){if(!Wn)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Li(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=14680064&i.subtreeFlags,r|=14680064&i.flags,i.return=e,i=i.sibling;else for(i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Ni(e,t,n){var r=t.pendingProps;switch(Vn(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Li(t),null;case 1:case 17:return ft(t.type)&&mt(),Li(t),null;case 3:return r=t.stateNode,pr(),st(dt),st(ut),br(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==e&&null!==e.child||(Kn(t)?ki(t):null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,null!==Xn&&(Ca(Xn),Xn=null))),xi(e,t),Li(t),null;case 5:mr(t),n=dr(ur.current);var i=t.type;if(null!==e&&null!=t.stateNode)_i(e,t,i,r,n),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(null===t.stateNode)throw Error(o(166));return Li(t),null}if(e=dr(lr.current),Kn(t)){if(!Z)throw Error(o(175));e=He(t.stateNode,t.type,t.memoizedProps,n,e,t,!Gn),t.updateQueue=e,null!==e&&ki(t)}else{var a=F(i,r,n,e,t);bi(a,t,!1,!1),t.stateNode=a,B(a,i,r,n,e)&&ki(t)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return Li(t),null;case 6:if(e&&null!=t.stateNode)wi(e,t,e.memoizedProps,r);else{if("string"!=typeof r&&null===t.stateNode)throw Error(o(166));if(e=dr(ur.current),n=dr(lr.current),Kn(t)){if(!Z)throw Error(o(176));if(e=t.stateNode,r=t.memoizedProps,(n=We(e,r,t,!Gn))&&null!==(i=jn))switch(a=!!(1&i.mode),i.tag){case 3:Ke(i.stateNode.containerInfo,e,r,a);break;case 5:Qe(i.type,i.memoizedProps,i.stateNode,e,r,a)}n&&ki(t)}else t.stateNode=H(r,e,n,t)}return Li(t),null;case 13:if(st(gr),r=t.memoizedState,Wn&&null!==Hn&&1&t.mode&&!(128&t.flags)){for(e=Hn;e;)e=ze(e);return Qn(),t.flags|=98560,t}if(null!==r&&null!==r.dehydrated){if(r=Kn(t),null===e){if(!r)throw Error(o(318));if(!Z)throw Error(o(344));if(!(e=null!==(e=t.memoizedState)?e.dehydrated:null))throw Error(o(317));Ge(e,t)}else Qn(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;return Li(t),null}return null!==Xn&&(Ca(Xn),Xn=null),128&t.flags?(t.lanes=n,t):(r=null!==r,n=!1,null===e?Kn(t):n=null!==e.memoizedState,r&&!n&&(t.child.flags|=8192,1&t.mode&&(null===e||1&gr.current?0===ea&&(ea=3):Da())),null!==t.updateQueue&&(t.flags|=4),Li(t),null);case 4:return pr(),xi(e,t),null===e&&K(t.stateNode.containerInfo),Li(t),null;case 10:return ln(t.type._context),Li(t),null;case 19:if(st(gr),null===(i=t.memoizedState))return Li(t),null;if(r=!!(128&t.flags),null===(a=i.rendering))if(r)Ii(i,!1);else{if(0!==ea||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(a=vr(e))){for(t.flags|=128,Ii(i,!1),null!==(e=a.updateQueue)&&(t.updateQueue=e,t.flags|=4),t.subtreeFlags=0,e=n,r=t.child;null!==r;)i=e,(n=r).flags&=14680066,null===(a=n.alternate)?(n.childLanes=0,n.lanes=i,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=a.childLanes,n.lanes=a.lanes,n.child=a.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=a.memoizedProps,n.memoizedState=a.memoizedState,n.updateQueue=a.updateQueue,n.type=a.type,i=a.dependencies,n.dependencies=null===i?null:{lanes:i.lanes,firstContext:i.firstContext}),r=r.sibling;return lt(gr,1&gr.current|2),t.child}e=e.sibling}null!==i.tail&&Ft()>la&&(t.flags|=128,r=!0,Ii(i,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=vr(a))){if(t.flags|=128,r=!0,null!==(e=e.updateQueue)&&(t.updateQueue=e,t.flags|=4),Ii(i,!0),null===i.tail&&"hidden"===i.tailMode&&!a.alternate&&!Wn)return Li(t),null}else 2*Ft()-i.renderingStartTime>la&&1073741824!==n&&(t.flags|=128,r=!0,Ii(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(null!==(e=i.last)?e.sibling=a:t.child=a,i.last=a)}return null!==i.tail?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Ft(),t.sibling=null,e=gr.current,lt(gr,r?1&e|2:1&e),t):(Li(t),null);case 22:case 23:return Ia(),r=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==r&&(t.flags|=8192),r&&1&t.mode?!!(1073741824&Ko)&&(Li(t),$&&6&t.subtreeFlags&&(t.flags|=8192)):Li(t),null;case 24:case 25:return null}throw Error(o(156,t.tag))}var Oi=a.ReactCurrentOwner,Di=!1;function Ui(e,t,n,r){t.child=null===e?ar(t,null,n,r):or(t,e.child,n,r)}function Fi(e,t,n,r,i){n=n.render;var o=t.ref;return un(t,i),r=Ir(e,t,n,r,o,i),n=Lr(),null===e||Di?(Wn&&n&&Bn(t),t.flags|=1,Ui(e,t,r,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,io(e,t,i))}function zi(e,t,n,r,i){if(null===e){var o=n.type;return"function"!=typeof o||Qa(o)||void 0!==o.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=ts(n.type,null,r,t,t.mode,i)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,Bi(e,t,o,r,i))}if(o=e.child,0===(e.lanes&i)){var a=o.memoizedProps;if((n=null!==(n=n.compare)?n:Kt)(a,r)&&e.ref===t.ref)return io(e,t,i)}return t.flags|=1,(e=es(o,r)).ref=t.ref,e.return=t,t.child=e}function Bi(e,t,n,r,i){if(null!==e&&Kt(e.memoizedProps,r)&&e.ref===t.ref){if(Di=!1,0===(e.lanes&i))return t.lanes=e.lanes,io(e,t,i);131072&e.flags&&(Di=!0)}return Hi(e,t,n,r,i)}function Vi(e,t,n){var r=t.pendingProps,i=r.children,o=null!==e?e.memoizedState:null;if("hidden"===r.mode)if(1&t.mode){if(!(1073741824&n))return e=null!==o?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null},t.updateQueue=null,lt(Qo,Ko),Ko|=e,null;t.memoizedState={baseLanes:0,cachePool:null},r=null!==o?o.baseLanes:n,lt(Qo,Ko),Ko|=r}else t.memoizedState={baseLanes:0,cachePool:null},lt(Qo,Ko),Ko|=n;else null!==o?(r=o.baseLanes|n,t.memoizedState=null):r=n,lt(Qo,Ko),Ko|=r;return Ui(e,t,i,n),t.child}function ji(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Hi(e,t,n,r,i){var o=ft(n)?ht:ut.current;return o=pt(t,o),un(t,i),n=Ir(e,t,n,r,o,i),r=Lr(),null===e||Di?(Wn&&r&&Bn(t),t.flags|=1,Ui(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,io(e,t,i))}function Wi(e,t,n,r,i){if(ft(n)){var o=!0;yt(t)}else o=!1;if(un(t,i),null===t.stateNode)null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),Tn(t,n,r),Cn(t,n,r,i),r=!0;else if(null===e){var a=t.stateNode,s=t.memoizedProps;a.props=s;var l=a.context,c=n.contextType;"object"==typeof c&&null!==c?c=dn(c):c=pt(t,c=ft(n)?ht:ut.current);var u=n.getDerivedStateFromProps,d="function"==typeof u||"function"==typeof a.getSnapshotBeforeUpdate;d||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==r||l!==c)&&An(t,a,r,c),pn=!1;var h=t.memoizedState;a.state=h,xn(t,r,a,i),l=t.memoizedState,s!==r||h!==l||dt.current||pn?("function"==typeof u&&(Sn(t,n,u,r),l=t.memoizedState),(s=pn||En(t,n,s,r,h,l,c))?(d||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||("function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount()),"function"==typeof a.componentDidMount&&(t.flags|=4194308)):("function"==typeof a.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=c,r=s):("function"==typeof a.componentDidMount&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,mn(e,t),s=t.memoizedProps,c=t.type===t.elementType?s:en(t.type,s),a.props=c,d=t.pendingProps,h=a.context,"object"==typeof(l=n.contextType)&&null!==l?l=dn(l):l=pt(t,l=ft(n)?ht:ut.current);var p=n.getDerivedStateFromProps;(u="function"==typeof p||"function"==typeof a.getSnapshotBeforeUpdate)||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==d||h!==l)&&An(t,a,r,l),pn=!1,h=t.memoizedState,a.state=h,xn(t,r,a,i);var f=t.memoizedState;s!==d||h!==f||dt.current||pn?("function"==typeof p&&(Sn(t,n,p,r),f=t.memoizedState),(c=pn||En(t,n,c,r,h,f,l)||!1)?(u||"function"!=typeof a.UNSAFE_componentWillUpdate&&"function"!=typeof a.componentWillUpdate||("function"==typeof a.componentWillUpdate&&a.componentWillUpdate(r,f,l),"function"==typeof a.UNSAFE_componentWillUpdate&&a.UNSAFE_componentWillUpdate(r,f,l)),"function"==typeof a.componentDidUpdate&&(t.flags|=4),"function"==typeof a.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=f),a.props=r,a.state=f,a.context=l,r=c):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return Gi(e,t,n,r,o,i)}function Gi(e,t,n,r,i,o){ji(e,t);var a=!!(128&t.flags);if(!r&&!a)return i&&bt(t,n,!1),io(e,t,o);r=t.stateNode,Oi.current=t;var s=a&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&a?(t.child=or(t,e.child,null,o),t.child=or(t,null,s,o)):Ui(e,t,s,o),t.memoizedState=r.state,i&&bt(t,n,!0),t.child}function Xi(e){var t=e.stateNode;t.pendingContext?gt(0,t.pendingContext,t.pendingContext!==t.context):t.context&>(0,t.context,!1),hr(e,t.containerInfo)}function qi(e,t,n,r,i){return Qn(),er(i),t.flags|=256,Ui(e,t,n,r),t.child}var $i={dehydrated:null,treeContext:null,retryLane:0};function Yi(e){return{baseLanes:e,cachePool:null}}function Zi(e,t,n){var r,i=t.pendingProps,a=gr.current,s=!1,l=!!(128&t.flags);if((r=l)||(r=(null===e||null!==e.memoizedState)&&!!(2&a)),r?(s=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(a|=1),lt(gr,1&a),null===e)return Zn(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(1&t.mode?Ue(e)?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=i.children,e=i.fallback,s?(i=t.mode,s=t.child,a={mode:"hidden",children:a},1&i||null===s?s=rs(a,i,0,null):(s.childLanes=0,s.pendingProps=a),e=ns(e,i,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Yi(n),t.memoizedState=$i,e):Ji(t,a));if(null!==(a=e.memoizedState)){if(null!==(r=a.dehydrated)){if(l)return 256&t.flags?(t.flags&=-257,eo(e,t,n,Error(o(422)))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(s=i.fallback,a=t.mode,i=rs({mode:"visible",children:i.children},a,0,null),(s=ns(s,a,n,null)).flags|=2,i.return=t,s.return=t,i.sibling=s,t.child=i,1&t.mode&&or(t,e.child,null,n),t.child.memoizedState=Yi(n),t.memoizedState=$i,s);if(1&t.mode)if(Ue(r))t=eo(e,t,n,Error(o(419)));else if(i=0!==(n&e.childLanes),Di||i){if(null!==(i=Yo)){switch(n&-n){case 4:s=2;break;case 16:s=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:s=32;break;case 536870912:s=268435456;break;default:s=0}0!==(i=0!==(s&(i.suspendedLanes|n))?0:s)&&i!==a.retryLane&&(a.retryLane=i,Sa(e,i,-1))}Da(),t=eo(e,t,n,Error(o(421)))}else De(r)?(t.flags|=128,t.child=e.child,t=$a.bind(null,e),Fe(r,t),t=null):(n=a.treeContext,Z&&(Hn=je(r),jn=t,Wn=!0,Xn=null,Gn=!1,null!==n&&(Ln[Nn++]=Dn,Ln[Nn++]=Un,Ln[Nn++]=On,Dn=n.id,Un=n.overflow,On=t)),(t=Ji(t,t.pendingProps.children)).flags|=4096);else t=eo(e,t,n,null);return t}return s?(i=Qi(e,t,i.children,i.fallback,n),s=t.child,a=e.child.memoizedState,s.memoizedState=null===a?Yi(n):{baseLanes:a.baseLanes|n,cachePool:null},s.childLanes=e.childLanes&~n,t.memoizedState=$i,i):(n=Ki(e,t,i.children,n),t.memoizedState=null,n)}return s?(i=Qi(e,t,i.children,i.fallback,n),s=t.child,a=e.child.memoizedState,s.memoizedState=null===a?Yi(n):{baseLanes:a.baseLanes|n,cachePool:null},s.childLanes=e.childLanes&~n,t.memoizedState=$i,i):(n=Ki(e,t,i.children,n),t.memoizedState=null,n)}function Ji(e,t){return(t=rs({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function Ki(e,t,n,r){var i=e.child;return e=i.sibling,n=es(i,{mode:"visible",children:n}),!(1&t.mode)&&(n.lanes=r),n.return=t,n.sibling=null,null!==e&&(null===(r=t.deletions)?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n}function Qi(e,t,n,r,i){var o=t.mode,a=(e=e.child).sibling,s={mode:"hidden",children:n};return 1&o||t.child===e?(n=es(e,s)).subtreeFlags=14680064&e.subtreeFlags:((n=t.child).childLanes=0,n.pendingProps=s,t.deletions=null),null!==a?r=es(a,r):(r=ns(r,o,i,null)).flags|=2,r.return=t,n.return=t,n.sibling=r,t.child=n,r}function eo(e,t,n,r){return null!==r&&er(r),or(t,e.child,null,n),(e=Ji(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function to(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),cn(e.return,t,n)}function no(e,t,n,r,i){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i)}function ro(e,t,n){var r=t.pendingProps,i=r.revealOrder,o=r.tail;if(Ui(e,t,r.children,n),2&(r=gr.current))r=1&r|2,t.flags|=128;else{if(null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&to(e,n,t);else if(19===e.tag)to(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(lt(gr,r),1&t.mode)switch(i){case"forwards":for(n=t.child,i=null;null!==n;)null!==(e=n.alternate)&&null===vr(e)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),no(t,!1,i,n,o);break;case"backwards":for(n=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===vr(e)){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}no(t,!0,n,null,o);break;case"together":no(t,!1,null,null,void 0);break;default:t.memoizedState=null}else t.memoizedState=null;return t.child}function io(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),na|=t.lanes,0===(n&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(o(153));if(null!==t.child){for(n=es(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=es(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function oo(e,t){switch(Vn(t),t.tag){case 1:return ft(t.type)&&mt(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return pr(),st(dt),st(ut),br(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 5:return mr(t),null;case 13:if(st(gr),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(o(340));Qn()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return st(gr),null;case 4:return pr(),null;case 10:return ln(t.type._context),null;case 22:case 23:return Ia(),null;default:return null}}var ao=!1,so=!1,lo="function"==typeof WeakSet?WeakSet:Set,co=null;function uo(e,t){var n=e.ref;if(null!==n)if("function"==typeof n)try{n(null)}catch(r){Ga(e,t,r)}else n.current=null}function ho(e,t,n){try{n()}catch(r){Ga(e,t,r)}}var po=!1;function fo(e,t,n){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,void 0!==o&&ho(t,n,o)}i=i.next}while(i!==r)}}function mo(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function go(e){var t=e.ref;if(null!==t){var n=e.stateNode;if(5===e.tag)e=L(n);else e=n;"function"==typeof t?t(e):t.current=e}}function vo(e,t,n){if(Wt&&"function"==typeof Wt.onCommitFiberUnmount)try{Wt.onCommitFiberUnmount(Ht,t)}catch(a){}switch(t.tag){case 0:case 11:case 14:case 15:if(null!==(e=t.updateQueue)&&null!==(e=e.lastEffect)){var r=e=e.next;do{var i=r,o=i.destroy;i=i.tag,void 0!==o&&(2&i||4&i)&&ho(t,n,o),r=r.next}while(r!==e)}break;case 1:if(uo(t,n),"function"==typeof(e=t.stateNode).componentWillUnmount)try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(a){Ga(t,n,a)}break;case 5:uo(t,n);break;case 4:$?Eo(e,t,n):Y&&Y&&(t=t.stateNode.containerInfo,n=Ae(t),Re(t,n))}}function yo(e,t,n){for(var r=t;;)if(vo(e,r,n),null===r.child||$&&4===r.tag){if(r===t)break;for(;null===r.sibling;){if(null===r.return||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}else r.child.return=r,r=r.child}function bo(e){var t=e.alternate;null!==t&&(e.alternate=null,bo(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&ee(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function xo(e){return 5===e.tag||3===e.tag||4===e.tag}function _o(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||xo(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function wo(e){if($){e:{for(var t=e.return;null!==t;){if(xo(t))break e;t=t.return}throw Error(o(160))}var n=t;switch(n.tag){case 5:t=n.stateNode,32&n.flags&&(xe(t),n.flags&=-33),Mo(e,n=_o(e),t);break;case 3:case 4:t=n.stateNode.containerInfo,So(e,n=_o(e),t);break;default:throw Error(o(161))}}}function So(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?ve(n,e,t):he(n,e);else if(4!==r&&null!==(e=e.child))for(So(e,t,n),e=e.sibling;null!==e;)So(e,t,n),e=e.sibling}function Mo(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?ge(n,e,t):de(n,e);else if(4!==r&&null!==(e=e.child))for(Mo(e,t,n),e=e.sibling;null!==e;)Mo(e,t,n),e=e.sibling}function Eo(e,t,n){for(var r,i,a=t,s=!1;;){if(!s){s=a.return;e:for(;;){if(null===s)throw Error(o(160));switch(r=s.stateNode,s.tag){case 5:i=!1;break e;case 3:case 4:r=r.containerInfo,i=!0;break e}s=s.return}s=!0}if(5===a.tag||6===a.tag)yo(e,a,n),i?be(r,a.stateNode):ye(r,a.stateNode);else if(18===a.tag)i?Ze(r,a.stateNode):Ye(r,a.stateNode);else if(4===a.tag){if(null!==a.child){r=a.stateNode.containerInfo,i=!0,a.child.return=a,a=a.child;continue}}else if(vo(e,a,n),null!==a.child){a.child.return=a,a=a.child;continue}if(a===t)break;for(;null===a.sibling;){if(null===a.return||a.return===t)return;4===(a=a.return).tag&&(s=!1)}a.sibling.return=a.return,a=a.sibling}}function To(e,t){if($){switch(t.tag){case 0:case 11:case 14:case 15:return fo(3,t,t.return),mo(3,t),void fo(5,t,t.return);case 1:case 12:case 17:return;case 5:var n=t.stateNode;if(null!=n){var r=t.memoizedProps;e=null!==e?e.memoizedProps:r;var i=t.type,a=t.updateQueue;t.updateQueue=null,null!==a&&me(n,a,i,e,r,t)}return;case 6:if(null===t.stateNode)throw Error(o(162));return n=t.memoizedProps,void pe(t.stateNode,null!==e?e.memoizedProps:n,n);case 3:return void(Z&&null!==e&&e.memoizedState.isDehydrated&&qe(t.stateNode.containerInfo));case 13:case 19:return void Ao(t)}throw Error(o(163))}switch(t.tag){case 0:case 11:case 14:case 15:return fo(3,t,t.return),mo(3,t),void fo(5,t,t.return);case 12:case 22:case 23:return;case 13:case 19:return void Ao(t);case 3:Z&&null!==e&&e.memoizedState.isDehydrated&&qe(t.stateNode.containerInfo)}e:if(Y){switch(t.tag){case 1:case 5:case 6:break e;case 3:case 4:t=t.stateNode,Re(t.containerInfo,t.pendingChildren);break e}throw Error(o(163))}}function Ao(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new lo),t.forEach(function(t){var r=Ya.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Co(e,t,n){co=e,ko(e)}function ko(e,t,n){for(var r=!!(1&e.mode);null!==co;){var i=co,o=i.child;if(22===i.tag&&r){var a=null!==i.memoizedState||ao;if(!a){var s=i.alternate,l=null!==s&&null!==s.memoizedState||so;s=ao;var c=so;if(ao=a,(so=l)&&!c)for(co=i;null!==co;)l=(a=co).child,22===a.tag&&null!==a.memoizedState?Io(i):null!==l?(l.return=a,co=l):Io(i);for(;null!==o;)co=o,ko(o),o=o.sibling;co=i,ao=s,so=c}Ro(e)}else 8772&i.subtreeFlags&&null!==o?(o.return=i,co=o):Ro(e)}}function Ro(e){for(;null!==co;){var t=co;if(8772&t.flags){var n=t.alternate;try{if(8772&t.flags)switch(t.tag){case 0:case 11:case 15:so||mo(5,t);break;case 1:var r=t.stateNode;if(4&t.flags&&!so)if(null===n)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:en(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var a=t.updateQueue;null!==a&&_n(t,a,r);break;case 3:var s=t.updateQueue;if(null!==s){if(n=null,null!==t.child)switch(t.child.tag){case 5:n=L(t.child.stateNode);break;case 1:n=t.child.stateNode}_n(t,s,n)}break;case 5:var l=t.stateNode;null===n&&4&t.flags&&fe(l,t.type,t.memoizedProps,t);break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:break;case 13:if(Z&&null===t.memoizedState){var c=t.alternate;if(null!==c){var u=c.memoizedState;if(null!==u){var d=u.dehydrated;null!==d&&$e(d)}}}break;default:throw Error(o(163))}so||512&t.flags&&go(t)}catch(h){Ga(t,t.return,h)}}if(t===e){co=null;break}if(null!==(n=t.sibling)){n.return=t.return,co=n;break}co=t.return}}function Po(e){for(;null!==co;){var t=co;if(t===e){co=null;break}var n=t.sibling;if(null!==n){n.return=t.return,co=n;break}co=t.return}}function Io(e){for(;null!==co;){var t=co;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{mo(4,t)}catch(l){Ga(t,n,l)}break;case 1:var r=t.stateNode;if("function"==typeof r.componentDidMount){var i=t.return;try{r.componentDidMount()}catch(l){Ga(t,i,l)}}var o=t.return;try{go(t)}catch(l){Ga(t,o,l)}break;case 5:var a=t.return;try{go(t)}catch(l){Ga(t,a,l)}}}catch(l){Ga(t,t.return,l)}if(t===e){co=null;break}var s=t.sibling;if(null!==s){s.return=t.return,co=s;break}co=t.return}}var Lo=0,No=1,Oo=2,Do=3,Uo=4;if("function"==typeof Symbol&&Symbol.for){var Fo=Symbol.for;Lo=Fo("selector.component"),No=Fo("selector.has_pseudo_class"),Oo=Fo("selector.role"),Do=Fo("selector.test_id"),Uo=Fo("selector.text")}function zo(e){var t=J(e);if(null!=t){if("string"!=typeof t.memoizedProps["data-testname"])throw Error(o(364));return t}if(null===(e=ie(e)))throw Error(o(362));return e.stateNode.current}function Bo(e,t){switch(t.$$typeof){case Lo:if(e.type===t.value)return!0;break;case No:e:{t=t.value,e=[e,0];for(var n=0;n<e.length;){var r=e[n++],i=e[n++],a=t[i];if(5!==r.tag||!se(r)){for(;null!=a&&Bo(r,a);)a=t[++i];if(i===t.length){t=!0;break e}for(r=r.child;null!==r;)e.push(r,i),r=r.sibling}}t=!1}return t;case Oo:if(5===e.tag&&le(e.stateNode,t.value))return!0;break;case Uo:if((5===e.tag||6===e.tag)&&null!==(e=ae(e))&&0<=e.indexOf(t.value))return!0;break;case Do:if(5===e.tag&&("string"==typeof(e=e.memoizedProps["data-testname"])&&e.toLowerCase()===t.value.toLowerCase()))return!0;break;default:throw Error(o(365))}return!1}function Vo(e){switch(e.$$typeof){case Lo:return"<"+(S(e.value)||"Unknown")+">";case No:return":has("+(Vo(e)||"")+")";case Oo:return'[role="'+e.value+'"]';case Uo:return'"'+e.value+'"';case Do:return'[data-testname="'+e.value+'"]';default:throw Error(o(365))}}function jo(e,t){var n=[];e=[e,0];for(var r=0;r<e.length;){var i=e[r++],o=e[r++],a=t[o];if(5!==i.tag||!se(i)){for(;null!=a&&Bo(i,a);)a=t[++o];if(o===t.length)n.push(i);else for(i=i.child;null!==i;)e.push(i,o),i=i.sibling}}return n}function Ho(e,t){if(!re)throw Error(o(363));e=jo(e=zo(e),t),t=[],e=Array.from(e);for(var n=0;n<e.length;){var r=e[n++];if(5===r.tag)se(r)||t.push(r.stateNode);else for(r=r.child;null!==r;)e.push(r),r=r.sibling}return t}var Wo=Math.ceil,Go=a.ReactCurrentDispatcher,Xo=a.ReactCurrentOwner,qo=a.ReactCurrentBatchConfig,$o=0,Yo=null,Zo=null,Jo=0,Ko=0,Qo=at(0),ea=0,ta=null,na=0,ra=0,ia=0,oa=null,aa=null,sa=0,la=1/0;function ca(){la=Ft()+500}var ua,da=!1,ha=null,pa=null,fa=!1,ma=null,ga=0,va=0,ya=null,ba=-1,xa=0;function _a(){return 6&$o?Ft():-1!==ba?ba:ba=Ft()}function wa(e){return 1&e.mode?2&$o&&0!==Jo?Jo&-Jo:null!==Jt.transition?(0===xa&&(e=St,!(4194240&(St<<=1))&&(St=64),xa=e),xa):0!==(e=It)?e:Q():1}function Sa(e,t,n){if(50<va)throw va=0,ya=null,Error(o(185));var r=Ma(e,t);return null===r?null:(Rt(r,t,n),2&$o&&r===Yo||(r===Yo&&(!(2&$o)&&(ra|=t),4===ea&&ka(r,Jo)),Ea(r,n),1===t&&0===$o&&!(1&e.mode)&&(ca(),qt&&Zt())),r)}function Ma(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}function Ea(e,t){var n=e.callbackNode;!function(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,o=e.pendingLanes;0<o;){var a=31-xt(o),s=1<<a,l=i[a];-1===l?0!==(s&n)&&0===(s&r)||(i[a]=At(s,t)):l<=t&&(e.expiredLanes|=s),o&=~s}}(e,t);var r=Tt(e,e===Yo?Jo:0);if(0===r)null!==n&&Ot(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(null!=n&&Ot(n),1===t)0===e.tag?function(e){qt=!0,Yt(e)}(Ra.bind(null,e)):Yt(Ra.bind(null,e)),te?ne(function(){0===$o&&Zt()}):Nt(zt,Zt),n=null;else{switch(Lt(r)){case 1:n=zt;break;case 4:n=Bt;break;case 16:default:n=Vt;break;case 536870912:n=jt}n=Za(n,Ta.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Ta(e,t){if(ba=-1,xa=0,6&$o)throw Error(o(327));var n=e.callbackNode;if(Ha()&&e.callbackNode!==n)return null;var r=Tt(e,e===Yo?Jo:0);if(0===r)return null;if(30&r||0!==(r&e.expiredLanes)||t)t=Ua(e,r);else{t=r;var i=$o;$o|=2;var a=Oa();for(Yo===e&&Jo===t||(ca(),La(e,t));;)try{za();break}catch(l){Na(e,l)}an(),Go.current=a,$o=i,null!==Zo?t=0:(Yo=null,Jo=0,t=ea)}if(0!==t){if(2===t&&(0!==(i=Ct(e))&&(r=i,t=Aa(e,i))),1===t)throw n=ta,La(e,0),ka(e,r),Ea(e,Ft()),n;if(6===t)ka(e,r);else{if(i=e.current.alternate,!(30&r||function(e){for(var t=e;;){if(16384&t.flags){var n=t.updateQueue;if(null!==n&&null!==(n=n.stores))for(var r=0;r<n.length;r++){var i=n[r],o=i.getSnapshot;i=i.value;try{if(!Gt(o(),i))return!1}catch(s){return!1}}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(i)||(t=Ua(e,r),2===t&&(a=Ct(e),0!==a&&(r=a,t=Aa(e,a))),1!==t)))throw n=ta,La(e,0),ka(e,r),Ea(e,Ft()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(o(345));case 2:case 5:ja(e,aa);break;case 3:if(ka(e,r),(130023424&r)===r&&10<(t=sa+500-Ft())){if(0!==Tt(e,0))break;if(((i=e.suspendedLanes)&r)!==r){_a(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=W(ja.bind(null,e,aa),t);break}ja(e,aa);break;case 4:if(ka(e,r),(4194240&r)===r)break;for(t=e.eventTimes,i=-1;0<r;){var s=31-xt(r);a=1<<s,(s=t[s])>i&&(i=s),r&=~a}if(r=i,10<(r=(120>(r=Ft()-r)?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Wo(r/1960))-r)){e.timeoutHandle=W(ja.bind(null,e,aa),r);break}ja(e,aa);break;default:throw Error(o(329))}}}return Ea(e,Ft()),e.callbackNode===n?Ta.bind(null,e):null}function Aa(e,t){var n=oa;return e.current.memoizedState.isDehydrated&&(La(e,t).flags|=256),2!==(e=Ua(e,t))&&(t=aa,aa=n,null!==t&&Ca(t)),e}function Ca(e){null===aa?aa=e:aa.push.apply(aa,e)}function ka(e,t){for(t&=~ia,t&=~ra,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-xt(t),r=1<<n;e[n]=-1,t&=~r}}function Ra(e){if(6&$o)throw Error(o(327));Ha();var t=Tt(e,0);if(!(1&t))return Ea(e,Ft()),null;var n=Ua(e,t);if(0!==e.tag&&2===n){var r=Ct(e);0!==r&&(t=r,n=Aa(e,r))}if(1===n)throw n=ta,La(e,0),ka(e,t),Ea(e,Ft()),n;if(6===n)throw Error(o(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,ja(e,aa),Ea(e,Ft()),null}function Pa(e){null!==ma&&0===ma.tag&&!(6&$o)&&Ha();var t=$o;$o|=1;var n=qo.transition,r=It;try{if(qo.transition=null,It=1,e)return e()}finally{It=r,qo.transition=n,!(6&($o=t))&&Zt()}}function Ia(){Ko=Qo.current,st(Qo)}function La(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==X&&(e.timeoutHandle=X,G(n)),null!==Zo)for(n=Zo.return;null!==n;){var r=n;switch(Vn(r),r.tag){case 1:null!=(r=r.type.childContextTypes)&&mt();break;case 3:pr(),st(dt),st(ut),br();break;case 5:mr(r);break;case 4:pr();break;case 13:case 19:st(gr);break;case 10:ln(r.type._context);break;case 22:case 23:Ia()}n=n.return}if(Yo=e,Zo=e=es(e.current,null),Jo=Ko=t,ea=0,ta=null,ia=ra=na=0,aa=oa=null,null!==hn){for(t=0;t<hn.length;t++)if(null!==(r=(n=hn[t]).interleaved)){n.interleaved=null;var i=r.next,o=n.pending;if(null!==o){var a=o.next;o.next=i,r.next=a}n.pending=r}hn=null}return e}function Na(e,t){for(;;){var n=Zo;try{if(an(),xr.current=pi,Tr){for(var r=Sr.memoizedState;null!==r;){var i=r.queue;null!==i&&(i.pending=null),r=r.next}Tr=!1}if(wr=0,Er=Mr=Sr=null,Ar=!1,Cr=0,Xo.current=null,null===n||null===n.return){ea=1,ta=t,Zo=null;break}e:{var a=e,s=n.return,l=n,c=t;if(t=Jo,l.flags|=32768,null!==c&&"object"==typeof c&&"function"==typeof c.then){var u=c,d=l,h=d.tag;if(!(1&d.mode||0!==h&&11!==h&&15!==h)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var f=Ai(s);if(null!==f){f.flags&=-257,Ci(f,s,l,0,t),1&f.mode&&Ti(a,u,t),c=u;var m=(t=f).updateQueue;if(null===m){var g=new Set;g.add(c),t.updateQueue=g}else m.add(c);break e}if(!(1&t)){Ti(a,u,t),Da();break e}c=Error(o(426))}else if(Wn&&1&l.mode){var v=Ai(s);if(null!==v){!(65536&v.flags)&&(v.flags|=256),Ci(v,s,l,0,t),er(c);break e}}a=c,4!==ea&&(ea=2),null===oa?oa=[a]:oa.push(a),c=vi(c,l),l=s;do{switch(l.tag){case 3:l.flags|=65536,t&=-t,l.lanes|=t,bn(l,Mi(0,c,t));break e;case 1:a=c;var y=l.type,b=l.stateNode;if(!(128&l.flags||"function"!=typeof y.getDerivedStateFromError&&(null===b||"function"!=typeof b.componentDidCatch||null!==pa&&pa.has(b)))){l.flags|=65536,t&=-t,l.lanes|=t,bn(l,Ei(l,a,t));break e}}l=l.return}while(null!==l)}Va(n)}catch(x){t=x,Zo===n&&null!==n&&(Zo=n=n.return);continue}break}}function Oa(){var e=Go.current;return Go.current=pi,null===e?pi:e}function Da(){0!==ea&&3!==ea&&2!==ea||(ea=4),null===Yo||!(268435455&na)&&!(268435455&ra)||ka(Yo,Jo)}function Ua(e,t){var n=$o;$o|=2;var r=Oa();for(Yo===e&&Jo===t||La(e,t);;)try{Fa();break}catch(Dv){Na(e,Dv)}if(an(),$o=n,Go.current=r,null!==Zo)throw Error(o(261));return Yo=null,Jo=0,ea}function Fa(){for(;null!==Zo;)Ba(Zo)}function za(){for(;null!==Zo&&!Dt();)Ba(Zo)}function Ba(e){var t=ua(e.alternate,e,Ko);e.memoizedProps=e.pendingProps,null===t?Va(e):Zo=t,Xo.current=null}function Va(e){var t=e;do{var n=t.alternate;if(e=t.return,32768&t.flags){if(null!==(n=oo(n,t)))return n.flags&=32767,void(Zo=n);if(null===e)return ea=6,void(Zo=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}else if(null!==(n=Ni(n,t,Ko)))return void(Zo=n);if(null!==(t=t.sibling))return void(Zo=t);Zo=t=e}while(null!==t);0===ea&&(ea=5)}function ja(e,t){var n=It,r=qo.transition;try{qo.transition=null,It=1,function(e,t,n){do{Ha()}while(null!==ma);if(6&$o)throw Error(o(327));var r=e.finishedWork,i=e.finishedLanes;if(null===r)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(o(177));e.callbackNode=null,e.callbackPriority=0;var a=r.lanes|r.childLanes;if(function(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-xt(n),o=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~o}}(e,a),e===Yo&&(Zo=Yo=null,Jo=0),!(2064&r.subtreeFlags)&&!(2064&r.flags)||fa||(fa=!0,Za(Vt,function(){return Ha(),null})),a=!!(15990&r.flags),!!(15990&r.subtreeFlags)||a){a=qo.transition,qo.transition=null;var s=It;It=1;var l=$o;$o|=4,Xo.current=null,function(e,t){for(D(e.containerInfo),co=t;null!==co;)if(t=(e=co).child,1028&e.subtreeFlags&&null!==t)t.return=e,co=t;else for(;null!==co;){e=co;try{var n=e.alternate;if(1024&e.flags)switch(e.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==n){var r=n.memoizedProps,i=n.memoizedState,a=e.stateNode,s=a.getSnapshotBeforeUpdate(e.elementType===e.type?r:en(e.type,r),i);a.__reactInternalSnapshotBeforeUpdate=s}break;case 3:$&&Ee(e.stateNode.containerInfo);break;default:throw Error(o(163))}}catch(l){Ga(e,e.return,l)}if(null!==(t=e.sibling)){t.return=e.return,co=t;break}co=e.return}n=po,po=!1}(e,r),function(e,t){for(co=t;null!==co;){var n=(t=co).deletions;if(null!==n)for(var r=0;r<n.length;r++){var i=n[r];try{var o=e;$?Eo(o,i,t):yo(o,i,t);var a=i.alternate;null!==a&&(a.return=null),i.return=null}catch(_){Ga(i,t,_)}}if(n=t.child,12854&t.subtreeFlags&&null!==n)n.return=t,co=n;else for(;null!==co;){t=co;try{var s=t.flags;if(32&s&&$&&xe(t.stateNode),512&s){var l=t.alternate;if(null!==l){var c=l.ref;null!==c&&("function"==typeof c?c(null):c.current=null)}}if(8192&s)switch(t.tag){case 13:if(null!==t.memoizedState){var u=t.alternate;null!==u&&null!==u.memoizedState||(sa=Ft())}break;case 22:var d=null!==t.memoizedState,h=t.alternate,p=null!==h&&null!==h.memoizedState;if(n=t,$)e:if(r=n,i=d,o=null,$)for(var f=r;;){if(5===f.tag){if(null===o){o=f;var m=f.stateNode;i?_e(m):Se(f.stateNode,f.memoizedProps)}}else if(6===f.tag){if(null===o){var g=f.stateNode;i?we(g):Me(g,f.memoizedProps)}}else if((22!==f.tag&&23!==f.tag||null===f.memoizedState||f===r)&&null!==f.child){f.child.return=f,f=f.child;continue}if(f===r)break;for(;null===f.sibling;){if(null===f.return||f.return===r)break e;o===f&&(o=null),f=f.return}o===f&&(o=null),f.sibling.return=f.return,f=f.sibling}if(d&&!p&&1&n.mode){co=n;for(var v=n.child;null!==v;){for(n=co=v;null!==co;){var y=(r=co).child;switch(r.tag){case 0:case 11:case 14:case 15:fo(4,r,r.return);break;case 1:uo(r,r.return);var b=r.stateNode;if("function"==typeof b.componentWillUnmount){var x=r.return;try{b.props=r.memoizedProps,b.state=r.memoizedState,b.componentWillUnmount()}catch(_){Ga(r,x,_)}}break;case 5:uo(r,r.return);break;case 22:if(null!==r.memoizedState){Po(n);continue}}null!==y?(y.return=r,co=y):Po(n)}v=v.sibling}}}switch(4102&s){case 2:wo(t),t.flags&=-3;break;case 6:wo(t),t.flags&=-3,To(t.alternate,t);break;case 4096:t.flags&=-4097;break;case 4100:t.flags&=-4097,To(t.alternate,t);break;case 4:To(t.alternate,t)}}catch(_){Ga(t,t.return,_)}if(null!==(n=t.sibling)){n.return=t.return,co=n;break}co=t.return}}}(e,r),U(e.containerInfo),e.current=r,Co(r),Ut(),$o=l,It=s,qo.transition=a}else e.current=r;if(fa&&(fa=!1,ma=e,ga=i),a=e.pendingLanes,0===a&&(pa=null),function(e){if(Wt&&"function"==typeof Wt.onCommitFiberRoot)try{Wt.onCommitFiberRoot(Ht,e,void 0,!(128&~e.current.flags))}catch(t){}}(r.stateNode),Ea(e,Ft()),null!==t)for(n=e.onRecoverableError,r=0;r<t.length;r++)n(t[r]);if(da)throw da=!1,e=ha,ha=null,e;!!(1&ga)&&0!==e.tag&&Ha(),a=e.pendingLanes,1&a?e===ya?va++:(va=0,ya=e):va=0,Zt()}(e,t,n)}finally{qo.transition=r,It=n}return null}function Ha(){if(null!==ma){var e=Lt(ga),t=qo.transition,n=It;try{if(qo.transition=null,It=16>e?16:e,null===ma)var r=!1;else{if(e=ma,ma=null,ga=0,6&$o)throw Error(o(331));var i=$o;for($o|=4,co=e.current;null!==co;){var a=co,s=a.child;if(16&co.flags){var l=a.deletions;if(null!==l){for(var c=0;c<l.length;c++){var u=l[c];for(co=u;null!==co;){var d=co;switch(d.tag){case 0:case 11:case 15:fo(8,d,a)}var h=d.child;if(null!==h)h.return=d,co=h;else for(;null!==co;){var p=(d=co).sibling,f=d.return;if(bo(d),d===u){co=null;break}if(null!==p){p.return=f,co=p;break}co=f}}}var m=a.alternate;if(null!==m){var g=m.child;if(null!==g){m.child=null;do{var v=g.sibling;g.sibling=null,g=v}while(null!==g)}}co=a}}if(2064&a.subtreeFlags&&null!==s)s.return=a,co=s;else e:for(;null!==co;){if(2048&(a=co).flags)switch(a.tag){case 0:case 11:case 15:fo(9,a,a.return)}var y=a.sibling;if(null!==y){y.return=a.return,co=y;break e}co=a.return}}var b=e.current;for(co=b;null!==co;){var x=(s=co).child;if(2064&s.subtreeFlags&&null!==x)x.return=s,co=x;else e:for(s=b;null!==co;){if(2048&(l=co).flags)try{switch(l.tag){case 0:case 11:case 15:mo(9,l)}}catch(w){Ga(l,l.return,w)}if(l===s){co=null;break e}var _=l.sibling;if(null!==_){_.return=l.return,co=_;break e}co=l.return}}if($o=i,Zt(),Wt&&"function"==typeof Wt.onPostCommitFiberRoot)try{Wt.onPostCommitFiberRoot(Ht,e)}catch(w){}r=!0}return r}finally{It=n,qo.transition=t}}return!1}function Wa(e,t,n){vn(e,t=Mi(0,t=vi(n,t),1)),t=_a(),null!==(e=Ma(e,1))&&(Rt(e,1,t),Ea(e,t))}function Ga(e,t,n){if(3===e.tag)Wa(e,e,n);else for(;null!==t;){if(3===t.tag){Wa(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===pa||!pa.has(r))){vn(t,e=Ei(t,e=vi(n,e),1)),e=_a(),null!==(t=Ma(t,1))&&(Rt(t,1,e),Ea(t,e));break}}t=t.return}}function Xa(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),t=_a(),e.pingedLanes|=e.suspendedLanes&n,Yo===e&&(Jo&n)===n&&(4===ea||3===ea&&(130023424&Jo)===Jo&&500>Ft()-sa?La(e,0):ia|=n),Ea(e,t)}function qa(e,t){0===t&&(1&e.mode?(t=Mt,!(130023424&(Mt<<=1))&&(Mt=4194304)):t=1);var n=_a();null!==(e=Ma(e,t))&&(Rt(e,t,n),Ea(e,n))}function $a(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),qa(e,n)}function Ya(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;null!==i&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(o(314))}null!==r&&r.delete(t),qa(e,n)}function Za(e,t){return Nt(e,t)}function Ja(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,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 Ka(e,t,n,r){return new Ja(e,t,n,r)}function Qa(e){return!(!(e=e.prototype)||!e.isReactComponent)}function es(e,t){var n=e.alternate;return null===n?((n=Ka(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ts(e,t,n,r,i,a){var s=2;if(r=e,"function"==typeof e)Qa(e)&&(s=1);else if("string"==typeof e)s=5;else e:switch(e){case c:return ns(n.children,i,a,t);case d:s=8,i|=8;break;case h:return(e=Ka(12,n,t,2|i)).elementType=h,e.lanes=a,e;case g:return(e=Ka(13,n,t,i)).elementType=g,e.lanes=a,e;case v:return(e=Ka(19,n,t,i)).elementType=v,e.lanes=a,e;case x:return rs(n,i,a,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case p:s=10;break e;case f:s=9;break e;case m:s=11;break e;case y:s=14;break e;case b:s=16,r=null;break e}throw Error(o(130,null==e?e:typeof e,""))}return(t=Ka(s,n,t,i)).elementType=e,t.type=r,t.lanes=a,t}function ns(e,t,n,r){return(e=Ka(7,e,r,t)).lanes=n,e}function rs(e,t,n,r){return(e=Ka(22,e,r,t)).elementType=x,e.lanes=n,e.stateNode={},e}function is(e,t,n){return(e=Ka(6,e,null,t)).lanes=n,e}function os(e,t,n){return(t=Ka(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function as(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=X,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=kt(0),this.expirationTimes=kt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=kt(0),this.identifierPrefix=r,this.onRecoverableError=i,Z&&(this.mutableSourceEagerHydrationData=null)}function ss(e,t,n,r,i,o,a,s,l){return e=new as(e,t,n,s,l),1===t?(t=1,!0===o&&(t|=8)):t=0,o=Ka(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null},fn(o),e}function ls(e){if(!e)return ct;e:{if(E(e=e._reactInternals)!==e||1!==e.tag)throw Error(o(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(ft(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(o(171))}if(1===e.tag){var n=e.type;if(ft(n))return vt(e,n,t)}return t}function cs(e){var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(o(188));throw e=Object.keys(e).join(","),Error(o(268,e))}return null===(e=C(t))?null:e.stateNode}function us(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function ds(e,t){us(e,t),(e=e.alternate)&&us(e,t)}function hs(e){return null===(e=C(e))?null:e.stateNode}function ps(){return null}return ua=function(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps||dt.current)Di=!0;else{if(0===(e.lanes&n)&&!(128&t.flags))return Di=!1,function(e,t,n){switch(t.tag){case 3:Xi(t),Qn();break;case 5:fr(t);break;case 1:ft(t.type)&&yt(t);break;case 4:hr(t,t.stateNode.containerInfo);break;case 10:sn(0,t.type._context,t.memoizedProps.value);break;case 13:var r=t.memoizedState;if(null!==r)return null!==r.dehydrated?(lt(gr,1&gr.current),t.flags|=128,null):0!==(n&t.child.childLanes)?Zi(e,t,n):(lt(gr,1&gr.current),null!==(e=io(e,t,n))?e.sibling:null);lt(gr,1&gr.current);break;case 19:if(r=0!==(n&t.childLanes),128&e.flags){if(r)return ro(e,t,n);t.flags|=128}var i=t.memoizedState;if(null!==i&&(i.rendering=null,i.tail=null,i.lastEffect=null),lt(gr,gr.current),r)break;return null;case 22:case 23:return t.lanes=0,Vi(e,t,n)}return io(e,t,n)}(e,t,n);Di=!!(131072&e.flags)}else Di=!1,Wn&&1048576&t.flags&&zn(t,In,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps;var i=pt(t,ut.current);un(t,n),i=Ir(null,t,r,e,i,n);var a=Lr();return t.flags|=1,"object"==typeof i&&null!==i&&"function"==typeof i.render&&void 0===i.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ft(r)?(a=!0,yt(t)):a=!1,t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,fn(t),i.updater=Mn,t.stateNode=i,i._reactInternals=t,Cn(t,r,e,n),t=Gi(null,t,r,!0,a,n)):(t.tag=0,Wn&&a&&Bn(t),Ui(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,r=(i=r._init)(r._payload),t.type=r,i=t.tag=function(e){if("function"==typeof e)return Qa(e)?1:0;if(null!=e){if((e=e.$$typeof)===m)return 11;if(e===y)return 14}return 2}(r),e=en(r,e),i){case 0:t=Hi(null,t,r,e,n);break e;case 1:t=Wi(null,t,r,e,n);break e;case 11:t=Fi(null,t,r,e,n);break e;case 14:t=zi(null,t,r,en(r.type,e),n);break e}throw Error(o(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,Hi(e,t,r,i=t.elementType===r?i:en(r,i),n);case 1:return r=t.type,i=t.pendingProps,Wi(e,t,r,i=t.elementType===r?i:en(r,i),n);case 3:e:{if(Xi(t),null===e)throw Error(o(387));r=t.pendingProps,i=(a=t.memoizedState).element,mn(e,t),xn(t,r,null,n);var s=t.memoizedState;if(r=s.element,Z&&a.isDehydrated){if(a={element:r,isDehydrated:!1,cache:s.cache,transitions:s.transitions},t.updateQueue.baseState=a,t.memoizedState=a,256&t.flags){t=qi(e,t,r,n,i=Error(o(423)));break e}if(r!==i){t=qi(e,t,r,n,i=Error(o(424)));break e}for(Z&&(Hn=Ve(t.stateNode.containerInfo),jn=t,Wn=!0,Xn=null,Gn=!1),n=ar(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(Qn(),r===i){t=io(e,t,n);break e}Ui(e,t,r,n)}t=t.child}return t;case 5:return fr(t),null===e&&Zn(t),r=t.type,i=t.pendingProps,a=null!==e?e.memoizedProps:null,s=i.children,j(r,i)?s=null:null!==a&&j(r,a)&&(t.flags|=32),ji(e,t),Ui(e,t,s,n),t.child;case 6:return null===e&&Zn(t),null;case 13:return Zi(e,t,n);case 4:return hr(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=or(t,null,r,n):Ui(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,Fi(e,t,r,i=t.elementType===r?i:en(r,i),n);case 7:return Ui(e,t,t.pendingProps,n),t.child;case 8:case 12:return Ui(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,a=t.memoizedProps,sn(0,r,s=i.value),null!==a)if(Gt(a.value,s)){if(a.children===i.children&&!dt.current){t=io(e,t,n);break e}}else for(null!==(a=t.child)&&(a.return=t);null!==a;){var l=a.dependencies;if(null!==l){s=a.child;for(var c=l.firstContext;null!==c;){if(c.context===r){if(1===a.tag){(c=gn(-1,n&-n)).tag=2;var u=a.updateQueue;if(null!==u){var d=(u=u.shared).pending;null===d?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}a.lanes|=n,null!==(c=a.alternate)&&(c.lanes|=n),cn(a.return,n,t),l.lanes|=n;break}c=c.next}}else if(10===a.tag)s=a.type===t.type?null:a.child;else if(18===a.tag){if(null===(s=a.return))throw Error(o(341));s.lanes|=n,null!==(l=s.alternate)&&(l.lanes|=n),cn(s,n,t),s=a.sibling}else s=a.child;if(null!==s)s.return=a;else for(s=a;null!==s;){if(s===t){s=null;break}if(null!==(a=s.sibling)){a.return=s.return,s=a;break}s=s.return}a=s}Ui(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,un(t,n),r=r(i=dn(i)),t.flags|=1,Ui(e,t,r,n),t.child;case 14:return i=en(r=t.type,t.pendingProps),zi(e,t,r,i=en(r.type,i),n);case 15:return Bi(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:en(r,i),null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),t.tag=1,ft(r)?(e=!0,yt(t)):e=!1,un(t,n),Tn(t,r,i),Cn(t,r,i,n),Gi(null,t,r,!0,e,n);case 19:return ro(e,t,n);case 22:return Vi(e,t,n)}throw Error(o(156,t.tag))},t.attemptContinuousHydration=function(e){13===e.tag&&(Sa(e,134217728,_a()),ds(e,134217728))},t.attemptHydrationAtCurrentPriority=function(e){if(13===e.tag){var t=_a(),n=wa(e);Sa(e,n,t),ds(e,n)}},t.attemptSynchronousHydration=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Et(t.pendingLanes);0!==n&&(Pt(t,1|n),Ea(t,Ft()),!(6&$o)&&(ca(),Zt()))}break;case 13:var r=_a();Pa(function(){return Sa(e,1,r)}),ds(e,1)}},t.batchedUpdates=function(e,t){var n=$o;$o|=1;try{return e(t)}finally{0===($o=n)&&(ca(),qt&&Zt())}},t.createComponentSelector=function(e){return{$$typeof:Lo,value:e}},t.createContainer=function(e,t,n,r,i,o,a){return ss(e,t,!1,null,0,r,0,o,a)},t.createHasPseudoClassSelector=function(e){return{$$typeof:No,value:e}},t.createHydrationContainer=function(e,t,n,r,i,o,a,s,l){return(e=ss(n,r,!0,e,0,o,0,s,l)).context=ls(null),n=e.current,(o=gn(r=_a(),i=wa(n))).callback=null!=t?t:null,vn(n,o),e.current.lanes=i,Rt(e,i,r),Ea(e,r),e},t.createPortal=function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:l,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}},t.createRoleSelector=function(e){return{$$typeof:Oo,value:e}},t.createTestNameSelector=function(e){return{$$typeof:Do,value:e}},t.createTextSelector=function(e){return{$$typeof:Uo,value:e}},t.deferredUpdates=function(e){var t=It,n=qo.transition;try{return qo.transition=null,It=16,e()}finally{It=t,qo.transition=n}},t.discreteUpdates=function(e,t,n,r,i){var o=It,a=qo.transition;try{return qo.transition=null,It=1,e(t,n,r,i)}finally{It=o,qo.transition=a,0===$o&&ca()}},t.findAllNodes=Ho,t.findBoundingRects=function(e,t){if(!re)throw Error(o(363));t=Ho(e,t),e=[];for(var n=0;n<t.length;n++)e.push(oe(t[n]));for(t=e.length-1;0<t;t--)for(var r=(n=e[t]).x,i=r+n.width,a=n.y,s=a+n.height,l=t-1;0<=l;l--)if(t!==l){var c=e[l],u=c.x,d=u+c.width,h=c.y,p=h+c.height;if(r>=u&&a>=h&&i<=d&&s<=p){e.splice(t,1);break}if(!(r!==u||n.width!==c.width||p<a||h>s)){h>a&&(c.height+=h-a,c.y=a),p<s&&(c.height=s-h),e.splice(t,1);break}if(!(a!==h||n.height!==c.height||d<r||u>i)){u>r&&(c.width+=u-r,c.x=r),d<i&&(c.width=i-u),e.splice(t,1);break}}return e},t.findHostInstance=cs,t.findHostInstanceWithNoPortals=function(e){return null===(e=null!==(e=A(e))?R(e):null)?null:e.stateNode},t.findHostInstanceWithWarning=function(e){return cs(e)},t.flushControlled=function(e){var t=$o;$o|=1;var n=qo.transition,r=It;try{qo.transition=null,It=1,e()}finally{It=r,qo.transition=n,0===($o=t)&&(ca(),Zt())}},t.flushPassiveEffects=Ha,t.flushSync=Pa,t.focusWithin=function(e,t){if(!re)throw Error(o(363));for(t=jo(e=zo(e),t),t=Array.from(t),e=0;e<t.length;){var n=t[e++];if(!se(n)){if(5===n.tag&&ce(n.stateNode))return!0;for(n=n.child;null!==n;)t.push(n),n=n.sibling}}return!1},t.getCurrentUpdatePriority=function(){return It},t.getFindAllNodesFailureDescription=function(e,t){if(!re)throw Error(o(363));var n=0,r=[];e=[zo(e),0];for(var i=0;i<e.length;){var a=e[i++],s=e[i++],l=t[s];if((5!==a.tag||!se(a))&&(Bo(a,l)&&(r.push(Vo(l)),++s>n&&(n=s)),s<t.length))for(a=a.child;null!==a;)e.push(a,s),a=a.sibling}if(n<t.length){for(e=[];n<t.length;n++)e.push(Vo(t[n]));return"findAllNodes was able to match part of the selector:\n "+r.join(" > ")+"\n\nNo matching component was found for:\n "+e.join(" > ")}return null},t.getPublicRootInstance=function(e){return(e=e.current).child?5===e.child.tag?L(e.child.stateNode):e.child.stateNode:null},t.injectIntoDevTools=function(e){if(e={bundleType:e.bundleType,version:e.version,rendererPackageName:e.rendererPackageName,rendererConfig:e.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:hs,findFiberByHostInstance:e.findFiberByHostInstance||ps,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)e=!0;else{try{Ht=t.inject(e),Wt=t}catch(n){}e=!!t.checkDCE}}return e},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(e,t,n,r){if(!re)throw Error(o(363));e=Ho(e,t);var i=ue(e,n,r).disconnect;return{disconnect:function(){i()}}},t.registerMutableSourceForHydration=function(e,t){var n=t._getVersion;n=n(t._source),null==e.mutableSourceEagerHydrationData?e.mutableSourceEagerHydrationData=[t,n]:e.mutableSourceEagerHydrationData.push(t,n)},t.runWithPriority=function(e,t){var n=It;try{return It=e,t()}finally{It=n}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(e,t,n,r){var i=t.current,o=_a(),a=wa(i);return n=ls(n),null===t.context?t.context=n:t.pendingContext=n,(t=gn(o,a)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),vn(i,t),null!==(e=Sa(i,a,o))&&yn(e,i,a),a},t}),aL}const fL=t((lL||(lL=1,cL.exports=pL()),cL.exports));var mL,gL,vL={exports:{}},yL={};var bL=(gL||(gL=1,vL.exports=(mL||(mL=1,function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<i(o,t)))break e;e[r]=t,e[n]=o,n=r}}function n(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,a=o>>>1;r<a;){var s=2*(r+1)-1,l=e[s],c=s+1,u=e[c];if(0>i(l,n))c<o&&0>i(u,l)?(e[r]=u,e[c]=n,r=c):(e[r]=l,e[s]=n,r=s);else{if(!(c<o&&0>i(u,n)))break e;e[r]=u,e[c]=n,r=c}}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,s=a.now();e.unstable_now=function(){return a.now()-s}}var l=[],c=[],u=1,d=null,h=3,p=!1,f=!1,m=!1,g="function"==typeof setTimeout?setTimeout:null,v="function"==typeof clearTimeout?clearTimeout:null,y="undefined"!=typeof setImmediate?setImmediate:null;function b(e){for(var i=n(c);null!==i;){if(null===i.callback)r(c);else{if(!(i.startTime<=e))break;r(c),i.sortIndex=i.expirationTime,t(l,i)}i=n(c)}}function x(e){if(m=!1,b(e),!f)if(null!==n(l))f=!0,I(_);else{var t=n(c);null!==t&&L(x,t.startTime-e)}}function _(t,i){f=!1,m&&(m=!1,v(E),E=-1),p=!0;var o=h;try{for(b(i),d=n(l);null!==d&&(!(d.expirationTime>i)||t&&!C());){var a=d.callback;if("function"==typeof a){d.callback=null,h=d.priorityLevel;var s=a(d.expirationTime<=i);i=e.unstable_now(),"function"==typeof s?d.callback=s:d===n(l)&&r(l),b(i)}else r(l);d=n(l)}if(null!==d)var u=!0;else{var g=n(c);null!==g&&L(x,g.startTime-i),u=!1}return u}finally{d=null,h=o,p=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var w,S=!1,M=null,E=-1,T=5,A=-1;function C(){return!(e.unstable_now()-A<T)}function k(){if(null!==M){var t=e.unstable_now();A=t;var n=!0;try{n=M(!0,t)}finally{n?w():(S=!1,M=null)}}else S=!1}if("function"==typeof y)w=function(){y(k)};else if("undefined"!=typeof MessageChannel){var R=new MessageChannel,P=R.port2;R.port1.onmessage=k,w=function(){P.postMessage(null)}}else w=function(){g(k,0)};function I(e){M=e,S||(S=!0,w())}function L(t,n){E=g(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){f||p||(f=!0,I(_))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(e){switch(h){case 1:case 2:case 3:var t=3;break;default:t=h}var n=h;h=t;try{return e()}finally{h=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=h;h=e;try{return t()}finally{h=n}},e.unstable_scheduleCallback=function(r,i,o){var a=e.unstable_now();switch(o="object"==typeof o&&null!==o&&"number"==typeof(o=o.delay)&&0<o?a+o:a,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return r={id:u++,callback:i,priorityLevel:r,startTime:o,expirationTime:s=o+s,sortIndex:-1},o>a?(r.sortIndex=o,t(c,r),null===n(l)&&r===n(c)&&(m?(v(E),E=-1):m=!0,L(x,o-a))):(r.sortIndex=s,t(l,r),f||p||(f=!0,I(_))),r},e.unstable_shouldYield=C,e.unstable_wrapCallback=function(e){var t=h;return function(){var n=h;h=t;try{return e.apply(this,arguments)}finally{h=n}}}}(yL)),yL)),vL.exports);const xL={};var _L,wL;const SL=e=>"colorSpace"in e||"outputColorSpace"in e,ML=()=>{var e;return null!=(e=xL.ColorManagement)?e:null},EL=e=>e&&e.isOrthographicCamera,TL="undefined"!=typeof window&&(null!=(_L=window.document)&&_L.createElement||"ReactNative"===(null==(wL=window.navigator)?void 0:wL.product))?w.useLayoutEffect:w.useEffect;function AL(e){const t=w.useRef(e);return TL(()=>{t.current=e},[e]),t}function CL({set:e}){return TL(()=>(e(new Promise(()=>null)),()=>e(!1)),[e]),null}class kL extends w.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}kL.getDerivedStateFromError=()=>({error:!0});const RL="__default",PL=new Map,IL=e=>e&&!!e.memoized&&!!e.changes;function LL(e){var t;const n="undefined"!=typeof window?null!=(t=window.devicePixelRatio)?t:2:1;return Array.isArray(e)?Math.min(Math.max(e[0],n),e[1]):e}const NL=e=>{var t;return null==(t=e.__r3f)?void 0:t.root.getState()};function OL(e){let t=e.__r3f.root;for(;t.getState().previousRoot;)t=t.getState().previousRoot;return t}const DL={obj:e=>e===Object(e)&&!DL.arr(e)&&"function"!=typeof e,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,boo:e=>"boolean"==typeof e,und:e=>void 0===e,arr:e=>Array.isArray(e),equ(e,t,{arrays:n="shallow",objects:r="reference",strict:i=!0}={}){if(typeof e!=typeof t||!!e!=!!t)return!1;if(DL.str(e)||DL.num(e)||DL.boo(e))return e===t;const o=DL.obj(e);if(o&&"reference"===r)return e===t;const a=DL.arr(e);if(a&&"reference"===n)return e===t;if((a||o)&&e===t)return!0;let s;for(s in e)if(!(s in t))return!1;if(o&&"shallow"===n&&"shallow"===r){for(s in i?t:e)if(!DL.equ(e[s],t[s],{strict:i,objects:"reference"}))return!1}else for(s in i?t:e)if(e[s]!==t[s])return!1;if(DL.und(s)){if(a&&0===e.length&&0===t.length)return!0;if(o&&0===Object.keys(e).length&&0===Object.keys(t).length)return!0;if(e!==t)return!1}return!0}};function UL(e,t){return e.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...t},e}function FL(e,t){let n=e;if(t.includes("-")){const r=t.split("-"),i=r.pop();return n=r.reduce((e,t)=>e[t],e),{target:n,key:i}}return{target:n,key:t}}const zL=/-\d+$/;function BL(e,t,n){if(DL.str(n)){if(zL.test(n)){const t=n.replace(zL,""),{target:r,key:i}=FL(e,t);Array.isArray(r[i])||(r[i]=[])}const{target:r,key:i}=FL(e,n);t.__r3f.previousAttach=r[i],r[i]=t}else t.__r3f.previousAttach=n(e,t)}function VL(e,t,n){var r,i;if(DL.str(n)){const{target:r,key:i}=FL(e,n),o=t.__r3f.previousAttach;void 0===o?delete r[i]:r[i]=o}else null==(r=t.__r3f)||null==r.previousAttach||r.previousAttach(e,t);null==(i=t.__r3f)||delete i.previousAttach}function jL(e,{children:t,key:n,ref:r,...i},{children:o,key:a,ref:s,...l}={},c=!1){const u=e.__r3f,d=Object.entries(i),h=[];if(c){const e=Object.keys(l);for(let t=0;t<e.length;t++)i.hasOwnProperty(e[t])||d.unshift([e[t],RL+"remove"])}d.forEach(([t,n])=>{var r;if(null!=(r=e.__r3f)&&r.primitive&&"object"===t)return;if(DL.equ(n,l[t]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(t))return h.push([t,n,!0,[]]);let o=[];t.includes("-")&&(o=t.split("-")),h.push([t,n,!1,o]);for(const e in i){const n=i[e];e.startsWith(`${t}-`)&&h.push([e,n,!1,e.split("-")])}});const p={...i};return null!=u&&u.memoizedProps&&null!=u&&u.memoizedProps.args&&(p.args=u.memoizedProps.args),null!=u&&u.memoizedProps&&null!=u&&u.memoizedProps.attach&&(p.attach=u.memoizedProps.attach),{memoized:p,changes:h}}function HL(e,t){var n;const r=e.__r3f,i=null==r?void 0:r.root,o=null==i||null==i.getState?void 0:i.getState(),{memoized:a,changes:s}=IL(t)?t:jL(e,t),l=null==r?void 0:r.eventCount;e.__r3f&&(e.__r3f.memoizedProps=a);for(let d=0;d<s.length;d++){let[t,n,i,a]=s[d];if(SL(e)){const e=3001,r="srgb",i="srgb-linear";"encoding"===t?(t="colorSpace",n=n===e?r:i):"outputEncoding"===t&&(t="outputColorSpace",n=n===e?r:i)}let l=e,h=l[t];if(a.length&&(h=a.reduce((e,t)=>e[t],e),!h||!h.set)){const[n,...r]=a.reverse();l=r.reverse().reduce((e,t)=>e[t],e),t=n}if(n===RL+"remove")if(l.constructor){let e=PL.get(l.constructor);e||(e=new l.constructor,PL.set(l.constructor,e)),n=e[t]}else n=0;if(i&&r)n?r.handlers[t]=n:delete r.handlers[t],r.eventCount=Object.keys(r.handlers).length;else if(h&&h.set&&(h.copy||h instanceof Cw)){if(Array.isArray(n))h.fromArray?h.fromArray(n):h.set(...n);else if(h.copy&&n&&n.constructor&&h.constructor===n.constructor)h.copy(n);else if(void 0!==n){var c;const e=null==(c=h)?void 0:c.isColor;!e&&h.setScalar?h.setScalar(n):h instanceof Cw&&n instanceof Cw?h.mask=n.mask:h.set(n),!ML()&&o&&!o.linear&&e&&h.convertSRGBToLinear()}}else{var u;if(l[t]=n,null!=(u=l[t])&&u.isTexture&&l[t].format===Ib&&l[t].type===vb&&o){const e=l[t];SL(e)&&SL(o.gl)?e.colorSpace=o.gl.outputColorSpace:e.encoding=o.gl.outputEncoding}}WL(e)}if(r&&r.parent&&e.raycast&&l!==r.eventCount){const t=OL(e).getState().internal,n=t.interaction.indexOf(e);n>-1&&t.interaction.splice(n,1),r.eventCount&&t.interaction.push(e)}return!(1===s.length&&"onUpdate"===s[0][0])&&s.length&&null!=(n=e.__r3f)&&n.parent&&GL(e),e}function WL(e){var t,n;const r=null==(t=e.__r3f)||null==(n=t.root)||null==n.getState?void 0:n.getState();r&&0===r.internal.frames&&r.invalidate()}function GL(e){null==e.onUpdate||e.onUpdate(e)}function XL(e){return(e.eventObject||e.object).uuid+"/"+e.index+e.instanceId}function qL(e,t,n,r){const i=n.get(t);i&&(n.delete(t),0===n.size&&(e.delete(r),i.target.releasePointerCapture(r)))}function $L(e){function t(e){return e.filter(e=>["Move","Over","Enter","Out","Leave"].some(t=>{var n;return null==(n=e.__r3f)?void 0:n.handlers["onPointer"+t]}))}function n(t){const{internal:n}=e.getState();for(const e of n.hovered.values())if(!t.length||!t.find(t=>t.object===e.object&&t.index===e.index&&t.instanceId===e.instanceId)){const r=e.eventObject.__r3f,i=null==r?void 0:r.handlers;if(n.hovered.delete(XL(e)),null!=r&&r.eventCount){const n={...e,intersections:t};null==i.onPointerOut||i.onPointerOut(n),null==i.onPointerLeave||i.onPointerLeave(n)}}}function r(e,t){for(let n=0;n<t.length;n++){const r=t[n].__r3f;null==r||null==r.handlers.onPointerMissed||r.handlers.onPointerMissed(e)}}return{handlePointer:function(i){switch(i){case"onPointerLeave":case"onPointerCancel":return()=>n([]);case"onLostPointerCapture":return t=>{const{internal:r}=e.getState();"pointerId"in t&&r.capturedMap.has(t.pointerId)&&requestAnimationFrame(()=>{r.capturedMap.has(t.pointerId)&&(r.capturedMap.delete(t.pointerId),n([]))})}}return function(o){const{onPointerMissed:a,internal:s}=e.getState();s.lastEvent.current=o;const l="onPointerMove"===i,c="onClick"===i||"onContextMenu"===i||"onDoubleClick"===i,u=function(t,n){const r=e.getState(),i=new Set,o=[],a=n?n(r.internal.interaction):r.internal.interaction;for(let e=0;e<a.length;e++){const t=NL(a[e]);t&&(t.raycaster.camera=void 0)}r.previousRoot||null==r.events.compute||r.events.compute(t,r);let s=a.flatMap(function(e){const n=NL(e);return n&&n.events.enabled&&null!==n.raycaster.camera?(void 0===n.raycaster.camera&&(null==n.events.compute||n.events.compute(t,n,null==(r=n.previousRoot)?void 0:r.getState()),void 0===n.raycaster.camera&&(n.raycaster.camera=null)),n.raycaster.camera?n.raycaster.intersectObject(e,!0):[]):[];var r}).sort((e,t)=>{const n=NL(e.object),r=NL(t.object);return n&&r&&r.events.priority-n.events.priority||e.distance-t.distance}).filter(e=>{const t=XL(e);return!i.has(t)&&(i.add(t),!0)});r.events.filter&&(s=r.events.filter(s,r));for(const e of s){let t=e.object;for(;t;){var l;null!=(l=t.__r3f)&&l.eventCount&&o.push({...e,eventObject:t}),t=t.parent}}if("pointerId"in t&&r.internal.capturedMap.has(t.pointerId))for(let e of r.internal.capturedMap.get(t.pointerId).values())i.has(XL(e.intersection))||o.push(e.intersection);return o}(o,l?t:void 0),d=c?function(t){const{internal:n}=e.getState(),r=t.offsetX-n.initialClick[0],i=t.offsetY-n.initialClick[1];return Math.round(Math.sqrt(r*r+i*i))}(o):0;"onPointerDown"===i&&(s.initialClick=[o.offsetX,o.offsetY],s.initialHits=u.map(e=>e.eventObject)),c&&!u.length&&d<=2&&(r(o,s.interaction),a&&a(o)),l&&n(u),function(t,r,i,o){const a=e.getState();if(t.length){const e={stopped:!1};for(const s of t){const l=NL(s.object)||a,{raycaster:c,pointer:u,camera:d,internal:h}=l,p=new x_(u.x,u.y,0).unproject(d),f=e=>{var t,n;return null!=(t=null==(n=h.capturedMap.get(e))?void 0:n.has(s.eventObject))&&t},m=e=>{const t={intersection:s,target:r.target};h.capturedMap.has(e)?h.capturedMap.get(e).set(s.eventObject,t):h.capturedMap.set(e,new Map([[s.eventObject,t]])),r.target.setPointerCapture(e)},g=e=>{const t=h.capturedMap.get(e);t&&qL(h.capturedMap,s.eventObject,t,e)};let v={};for(let e in r){let t=r[e];"function"!=typeof t&&(v[e]=t)}let y={...s,...v,pointer:u,intersections:t,stopped:e.stopped,delta:i,unprojectedPoint:p,ray:c.ray,camera:d,stopPropagation(){const i="pointerId"in r&&h.capturedMap.get(r.pointerId);(!i||i.has(s.eventObject))&&(y.stopped=e.stopped=!0,h.hovered.size&&Array.from(h.hovered.values()).find(e=>e.eventObject===s.eventObject))&&n([...t.slice(0,t.indexOf(s)),s])},target:{hasPointerCapture:f,setPointerCapture:m,releasePointerCapture:g},currentTarget:{hasPointerCapture:f,setPointerCapture:m,releasePointerCapture:g},nativeEvent:r};if(o(y),!0===e.stopped)break}}}(u,o,d,function(e){const t=e.eventObject,n=t.__r3f,a=null==n?void 0:n.handlers;if(null!=n&&n.eventCount)if(l){if(a.onPointerOver||a.onPointerEnter||a.onPointerOut||a.onPointerLeave){const t=XL(e),n=s.hovered.get(t);n?n.stopped&&e.stopPropagation():(s.hovered.set(t,e),null==a.onPointerOver||a.onPointerOver(e),null==a.onPointerEnter||a.onPointerEnter(e))}null==a.onPointerMove||a.onPointerMove(e)}else{const n=a[i];n?c&&!s.initialHits.includes(t)||(r(o,s.interaction.filter(e=>!s.initialHits.includes(e))),n(e)):c&&s.initialHits.includes(t)&&r(o,s.interaction.filter(e=>!s.initialHits.includes(e)))}})}}}}const YL=e=>!(null==e||!e.render),ZL=w.createContext(null),JL=(e,t)=>{const n=function(e){const t="function"==typeof e?nL(e):e,n=(e=t.getState,n=Object.is)=>{const[,r]=w.useReducer(e=>e+1,0),i=t.getState(),o=w.useRef(i),a=w.useRef(e),s=w.useRef(n),l=w.useRef(!1),c=w.useRef();let u;void 0===c.current&&(c.current=e(i));let d=!1;(o.current!==i||a.current!==e||s.current!==n||l.current)&&(u=e(i),d=!n(c.current,u)),rL(()=>{d&&(c.current=u),o.current=i,a.current=e,s.current=n,l.current=!1});const h=w.useRef(i);rL(()=>{const e=()=>{try{const e=t.getState(),n=a.current(e);s.current(c.current,n)||(o.current=e,c.current=n,r())}catch(e){l.current=!0,r()}},n=t.subscribe(e);return t.getState()!==h.current&&e(),n},[]);const p=d?u:c.current;return w.useDebugValue(p),p};return Object.assign(n,t),n[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const e=[n,t];return{next(){const t=e.length<=0;return{value:e.shift(),done:t}}}},n}((n,r)=>{const i=new x_,o=new x_,a=new x_;function s(e=r().camera,t=o,n=r().size){const{width:s,height:l,top:c,left:u}=n,d=s/l;t.isVector3?a.copy(t):a.set(...t);const h=e.getWorldPosition(i).distanceTo(a);if(EL(e))return{width:s/e.zoom,height:l/e.zoom,top:c,left:u,factor:1,distance:h,aspect:d};{const t=e.fov*Math.PI/180,n=2*Math.tan(t/2)*h,r=n*(s/l);return{width:r,height:n,top:c,left:u,factor:s/r,distance:h,aspect:d}}}let l;const c=e=>n(t=>({performance:{...t.performance,current:e}})),u=new y_;return{set:n,get:r,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(t=1)=>e(r(),t),advance:(e,n)=>t(e,n,r()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new JC,pointer:u,mouse:u,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const e=r();l&&clearTimeout(l),e.performance.current!==e.performance.min&&c(e.performance.min),l=setTimeout(()=>c(r().performance.max),e.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:s},setEvents:e=>n(t=>({...t,events:{...t.events,...e}})),setSize:(e,t,i,a,l)=>{const c=r().camera,u={width:e,height:t,top:a||0,left:l||0,updateStyle:i};n(e=>({size:u,viewport:{...e.viewport,...s(c,o,u)}}))},setDpr:e=>n(t=>{const n=LL(e);return{viewport:{...t.viewport,dpr:n,initialDpr:t.viewport.initialDpr||n}}}),setFrameloop:(e="always")=>{const t=r().clock;t.stop(),t.elapsedTime=0,"never"!==e&&(t.start(),t.elapsedTime=0),n(()=>({frameloop:e}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:w.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(e,t,n)=>{const i=r().internal;return i.priority=i.priority+(t>0?1:0),i.subscribers.push({ref:e,priority:t,store:n}),i.subscribers=i.subscribers.sort((e,t)=>e.priority-t.priority),()=>{const n=r().internal;null!=n&&n.subscribers&&(n.priority=n.priority-(t>0?1:0),n.subscribers=n.subscribers.filter(t=>t.ref!==e))}}}}}),r=n.getState();let i=r.size,o=r.viewport.dpr,a=r.camera;return n.subscribe(()=>{const{camera:e,size:t,viewport:r,gl:s,set:l}=n.getState();if(t.width!==i.width||t.height!==i.height||r.dpr!==o){var c;i=t,o=r.dpr,function(e,t){e.manual||(EL(e)?(e.left=t.width/-2,e.right=t.width/2,e.top=t.height/2,e.bottom=t.height/-2):e.aspect=t.width/t.height,e.updateProjectionMatrix(),e.updateMatrixWorld())}(e,t),s.setPixelRatio(r.dpr);const n=null!=(c=t.updateStyle)?c:"undefined"!=typeof HTMLCanvasElement&&s.domElement instanceof HTMLCanvasElement;s.setSize(t.width,t.height,n)}e!==a&&(a=e,l(t=>({viewport:{...t.viewport,...t.viewport.getCurrentViewport(e)}})))}),n.subscribe(t=>e(t)),n};let KL,QL,eN,tN=new Set,nN=new Set,rN=new Set;function iN(e,t){if(e.size)for(const{callback:n}of e.values())n(t)}function oN(e,t){switch(e){case"before":return iN(tN,t);case"after":return iN(nN,t);case"tail":return iN(rN,t)}}function aN(e,t,n){let r=t.clock.getDelta();for("never"===t.frameloop&&"number"==typeof e&&(r=e-t.clock.elapsedTime,t.clock.oldTime=t.clock.elapsedTime,t.clock.elapsedTime=e),QL=t.internal.subscribers,KL=0;KL<QL.length;KL++)eN=QL[KL],eN.ref.current(eN.store.getState(),r,n);return!t.internal.priority&&t.gl.render&&t.gl.render(t.scene,t.camera),t.internal.frames=Math.max(0,t.internal.frames-1),"always"===t.frameloop?1:t.internal.frames}function sN(){const e=w.useContext(ZL);if(!e)throw new Error("R3F: Hooks can only be used within the Canvas component!");return e}function lN(e=e=>e,t){return sN()(e,t)}const cN=new Map,{invalidate:uN,advance:dN}=function(e){let t,n,r,i=!1,o=!1;function a(s){n=requestAnimationFrame(a),i=!0,t=0,oN("before",s),o=!0;for(const n of e.values()){var l;r=n.store.getState(),!r.internal.active||!("always"===r.frameloop||r.internal.frames>0)||null!=(l=r.gl.xr)&&l.isPresenting||(t+=aN(s,r))}if(o=!1,oN("after",s),0===t)return oN("tail",s),i=!1,cancelAnimationFrame(n)}return{loop:a,invalidate:function t(n,r=1){var s;if(!n)return e.forEach(e=>t(e.store.getState(),r));null!=(s=n.gl.xr)&&s.isPresenting||!n.internal.active||"never"===n.frameloop||(n.internal.frames=r>1?Math.min(60,n.internal.frames+r):o?2:1,i||(i=!0,requestAnimationFrame(a)))},advance:function(t,n=!0,r,i){if(n&&oN("before",t),r)aN(t,r,i);else for(const o of e.values())aN(t,o.store.getState());n&&oN("after",t)}}}(cN),{reconciler:hN,applyProps:pN}=function(e,t){function n(e,{args:t=[],attach:n,...r},i){let o,a=`${e[0].toUpperCase()}${e.slice(1)}`;if("primitive"===e){if(void 0===r.object)throw new Error("R3F: Primitives without 'object' are invalid!");o=UL(r.object,{type:e,root:i,attach:n,primitive:!0})}else{const r=xL[a];if(!r)throw new Error(`R3F: ${a} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(t))throw new Error("R3F: The args prop must be an array!");o=UL(new r(...t),{type:e,root:i,attach:n,memoizedProps:{args:t}})}return void 0===o.__r3f.attach&&(o.isBufferGeometry?o.__r3f.attach="geometry":o.isMaterial&&(o.__r3f.attach="material")),"inject"!==a&&HL(o,r),o}function r(e,t){let n=!1;var r,i;t&&(null!=(r=t.__r3f)&&r.attach?BL(e,t,t.__r3f.attach):t.isObject3D&&e.isObject3D&&(e.add(t),n=!0),n||null==(i=e.__r3f)||i.objects.push(t),t.__r3f||UL(t,{}),t.__r3f.parent=e,GL(t),WL(t))}function i(e,t,n){let r=!1;if(t){var i,o;if(null!=(i=t.__r3f)&&i.attach)BL(e,t,t.__r3f.attach);else if(t.isObject3D&&e.isObject3D){t.parent=e,t.dispatchEvent({type:"added"}),e.dispatchEvent({type:"childadded",child:t});const i=e.children.filter(e=>e!==t),o=i.indexOf(n);e.children=[...i.slice(0,o),t,...i.slice(o)],r=!0}r||null==(o=e.__r3f)||o.objects.push(t),t.__r3f||UL(t,{}),t.__r3f.parent=e,GL(t),WL(t)}}function o(e,t,n=!1){e&&[...e].forEach(e=>a(t,e,n))}function a(e,t,n){if(t){var r,i,a;if(t.__r3f&&(t.__r3f.parent=null),null!=(r=e.__r3f)&&r.objects&&(e.__r3f.objects=e.__r3f.objects.filter(e=>e!==t)),null!=(i=t.__r3f)&&i.attach)VL(e,t,t.__r3f.attach);else if(t.isObject3D&&e.isObject3D){var s;e.remove(t),null!=(s=t.__r3f)&&s.root&&function(e,t){const{internal:n}=e.getState();n.interaction=n.interaction.filter(e=>e!==t),n.initialHits=n.initialHits.filter(e=>e!==t),n.hovered.forEach((e,r)=>{e.eventObject!==t&&e.object!==t||n.hovered.delete(r)}),n.capturedMap.forEach((e,r)=>{qL(n.capturedMap,t,e,r)})}(OL(t),t)}const c=null==(a=t.__r3f)?void 0:a.primitive,u=!c&&(void 0===n?null!==t.dispose:n);var l;if(!c)o(null==(l=t.__r3f)?void 0:l.objects,t,u),o(t.children,t,u);if(delete t.__r3f,u&&t.dispose&&"Scene"!==t.type){const e=()=>{try{t.dispose()}catch(Dv){}};"undefined"==typeof IS_REACT_ACT_ENVIRONMENT?bL.unstable_scheduleCallback(bL.unstable_IdlePriority,e):e()}WL(e)}}const s=()=>{};return{reconciler:fL({createInstance:n,removeChild:a,appendChild:r,appendInitialChild:r,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(e,t)=>{if(!t)return;const n=e.getState().scene;n.__r3f&&(n.__r3f.root=e,r(n,t))},removeChildFromContainer:(e,t)=>{t&&a(e.getState().scene,t)},insertInContainerBefore:(e,t,n)=>{if(!t||!n)return;const r=e.getState().scene;r.__r3f&&i(r,t,n)},getRootHostContext:()=>null,getChildHostContext:e=>e,finalizeInitialChildren(e){var t;const n=null!=(t=null==e?void 0:e.__r3f)?t:{};return Boolean(n.handlers)},prepareUpdate(e,t,n,r){var i;if((null!=(i=null==e?void 0:e.__r3f)?i:{}).primitive&&r.object&&r.object!==e)return[!0];{const{args:t=[],children:i,...o}=r,{args:a=[],children:s,...l}=n;if(!Array.isArray(t))throw new Error("R3F: the args prop must be an array!");if(t.some((e,t)=>e!==a[t]))return[!0];const c=jL(e,o,l,!0);return c.changes.length?[!1,c]:null}},commitUpdate(e,[t,i],o,s,l,c){t?function(e,t,i,o){var s;const l=null==(s=e.__r3f)?void 0:s.parent;if(!l)return;const c=n(t,i,e.__r3f.root);if(e.children){for(const t of e.children)t.__r3f&&r(c,t);e.children=e.children.filter(e=>!e.__r3f)}e.__r3f.objects.forEach(e=>r(c,e)),e.__r3f.objects=[],e.__r3f.autoRemovedBeforeAppend||a(l,e),c.parent&&(c.__r3f.autoRemovedBeforeAppend=!0),r(l,c),c.raycast&&c.__r3f.eventCount&&OL(c).getState().internal.interaction.push(c);[o,o.alternate].forEach(e=>{null!==e&&(e.stateNode=c,e.ref&&("function"==typeof e.ref?e.ref(c):e.ref.current=c))})}(e,o,l,c):HL(e,i)},commitMount(e,t,n,r){var i;const o=null!=(i=e.__r3f)?i:{};e.raycast&&o.handlers&&o.eventCount&&OL(e).getState().internal.interaction.push(e)},getPublicInstance:e=>e,prepareForCommit:()=>null,preparePortalMount:e=>UL(e.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(e){var t;const{attach:n,parent:r}=null!=(t=e.__r3f)?t:{};n&&r&&VL(r,e,n),e.isObject3D&&(e.visible=!1),WL(e)},unhideInstance(e,t){var n;const{attach:r,parent:i}=null!=(n=e.__r3f)?n:{};r&&i&&BL(i,e,r),(e.isObject3D&&null==t.visible||t.visible)&&(e.visible=!0),WL(e)},createTextInstance:s,hideTextInstance:s,unhideTextInstance:s,getCurrentEventPriority:()=>t?t():tL.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:"undefined"!=typeof performance&&DL.fun(performance.now)?performance.now:DL.fun(Date.now)?Date.now:()=>0,scheduleTimeout:DL.fun(setTimeout)?setTimeout:void 0,cancelTimeout:DL.fun(clearTimeout)?clearTimeout:void 0}),applyProps:HL}}(0,function(){var e;const t="undefined"!=typeof self&&self||"undefined"!=typeof window&&window;if(!t)return tL.DefaultEventPriority;switch(null==(e=t.event)?void 0:e.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return tL.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return tL.ContinuousEventPriority;default:return tL.DefaultEventPriority}}),fN={objects:"shallow",strict:!1},mN=(e,t)=>{const n="function"==typeof e?e(t):e;return YL(n)?n:new YI({powerPreference:"high-performance",canvas:t,antialias:!0,alpha:!0,...e})};function gN(e){const t=cN.get(e),n=null==t?void 0:t.fiber,r=null==t?void 0:t.store;t&&console.warn("R3F.createRoot should only be called once!");const i="function"==typeof reportError?reportError:console.error,o=r||JL(uN,dN),a=n||hN.createContainer(o,tL.ConcurrentRoot,null,!1,null,"",i,null);let s;t||cN.set(e,{fiber:a,store:o});let l,c=!1;return{configure(t={}){let{gl:n,size:r,scene:i,events:a,onCreated:u,shadows:d=!1,linear:h=!1,flat:p=!1,legacy:f=!1,orthographic:m=!1,frameloop:g="always",dpr:v=[1,2],performance:y,raycaster:b,camera:x,onPointerMissed:_}=t,w=o.getState(),S=w.gl;w.gl||w.set({gl:S=mN(n,e)});let M=w.raycaster;M||w.set({raycaster:M=new Sk});const{params:E,...T}=b||{};if(DL.equ(T,M,fN)||pN(M,{...T}),DL.equ(E,M.params,fN)||pN(M,{params:{...M.params,...E}}),!w.camera||w.camera===l&&!DL.equ(l,x,fN)){l=x;const e=x instanceof KS,t=e?x:m?new kC(0,0,0,0,.1,1e3):new nM(75,0,.1,1e3);e||(t.position.z=5,x&&(pN(t,x),("aspect"in x||"left"in x||"right"in x||"bottom"in x||"top"in x)&&(t.manual=!0,t.updateProjectionMatrix())),w.camera||null!=x&&x.rotation||t.lookAt(0,0,0)),w.set({camera:t}),M.camera=t}if(!w.scene){let e;null!=i&&i.isScene?e=i:(e=new hM,i&&pN(e,i)),w.set({scene:UL(e)})}if(!w.xr){var A;const e=(e,t)=>{const n=o.getState();"never"!==n.frameloop&&dN(e,!0,n,t)},t=()=>{const t=o.getState();t.gl.xr.enabled=t.gl.xr.isPresenting,t.gl.xr.setAnimationLoop(t.gl.xr.isPresenting?e:null),t.gl.xr.isPresenting||uN(t)},n={connect(){const e=o.getState().gl;e.xr.addEventListener("sessionstart",t),e.xr.addEventListener("sessionend",t)},disconnect(){const e=o.getState().gl;e.xr.removeEventListener("sessionstart",t),e.xr.removeEventListener("sessionend",t)}};"function"==typeof(null==(A=S.xr)?void 0:A.addEventListener)&&n.connect(),w.set({xr:n})}if(S.shadowMap){const e=S.shadowMap.enabled,t=S.shadowMap.type;if(S.shadowMap.enabled=!!d,DL.boo(d))S.shadowMap.type=2;else if(DL.str(d)){var C;const e={basic:0,percentage:1,soft:2,variance:3};S.shadowMap.type=null!=(C=e[d])?C:2}else DL.obj(d)&&Object.assign(S.shadowMap,d);e===S.shadowMap.enabled&&t===S.shadowMap.type||(S.shadowMap.needsUpdate=!0)}const k=ML();if(k&&("enabled"in k?k.enabled=!f:"legacyMode"in k&&(k.legacyMode=f)),!c){pN(S,{outputEncoding:h?3e3:3001,toneMapping:p?0:4})}w.legacy!==f&&w.set(()=>({legacy:f})),w.linear!==h&&w.set(()=>({linear:h})),w.flat!==p&&w.set(()=>({flat:p})),!n||DL.fun(n)||YL(n)||DL.equ(n,S,fN)||pN(S,n),a&&!w.events.handlers&&w.set({events:a(o)});const R=function(e,t){const n="undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement;if(t){const{width:e,height:r,top:i,left:o,updateStyle:a=n}=t;return{width:e,height:r,top:i,left:o,updateStyle:a}}if("undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&e.parentElement){const{width:t,height:r,top:i,left:o}=e.parentElement.getBoundingClientRect();return{width:t,height:r,top:i,left:o,updateStyle:n}}return"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas?{width:e.width,height:e.height,top:0,left:0,updateStyle:n}:{width:0,height:0,top:0,left:0}}(e,r);return DL.equ(R,w.size,fN)||w.setSize(R.width,R.height,R.updateStyle,R.top,R.left),v&&w.viewport.dpr!==LL(v)&&w.setDpr(v),w.frameloop!==g&&w.setFrameloop(g),w.onPointerMissed||w.set({onPointerMissed:_}),y&&!DL.equ(y,w.performance,fN)&&w.set(e=>({performance:{...e.performance,...y}})),s=u,c=!0,this},render(t){return c||this.configure(),hN.updateContainer(C.jsx(vN,{store:o,children:t,onCreated:s,rootElement:e}),a,null,()=>{}),o},unmount(){yN(e)}}}function vN({store:e,children:t,onCreated:n,rootElement:r}){return TL(()=>{const t=e.getState();t.set(e=>({internal:{...e.internal,active:!0}})),n&&n(t),e.getState().events.connected||null==t.events.connect||t.events.connect(r)},[]),C.jsx(ZL.Provider,{value:e,children:t})}function yN(e,t){const n=cN.get(e),r=null==n?void 0:n.fiber;if(r){const t=null==n?void 0:n.store.getState();t&&(t.internal.active=!1),hN.updateContainer(null,r,null,()=>{t&&setTimeout(()=>{try{var n,r,i,o;null==t.events.disconnect||t.events.disconnect(),null==(n=t.gl)||null==(r=n.renderLists)||null==r.dispose||r.dispose(),null==(i=t.gl)||null==i.forceContextLoss||i.forceContextLoss(),null!=(o=t.gl)&&o.xr&&t.xr.disconnect(),function(e){e.dispose&&"Scene"!==e.type&&e.dispose();for(const t in e)null==t.dispose||t.dispose(),delete e[t]}(t),cN.delete(e)}catch(Dv){}},500)})}}hN.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:w.version});const bN={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function xN(e){const{handlePointer:t}=$L(e);return{priority:1,enabled:!0,compute(e,t,n){t.pointer.set(e.offsetX/t.size.width*2-1,-e.offsetY/t.size.height*2+1),t.raycaster.setFromCamera(t.pointer,t.camera)},connected:void 0,handlers:Object.keys(bN).reduce((e,n)=>({...e,[n]:t(n)}),{}),update:()=>{var t;const{events:n,internal:r}=e.getState();null!=(t=r.lastEvent)&&t.current&&n.handlers&&n.handlers.onPointerMove(r.lastEvent.current)},connect:t=>{var n;const{set:r,events:i}=e.getState();null==i.disconnect||i.disconnect(),r(e=>({events:{...e.events,connected:t}})),Object.entries(null!=(n=i.handlers)?n:[]).forEach(([e,n])=>{const[r,i]=bN[e];t.addEventListener(r,n,{passive:i})})},disconnect:()=>{const{set:t,events:n}=e.getState();var r;n.connected&&(Object.entries(null!=(r=n.handlers)?r:[]).forEach(([e,t])=>{if(n&&n.connected instanceof HTMLElement){const[r]=bN[e];n.connected.removeEventListener(r,t)}}),t(e=>({events:{...e.events,connected:void 0}})))}}}function _N(e,t){let n;return(...r)=>{window.clearTimeout(n),n=window.setTimeout(()=>e(...r),t)}}function wN({debounce:e,scroll:t,polyfill:n,offsetSize:r}={debounce:0,scroll:!1,offsetSize:!1}){const i=n||("undefined"==typeof window?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[o,a]=w.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),s=w.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o,orientationHandler:null}),l=e?"number"==typeof e?e:e.scroll:null,c=e?"number"==typeof e?e:e.resize:null,u=w.useRef(!1);w.useEffect(()=>(u.current=!0,()=>{u.current=!1}));const[d,h,p]=w.useMemo(()=>{const e=()=>{if(!s.current.element)return;const{left:e,top:t,width:n,height:i,bottom:o,right:l,x:c,y:d}=s.current.element.getBoundingClientRect(),h={left:e,top:t,width:n,height:i,bottom:o,right:l,x:c,y:d};s.current.element instanceof HTMLElement&&r&&(h.height=s.current.element.offsetHeight,h.width=s.current.element.offsetWidth),Object.freeze(h),u.current&&!EN(s.current.lastBounds,h)&&a(s.current.lastBounds=h)};return[e,c?_N(e,c):e,l?_N(e,l):e]},[a,r,l,c]);function f(){s.current.scrollContainers&&(s.current.scrollContainers.forEach(e=>e.removeEventListener("scroll",p,!0)),s.current.scrollContainers=null),s.current.resizeObserver&&(s.current.resizeObserver.disconnect(),s.current.resizeObserver=null),s.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",s.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",s.current.orientationHandler))}function m(){s.current.element&&(s.current.resizeObserver=new i(p),s.current.resizeObserver.observe(s.current.element),t&&s.current.scrollContainers&&s.current.scrollContainers.forEach(e=>e.addEventListener("scroll",p,{capture:!0,passive:!0})),s.current.orientationHandler=()=>{p()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",s.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",s.current.orientationHandler))}return function(e,t){w.useEffect(()=>{if(t){const t=e;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",t,!0)}}},[e,t])}(p,!!t),function(e){w.useEffect(()=>{const t=e;return window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[e])}(h),w.useEffect(()=>{f(),m()},[t,p,h]),w.useEffect(()=>f,[]),[e=>{!e||e===s.current.element||(f(),s.current.element=e,s.current.scrollContainers=SN(e),m())},o,d]}function SN(e){const t=[];if(!e||e===document.body)return t;const{overflow:n,overflowX:r,overflowY:i}=window.getComputedStyle(e);return[n,r,i].some(e=>"auto"===e||"scroll"===e)&&t.push(e),[...t,...SN(e.parentElement)]}const MN=["x","y","top","bottom","left","right","width","height"],EN=(e,t)=>MN.every(n=>e[n]===t[n]);var TN,AN,CN=Object.defineProperty,kN=Object.defineProperties,RN=Object.getOwnPropertyDescriptors,PN=Object.getOwnPropertySymbols,IN=Object.prototype.hasOwnProperty,LN=Object.prototype.propertyIsEnumerable,NN=(e,t,n)=>t in e?CN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ON=(e,t)=>{for(var n in t||(t={}))IN.call(t,n)&&NN(e,n,t[n]);if(PN)for(var n of PN(t))LN.call(t,n)&&NN(e,n,t[n]);return e};function DN(e,t,n){if(!e)return;if(!0===n(e))return e;let r=e.child;for(;r;){const e=DN(r,t,n);if(e)return e;r=r.sibling}}function UN(e){try{return Object.defineProperties(e,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(t){return e}}"undefined"==typeof window||!(null==(TN=window.document)?void 0:TN.createElement)&&"ReactNative"!==(null==(AN=window.navigator)?void 0:AN.product)?w.useEffect:w.useLayoutEffect;const FN=console.error;console.error=function(){const e=[...arguments].join("");if(!(null==e?void 0:e.startsWith("Warning:"))||!e.includes("useContext"))return FN.apply(this,arguments);console.error=FN};const zN=UN(w.createContext(null));class BN extends w.Component{render(){return w.createElement(zN.Provider,{value:this._reactInternals},this.props.children)}}function VN(){const e=function(){const e=w.useContext(zN);if(null===e)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const t=w.useId();return w.useMemo(()=>{for(const n of[e,null==e?void 0:e.alternate]){if(!n)continue;const e=DN(n,!1,e=>{let n=e.memoizedState;for(;n;){if(n.memoizedState===t)return!0;n=n.next}});if(e)return e}},[e,t])}(),[t]=w.useState(()=>new Map);t.clear();let n=e;for(;n;){if(n.type&&"object"==typeof n.type){const e=void 0===n.type._context&&n.type.Provider===n.type?n.type:n.type._context;e&&e!==zN&&!t.has(e)&&t.set(e,w.useContext(UN(e)))}n=n.return}return t}function jN(){const e=VN();return w.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>{return w.createElement(t,null,w.createElement(n.Provider,(i=ON({},r),o={value:e.get(n)},kN(i,RN(o)))));var i,o},e=>w.createElement(BN,ON({},e))),[e])}const HN=w.forwardRef(function({children:e,fallback:t,resize:n,style:r,gl:i,events:o=xN,eventSource:a,eventPrefix:s,shadows:l,linear:c,flat:u,legacy:d,orthographic:h,frameloop:p,dpr:f,performance:m,raycaster:g,camera:v,scene:y,onPointerMissed:b,onCreated:x,..._},S){w.useMemo(()=>{return e=ZI,void Object.assign(xL,e);var e},[]);const M=jN(),[E,T]=wN({scroll:!0,debounce:{scroll:50,resize:0},...n}),A=w.useRef(null),k=w.useRef(null);w.useImperativeHandle(S,()=>A.current);const R=AL(b),[P,I]=w.useState(!1),[L,N]=w.useState(!1);if(P)throw P;if(L)throw L;const O=w.useRef(null);TL(()=>{const t=A.current;T.width>0&&T.height>0&&t&&(O.current||(O.current=gN(t)),O.current.configure({gl:i,events:o,shadows:l,linear:c,flat:u,legacy:d,orthographic:h,frameloop:p,dpr:f,performance:m,raycaster:g,camera:v,scene:y,size:T,onPointerMissed:(...e)=>null==R.current?void 0:R.current(...e),onCreated:e=>{var t;null==e.events.connect||e.events.connect(a?(t=a)&&t.hasOwnProperty("current")?a.current:a:k.current),s&&e.setEvents({compute:(e,t)=>{const n=e[s+"X"],r=e[s+"Y"];t.pointer.set(n/t.size.width*2-1,-r/t.size.height*2+1),t.raycaster.setFromCamera(t.pointer,t.camera)}}),null==x||x(e)}}),O.current.render(C.jsx(M,{children:C.jsx(kL,{set:N,children:C.jsx(w.Suspense,{fallback:C.jsx(CL,{set:I}),children:null!=e?e:null})})})))}),w.useEffect(()=>{const e=A.current;if(e)return()=>yN(e)},[]);const D=a?"none":"auto";return C.jsx("div",{ref:k,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:D,...r},..._,children:C.jsx("div",{ref:E,style:{width:"100%",height:"100%"},children:C.jsx("canvas",{ref:A,style:{display:"block"},children:t})})})}),WN=w.forwardRef(function(e,t){return C.jsx(BN,{children:C.jsx(HN,{...e,ref:t})})});var GN=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(Dv){i(Dv)}},a=e=>{try{s(n.throw(e))}catch(Dv){i(Dv)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())}),XN=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(Dv){i(Dv)}},a=e=>{try{s(n.throw(e))}catch(Dv){i(Dv)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())}),qN=class extends Ww{constructor(e){super(),this.weight=0,this.isBinary=!1,this.overrideBlink="none",this.overrideLookAt="none",this.overrideMouth="none",this._binds=[],this.name=`VRMExpression_${e}`,this.expressionName=e,this.type="VRMExpression",this.visible=!1}get binds(){return this._binds}get overrideBlinkAmount(){return"block"===this.overrideBlink?0<this.outputWeight?1:0:"blend"===this.overrideBlink?this.outputWeight:0}get overrideLookAtAmount(){return"block"===this.overrideLookAt?0<this.outputWeight?1:0:"blend"===this.overrideLookAt?this.outputWeight:0}get overrideMouthAmount(){return"block"===this.overrideMouth?0<this.outputWeight?1:0:"blend"===this.overrideMouth?this.outputWeight:0}get outputWeight(){return this.isBinary?this.weight>.5?1:0:this.weight}addBind(e){this._binds.push(e)}deleteBind(e){const t=this._binds.indexOf(e);t>=0&&this._binds.splice(t,1)}applyWeight(e){var t;let n=this.outputWeight;n*=null!=(t=null==e?void 0:e.multiplier)?t:1,this.isBinary&&n<1&&(n=0),this._binds.forEach(e=>e.applyWeight(n))}clearAppliedWeight(){this._binds.forEach(e=>e.clearAppliedWeight())}};function $N(e,t,n){var r,i;const o=e.parser.json,a=null==(r=o.nodes)?void 0:r[t];if(null==a)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${t}] of glTF but the node doesn't exist`),null;const s=a.mesh;if(null==s)return null;const l=null==(i=o.meshes)?void 0:i[s];if(null==l)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${s}] of glTF but the mesh doesn't exist`),null;const c=l.primitives.length,u=[];return n.traverse(e=>{u.length<c&&e.isMesh&&u.push(e)}),u}function YN(e,t){return XN(this,null,function*(){const n=yield e.parser.getDependency("node",t);return $N(e,t,n)})}function ZN(e){return XN(this,null,function*(){const t=yield e.parser.getDependencies("node"),n=new Map;return t.forEach((t,r)=>{const i=$N(e,r,t);null!=i&&n.set(r,i)}),n})}var JN={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 KN(e){return Math.max(Math.min(e,1),0)}var QN=class e{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(JN));return Object.entries(this._expressionMap).forEach(([n,r])=>{t.has(n)&&(e[n]=r)}),e}get customExpressionMap(){const e={},t=new Set(Object.values(JN));return Object.entries(this._expressionMap).forEach(([n,r])=>{t.has(n)||(e[n]=r)}),e}copy(e){return this._expressions.concat().forEach(e=>{this.unregisterExpression(e)}),e._expressions.forEach(e=>{this.registerExpression(e)}),this.blinkExpressionNames=e.blinkExpressionNames.concat(),this.lookAtExpressionNames=e.lookAtExpressionNames.concat(),this.mouthExpressionNames=e.mouthExpressionNames.concat(),this}clone(){return(new e).copy(this)}getExpression(e){var t;return null!=(t=this._expressionMap[e])?t:null}registerExpression(e){this._expressions.push(e),this._expressionMap[e.expressionName]=e}unregisterExpression(e){const t=this._expressions.indexOf(e);-1===t&&console.warn("VRMExpressionManager: The specified expressions is not registered"),this._expressions.splice(t,1),delete this._expressionMap[e.expressionName]}getValue(e){var t;const n=this.getExpression(e);return null!=(t=null==n?void 0:n.weight)?t:null}setValue(e,t){const n=this.getExpression(e);n&&(n.weight=KN(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(e=>{e.clearAppliedWeight()}),this._expressions.forEach(t=>{let n=1;const r=t.expressionName;-1!==this.blinkExpressionNames.indexOf(r)&&(n*=e.blink),-1!==this.lookAtExpressionNames.indexOf(r)&&(n*=e.lookAt),-1!==this.mouthExpressionNames.indexOf(r)&&(n*=e.mouth),t.applyWeight({multiplier:n})})}_calculateWeightMultipliers(){let e=1,t=1,n=1;return this._expressions.forEach(r=>{e-=r.overrideBlinkAmount,t-=r.overrideLookAtAmount,n-=r.overrideMouthAmount}),e=Math.max(0,e),t=Math.max(0,t),n=Math.max(0,n),{blink:e,lookAt:t,mouth:n}}},eO={_Color:"color",_EmissionColor:"emissionColor",_ShadeColor:"shadeColor",_RimColor:"rimColor",_OutlineColor:"outlineColor"},tO=new cS,nO=class e{constructor({material:e,type:t,targetValue:n,targetAlpha:r}){this.material=e,this.type=t,this.targetValue=n,this.targetAlpha=null!=r?r:1;const i=this._initColorBindState(),o=this._initAlphaBindState();this._state={color:i,alpha:o}}applyWeight(e){const{color:t,alpha:n}=this._state;if(null!=t){const{propertyName:n,deltaValue:r}=t,i=this.material[n];null!=i&&i.add(tO.copy(r).multiplyScalar(e))}if(null!=n){const{propertyName:t,deltaValue:r}=n;null!=this.material[t]&&(this.material[t]+=r*e)}}clearAppliedWeight(){const{color:e,alpha:t}=this._state;if(null!=e){const{propertyName:t,initialValue:n}=e,r=this.material[t];null!=r&&r.copy(n)}if(null!=t){const{propertyName:e,initialValue:n}=t;null!=this.material[e]&&(this.material[e]=n)}}_initColorBindState(){var e,t,n;const{material:r,type:i,targetValue:o}=this,a=this._getPropertyNameMap(),s=null!=(t=null==(e=null==a?void 0:a[i])?void 0:e[0])?t:null;if(null==s)return console.warn(`Tried to add a material color bind to the material ${null!=(n=r.name)?n:"(no name)"}, the type ${i} but the material or the type is not supported.`),null;const l=r[s].clone();return{propertyName:s,initialValue:l,deltaValue:new cS(o.r-l.r,o.g-l.g,o.b-l.b)}}_initAlphaBindState(){var e,t,n;const{material:r,type:i,targetAlpha:o}=this,a=this._getPropertyNameMap(),s=null!=(t=null==(e=null==a?void 0:a[i])?void 0:e[1])?t:null;if(null==s&&1!==o)return console.warn(`Tried to add a material alpha bind to the material ${null!=(n=r.name)?n:"(no name)"}, the type ${i} but the material or the type does not support alpha.`),null;if(null==s)return null;const l=r[s];return{propertyName:s,initialValue:l,deltaValue:o-l}}_getPropertyNameMap(){var t,n;return null!=(n=null==(t=Object.entries(e._propertyNameMapMap).find(([e])=>!0===this.material[e]))?void 0:t[1])?n:null}};nO._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 rO=nO,iO=class{constructor({primitives:e,index:t,weight:n}){this.primitives=e,this.index=t,this.weight=n}applyWeight(e){this.primitives.forEach(t=>{var n;null!=(null==(n=t.morphTargetInfluences)?void 0:n[this.index])&&(t.morphTargetInfluences[this.index]+=this.weight*e)})}clearAppliedWeight(){this.primitives.forEach(e=>{var t;null!=(null==(t=e.morphTargetInfluences)?void 0:t[this.index])&&(e.morphTargetInfluences[this.index]=0)})}},oO=new y_,aO=class e{constructor({material:t,scale:n,offset:r}){var i,o;this.material=t,this.scale=n,this.offset=r;const a=null==(i=Object.entries(e._propertyNamesMap).find(([e])=>!0===t[e]))?void 0:i[1];null==a?(console.warn(`Tried to add a texture transform bind to the material ${null!=(o=t.name)?o:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],a.forEach(e=>{var i;const o=null==(i=t[e])?void 0:i.clone();if(!o)return null;t[e]=o;const a=o.offset.clone(),s=o.repeat.clone(),l=r.clone().sub(a),c=n.clone().sub(s);this._properties.push({name:e,initialOffset:a,deltaOffset:l,initialScale:s,deltaScale:c})}))}applyWeight(e){this._properties.forEach(t=>{const n=this.material[t.name];void 0!==n&&(n.offset.add(oO.copy(t.deltaOffset).multiplyScalar(e)),n.repeat.add(oO.copy(t.deltaScale).multiplyScalar(e)))})}clearAppliedWeight(){this._properties.forEach(e=>{const t=this.material[e.name];void 0!==t&&(t.offset.copy(e.initialOffset),t.repeat.copy(e.initialScale))})}};aO._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};var sO=aO,lO=new Set(["1.0","1.0-beta"]),cO=class e{get name(){return"VRMExpressionLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return XN(this,null,function*(){e.userData.vrmExpressionManager=yield this._import(e)})}_import(e){return XN(this,null,function*(){const t=yield this._v1Import(e);if(t)return t;const n=yield this._v0Import(e);return n||null})}_v1Import(e){return XN(this,null,function*(){var t,n;const r=this.parser.json;if(!(-1!==(null==(t=r.extensionsUsed)?void 0:t.indexOf("VRMC_vrm"))))return null;const i=null==(n=r.extensions)?void 0:n.VRMC_vrm;if(!i)return null;const o=i.specVersion;if(!lO.has(o))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const a=i.expressions;if(!a)return null;const s=new Set(Object.values(JN)),l=new Map;null!=a.preset&&Object.entries(a.preset).forEach(([e,t])=>{null!=t&&(s.has(e)?l.set(e,t):console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${e}" detected. Ignoring the expression`))}),null!=a.custom&&Object.entries(a.custom).forEach(([e,t])=>{s.has(e)?console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${e}". Ignoring the expression`):l.set(e,t)});const c=new QN;return yield Promise.all(Array.from(l.entries()).map(t=>XN(this,[t],function*([t,n]){var r,i,o,a,s,l,u;const d=new qN(t);if(e.scene.add(d),d.isBinary=null!=(r=n.isBinary)&&r,d.overrideBlink=null!=(i=n.overrideBlink)?i:"none",d.overrideLookAt=null!=(o=n.overrideLookAt)?o:"none",d.overrideMouth=null!=(a=n.overrideMouth)?a:"none",null==(s=n.morphTargetBinds)||s.forEach(t=>XN(this,null,function*(){var r;if(void 0===t.node||void 0===t.index)return;const i=yield YN(e,t.node),o=t.index;i.every(e=>Array.isArray(e.morphTargetInfluences)&&o<e.morphTargetInfluences.length)?d.addBind(new iO({primitives:i,index:o,weight:null!=(r=t.weight)?r:1})):console.warn(`VRMExpressionLoaderPlugin: ${n.name} attempts to index morph #${o} but not found.`)})),n.materialColorBinds||n.textureTransformBinds){const t=[];e.scene.traverse(e=>{const n=e.material;n&&(Array.isArray(n)?t.push(...n):t.push(n))}),null==(l=n.materialColorBinds)||l.forEach(e=>XN(this,null,function*(){t.filter(t=>{var n;const r=null==(n=this.parser.associations.get(t))?void 0:n.materials;return e.material===r}).forEach(t=>{d.addBind(new rO({material:t,type:e.type,targetValue:(new cS).fromArray(e.targetValue),targetAlpha:e.targetValue[3]}))})})),null==(u=n.textureTransformBinds)||u.forEach(e=>XN(this,null,function*(){t.filter(t=>{var n;const r=null==(n=this.parser.associations.get(t))?void 0:n.materials;return e.material===r}).forEach(t=>{var n,r;d.addBind(new sO({material:t,offset:(new y_).fromArray(null!=(n=e.offset)?n:[0,0]),scale:(new y_).fromArray(null!=(r=e.scale)?r:[1,1])}))})}))}c.registerExpression(d)}))),c})}_v0Import(t){return XN(this,null,function*(){var n;const r=this.parser.json,i=null==(n=r.extensions)?void 0:n.VRM;if(!i)return null;const o=i.blendShapeMaster;if(!o)return null;const a=new QN,s=o.blendShapeGroups;if(!s)return a;const l=new Set;return yield Promise.all(s.map(n=>XN(this,null,function*(){var i;const o=n.presetName,s=null!=o&&e.v0v1PresetNameMap[o]||null,c=null!=s?s:n.name;if(null==c)return void console.warn("VRMExpressionLoaderPlugin: One of custom expressions has no name. Ignoring the expression");if(l.has(c))return void console.warn(`VRMExpressionLoaderPlugin: An expression preset ${o} has duplicated entries. Ignoring the expression`);l.add(c);const u=new qN(c);t.scene.add(u),u.isBinary=null!=(i=n.isBinary)&&i,n.binds&&n.binds.forEach(e=>XN(this,null,function*(){var i;if(void 0===e.mesh||void 0===e.index)return;const o=[];null==(i=r.nodes)||i.forEach((t,n)=>{t.mesh===e.mesh&&o.push(n)});const a=e.index;yield Promise.all(o.map(r=>XN(this,null,function*(){var i;const o=yield YN(t,r);o.every(e=>Array.isArray(e.morphTargetInfluences)&&a<e.morphTargetInfluences.length)?u.addBind(new iO({primitives:o,index:a,weight:.01*(null!=(i=e.weight)?i:100)})):console.warn(`VRMExpressionLoaderPlugin: ${n.name} attempts to index ${a}th morph but not found.`)})))}));const d=n.materialValues;d&&0!==d.length&&d.forEach(e=>{if(void 0===e.materialName||void 0===e.propertyName||void 0===e.targetValue)return;const n=[];t.scene.traverse(t=>{if(t.material){const r=t.material;Array.isArray(r)?n.push(...r.filter(t=>(t.name===e.materialName||t.name===e.materialName+" (Outline)")&&-1===n.indexOf(t))):r.name===e.materialName&&-1===n.indexOf(r)&&n.push(r)}});const r=e.propertyName;n.forEach(t=>{if("_MainTex_ST"===r){const n=new y_(e.targetValue[0],e.targetValue[1]),r=new y_(e.targetValue[2],e.targetValue[3]);return r.y=1-r.y-n.y,void u.addBind(new sO({material:t,scale:n,offset:r}))}const n=eO[r];n?u.addBind(new rO({material:t,type:n,targetValue:(new cS).fromArray(e.targetValue),targetAlpha:e.targetValue[3]})):console.warn(r+" is not supported")})}),a.registerExpression(u)}))),a})}};cO.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 uO=cO,dO=class e{constructor(t,n){this._firstPersonOnlyLayer=e.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=e.DEFAULT_THIRDPERSON_ONLY_LAYER,this._initializedLayers=!1,this.humanoid=t,this.meshAnnotations=n}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(e=>({meshes:e.meshes.concat(),type:e.type})),this}clone(){return new e(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:t=e.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:n=e.DEFAULT_THIRDPERSON_ONLY_LAYER}={}){this._initializedLayers||(this._firstPersonOnlyLayer=t,this._thirdPersonOnlyLayer=n,this.meshAnnotations.forEach(e=>{e.meshes.forEach(t=>{"firstPersonOnly"===e.type?(t.layers.set(this._firstPersonOnlyLayer),t.traverse(e=>e.layers.set(this._firstPersonOnlyLayer))):"thirdPersonOnly"===e.type?(t.layers.set(this._thirdPersonOnlyLayer),t.traverse(e=>e.layers.set(this._thirdPersonOnlyLayer))):"auto"===e.type&&this._createHeadlessModel(t)})}),this._initializedLayers=!0)}_excludeTriangles(e,t,n,r){let i=0;if(null!=t&&t.length>0)for(let o=0;o<e.length;o+=3){const a=e[o],s=e[o+1],l=e[o+2],c=t[a],u=n[a];if(c[0]>0&&r.includes(u[0]))continue;if(c[1]>0&&r.includes(u[1]))continue;if(c[2]>0&&r.includes(u[2]))continue;if(c[3]>0&&r.includes(u[3]))continue;const d=t[s],h=n[s];if(d[0]>0&&r.includes(h[0]))continue;if(d[1]>0&&r.includes(h[1]))continue;if(d[2]>0&&r.includes(h[2]))continue;if(d[3]>0&&r.includes(h[3]))continue;const p=t[l],f=n[l];p[0]>0&&r.includes(f[0])||(p[1]>0&&r.includes(f[1])||p[2]>0&&r.includes(f[2])||p[3]>0&&r.includes(f[3])||(e[i++]=a,e[i++]=s,e[i++]=l))}return i}_createErasedMesh(e,t){const n=new WM(e.geometry.clone(),e.material);n.name=`${e.name}(erase)`,n.frustumCulled=e.frustumCulled,n.layers.set(this._firstPersonOnlyLayer);const r=n.geometry,i=r.getAttribute("skinIndex"),o=i instanceof _k?[]:i.array,a=[];for(let f=0;f<o.length;f+=4)a.push([o[f],o[f+1],o[f+2],o[f+3]]);const s=r.getAttribute("skinWeight"),l=s instanceof _k?[]:s.array,c=[];for(let f=0;f<l.length;f+=4)c.push([l[f],l[f+1],l[f+2],l[f+3]]);const u=r.getIndex();if(!u)throw new Error("The geometry doesn't have an index buffer");const d=Array.from(u.array),h=this._excludeTriangles(d,c,a,t),p=[];for(let f=0;f<h;f++)p[f]=d[f];return r.setIndex(p),e.onBeforeRender&&(n.onBeforeRender=e.onBeforeRender),n.bind(new YM(e.skeleton.bones,e.skeleton.boneInverses),new vw),n}_createHeadlessModelForSkinnedMesh(e,t){const n=[];if(t.skeleton.bones.forEach((e,t)=>{this._isEraseTarget(e)&&n.push(t)}),!n.length)return t.layers.enable(this._thirdPersonOnlyLayer),void t.layers.enable(this._firstPersonOnlyLayer);t.layers.set(this._thirdPersonOnlyLayer);const r=this._createErasedMesh(t,n);e.add(r)}_createHeadlessModel(e){if("Group"===e.type)if(e.layers.set(this._thirdPersonOnlyLayer),this._isEraseTarget(e))e.traverse(e=>e.layers.set(this._thirdPersonOnlyLayer));else{const t=new sM;t.name=`_headless_${e.name}`,t.layers.set(this._firstPersonOnlyLayer),e.parent.add(t),e.children.filter(e=>"SkinnedMesh"===e.type).forEach(e=>{const n=e;this._createHeadlessModelForSkinnedMesh(t,n)})}else if("SkinnedMesh"===e.type){const t=e;this._createHeadlessModelForSkinnedMesh(e.parent,t)}else this._isEraseTarget(e)&&(e.layers.set(this._thirdPersonOnlyLayer),e.traverse(e=>e.layers.set(this._thirdPersonOnlyLayer)))}_isEraseTarget(e){return e===this.humanoid.getRawBoneNode("head")||!!e.parent&&this._isEraseTarget(e.parent)}};dO.DEFAULT_FIRSTPERSON_ONLY_LAYER=9,dO.DEFAULT_THIRDPERSON_ONLY_LAYER=10;var hO=dO,pO=new Set(["1.0","1.0-beta"]),fO=class{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return XN(this,null,function*(){const t=e.userData.vrmHumanoid;if(null!==t){if(void 0===t)throw new Error("VRMFirstPersonLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");e.userData.vrmFirstPerson=yield this._import(e,t)}})}_import(e,t){return XN(this,null,function*(){if(null==t)return null;const n=yield this._v1Import(e,t);if(n)return n;const r=yield this._v0Import(e,t);return r||null})}_v1Import(e,t){return XN(this,null,function*(){var n,r;const i=this.parser.json;if(!(-1!==(null==(n=i.extensionsUsed)?void 0:n.indexOf("VRMC_vrm"))))return null;const o=null==(r=i.extensions)?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!pO.has(a))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const s=o.firstPerson,l=[],c=yield ZN(e);return Array.from(c.entries()).forEach(([e,t])=>{var n,r;const i=null==(n=null==s?void 0:s.meshAnnotations)?void 0:n.find(t=>t.node===e);l.push({meshes:t,type:null!=(r=null==i?void 0:i.type)?r:"auto"})}),new hO(t,l)})}_v0Import(e,t){return XN(this,null,function*(){var n;const r=this.parser.json,i=null==(n=r.extensions)?void 0:n.VRM;if(!i)return null;const o=i.firstPerson;if(!o)return null;const a=[],s=yield ZN(e);return Array.from(s.entries()).forEach(([e,t])=>{const n=r.nodes[e],i=o.meshAnnotations?o.meshAnnotations.find(e=>e.mesh===n.mesh):void 0;a.push({meshes:t,type:this._convertV0FlagToV1Type(null==i?void 0:i.firstPersonFlag)})}),new hO(t,a)})}_convertV0FlagToV1Type(e){return"FirstPersonOnly"===e?"firstPersonOnly":"ThirdPersonOnly"===e?"thirdPersonOnly":"Both"===e?"both":"auto"}},mO=new x_,gO=new x_,vO=new b_,yO=class extends sM{constructor(e){super(),this.vrmHumanoid=e,this._boneAxesMap=new Map,Object.values(e.humanBones).forEach(e=>{const t=new eR(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(e=>{e.geometry.dispose(),e.material.dispose()})}updateMatrixWorld(e){Array.from(this._boneAxesMap.entries()).forEach(([e,t])=>{e.node.updateWorldMatrix(!0,!1),e.node.matrixWorld.decompose(mO,vO,gO);const n=mO.set(.1,.1,.1).divide(gO);t.matrix.copy(e.node.matrixWorld).scale(n)}),super.updateMatrixWorld(e)}},bO=["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"],xO={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 _O(e){return e.invert?e.invert():e.inverse(),e}var wO=new x_,SO=new b_,MO=class{constructor(e){this.humanBones=e,this.restPose=this.getAbsolutePose()}getAbsolutePose(){const e={};return Object.keys(this.humanBones).forEach(t=>{const n=t,r=this.getBoneNode(n);r&&(wO.copy(r.position),SO.copy(r.quaternion),e[n]={position:wO.toArray(),rotation:SO.toArray()})}),e}getPose(){const e={};return Object.keys(this.humanBones).forEach(t=>{const n=t,r=this.getBoneNode(n);if(!r)return;wO.set(0,0,0),SO.identity();const i=this.restPose[n];(null==i?void 0:i.position)&&wO.fromArray(i.position).negate(),(null==i?void 0:i.rotation)&&_O(SO.fromArray(i.rotation)),wO.add(r.position),SO.premultiply(r.quaternion),e[n]={position:wO.toArray(),rotation:SO.toArray()}}),e}setPose(e){Object.entries(e).forEach(([e,t])=>{const n=e,r=this.getBoneNode(n);if(!r)return;const i=this.restPose[n];i&&((null==t?void 0:t.position)&&(r.position.fromArray(t.position),i.position&&r.position.add(wO.fromArray(i.position))),(null==t?void 0:t.rotation)&&(r.quaternion.fromArray(t.rotation),i.rotation&&r.quaternion.multiply(SO.fromArray(i.rotation))))})}resetPose(){Object.entries(this.restPose).forEach(([e,t])=>{const n=this.getBoneNode(e);n&&((null==t?void 0:t.position)&&n.position.fromArray(t.position),(null==t?void 0:t.rotation)&&n.quaternion.fromArray(t.rotation))})}getBone(e){var t;return null!=(t=this.humanBones[e])?t:void 0}getBoneNode(e){var t,n;return null!=(n=null==(t=this.humanBones[e])?void 0:t.node)?n:null}},EO=new x_,TO=new b_,AO=new x_,CO=class e extends MO{static _setupTransforms(e){const t=new Ww;t.name="VRMHumanoidRig";const n={},r={},i={};bO.forEach(t=>{var o;const a=e.getBoneNode(t);if(a){const e=new x_,s=new b_;a.updateWorldMatrix(!0,!1),a.matrixWorld.decompose(e,s,EO),n[t]=e,r[t]=a.quaternion.clone();const l=new b_;null==(o=a.parent)||o.matrixWorld.decompose(EO,l,EO),i[t]=l}});const o={};return bO.forEach(r=>{var i;const a=e.getBoneNode(r);if(a){const e=n[r];let s,l=r;for(;null==s&&(l=xO[l],null!=l);)s=n[l];const c=new Ww;c.name="Normalized_"+a.name;(l?null==(i=o[l])?void 0:i.node:t).add(c),c.position.copy(e),s&&c.position.sub(s),o[r]={node:c}}}),{rigBones:o,root:t,parentWorldRotations:i,boneRotations:r}}constructor(t){const{rigBones:n,root:r,parentWorldRotations:i,boneRotations:o}=e._setupTransforms(t);super(n),this.original=t,this.root=r,this._parentWorldRotations=i,this._boneRotations=o}update(){bO.forEach(e=>{const t=this.original.getBoneNode(e);if(null!=t){const n=this.getBoneNode(e),r=this._parentWorldRotations[e],i=TO.copy(r).invert(),o=this._boneRotations[e];if(t.quaternion.copy(n.quaternion).multiply(r).premultiply(i).multiply(o),"hips"===e){const e=n.getWorldPosition(AO);t.parent.updateWorldMatrix(!0,!1);const r=t.parent.matrixWorld,i=e.applyMatrix4(r.invert());t.position.copy(i)}}})}},kO=class e{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 n;this.autoUpdateHumanBones=null==(n=null==t?void 0:t.autoUpdateHumanBones)||n,this._rawHumanBones=new MO(e),this._normalizedHumanBones=new CO(this._rawHumanBones)}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new MO(e.humanBones),this._normalizedHumanBones=new CO(this._rawHumanBones),this}clone(){return new e(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()}},RO={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"},PO=new Set(["1.0","1.0-beta"]),IO={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},LO=class{get name(){return"VRMHumanoidLoaderPlugin"}constructor(e,t){this.parser=e,this.helperRoot=null==t?void 0:t.helperRoot,this.autoUpdateHumanBones=null==t?void 0:t.autoUpdateHumanBones}afterRoot(e){return XN(this,null,function*(){e.userData.vrmHumanoid=yield this._import(e)})}_import(e){return XN(this,null,function*(){const t=yield this._v1Import(e);if(t)return t;const n=yield this._v0Import(e);return n||null})}_v1Import(e){return XN(this,null,function*(){var t,n;const r=this.parser.json;if(!(-1!==(null==(t=r.extensionsUsed)?void 0:t.indexOf("VRMC_vrm"))))return null;const i=null==(n=r.extensions)?void 0:n.VRMC_vrm;if(!i)return null;const o=i.specVersion;if(!PO.has(o))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const a=i.humanoid;if(!a)return null;const s=null!=a.humanBones.leftThumbIntermediate||null!=a.humanBones.rightThumbIntermediate,l={};null!=a.humanBones&&(yield Promise.all(Object.entries(a.humanBones).map(e=>XN(this,[e],function*([e,t]){let n=e;const r=t.node;if(s){const e=IO[n];null!=e&&(n=e)}const i=yield this.parser.getDependency("node",r);null!=i?l[n]={node:i}:console.warn(`A glTF node bound to the humanoid bone ${n} (index = ${r}) does not exist`)}))));const c=new kO(this._ensureRequiredBonesExist(l),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(e.scene.add(c.normalizedHumanBonesRoot),this.helperRoot){const e=new yO(c);this.helperRoot.add(e),e.renderOrder=this.helperRoot.renderOrder}return c})}_v0Import(e){return XN(this,null,function*(){var t;const n=null==(t=this.parser.json.extensions)?void 0:t.VRM;if(!n)return null;const r=n.humanoid;if(!r)return null;const i={};null!=r.humanBones&&(yield Promise.all(r.humanBones.map(e=>XN(this,null,function*(){const t=e.bone,n=e.node;if(null==t||null==n)return;const r=yield this.parser.getDependency("node",n);if(null==r)return void console.warn(`A glTF node bound to the humanoid bone ${t} (index = ${n}) does not exist`);const o=IO[t],a=null!=o?o:t;null==i[a]?i[a]={node:r}:console.warn(`Multiple bone entries for ${a} detected (index = ${n}), ignoring duplicated entries.`)}))));const o=new kO(this._ensureRequiredBonesExist(i),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(e.scene.add(o.normalizedHumanBonesRoot),this.helperRoot){const e=new yO(o);this.helperRoot.add(e),e.renderOrder=this.helperRoot.renderOrder}return o})}_ensureRequiredBonesExist(e){const t=Object.values(RO).filter(t=>null==e[t]);if(t.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${t.join(", ")}`);return e}},NO=class extends IS{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new _S(new Float32Array(195),3),this.setAttribute("position",this._attrPos),this._attrIndex=new _S(new Uint16Array(189),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;this._currentTheta!==this.theta&&(this._currentTheta=this.theta,e=!0),this._currentRadius!==this.radius&&(this._currentRadius=this.radius,e=!0),e&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,0,0,0);for(let e=0;e<64;e++){const t=e/63*this._currentTheta;this._attrPos.setXYZ(e+1,this._currentRadius*Math.sin(t),0,this._currentRadius*Math.cos(t))}this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<63;e++)this._attrIndex.setXYZ(3*e,0,e+1,e+2);this._attrIndex.needsUpdate=!0}},OO=class extends IS{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new x_,this._currentTail=new x_,this._attrPos=new _S(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new _S(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;this._currentRadius!==this.radius&&(this._currentRadius=this.radius,e=!0),this._currentTail.equals(this.tail)||(this._currentTail.copy(this.tail),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(t))}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 e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(2*e,e,t),this._attrIndex.setXY(64+2*e,32+e,32+t),this._attrIndex.setXY(128+2*e,64+e,64+t)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},DO=new b_,UO=new b_,FO=new x_,zO=new x_,BO=Math.sqrt(2)/2,VO=new b_(0,0,-BO,BO),jO=new x_(0,1,0),HO=class extends sM{constructor(e){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=e;{const e=new NO;e.radius=.5;const t=new pS({color:65280,transparent:!0,opacity:.5,side:2,depthTest:!1,depthWrite:!1});this._meshPitch=new WS(e,t),this.add(this._meshPitch)}{const e=new NO;e.radius=.5;const t=new pS({color:16711680,transparent:!0,opacity:.5,side:2,depthTest:!1,depthWrite:!1});this._meshYaw=new WS(e,t),this.add(this._meshYaw)}{const e=new OO;e.radius=.1;const t=new OE({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new qE(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(e){const t=v_.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=t,this._meshYaw.geometry.update();const n=v_.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=n,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition(FO),this.vrmLookAt.getLookAtWorldQuaternion(DO),DO.multiply(this.vrmLookAt.getFaceFrontQuaternion(UO)),this._meshYaw.position.copy(FO),this._meshYaw.quaternion.copy(DO),this._meshPitch.position.copy(FO),this._meshPitch.quaternion.copy(DO),this._meshPitch.quaternion.multiply(UO.setFromAxisAngle(jO,t)),this._meshPitch.quaternion.multiply(VO);const{target:r,autoUpdate:i}=this.vrmLookAt;null!=r&&i&&(r.getWorldPosition(zO).sub(FO),this._lineTarget.geometry.tail.copy(zO),this._lineTarget.geometry.update(),this._lineTarget.position.copy(FO)),super.updateMatrixWorld(e)}},WO=new x_,GO=new x_;function XO(e,t){return e.matrixWorld.decompose(WO,t,GO),t}function qO(e){return[Math.atan2(-e.z,e.x),Math.atan2(e.y,Math.sqrt(e.x*e.x+e.z*e.z))]}function $O(e){const t=Math.round(e/2/Math.PI);return e-2*Math.PI*t}var YO=new x_(0,0,1),ZO=new x_,JO=new x_,KO=new x_,QO=new b_,eD=new b_,tD=new b_,nD=new b_,rD=new Aw,iD=class e{constructor(e,t){this.offsetFromHeadBone=new x_,this.autoUpdate=!0,this.faceFront=new x_(0,0,1),this.humanoid=e,this.applier=t,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new b_)}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 Aw)}getEuler(e){return e.set(v_.DEG2RAD*this._pitch,v_.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 e(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){return XO(this.humanoid.getRawBoneNode("head"),e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(YO)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[t,n]=qO(this.faceFront);return rD.set(0,.5*Math.PI+t,n,"YZX"),e.setFromEuler(rD).premultiply(nD.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(eD),this.getFaceFrontQuaternion(tD),e.copy(YO).applyQuaternion(eD).applyQuaternion(tD).applyEuler(this.getEuler(rD))}lookAt(e){const t=QO.copy(this._restHeadWorldQuaternion).multiply(_O(this.getLookAtWorldQuaternion(eD))),n=this.getLookAtWorldPosition(JO),r=KO.copy(e).sub(n).applyQuaternion(t).normalize(),[i,o]=qO(this.faceFront),[a,s]=qO(r),l=$O(a-i),c=$O(o-s);this._yaw=v_.RAD2DEG*l,this._pitch=v_.RAD2DEG*c,this._needsUpdate=!0}update(e){null!=this.target&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(ZO)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};iD.EULER_ORDER="YXZ";var oD=iD,aD=new x_(0,0,1),sD=new b_,lD=new b_,cD=new Aw(0,0,0,"YXZ"),uD=class{constructor(e,t,n,r,i){this.humanoid=e,this.rangeMapHorizontalInner=t,this.rangeMapHorizontalOuter=n,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i,this.faceFront=new x_(0,0,1),this._restQuatLeftEye=new b_,this._restQuatRightEye=new b_,this._restLeftEyeParentWorldQuat=new b_,this._restRightEyeParentWorldQuat=new b_;const o=this.humanoid.getRawBoneNode("leftEye"),a=this.humanoid.getRawBoneNode("rightEye");o&&(this._restQuatLeftEye.copy(o.quaternion),XO(o.parent,this._restLeftEyeParentWorldQuat)),a&&(this._restQuatRightEye.copy(a.quaternion),XO(a.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(e,t){const n=this.humanoid.getRawBoneNode("leftEye"),r=this.humanoid.getRawBoneNode("rightEye"),i=this.humanoid.getNormalizedBoneNode("leftEye"),o=this.humanoid.getNormalizedBoneNode("rightEye");n&&(cD.x=t<0?-v_.DEG2RAD*this.rangeMapVerticalDown.map(-t):v_.DEG2RAD*this.rangeMapVerticalUp.map(t),cD.y=e<0?-v_.DEG2RAD*this.rangeMapHorizontalInner.map(-e):v_.DEG2RAD*this.rangeMapHorizontalOuter.map(e),sD.setFromEuler(cD),this._getWorldFaceFrontQuat(lD),i.quaternion.copy(lD).multiply(sD).multiply(lD.invert()),sD.copy(this._restLeftEyeParentWorldQuat),n.quaternion.copy(i.quaternion).multiply(sD).premultiply(sD.invert()).multiply(this._restQuatLeftEye)),r&&(cD.x=t<0?-v_.DEG2RAD*this.rangeMapVerticalDown.map(-t):v_.DEG2RAD*this.rangeMapVerticalUp.map(t),cD.y=e<0?-v_.DEG2RAD*this.rangeMapHorizontalOuter.map(-e):v_.DEG2RAD*this.rangeMapHorizontalInner.map(e),sD.setFromEuler(cD),this._getWorldFaceFrontQuat(lD),o.quaternion.copy(lD).multiply(sD).multiply(lD.invert()),sD.copy(this._restRightEyeParentWorldQuat),r.quaternion.copy(o.quaternion).multiply(sD).premultiply(sD.invert()).multiply(this._restQuatRightEye))}lookAt(e){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const t=v_.RAD2DEG*e.y,n=v_.RAD2DEG*e.x;this.applyYawPitch(t,n)}_getWorldFaceFrontQuat(e){if(this.faceFront.distanceToSquared(aD)<.01)return e.identity();const[t,n]=qO(this.faceFront);return cD.set(0,.5*Math.PI+t,n,"YZX"),e.setFromEuler(cD)}};uD.type="bone";var dD=class{constructor(e,t,n,r,i){this.expressions=e,this.rangeMapHorizontalInner=t,this.rangeMapHorizontalOuter=n,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i}applyYawPitch(e,t){t<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-t))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(t))),e<0?(this.expressions.setValue("lookLeft",0),this.expressions.setValue("lookRight",this.rangeMapHorizontalOuter.map(-e))):(this.expressions.setValue("lookRight",0),this.expressions.setValue("lookLeft",this.rangeMapHorizontalOuter.map(e)))}lookAt(e){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const t=v_.RAD2DEG*e.y,n=v_.RAD2DEG*e.x;this.applyYawPitch(t,n)}};dD.type="expression";var hD=class{constructor(e,t){this.inputMaxValue=e,this.outputScale=t}map(e){return this.outputScale*KN(e/this.inputMaxValue)}},pD=new Set(["1.0","1.0-beta"]),fD=.01,mD=class{get name(){return"VRMLookAtLoaderPlugin"}constructor(e,t){this.parser=e,this.helperRoot=null==t?void 0:t.helperRoot}afterRoot(e){return XN(this,null,function*(){const t=e.userData.vrmHumanoid;if(null===t)return;if(void 0===t)throw new Error("VRMLookAtLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");const n=e.userData.vrmExpressionManager;if(null!==n){if(void 0===n)throw new Error("VRMLookAtLoaderPlugin: vrmExpressionManager is undefined. VRMExpressionLoaderPlugin have to be used first");e.userData.vrmLookAt=yield this._import(e,t,n)}})}_import(e,t,n){return XN(this,null,function*(){if(null==t||null==n)return null;const r=yield this._v1Import(e,t,n);if(r)return r;const i=yield this._v0Import(e,t,n);return i||null})}_v1Import(e,t,n){return XN(this,null,function*(){var e,r,i;const o=this.parser.json;if(!(-1!==(null==(e=o.extensionsUsed)?void 0:e.indexOf("VRMC_vrm"))))return null;const a=null==(r=o.extensions)?void 0:r.VRMC_vrm;if(!a)return null;const s=a.specVersion;if(!pD.has(s))return console.warn(`VRMLookAtLoaderPlugin: Unknown VRMC_vrm specVersion "${s}"`),null;const l=a.lookAt;if(!l)return null;const c="expression"===l.type?1:10,u=this._v1ImportRangeMap(l.rangeMapHorizontalInner,c),d=this._v1ImportRangeMap(l.rangeMapHorizontalOuter,c),h=this._v1ImportRangeMap(l.rangeMapVerticalDown,c),p=this._v1ImportRangeMap(l.rangeMapVerticalUp,c);let f;f="expression"===l.type?new dD(n,u,d,h,p):new uD(t,u,d,h,p);const m=this._importLookAt(t,f);return m.offsetFromHeadBone.fromArray(null!=(i=l.offsetFromHeadBone)?i:[0,.06,0]),m})}_v1ImportRangeMap(e,t){var n,r;let i=null!=(n=null==e?void 0:e.inputMaxValue)?n:90;const o=null!=(r=null==e?void 0:e.outputScale)?r:t;return i<fD&&(console.warn("VRMLookAtLoaderPlugin: inputMaxValue of a range map is too small. Consider reviewing the range map!"),i=fD),new hD(i,o)}_v0Import(e,t,n){return XN(this,null,function*(){var e,r,i,o;const a=null==(e=this.parser.json.extensions)?void 0:e.VRM;if(!a)return null;const s=a.firstPerson;if(!s)return null;const l="BlendShape"===s.lookAtTypeName?1:10,c=this._v0ImportDegreeMap(s.lookAtHorizontalInner,l),u=this._v0ImportDegreeMap(s.lookAtHorizontalOuter,l),d=this._v0ImportDegreeMap(s.lookAtVerticalDown,l),h=this._v0ImportDegreeMap(s.lookAtVerticalUp,l);let p;p="BlendShape"===s.lookAtTypeName?new dD(n,c,u,d,h):new uD(t,c,u,d,h);const f=this._importLookAt(t,p);return s.firstPersonBoneOffset?f.offsetFromHeadBone.set(null!=(r=s.firstPersonBoneOffset.x)?r:0,null!=(i=s.firstPersonBoneOffset.y)?i:.06,-(null!=(o=s.firstPersonBoneOffset.z)?o:0)):f.offsetFromHeadBone.set(0,.06,0),f.faceFront.set(0,0,-1),p instanceof uD&&p.faceFront.set(0,0,-1),f})}_v0ImportDegreeMap(e,t){var n,r;const i=null==e?void 0:e.curve;"[0,0,0,1,1,1,1,0]"!==JSON.stringify(i)&&console.warn("Curves of LookAtDegreeMap defined in VRM 0.0 are not supported");let o=null!=(n=null==e?void 0:e.xRange)?n:90;const a=null!=(r=null==e?void 0:e.yRange)?r:t;return o<fD&&(console.warn("VRMLookAtLoaderPlugin: xRange of a degree map is too small. Consider reviewing the degree map!"),o=fD),new hD(o,a)}_importLookAt(e,t){const n=new oD(e,t);if(this.helperRoot){const e=new HO(n);this.helperRoot.add(e),e.renderOrder=this.helperRoot.renderOrder}return n}};var gD=new Set(["1.0","1.0-beta"]),vD=class{get name(){return"VRMMetaLoaderPlugin"}constructor(e,t){var n,r,i;this.parser=e,this.needThumbnailImage=null!=(n=null==t?void 0:t.needThumbnailImage)&&n,this.acceptLicenseUrls=null!=(r=null==t?void 0:t.acceptLicenseUrls)?r:["https://vrm.dev/licenses/1.0/"],this.acceptV0Meta=null==(i=null==t?void 0:t.acceptV0Meta)||i}afterRoot(e){return XN(this,null,function*(){e.userData.vrmMeta=yield this._import(e)})}_import(e){return XN(this,null,function*(){const t=yield this._v1Import(e);if(null!=t)return t;const n=yield this._v0Import(e);return null!=n?n:null})}_v1Import(e){return XN(this,null,function*(){var e,t,n;const r=this.parser.json;if(!(-1!==(null==(e=r.extensionsUsed)?void 0:e.indexOf("VRMC_vrm"))))return null;const i=null==(t=r.extensions)?void 0:t.VRMC_vrm;if(null==i)return null;const o=i.specVersion;if(!gD.has(o))return console.warn(`VRMMetaLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const a=i.meta;if(!a)return null;const s=a.licenseUrl;if(!new Set(this.acceptLicenseUrls).has(s))throw new Error(`VRMMetaLoaderPlugin: The license url "${s}" is not accepted`);let l;return this.needThumbnailImage&&null!=a.thumbnailImage&&(l=null!=(n=yield this._extractGLTFImage(a.thumbnailImage))?n:void 0),{metaVersion:"1",name:a.name,version:a.version,authors:a.authors,copyrightInformation:a.copyrightInformation,contactInformation:a.contactInformation,references:a.references,thirdPartyLicenses:a.thirdPartyLicenses,thumbnailImage:l,licenseUrl:a.licenseUrl,avatarPermission:a.avatarPermission,allowExcessivelyViolentUsage:a.allowExcessivelyViolentUsage,allowExcessivelySexualUsage:a.allowExcessivelySexualUsage,commercialUsage:a.commercialUsage,allowPoliticalOrReligiousUsage:a.allowPoliticalOrReligiousUsage,allowAntisocialOrHateUsage:a.allowAntisocialOrHateUsage,creditNotation:a.creditNotation,allowRedistribution:a.allowRedistribution,modification:a.modification,otherLicenseUrl:a.otherLicenseUrl}})}_v0Import(e){return XN(this,null,function*(){var e;const t=null==(e=this.parser.json.extensions)?void 0:e.VRM;if(!t)return null;const n=t.meta;if(!n)return null;if(!this.acceptV0Meta)throw new Error("VRMMetaLoaderPlugin: Attempted to load VRM0.0 meta but acceptV0Meta is false");let r;return this.needThumbnailImage&&null!=n.texture&&-1!==n.texture&&(r=yield this.parser.getDependency("texture",n.texture)),{metaVersion:"0",allowedUserName:n.allowedUserName,author:n.author,commercialUssageName:n.commercialUssageName,contactInformation:n.contactInformation,licenseName:n.licenseName,otherLicenseUrl:n.otherLicenseUrl,otherPermissionUrl:n.otherPermissionUrl,reference:n.reference,sexualUssageName:n.sexualUssageName,texture:null!=r?r:void 0,title:n.title,version:n.version,violentUssageName:n.violentUssageName}})}_extractGLTFImage(e){return XN(this,null,function*(){var t;const n=null==(t=this.parser.json.images)?void 0:t[e];if(null==n)return console.warn(`VRMMetaLoaderPlugin: Attempt to use images[${e}] of glTF as a thumbnail but the image doesn't exist`),null;let r=n.uri;if(null!=n.bufferView){const e=yield this.parser.getDependency("bufferView",n.bufferView),t=new Blob([e],{type:n.mimeType});r=URL.createObjectURL(t)}if(null==r)return console.warn(`VRMMetaLoaderPlugin: Attempt to use images[${e}] of glTF as a thumbnail but the image couldn't load properly`),null;const i=new vC;return yield i.loadAsync((o=r,a=this.parser.options.path,"string"!=typeof o||""===o?"":(/^https?:\/\//i.test(a)&&/^\//.test(o)&&(a=a.replace(/(^https?:\/\/[^/]+).*/i,"$1")),/^(https?:)?\/\//i.test(o)||/^data:.*,.*$/i.test(o)||/^blob:.*$/i.test(o)?o:a+o))).catch(e=>(console.error(e),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null));var o,a})}},yD=class{constructor(e){this.scene=e.scene,this.meta=e.meta,this.humanoid=e.humanoid,this.expressionManager=e.expressionManager,this.firstPerson=e.firstPerson,this.lookAt=e.lookAt}update(e){this.humanoid.update(),this.lookAt&&this.lookAt.update(e),this.expressionManager&&this.expressionManager.update()}},bD=class extends yD{constructor(e){super(e),this.materials=e.materials,this.springBoneManager=e.springBoneManager,this.nodeConstraintManager=e.nodeConstraintManager}update(e){super.update(e),this.nodeConstraintManager&&this.nodeConstraintManager.update(),this.springBoneManager&&this.springBoneManager.update(e),this.materials&&this.materials.forEach(t=>{t.update&&t.update(e)})}},xD=Object.defineProperty,_D=Object.getOwnPropertySymbols,wD=Object.prototype.hasOwnProperty,SD=Object.prototype.propertyIsEnumerable,MD=(e,t,n)=>t in e?xD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ED=(e,t)=>{for(var n in t||(t={}))wD.call(t,n)&&MD(e,n,t[n]);if(_D)for(var n of _D(t))SD.call(t,n)&&MD(e,n,t[n]);return e},TD=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(Dv){i(Dv)}},a=e=>{try{s(n.throw(e))}catch(Dv){i(Dv)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())}),AD={"":3e3,srgb:3001};var CD=class{get pending(){return Promise.all(this._pendings)}constructor(e,t){this._parser=e,this._materialParams=t,this._pendings=[]}assignPrimitive(e,t){null!=t&&(this._materialParams[e]=t)}assignColor(e,t,n){if(null!=t){const r=(new cS).fromArray(t);n&&r.convertSRGBToLinear(),this._materialParams[e]=r}}assignTexture(e,t,n){return TD(this,null,function*(){const r=(()=>TD(this,null,function*(){null!=t&&(yield this._parser.assignTexture(this._materialParams,e,t),n&&function(e,t){parseInt(hy,10)>=152?e.colorSpace=t:e.encoding=AD[t]}(this._materialParams[e],"srgb"))}))();return this._pendings.push(r),r})}assignTextureByIndex(e,t,n){return TD(this,null,function*(){return this.assignTexture(e,null!=t?{index:t}:void 0,n)})}},kD="none",RD="none",PD="screenCoordinates",ID={3e3:"",3001:"srgb"};function LD(e){return parseInt(hy,10)>=152?e.colorSpace:ID[e.encoding]}var ND=class extends JS{constructor(e={}){var t;super({vertexShader:"// #define PHONG\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n\n#include <common>\n\n// #include <uv_pars_vertex>\n#ifdef MTOON_USE_UV\n varying vec2 vUv;\n\n // COMPAT: pre-r151 uses a common uvTransform\n #if THREE_VRM_THREE_REVISION < 151\n uniform mat3 uvTransform;\n #endif\n#endif\n\n// #include <uv2_pars_vertex>\n// COMAPT: pre-r151 uses uv2 for lightMap and aoMap\n#if THREE_VRM_THREE_REVISION < 151\n #if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n attribute vec2 uv2;\n varying vec2 vUv2;\n uniform mat3 uv2Transform;\n #endif\n#endif\n\n// #include <displacementmap_pars_vertex>\n// #include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\n#ifdef USE_OUTLINEWIDTHMULTIPLYTEXTURE\n uniform sampler2D outlineWidthMultiplyTexture;\n uniform mat3 outlineWidthMultiplyTextureUvTransform;\n#endif\n\nuniform float outlineWidthFactor;\n\nvoid main() {\n\n // #include <uv_vertex>\n #ifdef MTOON_USE_UV\n // COMPAT: pre-r151 uses a common uvTransform\n #if THREE_VRM_THREE_REVISION >= 151\n vUv = uv;\n #else\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #endif\n\n // #include <uv2_vertex>\n // COMAPT: pre-r151 uses uv2 for lightMap and aoMap\n #if THREE_VRM_THREE_REVISION < 151\n #if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n #endif\n #endif\n\n #include <color_vertex>\n\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n\n // we need this to compute the outline properly\n objectNormal = normalize( objectNormal );\n\n #include <defaultnormal_vertex>\n\n #ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #endif\n\n #include <begin_vertex>\n\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n // #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n\n vViewPosition = - mvPosition.xyz;\n\n #ifdef OUTLINE\n float worldNormalLength = length( transformedNormal );\n vec3 outlineOffset = outlineWidthFactor * worldNormalLength * objectNormal;\n\n #ifdef USE_OUTLINEWIDTHMULTIPLYTEXTURE\n vec2 outlineWidthMultiplyTextureUv = ( outlineWidthMultiplyTextureUvTransform * vec3( vUv, 1 ) ).xy;\n float outlineTex = texture2D( outlineWidthMultiplyTexture, outlineWidthMultiplyTextureUv ).g;\n outlineOffset *= outlineTex;\n #endif\n\n #ifdef OUTLINE_WIDTH_SCREEN\n outlineOffset *= vViewPosition.z / projectionMatrix[ 1 ].y;\n #endif\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( outlineOffset + transformed, 1.0 );\n\n gl_Position.z += 1E-6 * gl_Position.w; // anti-artifact magic\n #endif\n\n #include <worldpos_vertex>\n // #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n\n}",fragmentShader:"// #define PHONG\n\nuniform vec3 litFactor;\n\nuniform float opacity;\n\nuniform vec3 shadeColorFactor;\n#ifdef USE_SHADEMULTIPLYTEXTURE\n uniform sampler2D shadeMultiplyTexture;\n uniform mat3 shadeMultiplyTextureUvTransform;\n#endif\n\nuniform float shadingShiftFactor;\nuniform float shadingToonyFactor;\n\n#ifdef USE_SHADINGSHIFTTEXTURE\n uniform sampler2D shadingShiftTexture;\n uniform mat3 shadingShiftTextureUvTransform;\n uniform float shadingShiftTextureScale;\n#endif\n\nuniform float giEqualizationFactor;\n\nuniform vec3 parametricRimColorFactor;\n#ifdef USE_RIMMULTIPLYTEXTURE\n uniform sampler2D rimMultiplyTexture;\n uniform mat3 rimMultiplyTextureUvTransform;\n#endif\nuniform float rimLightingMixFactor;\nuniform float parametricRimFresnelPowerFactor;\nuniform float parametricRimLiftFactor;\n\n#ifdef USE_MATCAPTEXTURE\n uniform vec3 matcapFactor;\n uniform sampler2D matcapTexture;\n uniform mat3 matcapTextureUvTransform;\n#endif\n\nuniform vec3 emissive;\nuniform float emissiveIntensity;\n\nuniform vec3 outlineColorFactor;\nuniform float outlineLightingMixFactor;\n\n#ifdef USE_UVANIMATIONMASKTEXTURE\n uniform sampler2D uvAnimationMaskTexture;\n uniform mat3 uvAnimationMaskTextureUvTransform;\n#endif\n\nuniform float uvAnimationScrollXOffset;\nuniform float uvAnimationScrollYOffset;\nuniform float uvAnimationRotationPhase;\n\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n\n// #include <uv_pars_fragment>\n#if ( defined( MTOON_USE_UV ) && !defined( MTOON_UVS_VERTEX_ONLY ) )\n varying vec2 vUv;\n#endif\n\n// #include <uv2_pars_fragment>\n// COMAPT: pre-r151 uses uv2 for lightMap and aoMap\n#if THREE_VRM_THREE_REVISION < 151\n #if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n varying vec2 vUv2;\n #endif\n#endif\n\n#include <map_pars_fragment>\n\n#ifdef USE_MAP\n uniform mat3 mapUvTransform;\n#endif\n\n// #include <alphamap_pars_fragment>\n\n#include <alphatest_pars_fragment>\n\n#include <aomap_pars_fragment>\n// #include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapUvTransform;\n#endif\n\n// #include <envmap_common_pars_fragment>\n// #include <envmap_pars_fragment>\n// #include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n\n// #include <bsdfs>\n// COMPAT: pre-r151 doesn't have BRDF_Lambert in <common>\n#if THREE_VRM_THREE_REVISION < 151\n vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n }\n#endif\n\n#include <lights_pars_begin>\n\n#include <normal_pars_fragment>\n\n// #include <lights_phong_pars_fragment>\nvarying vec3 vViewPosition;\n\nstruct MToonMaterial {\n vec3 diffuseColor;\n vec3 shadeColor;\n float shadingShift;\n};\n\nfloat linearstep( float a, float b, float t ) {\n return clamp( ( t - a ) / ( b - a ), 0.0, 1.0 );\n}\n\n/**\n * Convert NdotL into toon shading factor using shadingShift and shadingToony\n */\nfloat getShading(\n const in float dotNL,\n const in float shadow,\n const in float shadingShift\n) {\n float shading = dotNL;\n shading = shading + shadingShift;\n shading = linearstep( -1.0 + shadingToonyFactor, 1.0 - shadingToonyFactor, shading );\n shading *= shadow;\n return shading;\n}\n\n/**\n * Mix diffuseColor and shadeColor using shading factor and light color\n */\nvec3 getDiffuse(\n const in MToonMaterial material,\n const in float shading,\n in vec3 lightColor\n) {\n #ifdef DEBUG_LITSHADERATE\n return vec3( BRDF_Lambert( shading * lightColor ) );\n #endif\n\n vec3 col = lightColor * BRDF_Lambert( mix( material.shadeColor, material.diffuseColor, shading ) );\n\n // The \"comment out if you want to PBR absolutely\" line\n #ifdef V0_COMPAT_SHADE\n col = min( col, material.diffuseColor );\n #endif\n\n return col;\n}\n\n// COMPAT: pre-r156 uses a struct GeometricContext\n#if THREE_VRM_THREE_REVISION >= 157\n void RE_Direct_MToon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in MToonMaterial material, const in float shadow, inout ReflectedLight reflectedLight ) {\n float dotNL = clamp( dot( geometryNormal, directLight.direction ), -1.0, 1.0 );\n vec3 irradiance = directLight.color;\n\n // directSpecular will be used for rim lighting, not an actual specular\n reflectedLight.directSpecular += irradiance;\n\n irradiance *= dotNL;\n\n float shading = getShading( dotNL, shadow, material.shadingShift );\n\n // toon shaded diffuse\n reflectedLight.directDiffuse += getDiffuse( material, shading, directLight.color );\n }\n\n void RE_IndirectDiffuse_MToon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in MToonMaterial material, inout ReflectedLight reflectedLight ) {\n // indirect diffuse will use diffuseColor, no shadeColor involved\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n // directSpecular will be used for rim lighting, not an actual specular\n reflectedLight.directSpecular += irradiance;\n }\n#else\n void RE_Direct_MToon( const in IncidentLight directLight, const in GeometricContext geometry, const in MToonMaterial material, const in float shadow, inout ReflectedLight reflectedLight ) {\n float dotNL = clamp( dot( geometry.normal, directLight.direction ), -1.0, 1.0 );\n vec3 irradiance = directLight.color;\n\n // directSpecular will be used for rim lighting, not an actual specular\n reflectedLight.directSpecular += irradiance;\n\n irradiance *= dotNL;\n\n float shading = getShading( dotNL, shadow, material.shadingShift );\n\n // toon shaded diffuse\n reflectedLight.directDiffuse += getDiffuse( material, shading, directLight.color );\n }\n\n void RE_IndirectDiffuse_MToon( const in vec3 irradiance, const in GeometricContext geometry, const in MToonMaterial material, inout ReflectedLight reflectedLight ) {\n // indirect diffuse will use diffuseColor, no shadeColor involved\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n // directSpecular will be used for rim lighting, not an actual specular\n reflectedLight.directSpecular += irradiance;\n }\n#endif\n\n#define RE_Direct RE_Direct_MToon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_MToon\n#define Material_LightProbeLOD( material ) (0)\n\n#include <shadowmap_pars_fragment>\n// #include <bumpmap_pars_fragment>\n\n// #include <normalmap_pars_fragment>\n#ifdef USE_NORMALMAP\n\n uniform sampler2D normalMap;\n uniform mat3 normalMapUvTransform;\n uniform vec2 normalScale;\n\n#endif\n\n// COMPAT: pre-r151\n// USE_NORMALMAP_OBJECTSPACE used to be OBJECTSPACE_NORMALMAP in pre-r151\n#if defined( USE_NORMALMAP_OBJECTSPACE ) || defined( OBJECTSPACE_NORMALMAP )\n\n uniform mat3 normalMatrix;\n\n#endif\n\n// COMPAT: pre-r151\n// USE_NORMALMAP_TANGENTSPACE used to be TANGENTSPACE_NORMALMAP in pre-r151\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( TANGENTSPACE_NORMALMAP ) )\n\n // Per-Pixel Tangent Space Normal Mapping\n // http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n // three-vrm specific change: it requires `uv` as an input in order to support uv scrolls\n\n // Temporary compat against shader change @ Three.js r126, r151\n #if THREE_VRM_THREE_REVISION >= 151\n\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n\n vec3 N = surf_norm;\n\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\n return mat3( T * scale, B * scale, N );\n\n }\n\n #else\n\n vec3 perturbNormal2Arb( vec2 uv, vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\n vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n\n vec3 N = normalize( surf_norm );\n\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n\n // three-vrm specific change: Workaround for the issue that happens when delta of uv = 0.0\n // TODO: Is this still required? Or shall I make a PR about it?\n if ( length( T ) == 0.0 || length( B ) == 0.0 ) {\n return surf_norm;\n }\n\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\n return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\n }\n\n #endif\n\n#endif\n\n// #include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\n// == post correction ==========================================================\nvoid postCorrection() {\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}\n\n// == main procedure ===========================================================\nvoid main() {\n #include <clipping_planes_fragment>\n\n vec2 uv = vec2(0.5, 0.5);\n\n #if ( defined( MTOON_USE_UV ) && !defined( MTOON_UVS_VERTEX_ONLY ) )\n uv = vUv;\n\n float uvAnimMask = 1.0;\n #ifdef USE_UVANIMATIONMASKTEXTURE\n vec2 uvAnimationMaskTextureUv = ( uvAnimationMaskTextureUvTransform * vec3( uv, 1 ) ).xy;\n uvAnimMask = texture2D( uvAnimationMaskTexture, uvAnimationMaskTextureUv ).b;\n #endif\n\n float uvRotCos = cos( uvAnimationRotationPhase * uvAnimMask );\n float uvRotSin = sin( uvAnimationRotationPhase * uvAnimMask );\n uv = mat2( uvRotCos, -uvRotSin, uvRotSin, uvRotCos ) * ( uv - 0.5 ) + 0.5;\n uv = uv + vec2( uvAnimationScrollXOffset, uvAnimationScrollYOffset ) * uvAnimMask;\n #endif\n\n #ifdef DEBUG_UV\n gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #if ( defined( MTOON_USE_UV ) && !defined( MTOON_UVS_VERTEX_ONLY ) )\n gl_FragColor = vec4( uv, 0.0, 1.0 );\n #endif\n return;\n #endif\n\n vec4 diffuseColor = vec4( litFactor, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive * emissiveIntensity;\n\n #include <logdepthbuf_fragment>\n\n // #include <map_fragment>\n #ifdef USE_MAP\n vec2 mapUv = ( mapUvTransform * vec3( uv, 1 ) ).xy;\n vec4 sampledDiffuseColor = texture2D( map, mapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n 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 );\n #endif\n diffuseColor *= sampledDiffuseColor;\n #endif\n\n // #include <color_fragment>\n #if ( defined( USE_COLOR ) && !defined( IGNORE_VERTEX_COLOR ) )\n diffuseColor.rgb *= vColor;\n #endif\n\n // #include <alphamap_fragment>\n\n #include <alphatest_fragment>\n\n // #include <specularmap_fragment>\n\n // #include <normal_fragment_begin>\n float faceDirection = gl_FrontFacing ? 1.0 : -1.0;\n\n #ifdef FLAT_SHADED\n\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n\n #else\n\n vec3 normal = normalize( vNormal );\n\n #ifdef DOUBLE_SIDED\n\n normal *= faceDirection;\n\n #endif\n\n #endif\n\n #ifdef USE_NORMALMAP\n\n vec2 normalMapUv = ( normalMapUvTransform * vec3( uv, 1 ) ).xy;\n\n #endif\n\n #ifdef USE_NORMALMAP_TANGENTSPACE\n\n #ifdef USE_TANGENT\n\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\n #else\n\n mat3 tbn = getTangentFrame( - vViewPosition, normal, normalMapUv );\n\n #endif\n\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n\n #endif\n\n #endif\n\n #ifdef USE_CLEARCOAT_NORMALMAP\n\n #ifdef USE_TANGENT\n\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\n #else\n\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\n #endif\n\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n\n #endif\n\n #endif\n\n // non perturbed normal for clearcoat among others\n\n vec3 nonPerturbedNormal = normal;\n\n #ifdef OUTLINE\n normal *= -1.0;\n #endif\n\n // #include <normal_fragment_maps>\n\n // COMPAT: pre-r151\n // USE_NORMALMAP_OBJECTSPACE used to be OBJECTSPACE_NORMALMAP in pre-r151\n #if defined( USE_NORMALMAP_OBJECTSPACE ) || defined( OBJECTSPACE_NORMALMAP )\n\n normal = texture2D( normalMap, normalMapUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals\n\n #ifdef FLIP_SIDED\n\n normal = - normal;\n\n #endif\n\n #ifdef DOUBLE_SIDED\n\n normal = normal * faceDirection;\n\n #endif\n\n normal = normalize( normalMatrix * normal );\n\n // COMPAT: pre-r151\n // USE_NORMALMAP_TANGENTSPACE used to be TANGENTSPACE_NORMALMAP in pre-r151\n #elif defined( USE_NORMALMAP_TANGENTSPACE ) || defined( TANGENTSPACE_NORMALMAP )\n\n vec3 mapN = texture2D( normalMap, normalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n\n // COMPAT: pre-r151\n #if THREE_VRM_THREE_REVISION >= 151 || defined( USE_TANGENT )\n\n normal = normalize( tbn * mapN );\n\n #else\n\n normal = perturbNormal2Arb( uv, -vViewPosition, normal, mapN, faceDirection );\n\n #endif\n\n #endif\n\n // #include <emissivemap_fragment>\n #ifdef USE_EMISSIVEMAP\n vec2 emissiveMapUv = ( emissiveMapUvTransform * vec3( uv, 1 ) ).xy;\n totalEmissiveRadiance *= texture2D( emissiveMap, emissiveMapUv ).rgb;\n #endif\n\n #ifdef DEBUG_NORMAL\n gl_FragColor = vec4( 0.5 + 0.5 * normal, 1.0 );\n return;\n #endif\n\n // -- MToon: lighting --------------------------------------------------------\n // accumulation\n // #include <lights_phong_fragment>\n MToonMaterial material;\n\n material.diffuseColor = diffuseColor.rgb;\n\n material.shadeColor = shadeColorFactor;\n #ifdef USE_SHADEMULTIPLYTEXTURE\n vec2 shadeMultiplyTextureUv = ( shadeMultiplyTextureUvTransform * vec3( uv, 1 ) ).xy;\n material.shadeColor *= texture2D( shadeMultiplyTexture, shadeMultiplyTextureUv ).rgb;\n #endif\n\n #if ( defined( USE_COLOR ) && !defined( IGNORE_VERTEX_COLOR ) )\n material.shadeColor.rgb *= vColor;\n #endif\n\n material.shadingShift = shadingShiftFactor;\n #ifdef USE_SHADINGSHIFTTEXTURE\n vec2 shadingShiftTextureUv = ( shadingShiftTextureUvTransform * vec3( uv, 1 ) ).xy;\n material.shadingShift += texture2D( shadingShiftTexture, shadingShiftTextureUv ).r * shadingShiftTextureScale;\n #endif\n\n // #include <lights_fragment_begin>\n\n // MToon Specific changes:\n // Since we want to take shadows into account of shading instead of irradiance,\n // we had to modify the codes that multiplies the results of shadowmap into color of direct lights.\n\n // COMPAT: pre-r156 uses a struct GeometricContext\n #if THREE_VRM_THREE_REVISION >= 157\n vec3 geometryPosition = - vViewPosition;\n vec3 geometryNormal = normal;\n vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\n vec3 geometryClearcoatNormal;\n\n #ifdef USE_CLEARCOAT\n\n geometryClearcoatNormal = clearcoatNormal;\n\n #endif\n #else\n GeometricContext geometry;\n\n geometry.position = - vViewPosition;\n geometry.normal = normal;\n geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\n #ifdef USE_CLEARCOAT\n\n geometry.clearcoatNormal = clearcoatNormal;\n\n #endif\n #endif\n\n IncidentLight directLight;\n\n // since these variables will be used in unrolled loop, we have to define in prior\n float shadow;\n\n #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n pointLight = pointLights[ i ];\n\n // COMPAT: pre-r156 uses a struct GeometricContext\n #if THREE_VRM_THREE_REVISION >= 157\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #else\n getPointLightInfo( pointLight, geometry, directLight );\n #endif\n\n shadow = 1.0;\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n // COMPAT: pre-r166\n // r166 introduced shadowIntensity\n #if THREE_VRM_THREE_REVISION >= 166\n shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #else\n shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n #endif\n\n // COMPAT: pre-r156 uses a struct GeometricContext\n #if THREE_VRM_THREE_REVISION >= 157\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, shadow, reflectedLight );\n #else\n RE_Direct( directLight, geometry, material, shadow, reflectedLight );\n #endif\n\n }\n #pragma unroll_loop_end\n\n #endif\n\n #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\n SpotLight spotLight;\n // COMPAT: pre-r144 uses NUM_SPOT_LIGHT_SHADOWS, r144+ uses NUM_SPOT_LIGHT_COORDS\n #if THREE_VRM_THREE_REVISION >= 144\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_COORDS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #elif defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n spotLight = spotLights[ i ];\n\n // COMPAT: pre-r156 uses a struct GeometricContext\n #if THREE_VRM_THREE_REVISION >= 157\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #else\n getSpotLightInfo( spotLight, geometry, directLight );\n #endif\n\n shadow = 1.0;\n // COMPAT: pre-r144 uses NUM_SPOT_LIGHT_SHADOWS and vSpotShadowCoord, r144+ uses NUM_SPOT_LIGHT_COORDS and vSpotLightCoord\n // COMPAT: pre-r166 does not have shadowIntensity, r166+ has shadowIntensity\n #if THREE_VRM_THREE_REVISION >= 166\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_COORDS )\n spotLightShadow = spotLightShadows[ i ];\n shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n #elif THREE_VRM_THREE_REVISION >= 144\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_COORDS )\n spotLightShadow = spotLightShadows[ i ];\n shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n #elif defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n #endif\n\n // COMPAT: pre-r156 uses a struct GeometricContext\n #if THREE_VRM_THREE_REVISION >= 157\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, shadow, reflectedLight );\n #else\n RE_Direct( directLight, geometry, material, shadow, reflectedLight );\n #endif\n\n }\n #pragma unroll_loop_end\n\n #endif\n\n #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n directionalLight = directionalLights[ i ];\n\n // COMPAT: pre-r156 uses a struct GeometricContext\n #if THREE_VRM_THREE_REVISION >= 157\n getDirectionalLightInfo( directionalLight, directLight );\n #else\n getDirectionalLightInfo( directionalLight, geometry, directLight );\n #endif\n\n shadow = 1.0;\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n // COMPAT: pre-r166\n // r166 introduced shadowIntensity\n #if THREE_VRM_THREE_REVISION >= 166\n shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #else\n shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n #endif\n\n // COMPAT: pre-r156 uses a struct GeometricContext\n #if THREE_VRM_THREE_REVISION >= 157\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, shadow, reflectedLight );\n #else\n RE_Direct( directLight, geometry, material, shadow, reflectedLight );\n #endif\n\n }\n #pragma unroll_loop_end\n\n #endif\n\n // #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\n // RectAreaLight rectAreaLight;\n\n // #pragma unroll_loop_start\n // for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\n // rectAreaLight = rectAreaLights[ i ];\n // RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\n // }\n // #pragma unroll_loop_end\n\n // #endif\n\n #if defined( RE_IndirectDiffuse )\n\n vec3 iblIrradiance = vec3( 0.0 );\n\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\n // COMPAT: pre-r156 uses a struct GeometricContext\n // COMPAT: pre-r156 doesn't have a define USE_LIGHT_PROBES\n #if THREE_VRM_THREE_REVISION >= 157\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #else\n irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n #endif\n\n #if ( NUM_HEMI_LIGHTS > 0 )\n\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n // COMPAT: pre-r156 uses a struct GeometricContext\n #if THREE_VRM_THREE_REVISION >= 157\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n #else\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n #endif\n\n }\n #pragma unroll_loop_end\n\n #endif\n\n #endif\n\n // #if defined( RE_IndirectSpecular )\n\n // vec3 radiance = vec3( 0.0 );\n // vec3 clearcoatRadiance = vec3( 0.0 );\n\n // #endif\n\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n\n // modulation\n #include <aomap_fragment>\n\n vec3 col = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\n #ifdef DEBUG_LITSHADERATE\n gl_FragColor = vec4( col, diffuseColor.a );\n postCorrection();\n return;\n #endif\n\n // -- MToon: rim lighting -----------------------------------------\n vec3 viewDir = normalize( vViewPosition );\n\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n reflectedLight.directSpecular /= PI;\n #endif\n vec3 rimMix = mix( vec3( 1.0 ), reflectedLight.directSpecular, 1.0 );\n\n vec3 rim = parametricRimColorFactor * pow( saturate( 1.0 - dot( viewDir, normal ) + parametricRimLiftFactor ), parametricRimFresnelPowerFactor );\n\n #ifdef USE_MATCAPTEXTURE\n {\n vec3 x = normalize( vec3( viewDir.z, 0.0, -viewDir.x ) );\n vec3 y = cross( viewDir, x ); // guaranteed to be normalized\n vec2 sphereUv = 0.5 + 0.5 * vec2( dot( x, normal ), -dot( y, normal ) );\n sphereUv = ( matcapTextureUvTransform * vec3( sphereUv, 1 ) ).xy;\n vec3 matcap = texture2D( matcapTexture, sphereUv ).rgb;\n rim += matcapFactor * matcap;\n }\n #endif\n\n #ifdef USE_RIMMULTIPLYTEXTURE\n vec2 rimMultiplyTextureUv = ( rimMultiplyTextureUvTransform * vec3( uv, 1 ) ).xy;\n rim *= texture2D( rimMultiplyTexture, rimMultiplyTextureUv ).rgb;\n #endif\n\n col += rimMix * rim;\n\n // -- MToon: Emission --------------------------------------------------------\n col += totalEmissiveRadiance;\n\n // #include <envmap_fragment>\n\n // -- Almost done! -----------------------------------------------------------\n #if defined( OUTLINE )\n col = outlineColorFactor.rgb * mix( vec3( 1.0 ), col, outlineLightingMixFactor );\n #endif\n\n #ifdef OPAQUE\n diffuseColor.a = 1.0;\n #endif\n\n gl_FragColor = vec4( col, diffuseColor.a );\n postCorrection();\n}\n"}),this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.fog=!0,this.normalMapType=0,this._ignoreVertexColor=!0,this._v0CompatShade=!1,this._debugMode=kD,this._outlineWidthMode=RD,this._isOutline=!1,e.transparentWithZWrite&&(e.depthWrite=!0),delete e.transparentWithZWrite,e.fog=!0,e.lights=!0,e.clipping=!0,this.uniforms=ZS.merge([oR.common,oR.normalmap,oR.emissivemap,oR.fog,oR.lights,{litFactor:{value:new cS(1,1,1)},mapUvTransform:{value:new S_},colorAlpha:{value:1},normalMapUvTransform:{value:new S_},shadeColorFactor:{value:new cS(0,0,0)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new S_},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new S_},shadingShiftTextureScale:{value:1},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new cS(1,1,1)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new S_},parametricRimColorFactor:{value:new cS(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new S_},rimLightingMixFactor:{value:1},parametricRimFresnelPowerFactor:{value:5},parametricRimLiftFactor:{value:0},emissive:{value:new cS(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new S_},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new S_},outlineWidthFactor:{value:0},outlineColorFactor:{value:new cS(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new S_},uvAnimationScrollXOffset:{value:0},uvAnimationScrollYOffset:{value:0},uvAnimationRotationPhase:{value:0}},null!=(t=e.uniforms)?t:{}]),this.setValues(e),this._uploadUniformsWorkaround(),this.customProgramCacheKey=()=>[...Object.entries(this._generateDefines()).map(([e,t])=>`${e}:${t}`),this.matcapTexture?`matcapTextureColorSpace:${LD(this.matcapTexture)}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureColorSpace:${LD(this.shadeMultiplyTexture)}`:"",this.rimMultiplyTexture?`rimMultiplyTextureColorSpace:${LD(this.rimMultiplyTexture)}`:""].join(","),this.onBeforeCompile=e=>{const t=parseInt(hy,10),n=Object.entries(ED(ED({},this._generateDefines()),this.defines)).filter(([e,t])=>!!t).map(([e,t])=>`#define ${e} ${t}`).join("\n")+"\n";e.vertexShader=n+e.vertexShader,e.fragmentShader=n+e.fragmentShader,t<154&&(e.fragmentShader=e.fragmentShader.replace("#include <colorspace_fragment>","#include <encodings_fragment>"))}}get color(){return this.uniforms.litFactor.value}set color(e){this.uniforms.litFactor.value=e}get map(){return this.uniforms.map.value}set map(e){this.uniforms.map.value=e}get normalMap(){return this.uniforms.normalMap.value}set normalMap(e){this.uniforms.normalMap.value=e}get normalScale(){return this.uniforms.normalScale.value}set normalScale(e){this.uniforms.normalScale.value=e}get emissive(){return this.uniforms.emissive.value}set emissive(e){this.uniforms.emissive.value=e}get emissiveIntensity(){return this.uniforms.emissiveIntensity.value}set emissiveIntensity(e){this.uniforms.emissiveIntensity.value=e}get emissiveMap(){return this.uniforms.emissiveMap.value}set emissiveMap(e){this.uniforms.emissiveMap.value=e}get shadeColorFactor(){return this.uniforms.shadeColorFactor.value}set shadeColorFactor(e){this.uniforms.shadeColorFactor.value=e}get shadeMultiplyTexture(){return this.uniforms.shadeMultiplyTexture.value}set shadeMultiplyTexture(e){this.uniforms.shadeMultiplyTexture.value=e}get shadingShiftFactor(){return this.uniforms.shadingShiftFactor.value}set shadingShiftFactor(e){this.uniforms.shadingShiftFactor.value=e}get shadingShiftTexture(){return this.uniforms.shadingShiftTexture.value}set shadingShiftTexture(e){this.uniforms.shadingShiftTexture.value=e}get shadingShiftTextureScale(){return this.uniforms.shadingShiftTextureScale.value}set shadingShiftTextureScale(e){this.uniforms.shadingShiftTextureScale.value=e}get shadingToonyFactor(){return this.uniforms.shadingToonyFactor.value}set shadingToonyFactor(e){this.uniforms.shadingToonyFactor.value=e}get giEqualizationFactor(){return this.uniforms.giEqualizationFactor.value}set giEqualizationFactor(e){this.uniforms.giEqualizationFactor.value=e}get matcapFactor(){return this.uniforms.matcapFactor.value}set matcapFactor(e){this.uniforms.matcapFactor.value=e}get matcapTexture(){return this.uniforms.matcapTexture.value}set matcapTexture(e){this.uniforms.matcapTexture.value=e}get parametricRimColorFactor(){return this.uniforms.parametricRimColorFactor.value}set parametricRimColorFactor(e){this.uniforms.parametricRimColorFactor.value=e}get rimMultiplyTexture(){return this.uniforms.rimMultiplyTexture.value}set rimMultiplyTexture(e){this.uniforms.rimMultiplyTexture.value=e}get rimLightingMixFactor(){return this.uniforms.rimLightingMixFactor.value}set rimLightingMixFactor(e){this.uniforms.rimLightingMixFactor.value=e}get parametricRimFresnelPowerFactor(){return this.uniforms.parametricRimFresnelPowerFactor.value}set parametricRimFresnelPowerFactor(e){this.uniforms.parametricRimFresnelPowerFactor.value=e}get parametricRimLiftFactor(){return this.uniforms.parametricRimLiftFactor.value}set parametricRimLiftFactor(e){this.uniforms.parametricRimLiftFactor.value=e}get outlineWidthMultiplyTexture(){return this.uniforms.outlineWidthMultiplyTexture.value}set outlineWidthMultiplyTexture(e){this.uniforms.outlineWidthMultiplyTexture.value=e}get outlineWidthFactor(){return this.uniforms.outlineWidthFactor.value}set outlineWidthFactor(e){this.uniforms.outlineWidthFactor.value=e}get outlineColorFactor(){return this.uniforms.outlineColorFactor.value}set outlineColorFactor(e){this.uniforms.outlineColorFactor.value=e}get outlineLightingMixFactor(){return this.uniforms.outlineLightingMixFactor.value}set outlineLightingMixFactor(e){this.uniforms.outlineLightingMixFactor.value=e}get uvAnimationMaskTexture(){return this.uniforms.uvAnimationMaskTexture.value}set uvAnimationMaskTexture(e){this.uniforms.uvAnimationMaskTexture.value=e}get uvAnimationScrollXOffset(){return this.uniforms.uvAnimationScrollXOffset.value}set uvAnimationScrollXOffset(e){this.uniforms.uvAnimationScrollXOffset.value=e}get uvAnimationScrollYOffset(){return this.uniforms.uvAnimationScrollYOffset.value}set uvAnimationScrollYOffset(e){this.uniforms.uvAnimationScrollYOffset.value=e}get uvAnimationRotationPhase(){return this.uniforms.uvAnimationRotationPhase.value}set uvAnimationRotationPhase(e){this.uniforms.uvAnimationRotationPhase.value=e}get ignoreVertexColor(){return this._ignoreVertexColor}set ignoreVertexColor(e){this._ignoreVertexColor=e,this.needsUpdate=!0}get v0CompatShade(){return this._v0CompatShade}set v0CompatShade(e){this._v0CompatShade=e,this.needsUpdate=!0}get debugMode(){return this._debugMode}set debugMode(e){this._debugMode=e,this.needsUpdate=!0}get outlineWidthMode(){return this._outlineWidthMode}set outlineWidthMode(e){this._outlineWidthMode=e,this.needsUpdate=!0}get isOutline(){return this._isOutline}set isOutline(e){this._isOutline=e,this.needsUpdate=!0}get isMToonMaterial(){return!0}update(e){this._uploadUniformsWorkaround(),this._updateUVAnimation(e)}copy(e){return super.copy(e),this.map=e.map,this.normalMap=e.normalMap,this.emissiveMap=e.emissiveMap,this.shadeMultiplyTexture=e.shadeMultiplyTexture,this.shadingShiftTexture=e.shadingShiftTexture,this.matcapTexture=e.matcapTexture,this.rimMultiplyTexture=e.rimMultiplyTexture,this.outlineWidthMultiplyTexture=e.outlineWidthMultiplyTexture,this.uvAnimationMaskTexture=e.uvAnimationMaskTexture,this.normalMapType=e.normalMapType,this.uvAnimationScrollXSpeedFactor=e.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=e.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=e.uvAnimationRotationSpeedFactor,this.ignoreVertexColor=e.ignoreVertexColor,this.v0CompatShade=e.v0CompatShade,this.debugMode=e.debugMode,this.outlineWidthMode=e.outlineWidthMode,this.isOutline=e.isOutline,this.needsUpdate=!0,this}_updateUVAnimation(e){this.uniforms.uvAnimationScrollXOffset.value+=e*this.uvAnimationScrollXSpeedFactor,this.uniforms.uvAnimationScrollYOffset.value+=e*this.uvAnimationScrollYSpeedFactor,this.uniforms.uvAnimationRotationPhase.value+=e*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 e=parseInt(hy,10),t=null!==this.outlineWidthMultiplyTexture,n=null!==this.map||null!==this.normalMap||null!==this.emissiveMap||null!==this.shadeMultiplyTexture||null!==this.shadingShiftTexture||null!==this.rimMultiplyTexture||null!==this.uvAnimationMaskTexture;return{THREE_VRM_THREE_REVISION:e,OUTLINE:this._isOutline,MTOON_USE_UV:t||n,MTOON_UVS_VERTEX_ONLY:t&&!n,V0_COMPAT_SHADE:this._v0CompatShade,USE_SHADEMULTIPLYTEXTURE:null!==this.shadeMultiplyTexture,USE_SHADINGSHIFTTEXTURE:null!==this.shadingShiftTexture,USE_MATCAPTEXTURE:null!==this.matcapTexture,USE_RIMMULTIPLYTEXTURE:null!==this.rimMultiplyTexture,USE_OUTLINEWIDTHMULTIPLYTEXTURE:this._isOutline&&null!==this.outlineWidthMultiplyTexture,USE_UVANIMATIONMASKTEXTURE:null!==this.uvAnimationMaskTexture,IGNORE_VERTEX_COLOR:!0===this._ignoreVertexColor,DEBUG_NORMAL:"normal"===this._debugMode,DEBUG_LITSHADERATE:"litShadeRate"===this._debugMode,DEBUG_UV:"uv"===this._debugMode,OUTLINE_WIDTH_SCREEN:this._isOutline&&this._outlineWidthMode===PD}}_updateTextureMatrix(e,t){e.value&&(e.value.matrixAutoUpdate&&e.value.updateMatrix(),t.value.copy(e.value.matrix))}},OD=new Set(["1.0","1.0-beta"]),DD=class e{get name(){return e.EXTENSION_NAME}constructor(e,t={}){var n,r,i,o;this.parser=e,this.materialType=null!=(n=t.materialType)?n:ND,this.renderOrderOffset=null!=(r=t.renderOrderOffset)?r:0,this.v0CompatShade=null!=(i=t.v0CompatShade)&&i,this.debugMode=null!=(o=t.debugMode)?o:"none",this._mToonMaterialSet=new Set}beforeRoot(){return TD(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return TD(this,null,function*(){e.userData.vrmMToonMaterials=Array.from(this._mToonMaterialSet)})}getMaterialType(e){return this._getMToonExtension(e)?this.materialType:null}extendMaterialParams(e,t){const n=this._getMToonExtension(e);return n?this._extendMaterialParams(n,t):null}loadMesh(e){return TD(this,null,function*(){var t;const n=this.parser,r=null==(t=n.json.meshes)?void 0:t[e];if(null==r)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${e}] of glTF but the mesh doesn't exist`);const i=r.primitives,o=yield n.loadMesh(e);if(1===i.length){const e=o,t=i[0].material;null!=t&&this._setupPrimitive(e,t)}else{const e=o;for(let t=0;t<i.length;t++){const n=e.children[t],r=i[t].material;null!=r&&this._setupPrimitive(n,r)}}return o})}_removeUnlitExtensionIfMToonExists(){const e=this.parser.json.materials;null==e||e.map((e,t)=>{var n;this._getMToonExtension(t)&&(null==(n=e.extensions)?void 0:n.KHR_materials_unlit)&&delete e.extensions.KHR_materials_unlit})}_getMToonExtension(t){var n,r;const i=null==(n=this.parser.json.materials)?void 0:n[t];if(null==i)return void console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${t}] of glTF but the material doesn't exist`);const o=null==(r=i.extensions)?void 0:r[e.EXTENSION_NAME];if(null==o)return;const a=o.specVersion;if(OD.has(a))return o;console.warn(`MToonMaterialLoaderPlugin: Unknown ${e.EXTENSION_NAME} specVersion "${a}"`)}_extendMaterialParams(e,t){return TD(this,null,function*(){var n;delete t.metalness,delete t.roughness;const r=new CD(this.parser,t);r.assignPrimitive("transparentWithZWrite",e.transparentWithZWrite),r.assignColor("shadeColorFactor",e.shadeColorFactor),r.assignTexture("shadeMultiplyTexture",e.shadeMultiplyTexture,!0),r.assignPrimitive("shadingShiftFactor",e.shadingShiftFactor),r.assignTexture("shadingShiftTexture",e.shadingShiftTexture,!0),r.assignPrimitive("shadingShiftTextureScale",null==(n=e.shadingShiftTexture)?void 0:n.scale),r.assignPrimitive("shadingToonyFactor",e.shadingToonyFactor),r.assignPrimitive("giEqualizationFactor",e.giEqualizationFactor),r.assignColor("matcapFactor",e.matcapFactor),r.assignTexture("matcapTexture",e.matcapTexture,!0),r.assignColor("parametricRimColorFactor",e.parametricRimColorFactor),r.assignTexture("rimMultiplyTexture",e.rimMultiplyTexture,!0),r.assignPrimitive("rimLightingMixFactor",e.rimLightingMixFactor),r.assignPrimitive("parametricRimFresnelPowerFactor",e.parametricRimFresnelPowerFactor),r.assignPrimitive("parametricRimLiftFactor",e.parametricRimLiftFactor),r.assignPrimitive("outlineWidthMode",e.outlineWidthMode),r.assignPrimitive("outlineWidthFactor",e.outlineWidthFactor),r.assignTexture("outlineWidthMultiplyTexture",e.outlineWidthMultiplyTexture,!1),r.assignColor("outlineColorFactor",e.outlineColorFactor),r.assignPrimitive("outlineLightingMixFactor",e.outlineLightingMixFactor),r.assignTexture("uvAnimationMaskTexture",e.uvAnimationMaskTexture,!1),r.assignPrimitive("uvAnimationScrollXSpeedFactor",e.uvAnimationScrollXSpeedFactor),r.assignPrimitive("uvAnimationScrollYSpeedFactor",e.uvAnimationScrollYSpeedFactor),r.assignPrimitive("uvAnimationRotationSpeedFactor",e.uvAnimationRotationSpeedFactor),r.assignPrimitive("v0CompatShade",this.v0CompatShade),r.assignPrimitive("debugMode",this.debugMode),yield r.pending})}_setupPrimitive(e,t){const n=this._getMToonExtension(t);if(n){const t=this._parseRenderOrder(n);return e.renderOrder=t+this.renderOrderOffset,this._generateOutline(e),void this._addToMaterialSet(e)}}_shouldGenerateOutline(e){return"string"==typeof e.outlineWidthMode&&"none"!==e.outlineWidthMode&&"number"==typeof e.outlineWidthFactor&&e.outlineWidthFactor>0}_generateOutline(e){const t=e.material;if(!(t instanceof hS))return;if(!this._shouldGenerateOutline(t))return;e.material=[t];const n=t.clone();n.name+=" (Outline)",n.isOutline=!0,n.side=1,e.material.push(n);const r=e.geometry,i=r.index?r.index.count:r.attributes.position.count/3;r.addGroup(0,i,0),r.addGroup(0,i,1)}_addToMaterialSet(e){const t=e.material,n=new Set;Array.isArray(t)?t.forEach(e=>n.add(e)):n.add(t);for(const r of n)this._mToonMaterialSet.add(r)}_parseRenderOrder(e){var t;return(e.transparentWithZWrite?0:19)+(null!=(t=e.renderQueueOffsetNumber)?t:0)}};DD.EXTENSION_NAME="VRMC_materials_mtoon";var UD=DD,FD=class e{get name(){return e.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,t){return n=this,r=null,i=function*(){const n=this._getHDREmissiveMultiplierExtension(e);if(null==n)return;console.warn("VRMMaterialsHDREmissiveMultiplierLoaderPlugin: `VRMC_materials_hdr_emissiveMultiplier` is archived. Use `KHR_materials_emissive_strength` instead.");const r=n.emissiveMultiplier;t.emissiveIntensity=r},new Promise((e,t)=>{var o=e=>{try{s(i.next(e))}catch(Dv){t(Dv)}},a=e=>{try{s(i.throw(e))}catch(Dv){t(Dv)}},s=t=>t.done?e(t.value):Promise.resolve(t.value).then(o,a);s((i=i.apply(n,r)).next())});var n,r,i}_getHDREmissiveMultiplierExtension(t){var n,r;const i=null==(n=this.parser.json.materials)?void 0:n[t];if(null==i)return void console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${t}] of glTF but the material doesn't exist`);const o=null==(r=i.extensions)?void 0:r[e.EXTENSION_NAME];return null!=o?o:void 0}};FD.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var zD=FD,BD=Object.defineProperty,VD=Object.defineProperties,jD=Object.getOwnPropertyDescriptors,HD=Object.getOwnPropertySymbols,WD=Object.prototype.hasOwnProperty,GD=Object.prototype.propertyIsEnumerable,XD=(e,t,n)=>t in e?BD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qD=(e,t)=>{for(var n in t||(t={}))WD.call(t,n)&&XD(e,n,t[n]);if(HD)for(var n of HD(t))GD.call(t,n)&&XD(e,n,t[n]);return e},$D=(e,t)=>VD(e,jD(t));function YD(e){return Math.pow(e,2.2)}var ZD=class{get name(){return"VRMMaterialsV0CompatPlugin"}constructor(e){var t;this.parser=e,this._renderQueueMapTransparent=new Map,this._renderQueueMapTransparentZWrite=new Map;const n=this.parser.json;n.extensionsUsed=null!=(t=n.extensionsUsed)?t:[],-1===n.extensionsUsed.indexOf("KHR_texture_transform")&&n.extensionsUsed.push("KHR_texture_transform")}beforeRoot(){return e=this,t=null,n=function*(){var e;const t=this.parser.json,n=null==(e=t.extensions)?void 0:e.VRM,r=null==n?void 0:n.materialProperties;r&&(this._populateRenderQueueMap(r),r.forEach((e,n)=>{var r,i;const o=null==(r=t.materials)?void 0:r[n];if(null!=o)if("VRM/MToon"===e.shader){const r=this._parseV0MToonProperties(e,o);t.materials[n]=r}else if(null==(i=e.shader)?void 0:i.startsWith("VRM/Unlit")){const r=this._parseV0UnlitProperties(e,o);t.materials[n]=r}else"VRM_USE_GLTFSHADER"===e.shader||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${e.shader}`);else console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${n}] of glTF but the material doesn't exist`)}))},new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(Dv){i(Dv)}},a=e=>{try{s(n.throw(e))}catch(Dv){i(Dv)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});var e,t,n}_parseV0MToonProperties(e,t){var n,r,i,o,a,s,l,c,u,d,h,p,f,m,g,v,y,b,x,_,w,S,M,E,T,A,C,k,R,P,I,L,N,O,D,U,F,z,B,V,j,H,W,G,X,q,$,Y,Z,J,K,Q,ee,te,ne;const re=null!=(r=null==(n=e.keywordMap)?void 0:n._ALPHABLEND_ON)&&r,ie=1===(null==(i=e.floatProperties)?void 0:i._ZWrite)&&re,oe=this._v0ParseRenderQueue(e),ae=null!=(a=null==(o=e.keywordMap)?void 0:o._ALPHATEST_ON)&&a,se=re?"BLEND":ae?"MASK":"OPAQUE",le=ae?null!=(l=null==(s=e.floatProperties)?void 0:s._Cutoff)?l:.5:void 0,ce=0===(null!=(u=null==(c=e.floatProperties)?void 0:c._CullMode)?u:2),ue=this._portTextureTransform(e),de=(null!=(h=null==(d=e.vectorProperties)?void 0:d._Color)?h:[1,1,1,1]).map((e,t)=>3===t?e:YD(e)),he=null==(p=e.textureProperties)?void 0:p._MainTex,pe=null!=he?{index:he,extensions:qD({},ue)}:void 0,fe=null!=(m=null==(f=e.floatProperties)?void 0:f._BumpScale)?m:1,me=null==(g=e.textureProperties)?void 0:g._BumpMap,ge=null!=me?{index:me,scale:fe,extensions:qD({},ue)}:void 0,ve=(null!=(y=null==(v=e.vectorProperties)?void 0:v._EmissionColor)?y:[0,0,0,1]).map(YD),ye=null==(b=e.textureProperties)?void 0:b._EmissionMap,be=null!=ye?{index:ye,extensions:qD({},ue)}:void 0,xe=(null!=(_=null==(x=e.vectorProperties)?void 0:x._ShadeColor)?_:[.97,.81,.86,1]).map(YD),_e=null==(w=e.textureProperties)?void 0:w._ShadeTexture,we=null!=_e?{index:_e,extensions:qD({},ue)}:void 0;let Se=null!=(M=null==(S=e.floatProperties)?void 0:S._ShadeShift)?M:0,Me=null!=(T=null==(E=e.floatProperties)?void 0:E._ShadeToony)?T:.9;Me=v_.lerp(Me,1,.5+.5*Se),Se=-Se-(1-Me);const Ee=null!=(C=null==(A=e.floatProperties)?void 0:A._IndirectLightIntensity)?C:.1,Te=Ee?1-Ee:void 0,Ae=null==(k=e.textureProperties)?void 0:k._SphereAdd,Ce=null!=Ae?[1,1,1]:void 0,ke=null!=Ae?{index:Ae}:void 0,Re=null!=(P=null==(R=e.floatProperties)?void 0:R._RimLightingMix)?P:0,Pe=null==(I=e.textureProperties)?void 0:I._RimTexture,Ie=null!=Pe?{index:Pe,extensions:qD({},ue)}:void 0,Le=(null!=(N=null==(L=e.vectorProperties)?void 0:L._RimColor)?N:[0,0,0,1]).map(YD),Ne=null!=(D=null==(O=e.floatProperties)?void 0:O._RimFresnelPower)?D:1,Oe=null!=(F=null==(U=e.floatProperties)?void 0:U._RimLift)?F:0,De=["none","worldCoordinates","screenCoordinates"][null!=(B=null==(z=e.floatProperties)?void 0:z._OutlineWidthMode)?B:0];let Ue=null!=(j=null==(V=e.floatProperties)?void 0:V._OutlineWidth)?j:0;Ue*=.01;const Fe=null==(H=e.textureProperties)?void 0:H._OutlineWidthTexture,ze=null!=Fe?{index:Fe,extensions:qD({},ue)}:void 0,Be=(null!=(G=null==(W=e.vectorProperties)?void 0:W._OutlineColor)?G:[0,0,0]).map(YD),Ve=1===(null!=(q=null==(X=e.floatProperties)?void 0:X._OutlineColorMode)?q:0)?null!=(Y=null==($=e.floatProperties)?void 0:$._OutlineLightingMix)?Y:1:0,je=null==(Z=e.textureProperties)?void 0:Z._UvAnimMaskTexture,He=null!=je?{index:je,extensions:qD({},ue)}:void 0,We=null!=(K=null==(J=e.floatProperties)?void 0:J._UvAnimScrollX)?K:0;let Ge=null!=(ee=null==(Q=e.floatProperties)?void 0:Q._UvAnimScrollY)?ee:0;null!=Ge&&(Ge=-Ge);const Xe={specVersion:"1.0",transparentWithZWrite:ie,renderQueueOffsetNumber:oe,shadeColorFactor:xe,shadeMultiplyTexture:we,shadingShiftFactor:Se,shadingToonyFactor:Me,giEqualizationFactor:Te,matcapFactor:Ce,matcapTexture:ke,rimLightingMixFactor:Re,rimMultiplyTexture:Ie,parametricRimColorFactor:Le,parametricRimFresnelPowerFactor:Ne,parametricRimLiftFactor:Oe,outlineWidthMode:De,outlineWidthFactor:Ue,outlineWidthMultiplyTexture:ze,outlineColorFactor:Be,outlineLightingMixFactor:Ve,uvAnimationMaskTexture:He,uvAnimationScrollXSpeedFactor:We,uvAnimationScrollYSpeedFactor:Ge,uvAnimationRotationSpeedFactor:null!=(ne=null==(te=e.floatProperties)?void 0:te._UvAnimRotation)?ne:0};return $D(qD({},t),{pbrMetallicRoughness:{baseColorFactor:de,baseColorTexture:pe},normalTexture:ge,emissiveTexture:be,emissiveFactor:ve,alphaMode:se,alphaCutoff:le,doubleSided:ce,extensions:{VRMC_materials_mtoon:Xe}})}_parseV0UnlitProperties(e,t){var n,r,i,o,a;const s="VRM/UnlitTransparentZWrite"===e.shader,l="VRM/UnlitTransparent"===e.shader||s,c=this._v0ParseRenderQueue(e),u="VRM/UnlitCutout"===e.shader,d=l?"BLEND":u?"MASK":"OPAQUE",h=u?null!=(r=null==(n=e.floatProperties)?void 0:n._Cutoff)?r:.5:void 0,p=this._portTextureTransform(e),f=(null!=(o=null==(i=e.vectorProperties)?void 0:i._Color)?o:[1,1,1,1]).map(YD),m=null==(a=e.textureProperties)?void 0:a._MainTex,g=null!=m?{index:m,extensions:qD({},p)}:void 0,v={specVersion:"1.0",transparentWithZWrite:s,renderQueueOffsetNumber:c,shadeColorFactor:f,shadeMultiplyTexture:g};return $D(qD({},t),{pbrMetallicRoughness:{baseColorFactor:f,baseColorTexture:g},alphaMode:d,alphaCutoff:h,extensions:{VRMC_materials_mtoon:v}})}_portTextureTransform(e){var t,n,r,i,o;const a=null==(t=e.vectorProperties)?void 0:t._MainTex;if(null==a)return{};const s=[null!=(n=null==a?void 0:a[0])?n:0,null!=(r=null==a?void 0:a[1])?r:0],l=[null!=(i=null==a?void 0:a[2])?i:1,null!=(o=null==a?void 0:a[3])?o:1];return s[1]=1-l[1]-s[1],{KHR_texture_transform:{offset:s,scale:l}}}_v0ParseRenderQueue(e){var t,n;const r="VRM/UnlitTransparentZWrite"===e.shader,i=null!=(null==(t=e.keywordMap)?void 0:t._ALPHABLEND_ON)||"VRM/UnlitTransparent"===e.shader||r,o=1===(null==(n=e.floatProperties)?void 0:n._ZWrite)||r;let a=0;if(i){const t=e.renderQueue;null!=t&&(a=o?this._renderQueueMapTransparentZWrite.get(t):this._renderQueueMapTransparent.get(t))}return a}_populateRenderQueueMap(e){const t=new Set,n=new Set;e.forEach(e=>{var r,i;const o="VRM/UnlitTransparentZWrite"===e.shader,a=null!=(null==(r=e.keywordMap)?void 0:r._ALPHABLEND_ON)||"VRM/UnlitTransparent"===e.shader||o,s=1===(null==(i=e.floatProperties)?void 0:i._ZWrite)||o;if(a){const r=e.renderQueue;null!=r&&(s?n.add(r):t.add(r))}}),t.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${t.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),n.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${n.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(t).sort().forEach((e,n)=>{const r=Math.min(Math.max(n-t.size+1,-9),0);this._renderQueueMapTransparent.set(e,r)}),Array.from(n).sort().forEach((e,t)=>{const n=Math.min(Math.max(t,0),9);this._renderQueueMapTransparentZWrite.set(e,n)})}},JD=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(Dv){i(Dv)}},a=e=>{try{s(n.throw(e))}catch(Dv){i(Dv)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())}),KD=new x_,QD=class extends sM{constructor(e){super(),this._attrPosition=new _S(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(35048);const t=new IS;t.setAttribute("position",this._attrPosition);const n=new OE({color:16711935,depthTest:!1,depthWrite:!1});this._line=new HE(t,n),this.add(this._line),this.constraint=e}updateMatrixWorld(e){KD.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,KD.x,KD.y,KD.z),this.constraint.source&&KD.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,KD.x,KD.y,KD.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(e)}};function eU(e,t){return t.set(e.elements[12],e.elements[13],e.elements[14])}var tU=new x_,nU=new x_;function rU(e){return e.invert?e.invert():e.inverse(),e}var iU=class{constructor(e,t){this.destination=e,this.source=t,this.weight=1}},oU=new x_,aU=new x_,sU=new x_,lU=new b_,cU=new b_,uU=new b_,dU=class extends iU{get aimAxis(){return this._aimAxis}set aimAxis(e){this._aimAxis=e,this._v3AimAxis.set("PositiveX"===e?1:"NegativeX"===e?-1:0,"PositiveY"===e?1:"NegativeY"===e?-1:0,"PositiveZ"===e?1:"NegativeZ"===e?-1:0)}get dependencies(){const e=new Set([this.source]);return this.destination.parent&&e.add(this.destination.parent),e}constructor(e,t){super(e,t),this._aimAxis="PositiveX",this._v3AimAxis=new x_(1,0,0),this._dstRestQuat=new b_}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);const e=lU.identity(),t=cU.identity();var n,r;this.destination.parent&&(n=this.destination.parent.matrixWorld,r=e,n.decompose(tU,r,nU),rU(t.copy(e)));const i=oU.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(e),o=eU(this.source.matrixWorld,aU).sub(eU(this.destination.matrixWorld,sU)).normalize(),a=uU.setFromUnitVectors(i,o).premultiply(t).multiply(e).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(a,this.weight)}};function hU(e,t){const n=[e];let r=e.parent;for(;null!==r;)n.unshift(r),r=r.parent;n.forEach(e=>{t(e)})}var pU=class{constructor(){this._constraints=new Set,this._objectConstraintsMap=new Map}get constraints(){return this._constraints}addConstraint(e){this._constraints.add(e);let t=this._objectConstraintsMap.get(e.destination);null==t&&(t=new Set,this._objectConstraintsMap.set(e.destination,t)),t.add(e)}deleteConstraint(e){this._constraints.delete(e);this._objectConstraintsMap.get(e.destination).delete(e)}setInitState(){const e=new Set,t=new Set;for(const n of this._constraints)this._processConstraint(n,e,t,e=>e.setInitState())}update(){const e=new Set,t=new Set;for(const n of this._constraints)this._processConstraint(n,e,t,e=>e.update())}_processConstraint(e,t,n,r){if(n.has(e))return;if(t.has(e))throw new Error("VRMNodeConstraintManager: Circular dependency detected while updating constraints");t.add(e);const i=e.dependencies;for(const o of i)hU(o,e=>{const i=this._objectConstraintsMap.get(e);if(i)for(const o of i)this._processConstraint(o,t,n,r)});r(e),n.add(e)}},fU=new b_,mU=new b_,gU=class extends iU{get dependencies(){return new Set([this.source])}constructor(e,t){super(e,t),this._dstRestQuat=new b_,this._invSrcRestQuat=new b_}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),rU(this._invSrcRestQuat.copy(this.source.quaternion))}update(){const e=fU.copy(this._invSrcRestQuat).multiply(this.source.quaternion),t=mU.copy(this._dstRestQuat).multiply(e);this.destination.quaternion.copy(this._dstRestQuat).slerp(t,this.weight)}},vU=new x_,yU=new b_,bU=new b_,xU=class extends iU{get rollAxis(){return this._rollAxis}set rollAxis(e){this._rollAxis=e,this._v3RollAxis.set("X"===e?1:0,"Y"===e?1:0,"Z"===e?1:0)}get dependencies(){return new Set([this.source])}constructor(e,t){super(e,t),this._rollAxis="X",this._v3RollAxis=new x_(1,0,0),this._dstRestQuat=new b_,this._invDstRestQuat=new b_,this._invSrcRestQuatMulDstRestQuat=new b_}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),rU(this._invDstRestQuat.copy(this._dstRestQuat)),rU(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){const e=yU.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),t=vU.copy(this._v3RollAxis).applyQuaternion(e),n=bU.setFromUnitVectors(t,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(e);this.destination.quaternion.copy(this._dstRestQuat).slerp(n,this.weight)}},_U=new Set(["1.0","1.0-beta"]),wU=class e{get name(){return e.EXTENSION_NAME}constructor(e,t){this.parser=e,this.helperRoot=null==t?void 0:t.helperRoot}afterRoot(e){return JD(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(t){return JD(this,null,function*(){var n;const r=this.parser.json;if(!(-1!==(null==(n=r.extensionsUsed)?void 0:n.indexOf(e.EXTENSION_NAME))))return null;const i=new pU,o=yield this.parser.getDependencies("node");return o.forEach((t,n)=>{var a;const s=r.nodes[n],l=null==(a=null==s?void 0:s.extensions)?void 0:a[e.EXTENSION_NAME];if(null==l)return;const c=l.specVersion;if(!_U.has(c))return void console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${e.EXTENSION_NAME} specVersion "${c}"`);const u=l.constraint;if(null!=u.roll){const e=this._importRollConstraint(t,o,u.roll);i.addConstraint(e)}else if(null!=u.aim){const e=this._importAimConstraint(t,o,u.aim);i.addConstraint(e)}else if(null!=u.rotation){const e=this._importRotationConstraint(t,o,u.rotation);i.addConstraint(e)}}),t.scene.updateMatrixWorld(),i.setInitState(),i})}_importRollConstraint(e,t,n){const{source:r,rollAxis:i,weight:o}=n,a=t[r],s=new xU(e,a);if(null!=i&&(s.rollAxis=i),null!=o&&(s.weight=o),this.helperRoot){const e=new QD(s);this.helperRoot.add(e)}return s}_importAimConstraint(e,t,n){const{source:r,aimAxis:i,weight:o}=n,a=t[r],s=new dU(e,a);if(null!=i&&(s.aimAxis=i),null!=o&&(s.weight=o),this.helperRoot){const e=new QD(s);this.helperRoot.add(e)}return s}_importRotationConstraint(e,t,n){const{source:r,weight:i}=n,o=t[r],a=new gU(e,o);if(null!=i&&(a.weight=i),this.helperRoot){const e=new QD(a);this.helperRoot.add(e)}return a}};wU.EXTENSION_NAME="VRMC_node_constraint";var SU=wU,MU=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(Dv){i(Dv)}},a=e=>{try{s(n.throw(e))}catch(Dv){i(Dv)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())}),EU=class{},TU=new x_,AU=new x_,CU=class extends EU{get type(){return"capsule"}constructor(e){var t,n,r,i;super(),this.offset=null!=(t=null==e?void 0:e.offset)?t:new x_(0,0,0),this.tail=null!=(n=null==e?void 0:e.tail)?n:new x_(0,0,0),this.radius=null!=(r=null==e?void 0:e.radius)?r:0,this.inside=null!=(i=null==e?void 0:e.inside)&&i}calculateCollision(e,t,n,r){TU.setFromMatrixPosition(e),AU.subVectors(this.tail,this.offset).applyMatrix4(e),AU.sub(TU);const i=AU.lengthSq();r.copy(t).sub(TU);const o=AU.dot(r);o<=0||(i<=o||AU.multiplyScalar(o/i),r.sub(AU));const a=r.length(),s=this.inside?this.radius-n-a:a-n-this.radius;return s<0&&(r.multiplyScalar(1/a),this.inside&&r.negate()),s}},kU=new x_,RU=new S_,PU=class extends EU{get type(){return"plane"}constructor(e){var t,n;super(),this.offset=null!=(t=null==e?void 0:e.offset)?t:new x_(0,0,0),this.normal=null!=(n=null==e?void 0:e.normal)?n:new x_(0,0,1)}calculateCollision(e,t,n,r){r.setFromMatrixPosition(e),r.negate().add(t),RU.getNormalMatrix(e),kU.copy(this.normal).applyNormalMatrix(RU).normalize();const i=r.dot(kU)-n;return r.copy(kU),i}},IU=new x_,LU=class extends EU{get type(){return"sphere"}constructor(e){var t,n,r;super(),this.offset=null!=(t=null==e?void 0:e.offset)?t:new x_(0,0,0),this.radius=null!=(n=null==e?void 0:e.radius)?n:0,this.inside=null!=(r=null==e?void 0:e.inside)&&r}calculateCollision(e,t,n,r){r.subVectors(t,IU.setFromMatrixPosition(e));const i=r.length(),o=this.inside?this.radius-n-i:i-n-this.radius;return o<0&&(r.multiplyScalar(1/i),this.inside&&r.negate()),o}},NU=new x_,OU=class extends IS{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new x_,this._currentTail=new x_,this._shape=e,this._attrPos=new _S(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new _S(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._shape.radius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),e=!0);const n=NU.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(n)>1e-10&&(this._currentTail.copy(n),e=!0),e&&this._buildPosition()}_buildPosition(){NU.copy(this._currentTail).sub(this._currentOffset);const e=NU.length()/this._currentRadius;for(let r=0;r<=16;r++){const t=r/16*Math.PI;this._attrPos.setXYZ(r,-Math.sin(t),-Math.cos(t),0),this._attrPos.setXYZ(17+r,e+Math.sin(t),Math.cos(t),0),this._attrPos.setXYZ(34+r,-Math.sin(t),0,-Math.cos(t)),this._attrPos.setXYZ(51+r,e+Math.sin(t),0,Math.cos(t))}for(let r=0;r<32;r++){const t=r/16*Math.PI;this._attrPos.setXYZ(68+r,0,Math.sin(t),Math.cos(t)),this._attrPos.setXYZ(100+r,e,Math.sin(t),Math.cos(t))}const t=Math.atan2(NU.y,Math.sqrt(NU.x*NU.x+NU.z*NU.z)),n=-Math.atan2(NU.z,NU.x);this.rotateZ(t),this.rotateY(n),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 e=0;e<34;e++){const t=(e+1)%34;this._attrIndex.setXY(2*e,e,t),this._attrIndex.setXY(68+2*e,34+e,34+t)}for(let e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(136+2*e,68+e,68+t),this._attrIndex.setXY(200+2*e,100+e,100+t)}this._attrIndex.needsUpdate=!0}},DU=class extends IS{constructor(e){super(),this.worldScale=1,this._currentOffset=new x_,this._currentNormal=new x_,this._shape=e,this._attrPos=new _S(new Float32Array(18),3),this.setAttribute("position",this._attrPos),this._attrIndex=new _S(new Uint16Array(10),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),e=!0),this._currentNormal.equals(this._shape.normal)||(this._currentNormal.copy(this._shape.normal),e=!0),e&&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}},UU=class extends IS{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new x_,this._shape=e,this._attrPos=new _S(new Float32Array(288),3),this.setAttribute("position",this._attrPos),this._attrIndex=new _S(new Uint16Array(192),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._shape.radius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(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 e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(2*e,e,t),this._attrIndex.setXY(64+2*e,32+e,32+t),this._attrIndex.setXY(128+2*e,64+e,64+t)}this._attrIndex.needsUpdate=!0}},FU=new x_,zU=class extends sM{constructor(e){if(super(),this.matrixAutoUpdate=!1,this.collider=e,this.collider.shape instanceof LU)this._geometry=new UU(this.collider.shape);else if(this.collider.shape instanceof CU)this._geometry=new OU(this.collider.shape);else{if(!(this.collider.shape instanceof PU))throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");this._geometry=new DU(this.collider.shape)}const t=new OE({color:16711935,depthTest:!1,depthWrite:!1});this._line=new qE(this._geometry,t),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(e){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const t=this.matrix.elements;this._geometry.worldScale=FU.set(t[0],t[1],t[2]).length(),this._geometry.update(),super.updateMatrixWorld(e)}},BU=class extends IS{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new x_,this._springBone=e,this._attrPos=new _S(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new _S(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(t))}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 e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(2*e,e,t),this._attrIndex.setXY(64+2*e,32+e,32+t),this._attrIndex.setXY(128+2*e,64+e,64+t)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},VU=new x_,jU=class extends sM{constructor(e){super(),this.matrixAutoUpdate=!1,this.springBone=e,this._geometry=new BU(this.springBone);const t=new OE({color:16776960,depthTest:!1,depthWrite:!1});this._line=new qE(this._geometry,t),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(e){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const t=this.matrix.elements;this._geometry.worldScale=VU.set(t[0],t[1],t[2]).length(),this._geometry.update(),super.updateMatrixWorld(e)}},HU=class extends Ww{constructor(e){super(),this.colliderMatrix=new vw,this.shape=e}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),function(e,t,n){const r=t.elements;e.copy(t),n&&(e.elements[12]=r[0]*n.x+r[4]*n.y+r[8]*n.z+r[12],e.elements[13]=r[1]*n.x+r[5]*n.y+r[9]*n.z+r[13],e.elements[14]=r[2]*n.x+r[6]*n.y+r[10]*n.z+r[14])}(this.colliderMatrix,this.matrixWorld,this.shape.offset)}};var WU=new vw;var GU=class{constructor(e){this._inverseCache=new vw,this._shouldUpdateInverse=!0,this.matrix=e;const t={set:(e,t,n)=>(this._shouldUpdateInverse=!0,e[t]=n,!0)};this._originalElements=e.elements,e.elements=new Proxy(e.elements,t)}get inverse(){var e;return this._shouldUpdateInverse&&((e=this._inverseCache.copy(this.matrix)).invert?e.invert():e.getInverse(WU.copy(e)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},XU=new vw,qU=new x_,$U=new x_,YU=new x_,ZU=new x_,JU=new vw,KU=class{constructor(e,t,n={},r=[]){var i,o,a,s,l,c;this._currentTail=new x_,this._prevTail=new x_,this._boneAxis=new x_,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new vw,this._initialLocalRotation=new b_,this._initialLocalChildPosition=new x_,this.bone=e,this.bone.matrixAutoUpdate=!1,this.child=t,this.settings={hitRadius:null!=(i=n.hitRadius)?i:0,stiffness:null!=(o=n.stiffness)?o:1,gravityPower:null!=(a=n.gravityPower)?a:0,gravityDir:null!=(l=null==(s=n.gravityDir)?void 0:s.clone())?l:new x_(0,-1,0),dragForce:null!=(c=n.dragForce)?c:.4},this.colliderGroups=r}get dependencies(){const e=new Set,t=this.bone.parent;t&&e.add(t);for(let n=0;n<this.colliderGroups.length;n++)for(let t=0;t<this.colliderGroups[n].colliders.length;t++)e.add(this.colliderGroups[n].colliders[t]);return e}get center(){return this._center}set center(e){var t;(null==(t=this._center)?void 0:t.userData.inverseCacheProxy)&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=e,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new GU(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:XU}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 e=this._getMatrixWorldToCenter();this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(e),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 e=this._getMatrixWorldToCenter();this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(e),this._prevTail.copy(this._currentTail)}update(e){if(e<=0)return;this._calcWorldSpaceBoneLength();const t=$U.copy(this._boneAxis).transformDirection(this._initialLocalMatrix).transformDirection(this._parentMatrixWorld);ZU.copy(this._currentTail).add(qU.subVectors(this._currentTail,this._prevTail).multiplyScalar(1-this.settings.dragForce)).applyMatrix4(this._getMatrixCenterToWorld()).addScaledVector(t,this.settings.stiffness*e).addScaledVector(this.settings.gravityDir,this.settings.gravityPower*e),YU.setFromMatrixPosition(this.bone.matrixWorld),ZU.sub(YU).normalize().multiplyScalar(this._worldSpaceBoneLength).add(YU),this._collision(ZU),this._prevTail.copy(this._currentTail),this._currentTail.copy(ZU).applyMatrix4(this._getMatrixWorldToCenter());const n=JU.multiplyMatrices(this._parentMatrixWorld,this._initialLocalMatrix).invert();this.bone.quaternion.setFromUnitVectors(this._boneAxis,qU.copy(ZU).applyMatrix4(n).normalize()).premultiply(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix)}_collision(e){for(let t=0;t<this.colliderGroups.length;t++)for(let n=0;n<this.colliderGroups[t].colliders.length;n++){const r=this.colliderGroups[t].colliders[n],i=r.shape.calculateCollision(r.colliderMatrix,e,this.settings.hitRadius,qU);if(i<0){e.addScaledVector(qU,-i),e.sub(YU);const t=e.length();e.multiplyScalar(this._worldSpaceBoneLength/t).add(YU)}}}_calcWorldSpaceBoneLength(){qU.setFromMatrixPosition(this.bone.matrixWorld),this.child?$U.setFromMatrixPosition(this.child.matrixWorld):($U.copy(this._initialLocalChildPosition),$U.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=qU.sub($U).length()}_getMatrixCenterToWorld(){return this._center?this._center.matrixWorld:XU}_getMatrixWorldToCenter(){return this._center?this._center.userData.inverseCacheProxy.inverse:XU}};function QU(e,t){const n=[];let r=e;for(;null!==r;)n.unshift(r),r=r.parent;n.forEach(e=>{t(e)})}function eF(e,t){e.children.forEach(e=>{t(e)||eF(e,t)})}var tF=class{constructor(){this._joints=new Set,this._sortedJoints=[],this._hasWarnedCircularDependency=!1,this._ancestors=[],this._objectSpringBonesMap=new Map,this._isSortedJointsDirty=!1,this._relevantChildrenUpdated=this._relevantChildrenUpdated.bind(this)}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){const e=new Set;return this._joints.forEach(t=>{t.colliderGroups.forEach(t=>{e.add(t)})}),Array.from(e)}get colliders(){const e=new Set;return this.colliderGroups.forEach(t=>{t.colliders.forEach(t=>{e.add(t)})}),Array.from(e)}addJoint(e){this._joints.add(e);let t=this._objectSpringBonesMap.get(e.bone);null==t&&(t=new Set,this._objectSpringBonesMap.set(e.bone,t)),t.add(e),this._isSortedJointsDirty=!0}addSpringBone(e){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(e)}deleteJoint(e){this._joints.delete(e);this._objectSpringBonesMap.get(e.bone).delete(e),this._isSortedJointsDirty=!0}deleteSpringBone(e){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(e)}setInitState(){this._sortJoints();for(let e=0;e<this._sortedJoints.length;e++){const t=this._sortedJoints[e];t.bone.updateMatrix(),t.bone.updateWorldMatrix(!1,!1),t.setInitState()}}reset(){this._sortJoints();for(let e=0;e<this._sortedJoints.length;e++){const t=this._sortedJoints[e];t.bone.updateMatrix(),t.bone.updateWorldMatrix(!1,!1),t.reset()}}update(e){this._sortJoints();for(let t=0;t<this._ancestors.length;t++)this._ancestors[t].updateWorldMatrix(0===t,!1);for(let t=0;t<this._sortedJoints.length;t++){const n=this._sortedJoints[t];n.bone.updateMatrix(),n.bone.updateWorldMatrix(!1,!1),n.update(e),eF(n.bone,this._relevantChildrenUpdated)}}_sortJoints(){if(!this._isSortedJointsDirty)return;const e=[],t=new Set,n=new Set,r=new Set;for(const o of this._joints)this._insertJointSort(o,t,n,e,r);this._sortedJoints=e;const i=function(e){var t;const n=new Map;for(const r of e){let i=r;do{const r=(null!=(t=n.get(i))?t:0)+1;if(r===e.size)return i;n.set(i,r),i=i.parent}while(null!==i)}return null}(r);this._ancestors=[],i&&(this._ancestors.push(i),eF(i,e=>{var t,n;return(null!=(n=null==(t=this._objectSpringBonesMap.get(e))?void 0:t.size)?n:0)>0||(this._ancestors.push(e),!1)})),this._isSortedJointsDirty=!1}_insertJointSort(e,t,n,r,i){if(n.has(e))return;if(t.has(e))return void(this._hasWarnedCircularDependency||(console.warn("VRMSpringBoneManager: Circular dependency detected"),this._hasWarnedCircularDependency=!0));t.add(e);const o=e.dependencies;for(const a of o){let e=!1,o=null;QU(a,a=>{const s=this._objectSpringBonesMap.get(a);if(s)for(const o of s)e=!0,this._insertJointSort(o,t,n,r,i);else e||(o=a)}),o&&i.add(o)}r.push(e),n.add(e)}_relevantChildrenUpdated(e){var t,n;return(null!=(n=null==(t=this._objectSpringBonesMap.get(e))?void 0:t.size)?n:0)>0||(e.updateWorldMatrix(!1,!1),!1)}},nF="VRMC_springBone_extended_collider",rF=new Set(["1.0","1.0-beta"]),iF=new Set(["1.0"]),oF=class e{get name(){return e.EXTENSION_NAME}constructor(e,t){var n;this.parser=e,this.jointHelperRoot=null==t?void 0:t.jointHelperRoot,this.colliderHelperRoot=null==t?void 0:t.colliderHelperRoot,this.useExtendedColliders=null==(n=null==t?void 0:t.useExtendedColliders)||n}afterRoot(e){return MU(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return MU(this,null,function*(){const t=yield this._v1Import(e);if(null!=t)return t;const n=yield this._v0Import(e);return null!=n?n:null})}_v1Import(t){return MU(this,null,function*(){var n,r,i,o,a;const s=t.parser.json;if(!(-1!==(null==(n=s.extensionsUsed)?void 0:n.indexOf(e.EXTENSION_NAME))))return null;const l=new tF,c=yield t.parser.getDependencies("node"),u=null==(r=s.extensions)?void 0:r[e.EXTENSION_NAME];if(!u)return null;const d=u.specVersion;if(!rF.has(d))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${e.EXTENSION_NAME} specVersion "${d}"`),null;const h=null==(i=u.colliders)?void 0:i.map((t,n)=>{var r,i,o,a,s,l,u,d,h,p,f,m,g,v,y;const b=c[t.node];if(null==b)return console.warn(`VRMSpringBoneLoaderPlugin: The collider #${n} attempted to use the node #${t.node} but not found`),null;const x=t.shape,_=null==(r=t.extensions)?void 0:r[nF];if(this.useExtendedColliders&&null!=_){const t=_.specVersion;if(iF.has(t)){const e=_.shape;if(e.sphere)return this._importSphereCollider(b,{offset:(new x_).fromArray(null!=(i=e.sphere.offset)?i:[0,0,0]),radius:null!=(o=e.sphere.radius)?o:0,inside:null!=(a=e.sphere.inside)&&a});if(e.capsule)return this._importCapsuleCollider(b,{offset:(new x_).fromArray(null!=(s=e.capsule.offset)?s:[0,0,0]),radius:null!=(l=e.capsule.radius)?l:0,tail:(new x_).fromArray(null!=(u=e.capsule.tail)?u:[0,0,0]),inside:null!=(d=e.capsule.inside)&&d});if(e.plane)return this._importPlaneCollider(b,{offset:(new x_).fromArray(null!=(h=e.plane.offset)?h:[0,0,0]),normal:(new x_).fromArray(null!=(p=e.plane.normal)?p:[0,0,1])})}else console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${nF} specVersion "${t}". Fallbacking to the ${e.EXTENSION_NAME} definition`)}if(x.sphere)return this._importSphereCollider(b,{offset:(new x_).fromArray(null!=(f=x.sphere.offset)?f:[0,0,0]),radius:null!=(m=x.sphere.radius)?m:0,inside:!1});if(x.capsule)return this._importCapsuleCollider(b,{offset:(new x_).fromArray(null!=(g=x.capsule.offset)?g:[0,0,0]),radius:null!=(v=x.capsule.radius)?v:0,tail:(new x_).fromArray(null!=(y=x.capsule.tail)?y:[0,0,0]),inside:!1});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${n} has no valid shape`)}),p=null==(o=u.colliderGroups)?void 0:o.map((e,t)=>{var n;return{colliders:(null!=(n=e.colliders)?n:[]).flatMap(e=>{const n=null==h?void 0:h[e];return null==n?(console.warn(`VRMSpringBoneLoaderPlugin: The colliderGroup #${t} attempted to use a collider #${e} but not found`),[]):n}),name:e.name}});return null==(a=u.springs)||a.forEach((e,t)=>{var n;const r=e.joints,i=null==(n=e.colliderGroups)?void 0:n.map(e=>{const n=null==p?void 0:p[e];if(null==n)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${t} attempted to use a colliderGroup ${e} but not found`);return n}),o=null!=e.center?c[e.center]:void 0;let a;r.forEach(e=>{if(a){const t=a.node,n=c[t],r=e.node,s=c[r],u={hitRadius:a.hitRadius,dragForce:a.dragForce,gravityPower:a.gravityPower,stiffness:a.stiffness,gravityDir:null!=a.gravityDir?(new x_).fromArray(a.gravityDir):void 0},d=this._importJoint(n,s,u,i);o&&(d.center=o),l.addJoint(d)}a=e})}),l.setInitState(),l})}_v0Import(e){return MU(this,null,function*(){var t,n,r;const i=e.parser.json;if(!(-1!==(null==(t=i.extensionsUsed)?void 0:t.indexOf("VRM"))))return null;const o=null==(n=i.extensions)?void 0:n.VRM,a=null==o?void 0:o.secondaryAnimation;if(!a)return null;const s=null==a?void 0:a.boneGroups;if(!s)return null;const l=new tF,c=yield e.parser.getDependencies("node"),u=null==(r=a.colliderGroups)?void 0:r.map(e=>{var t;const n=c[e.node];return{colliders:(null!=(t=e.colliders)?t:[]).map((e,t)=>{var r,i,o;const a=new x_(0,0,0);return e.offset&&a.set(null!=(r=e.offset.x)?r:0,null!=(i=e.offset.y)?i:0,e.offset.z?-e.offset.z:0),this._importSphereCollider(n,{offset:a,radius:null!=(o=e.radius)?o:0,inside:!1})})}});return null==s||s.forEach((e,t)=>{const n=e.bones;n&&n.forEach(n=>{var r,i,o,a;const s=c[n],d=new x_;e.gravityDir?d.set(null!=(r=e.gravityDir.x)?r:0,null!=(i=e.gravityDir.y)?i:0,null!=(o=e.gravityDir.z)?o:0):d.set(0,-1,0);const h=null!=e.center?c[e.center]:void 0,p={hitRadius:e.hitRadius,dragForce:e.dragForce,gravityPower:e.gravityPower,stiffness:e.stiffiness,gravityDir:d},f=null==(a=e.colliderGroups)?void 0:a.map(e=>{const n=null==u?void 0:u[e];if(null==n)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${t} attempted to use a colliderGroup ${e} but not found`);return n});s.traverse(e=>{var t;const n=null!=(t=e.children[0])?t:null,r=this._importJoint(e,n,p,f);h&&(r.center=h),l.addJoint(r)})})}),e.scene.updateMatrixWorld(),l.setInitState(),l})}_importJoint(e,t,n,r){const i=new KU(e,t,n,r);if(this.jointHelperRoot){const e=new jU(i);this.jointHelperRoot.add(e),e.renderOrder=this.jointHelperRoot.renderOrder}return i}_importSphereCollider(e,t){const n=new LU(t),r=new HU(n);if(e.add(r),this.colliderHelperRoot){const e=new zU(r);this.colliderHelperRoot.add(e),e.renderOrder=this.colliderHelperRoot.renderOrder}return r}_importCapsuleCollider(e,t){const n=new CU(t),r=new HU(n);if(e.add(r),this.colliderHelperRoot){const e=new zU(r);this.colliderHelperRoot.add(e),e.renderOrder=this.colliderHelperRoot.renderOrder}return r}_importPlaneCollider(e,t){const n=new PU(t),r=new HU(n);if(e.add(r),this.colliderHelperRoot){const e=new zU(r);this.colliderHelperRoot.add(e),e.renderOrder=this.colliderHelperRoot.renderOrder}return r}};oF.EXTENSION_NAME="VRMC_springBone";var aF=oF,sF=class{get name(){return"VRMLoaderPlugin"}constructor(e,t){var n,r,i,o,a,s,l,c,u,d;this.parser=e;const h=null==t?void 0:t.helperRoot,p=null==t?void 0:t.autoUpdateHumanBones;this.expressionPlugin=null!=(n=null==t?void 0:t.expressionPlugin)?n:new uO(e),this.firstPersonPlugin=null!=(r=null==t?void 0:t.firstPersonPlugin)?r:new fO(e),this.humanoidPlugin=null!=(i=null==t?void 0:t.humanoidPlugin)?i:new LO(e,{helperRoot:h,autoUpdateHumanBones:p}),this.lookAtPlugin=null!=(o=null==t?void 0:t.lookAtPlugin)?o:new mD(e,{helperRoot:h}),this.metaPlugin=null!=(a=null==t?void 0:t.metaPlugin)?a:new vD(e),this.mtoonMaterialPlugin=null!=(s=null==t?void 0:t.mtoonMaterialPlugin)?s:new UD(e),this.materialsHDREmissiveMultiplierPlugin=null!=(l=null==t?void 0:t.materialsHDREmissiveMultiplierPlugin)?l:new zD(e),this.materialsV0CompatPlugin=null!=(c=null==t?void 0:t.materialsV0CompatPlugin)?c:new ZD(e),this.springBonePlugin=null!=(u=null==t?void 0:t.springBonePlugin)?u:new aF(e,{colliderHelperRoot:h,jointHelperRoot:h}),this.nodeConstraintPlugin=null!=(d=null==t?void 0:t.nodeConstraintPlugin)?d:new SU(e,{helperRoot:h})}beforeRoot(){return GN(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(e){return GN(this,null,function*(){return yield this.mtoonMaterialPlugin.loadMesh(e)})}getMaterialType(e){const t=this.mtoonMaterialPlugin.getMaterialType(e);return null!=t?t:null}extendMaterialParams(e,t){return GN(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(e,t),yield this.mtoonMaterialPlugin.extendMaterialParams(e,t)})}afterRoot(e){return GN(this,null,function*(){yield this.metaPlugin.afterRoot(e),yield this.humanoidPlugin.afterRoot(e),yield this.expressionPlugin.afterRoot(e),yield this.lookAtPlugin.afterRoot(e),yield this.firstPersonPlugin.afterRoot(e),yield this.springBonePlugin.afterRoot(e),yield this.nodeConstraintPlugin.afterRoot(e),yield this.mtoonMaterialPlugin.afterRoot(e);const t=e.userData.vrmMeta,n=e.userData.vrmHumanoid;if(t&&n){const r=new bD({scene:e.scene,expressionManager:e.userData.vrmExpressionManager,firstPerson:e.userData.vrmFirstPerson,humanoid:n,lookAt:e.userData.vrmLookAt,meta:t,materials:e.userData.vrmMToonMaterials,springBoneManager:e.userData.vrmSpringBoneManager,nodeConstraintManager:e.userData.vrmNodeConstraintManager});e.userData.vrm=r}})}};function lF(e,t){if(0===t)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(2===t||1===t){let n=e.getIndex();if(null===n){const t=[],r=e.getAttribute("position");if(void 0===r)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<r.count;e++)t.push(e);e.setIndex(t),n=e.getIndex()}const r=n.count-2,i=[];if(2===t)for(let e=1;e<=r;e++)i.push(n.getX(0)),i.push(n.getX(e)),i.push(n.getX(e+1));else for(let e=0;e<r;e++)e%2==0?(i.push(n.getX(e)),i.push(n.getX(e+1)),i.push(n.getX(e+2))):(i.push(n.getX(e+2)),i.push(n.getX(e+1)),i.push(n.getX(e)));i.length/3!==r&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const o=e.clone();return o.setIndex(i),o.clearGroups(),o}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}class cF extends hC{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new mF(e)}),this.register(function(e){return new gF(e)}),this.register(function(e){return new EF(e)}),this.register(function(e){return new TF(e)}),this.register(function(e){return new AF(e)}),this.register(function(e){return new yF(e)}),this.register(function(e){return new bF(e)}),this.register(function(e){return new xF(e)}),this.register(function(e){return new _F(e)}),this.register(function(e){return new fF(e)}),this.register(function(e){return new wF(e)}),this.register(function(e){return new vF(e)}),this.register(function(e){return new MF(e)}),this.register(function(e){return new SF(e)}),this.register(function(e){return new hF(e)}),this.register(function(e){return new CF(e)}),this.register(function(e){return new kF(e)})}load(e,t,n,r){const i=this;let o;if(""!==this.resourcePath)o=this.resourcePath;else if(""!==this.path){const t=UC.extractUrlBase(e);o=UC.resolveURL(t,this.path)}else o=UC.extractUrlBase(e);this.manager.itemStart(e);const a=function(t){r?r(t):console.error(t),i.manager.itemError(e),i.manager.itemEnd(e)},s=new mC(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(n){try{i.parse(n,o,function(n){t(n),i.manager.itemEnd(e)},a)}catch(Dv){a(Dv)}},n,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,r){let i;const o={},a={},s=new TextDecoder;if("string"==typeof e)i=JSON.parse(e);else if(e instanceof ArrayBuffer){if(s.decode(new Uint8Array(e,0,4))===RF){try{o[dF.KHR_BINARY_GLTF]=new LF(e)}catch(c){return void(r&&r(c))}i=JSON.parse(o[dF.KHR_BINARY_GLTF].content)}else i=JSON.parse(s.decode(e))}else i=e;if(void 0===i.asset||i.asset.version[0]<2)return void(r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const l=new oz(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){const e=this.pluginCallbacks[u](l);e.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[e.name]=e,o[e.name]=!0}if(i.extensionsUsed)for(let u=0;u<i.extensionsUsed.length;++u){const e=i.extensionsUsed[u],t=i.extensionsRequired||[];switch(e){case dF.KHR_MATERIALS_UNLIT:o[e]=new pF;break;case dF.KHR_DRACO_MESH_COMPRESSION:o[e]=new NF(i,this.dracoLoader);break;case dF.KHR_TEXTURE_TRANSFORM:o[e]=new OF;break;case dF.KHR_MESH_QUANTIZATION:o[e]=new DF;break;default:t.indexOf(e)>=0&&void 0===a[e]&&console.warn('THREE.GLTFLoader: Unknown extension "'+e+'".')}}l.setExtensions(o),l.setPlugins(a),l.parse(n,r)}parseAsync(e,t){const n=this;return new Promise(function(r,i){n.parse(e,t,r,i)})}}function uF(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const dF={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 hF{constructor(e){this.parser=e,this.name=dF.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n<r;n++){const r=t[n];r.extensions&&r.extensions[this.name]&&void 0!==r.extensions[this.name].light&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let r=t.cache.get(n);if(r)return r;const i=t.json,o=((i.extensions&&i.extensions[this.name]||{}).lights||[])[e];let a;const s=new cS(16777215);void 0!==o.color&&s.setRGB(o.color[0],o.color[1],o.color[2],Ix);const l=void 0!==o.range?o.range:0;switch(o.type){case"directional":a=new PC(s),a.target.position.set(0,0,-1),a.add(a.target);break;case"point":a=new CC(s),a.distance=l;break;case"spot":a=new TC(s),a.distance=l,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,a.angle=o.spot.outerConeAngle,a.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,a.target.position.set(0,0,-1),a.add(a.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return a.position.set(0,0,0),QF(a,o),void 0!==o.intensity&&(a.intensity=o.intensity),a.name=t.createUniqueName(o.name||"light_"+e),r=Promise.resolve(a),t.cache.add(n,r),r}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,r=n.json.nodes[e],i=(r.extensions&&r.extensions[this.name]||{}).light;return void 0===i?null:this._loadLight(i).then(function(e){return n._getNodeRef(t.cache,i,e)})}}class pF{constructor(){this.name=dF.KHR_MATERIALS_UNLIT}getMaterialType(){return pS}extendParams(e,t,n){const r=[];e.color=new cS(1,1,1),e.opacity=1;const i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){const t=i.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],Ix),e.opacity=t[3]}void 0!==i.baseColorTexture&&r.push(n.assignTexture(e,"map",i.baseColorTexture,Px))}return Promise.all(r)}}class fF{constructor(e){this.parser=e,this.name=dF.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=n.extensions[this.name].emissiveStrength;return void 0!==r&&(t.emissiveIntensity=r),Promise.resolve()}}class mF{constructor(e){this.parser=e,this.name=dF.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?DA:null}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=[],o=r.extensions[this.name];if(void 0!==o.clearcoatFactor&&(t.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&i.push(n.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&i.push(n.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(i.push(n.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){const e=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new y_(e,e)}return Promise.all(i)}}class gF{constructor(e){this.parser=e,this.name=dF.KHR_MATERIALS_DISPERSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?DA:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=n.extensions[this.name];return t.dispersion=void 0!==r.dispersion?r.dispersion:0,Promise.resolve()}}class vF{constructor(e){this.parser=e,this.name=dF.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?DA:null}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=[],o=r.extensions[this.name];return void 0!==o.iridescenceFactor&&(t.iridescence=o.iridescenceFactor),void 0!==o.iridescenceTexture&&i.push(n.assignTexture(t,"iridescenceMap",o.iridescenceTexture)),void 0!==o.iridescenceIor&&(t.iridescenceIOR=o.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==o.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),void 0!==o.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),void 0!==o.iridescenceThicknessTexture&&i.push(n.assignTexture(t,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(i)}}class yF{constructor(e){this.parser=e,this.name=dF.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?DA:null}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=[];t.sheenColor=new cS(0,0,0),t.sheenRoughness=0,t.sheen=1;const o=r.extensions[this.name];if(void 0!==o.sheenColorFactor){const e=o.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],Ix)}return void 0!==o.sheenRoughnessFactor&&(t.sheenRoughness=o.sheenRoughnessFactor),void 0!==o.sheenColorTexture&&i.push(n.assignTexture(t,"sheenColorMap",o.sheenColorTexture,Px)),void 0!==o.sheenRoughnessTexture&&i.push(n.assignTexture(t,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(i)}}class bF{constructor(e){this.parser=e,this.name=dF.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?DA:null}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=[],o=r.extensions[this.name];return void 0!==o.transmissionFactor&&(t.transmission=o.transmissionFactor),void 0!==o.transmissionTexture&&i.push(n.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(i)}}class xF{constructor(e){this.parser=e,this.name=dF.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?DA:null}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=[],o=r.extensions[this.name];t.thickness=void 0!==o.thicknessFactor?o.thicknessFactor:0,void 0!==o.thicknessTexture&&i.push(n.assignTexture(t,"thicknessMap",o.thicknessTexture)),t.attenuationDistance=o.attenuationDistance||1/0;const a=o.attenuationColor||[1,1,1];return t.attenuationColor=(new cS).setRGB(a[0],a[1],a[2],Ix),Promise.all(i)}}class _F{constructor(e){this.parser=e,this.name=dF.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?DA:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=n.extensions[this.name];return t.ior=void 0!==r.ior?r.ior:1.5,Promise.resolve()}}class wF{constructor(e){this.parser=e,this.name=dF.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?DA:null}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=[],o=r.extensions[this.name];t.specularIntensity=void 0!==o.specularFactor?o.specularFactor:1,void 0!==o.specularTexture&&i.push(n.assignTexture(t,"specularIntensityMap",o.specularTexture));const a=o.specularColorFactor||[1,1,1];return t.specularColor=(new cS).setRGB(a[0],a[1],a[2],Ix),void 0!==o.specularColorTexture&&i.push(n.assignTexture(t,"specularColorMap",o.specularColorTexture,Px)),Promise.all(i)}}class SF{constructor(e){this.parser=e,this.name=dF.EXT_MATERIALS_BUMP}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?DA:null}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=[],o=r.extensions[this.name];return t.bumpScale=void 0!==o.bumpFactor?o.bumpFactor:1,void 0!==o.bumpTexture&&i.push(n.assignTexture(t,"bumpMap",o.bumpTexture)),Promise.all(i)}}class MF{constructor(e){this.parser=e,this.name=dF.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?DA:null}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=[],o=r.extensions[this.name];return void 0!==o.anisotropyStrength&&(t.anisotropy=o.anisotropyStrength),void 0!==o.anisotropyRotation&&(t.anisotropyRotation=o.anisotropyRotation),void 0!==o.anisotropyTexture&&i.push(n.assignTexture(t,"anisotropyMap",o.anisotropyTexture)),Promise.all(i)}}class EF{constructor(e){this.parser=e,this.name=dF.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,r=n.textures[e];if(!r.extensions||!r.extensions[this.name])return null;const i=r.extensions[this.name],o=t.options.ktx2Loader;if(!o){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,i.source,o)}}class TF{constructor(e){this.parser=e,this.name=dF.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;const o=i.extensions[t],a=r.images[o.source];let s=n.textureLoader;if(a.uri){const e=n.options.manager.getHandler(a.uri);null!==e&&(s=e)}return n.loadTextureImage(e,o.source,s)}}class AF{constructor(e){this.parser=e,this.name=dF.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;const o=i.extensions[t],a=r.images[o.source];let s=n.textureLoader;if(a.uri){const e=n.options.manager.getHandler(a.uri);null!==e&&(s=e)}return n.loadTextureImage(e,o.source,s)}}class CF{constructor(e){this.name=dF.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const e=n.extensions[this.name],r=this.parser.getDependency("buffer",e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.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 r.then(function(t){const n=e.byteOffset||0,r=e.byteLength||0,o=e.count,a=e.byteStride,s=new Uint8Array(t,n,r);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(o,a,s,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){const t=new ArrayBuffer(o*a);return i.decodeGltfBuffer(new Uint8Array(t),o,a,s,e.mode,e.filter),t})})}return null}}class kF{constructor(e){this.name=dF.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const r=t.meshes[n.mesh];for(const s of r.primitives)if(s.mode!==BF.TRIANGLES&&s.mode!==BF.TRIANGLE_STRIP&&s.mode!==BF.TRIANGLE_FAN&&void 0!==s.mode)return null;const i=n.extensions[this.name].attributes,o=[],a={};for(const s in i)o.push(this.parser.getDependency("accessor",i[s]).then(e=>(a[s]=e,a[s])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(e=>{const t=e.pop(),n=t.isGroup?t.children:[t],r=e[0].count,i=[];for(const o of n){const e=new vw,t=new x_,n=new b_,s=new x_(1,1,1),l=new iE(o.geometry,o.material,r);for(let i=0;i<r;i++)a.TRANSLATION&&t.fromBufferAttribute(a.TRANSLATION,i),a.ROTATION&&n.fromBufferAttribute(a.ROTATION,i),a.SCALE&&s.fromBufferAttribute(a.SCALE,i),l.setMatrixAt(i,e.compose(t,n,s));for(const r in a)if("_COLOR_0"===r){const e=a[r];l.instanceColor=new ZM(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==r&&"ROTATION"!==r&&"SCALE"!==r&&o.geometry.setAttribute(r,a[r]);Ww.prototype.copy.call(l,o),this.parser.assignFinalMaterial(l),i.push(l)}return t.isGroup?(t.clear(),t.add(...i),t):i[0]}))}}const RF="glTF",PF=1313821514,IF=5130562;class LF{constructor(e){this.name=dF.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==RF)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-12,i=new DataView(e,12);let o=0;for(;o<r;){const t=i.getUint32(o,!0);o+=4;const r=i.getUint32(o,!0);if(o+=4,r===PF){const r=new Uint8Array(e,12+o,t);this.content=n.decode(r)}else if(r===IF){const n=12+o;this.body=e.slice(n,n+t)}o+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class NF{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=dF.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,r=this.dracoLoader,i=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},s={},l={};for(const c in o){const e=GF[c]||c.toLowerCase();a[e]=o[c]}for(const c in e.attributes){const t=GF[c]||c.toLowerCase();if(void 0!==o[c]){const r=n.accessors[e.attributes[c]],i=VF[r.componentType];l[t]=i.name,s[t]=!0===r.normalized}}return t.getDependency("bufferView",i).then(function(e){return new Promise(function(t,n){r.decodeDracoFile(e,function(e){for(const t in e.attributes){const n=e.attributes[t],r=s[t];void 0!==r&&(n.normalized=r)}t(e)},a,l,Ix,n)})})}}class OF{constructor(){this.name=dF.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e):e}}class DF{constructor(){this.name=dF.KHR_MESH_QUANTIZATION}}class UF extends YA{constructor(e,t,n,r){super(e,t,n,r)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r;for(let o=0;o!==r;o++)t[o]=n[i+o];return t}interpolate_(e,t,n,r){const i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=2*a,l=3*a,c=r-t,u=(n-t)/c,d=u*u,h=d*u,p=e*l,f=p-l,m=-2*h+3*d,g=h-d,v=1-m,y=g-d+u;for(let b=0;b!==a;b++){const e=o[f+b+a],t=o[f+b+s]*c,n=o[p+b+a],r=o[p+b]*c;i[b]=v*e+y*t+m*n+g*r}return i}}const FF=new b_;class zF extends UF{interpolate_(e,t,n,r){const i=super.interpolate_(e,t,n,r);return FF.fromArray(i).normalize().toArray(i),i}}const BF={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},VF={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},jF={9728:db,9729:fb,9984:hb,9985:mb,9986:pb,9987:gb},HF={33071:cb,33648:ub,10497:lb},WF={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},GF={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},XF={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},qF={CUBICSPLINE:void 0,LINEAR:Sx,STEP:wx},$F="OPAQUE",YF="MASK",ZF="BLEND";function JF(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new OA({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),e.DefaultMaterial}function KF(e,t,n){for(const r in n.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function QF(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function ez(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let n=0,r=t.weights.length;n<r;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){const n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let t=0,r=n.length;t<r;t++)e.morphTargetDictionary[n[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function tz(e){let t;const n=e.extensions&&e.extensions[dF.KHR_DRACO_MESH_COMPRESSION];if(t=n?"draco:"+n.bufferView+":"+n.indices+":"+nz(n.attributes):e.indices+":"+nz(e.attributes)+":"+e.mode,void 0!==e.targets)for(let r=0,i=e.targets.length;r<i;r++)t+=":"+nz(e.targets[r]);return t}function nz(e){let t="";const n=Object.keys(e).sort();for(let r=0,i=n.length;r<i;r++)t+=n[r]+":"+e[n[r]]+";";return t}function rz(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const iz=new vw;class oz{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new uF,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 n=!1,r=-1,i=!1,o=-1;if("undefined"!=typeof navigator){const e=navigator.userAgent;n=!0===/^((?!chrome|android).)*safari/i.test(e);const t=e.match(/Version\/(\d+)/);r=n&&t?parseInt(t[1],10):-1,i=e.indexOf("Firefox")>-1,o=i?e.match(/Firefox\/([0-9]+)\./)[1]:-1}"undefined"==typeof createImageBitmap||n&&r<17||i&&o<98?this.textureLoader=new yC(this.options.manager):this.textureLoader=new WC(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new mC(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(t){const o={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};return KF(i,o,r),QF(o,r),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(o)})).then(function(){for(const e of o.scenes)e.updateMatrixWorld();e(o)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let r=0,i=t.length;r<i;r++){const n=t[r].joints;for(let t=0,r=n.length;t<r;t++)e[n[t]].isBone=!0}for(let r=0,i=e.length;r<i;r++){const t=e[r];void 0!==t.mesh&&(this._addNodeRef(this.meshCache,t.mesh),void 0!==t.skin&&(n[t.mesh].isSkinnedMesh=!0)),void 0!==t.camera&&this._addNodeRef(this.cameraCache,t.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const r=n.clone(),i=(e,t)=>{const n=this.associations.get(e);null!=n&&this.associations.set(t,n);for(const[r,o]of e.children.entries())i(o,t.children[r])};return i(n,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const r=e(t[n]);if(r)return r}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let r=0;r<t.length;r++){const i=e(t[r]);i&&n.push(i)}return n}getDependency(e,t){const n=e+":"+t;let r=this.cache.get(n);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case"mesh":r=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":r=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)}),!r)throw new Error("Unknown type: "+e)}this.cache.add(n,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,r=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(r.map(function(t,r){return n.getDependency(e,r)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[dF.KHR_BINARY_GLTF].body);const r=this.options;return new Promise(function(e,i){n.load(UC.resolveURL(t.uri,r.path),e,void 0,function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){const n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)})}loadAccessor(e){const t=this,n=this.json,r=this.json.accessors[e];if(void 0===r.bufferView&&void 0===r.sparse){const e=WF[r.type],t=VF[r.componentType],n=!0===r.normalized,i=new t(r.count*e);return Promise.resolve(new _S(i,e,n))}const i=[];return void 0!==r.bufferView?i.push(this.getDependency("bufferView",r.bufferView)):i.push(null),void 0!==r.sparse&&(i.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(i).then(function(e){const i=e[0],o=WF[r.type],a=VF[r.componentType],s=a.BYTES_PER_ELEMENT,l=s*o,c=r.byteOffset||0,u=void 0!==r.bufferView?n.bufferViews[r.bufferView].byteStride:void 0,d=!0===r.normalized;let h,p;if(u&&u!==l){const e=Math.floor(c/u),n="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+e+":"+r.count;let l=t.cache.get(n);l||(h=new a(i,e*u,r.count*u/s),l=new pM(h,u/s),t.cache.add(n,l)),p=new mM(l,o,c%u/s,d)}else h=null===i?new a(r.count*o):new a(i,c,r.count*o),p=new _S(h,o,d);if(void 0!==r.sparse){const t=WF.SCALAR,n=VF[r.sparse.indices.componentType],s=r.sparse.indices.byteOffset||0,l=r.sparse.values.byteOffset||0,c=new n(e[1],s,r.sparse.count*t),u=new a(e[2],l,r.sparse.count*o);null!==i&&(p=new _S(p.array.slice(),p.itemSize,p.normalized)),p.normalized=!1;for(let e=0,r=c.length;e<r;e++){const t=c[e];if(p.setX(t,u[e*o]),o>=2&&p.setY(t,u[e*o+1]),o>=3&&p.setZ(t,u[e*o+2]),o>=4&&p.setW(t,u[e*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}p.normalized=d}return p})}loadTexture(e){const t=this.json,n=this.options,r=t.textures[e].source,i=t.images[r];let o=this.textureLoader;if(i.uri){const e=n.manager.getHandler(i.uri);null!==e&&(o=e)}return this.loadTextureImage(e,r,o)}loadTextureImage(e,t,n){const r=this,i=this.json,o=i.textures[e],a=i.images[t],s=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[s])return this.textureCache[s];const l=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=o.name||a.name||"",""===t.name&&"string"==typeof a.uri&&!1===a.uri.startsWith("data:image/")&&(t.name=a.uri);const n=(i.samplers||{})[o.sampler]||{};return t.magFilter=jF[n.magFilter]||fb,t.minFilter=jF[n.minFilter]||gb,t.wrapS=HF[n.wrapS]||lb,t.wrapT=HF[n.wrapT]||lb,t.generateMipmaps=!t.isCompressedTexture&&t.minFilter!==db&&t.minFilter!==fb,r.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[s]=l,l}loadImageSource(e,t){const n=this,r=this.json,i=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());const o=r.images[e],a=self.URL||self.webkitURL;let s=o.uri||"",l=!1;if(void 0!==o.bufferView)s=n.getDependency("bufferView",o.bufferView).then(function(e){l=!0;const t=new Blob([e],{type:o.mimeType});return s=a.createObjectURL(t),s});else if(void 0===o.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const c=Promise.resolve(s).then(function(e){return new Promise(function(n,r){let o=n;!0===t.isImageBitmapLoader&&(o=function(e){const t=new F_(e);t.needsUpdate=!0,n(t)}),t.load(UC.resolveURL(e,i.path),o,void 0,r)})}).then(function(e){var t;return!0===l&&a.revokeObjectURL(s),QF(e,o),e.userData.mimeType=o.mimeType||((t=o.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":t.search(/\.ktx2($|\?)/i)>0||0===t.search(/^data\:image\/ktx2/)?"image/ktx2":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),e});return this.sourceCache[e]=c,c}assignTexture(e,t,n,r){const i=this;return this.getDependency("texture",n.index).then(function(o){if(!o)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((o=o.clone()).channel=n.texCoord),i.extensions[dF.KHR_TEXTURE_TRANSFORM]){const e=void 0!==n.extensions?n.extensions[dF.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=i.associations.get(o);o=i.extensions[dF.KHR_TEXTURE_TRANSFORM].extendTexture(o,e),i.associations.set(o,t)}}return void 0!==r&&(o.colorSpace=r),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const r=void 0===t.attributes.tangent,i=void 0!==t.attributes.color,o=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new YE,hS.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){const e="LineBasicMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new OE,hS.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(r||i||o){let e="ClonedMaterial:"+n.uuid+":";r&&(e+="derivative-tangents:"),i&&(e+="vertex-colors:"),o&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=n.clone(),i&&(t.vertexColors=!0),o&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return OA}loadMaterial(e){const t=this,n=this.json,r=this.extensions,i=n.materials[e];let o;const a={},s=[];if((i.extensions||{})[dF.KHR_MATERIALS_UNLIT]){const e=r[dF.KHR_MATERIALS_UNLIT];o=e.getMaterialType(),s.push(e.extendParams(a,i,t))}else{const n=i.pbrMetallicRoughness||{};if(a.color=new cS(1,1,1),a.opacity=1,Array.isArray(n.baseColorFactor)){const e=n.baseColorFactor;a.color.setRGB(e[0],e[1],e[2],Ix),a.opacity=e[3]}void 0!==n.baseColorTexture&&s.push(t.assignTexture(a,"map",n.baseColorTexture,Px)),a.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,a.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(s.push(t.assignTexture(a,"metalnessMap",n.metallicRoughnessTexture)),s.push(t.assignTexture(a,"roughnessMap",n.metallicRoughnessTexture))),o=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),s.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,a)})))}!0===i.doubleSided&&(a.side=2);const l=i.alphaMode||$F;if(l===ZF?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,l===YF&&(a.alphaTest=void 0!==i.alphaCutoff?i.alphaCutoff:.5)),void 0!==i.normalTexture&&o!==pS&&(s.push(t.assignTexture(a,"normalMap",i.normalTexture)),a.normalScale=new y_(1,1),void 0!==i.normalTexture.scale)){const e=i.normalTexture.scale;a.normalScale.set(e,e)}if(void 0!==i.occlusionTexture&&o!==pS&&(s.push(t.assignTexture(a,"aoMap",i.occlusionTexture)),void 0!==i.occlusionTexture.strength&&(a.aoMapIntensity=i.occlusionTexture.strength)),void 0!==i.emissiveFactor&&o!==pS){const e=i.emissiveFactor;a.emissive=(new cS).setRGB(e[0],e[1],e[2],Ix)}return void 0!==i.emissiveTexture&&o!==pS&&s.push(t.assignTexture(a,"emissiveMap",i.emissiveTexture,Px)),Promise.all(s).then(function(){const n=new o(a);return i.name&&(n.name=i.name),QF(n,i),t.associations.set(n,{materials:e}),i.extensions&&KF(r,n,i),n})}createUniqueName(e){const t=mk.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,r=this.primitiveCache;function i(e){return n[dF.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return az(n,e,t)})}const o=[];for(let a=0,s=e.length;a<s;a++){const n=e[a],s=tz(n),l=r[s];if(l)o.push(l.promise);else{let e;e=n.extensions&&n.extensions[dF.KHR_DRACO_MESH_COMPRESSION]?i(n):az(new IS,n,t),r[s]={primitive:n,promise:e},o.push(e)}}return Promise.all(o)}loadMesh(e){const t=this,n=this.json,r=this.extensions,i=n.meshes[e],o=i.primitives,a=[];for(let s=0,l=o.length;s<l;s++){const e=void 0===o[s].material?JF(this.cache):this.getDependency("material",o[s].material);a.push(e)}return a.push(t.loadGeometries(o)),Promise.all(a).then(function(n){const a=n.slice(0,n.length-1),s=n[n.length-1],l=[];for(let u=0,d=s.length;u<d;u++){const n=s[u],c=o[u];let d;const h=a[u];if(c.mode===BF.TRIANGLES||c.mode===BF.TRIANGLE_STRIP||c.mode===BF.TRIANGLE_FAN||void 0===c.mode)d=!0===i.isSkinnedMesh?new WM(n,h):new WS(n,h),!0===d.isSkinnedMesh&&d.normalizeSkinWeights(),c.mode===BF.TRIANGLE_STRIP?d.geometry=lF(d.geometry,1):c.mode===BF.TRIANGLE_FAN&&(d.geometry=lF(d.geometry,2));else if(c.mode===BF.LINES)d=new qE(n,h);else if(c.mode===BF.LINE_STRIP)d=new HE(n,h);else if(c.mode===BF.LINE_LOOP)d=new $E(n,h);else{if(c.mode!==BF.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+c.mode);d=new eT(n,h)}Object.keys(d.geometry.morphAttributes).length>0&&ez(d,i),d.name=t.createUniqueName(i.name||"mesh_"+e),QF(d,i),c.extensions&&KF(r,d,c),t.assignFinalMaterial(d),l.push(d)}for(let r=0,i=l.length;r<i;r++)t.associations.set(l[r],{meshes:e,primitives:r});if(1===l.length)return i.extensions&&KF(r,l[0],i),l[0];const c=new sM;i.extensions&&KF(r,c,i),t.associations.set(c,{meshes:e});for(let e=0,t=l.length;e<t;e++)c.add(l[e]);return c})}loadCamera(e){let t;const n=this.json.cameras[e],r=n[n.type];if(r)return"perspective"===n.type?t=new nM(v_.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===n.type&&(t=new kC(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),QF(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const t=this.json.skins[e],n=[];for(let r=0,i=t.joints.length;r<i;r++)n.push(this._loadNodeShallow(t.joints[r]));return void 0!==t.inverseBindMatrices?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(e){const n=e.pop(),r=e,i=[],o=[];for(let a=0,s=r.length;a<s;a++){const e=r[a];if(e){i.push(e);const t=new vw;null!==n&&t.fromArray(n.array,16*a),o.push(t)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[a])}return new YM(i,o)})}loadAnimation(e){const t=this.json,n=this,r=t.animations[e],i=r.name?r.name:"animation_"+e,o=[],a=[],s=[],l=[],c=[];for(let u=0,d=r.channels.length;u<d;u++){const e=r.channels[u],t=r.samplers[e.sampler],n=e.target,i=n.node,d=void 0!==r.parameters?r.parameters[t.input]:t.input,h=void 0!==r.parameters?r.parameters[t.output]:t.output;void 0!==n.node&&(o.push(this.getDependency("node",i)),a.push(this.getDependency("accessor",d)),s.push(this.getDependency("accessor",h)),l.push(t),c.push(n))}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(s),Promise.all(l),Promise.all(c)]).then(function(e){const t=e[0],o=e[1],a=e[2],s=e[3],l=e[4],c=[];for(let r=0,i=t.length;r<i;r++){const e=t[r],i=o[r],u=a[r],d=s[r],h=l[r];if(void 0===e)continue;e.updateMatrix&&e.updateMatrix();const p=n._createAnimationTracks(e,i,u,d,h);if(p)for(let t=0;t<p.length;t++)c.push(p[t])}const u=new sC(i,void 0,c);return QF(u,r),u})}createNodeMesh(e){const t=this.json,n=this,r=t.nodes[e];return void 0===r.mesh?null:n.getDependency("mesh",r.mesh).then(function(e){const t=n._getNodeRef(n.meshCache,r.mesh,e);return void 0!==r.weights&&t.traverse(function(e){if(e.isMesh)for(let t=0,n=r.weights.length;t<n;t++)e.morphTargetInfluences[t]=r.weights[t]}),t})}loadNode(e){const t=this,n=this.json.nodes[e],r=t._loadNodeShallow(e),i=[],o=n.children||[];for(let s=0,l=o.length;s<l;s++)i.push(t.getDependency("node",o[s]));const a=void 0===n.skin?Promise.resolve(null):t.getDependency("skin",n.skin);return Promise.all([r,Promise.all(i),a]).then(function(e){const t=e[0],n=e[1],r=e[2];null!==r&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(r,iz)});for(let i=0,o=n.length;i<o;i++)t.add(n[i]);return t})}_loadNodeShallow(e){const t=this.json,n=this.extensions,r=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const i=t.nodes[e],o=i.name?r.createUniqueName(i.name):"",a=[],s=r._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return s&&a.push(s),void 0!==i.camera&&a.push(r.getDependency("camera",i.camera).then(function(e){return r._getNodeRef(r.cameraCache,i.camera,e)})),r._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){a.push(e)}),this.nodeCache[e]=Promise.all(a).then(function(t){let a;if(a=!0===i.isBone?new GM:t.length>1?new sM:1===t.length?t[0]:new Ww,a!==t[0])for(let e=0,n=t.length;e<n;e++)a.add(t[e]);if(i.name&&(a.userData.name=i.name,a.name=o),QF(a,i),i.extensions&&KF(n,a,i),void 0!==i.matrix){const e=new vw;e.fromArray(i.matrix),a.applyMatrix4(e)}else void 0!==i.translation&&a.position.fromArray(i.translation),void 0!==i.rotation&&a.quaternion.fromArray(i.rotation),void 0!==i.scale&&a.scale.fromArray(i.scale);if(r.associations.has(a)){if(void 0!==i.mesh&&r.meshCache.refs[i.mesh]>1){const e=r.associations.get(a);r.associations.set(a,{...e})}}else r.associations.set(a,{});return r.associations.get(a).nodes=e,a}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],r=this,i=new sM;n.name&&(i.name=r.createUniqueName(n.name)),QF(i,n),n.extensions&&KF(t,i,n);const o=n.nodes||[],a=[];for(let s=0,l=o.length;s<l;s++)a.push(r.getDependency("node",o[s]));return Promise.all(a).then(function(e){for(let t=0,n=e.length;t<n;t++)i.add(e[t]);return r.associations=(e=>{const t=new Map;for(const[n,i]of r.associations)(n instanceof hS||n instanceof F_)&&t.set(n,i);return e.traverse(e=>{const n=r.associations.get(e);null!=n&&t.set(e,n)}),t})(i),i})}_createAnimationTracks(e,t,n,r,i){const o=[],a=e.name?e.name:e.uuid,s=[];let l;switch(XF[i.path]===XF.weights?e.traverse(function(e){e.morphTargetInfluences&&s.push(e.name?e.name:e.uuid)}):s.push(a),XF[i.path]){case XF.weights:l=nC;break;case XF.rotation:l=iC;break;case XF.translation:case XF.scale:l=aC;break;default:if(1===n.itemSize)l=nC;else l=aC}const c=void 0!==r.interpolation?qF[r.interpolation]:Sx,u=this._getArrayFromAccessor(n);for(let d=0,h=s.length;d<h;d++){const e=new l(s[d]+"."+XF[i.path],t.array,u,c);"CUBICSPLINE"===r.interpolation&&this._createCubicSplineTrackInterpolant(e),o.push(e)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=rz(t.constructor),n=new Float32Array(t.length);for(let r=0,i=t.length;r<i;r++)n[r]=t[r]*e;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof iC?zF:UF)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function az(e,t,n){const r=t.attributes,i=[];function o(t,r){return n.getDependency("accessor",t).then(function(t){e.setAttribute(r,t)})}for(const a in r){const t=GF[a]||a.toLowerCase();t in e.attributes||i.push(o(r[a],t))}if(void 0!==t.indices&&!e.index){const r=n.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});i.push(r)}return C_.workingColorSpace!==Ix&&"COLOR_0"in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${C_.workingColorSpace}" not supported.`),QF(e,t),function(e,t,n){const r=t.attributes,i=new W_;if(void 0===r.POSITION)return;{const e=n.json.accessors[r.POSITION],t=e.min,o=e.max;if(void 0===t||void 0===o)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(i.set(new x_(t[0],t[1],t[2]),new x_(o[0],o[1],o[2])),e.normalized){const t=rz(VF[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}const o=t.targets;if(void 0!==o){const e=new x_,t=new x_;for(let r=0,i=o.length;r<i;r++){const i=o[r];if(void 0!==i.POSITION){const r=n.json.accessors[i.POSITION],o=r.min,a=r.max;if(void 0!==o&&void 0!==a){if(t.setX(Math.max(Math.abs(o[0]),Math.abs(a[0]))),t.setY(Math.max(Math.abs(o[1]),Math.abs(a[1]))),t.setZ(Math.max(Math.abs(o[2]),Math.abs(a[2]))),r.normalized){const e=rz(VF[r.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(e)}e.boundingBox=i;const a=new lw;i.getCenter(a.center),a.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=a}(e,t,n),Promise.all(i).then(function(){return void 0!==t.targets?function(e,t,n){let r=!1,i=!1,o=!1;for(let c=0,u=t.length;c<u;c++){const e=t[c];if(void 0!==e.POSITION&&(r=!0),void 0!==e.NORMAL&&(i=!0),void 0!==e.COLOR_0&&(o=!0),r&&i&&o)break}if(!r&&!i&&!o)return Promise.resolve(e);const a=[],s=[],l=[];for(let c=0,u=t.length;c<u;c++){const u=t[c];if(r){const t=void 0!==u.POSITION?n.getDependency("accessor",u.POSITION):e.attributes.position;a.push(t)}if(i){const t=void 0!==u.NORMAL?n.getDependency("accessor",u.NORMAL):e.attributes.normal;s.push(t)}if(o){const t=void 0!==u.COLOR_0?n.getDependency("accessor",u.COLOR_0):e.attributes.color;l.push(t)}}return Promise.all([Promise.all(a),Promise.all(s),Promise.all(l)]).then(function(t){const n=t[0],a=t[1],s=t[2];return r&&(e.morphAttributes.position=n),i&&(e.morphAttributes.normal=a),o&&(e.morphAttributes.color=s),e.morphTargetsRelative=!0,e})}(e,t.targets,n):e})}const sz={default:{expressions:{[JN.Neutral]:1}},happy:{expressions:{[JN.Happy]:.8}},angry:{expressions:{[JN.Angry]:.7},headRotation:[.05,0,0]},sorry:{expressions:{[JN.Sad]:.6},headRotation:[-.08,0,0]},confused:{expressions:{[JN.Sad]:.3},headRotation:[0,0,.08]},love:{expressions:{[JN.Happy]:.9,[JN.Relaxed]:.4}},thinking:{expressions:{[JN.Neutral]:.6},headRotation:[.06,-.1,0]},writing:{expressions:{[JN.Neutral]:.8},headRotation:[-.05,0,0]},wink:{expressions:{[JN.Happy]:.5,[JN.Blink]:.9}}};function lz({url:e,emotion:t,callState:n,audioLevel:r}){const i=w.useRef(null),o=w.useRef(null),a=w.useRef(null),s=w.useRef(0),l=w.useRef(1),c=w.useRef(0),u=w.useRef(3*Math.random()+2),d=w.useRef(0),h=w.useRef({}),p=w.useRef({}),f=w.useRef(new Aw(0,0,0)),m=w.useRef(0),{scene:g,camera:v}=lN();return w.useEffect(()=>{const t=new cF;return t.register(e=>new sF(e)),t.load(e,e=>{const t=e.userData?.vrm;if(t){i.current=t,t.scene.rotation.y=Math.PI;const e=(new W_).setFromObject(t.scene),n=e.getCenter(new x_),r=e.getSize(new x_).y;t.scene.position.y=-n.y-.05*r,m.current=t.scene.position.y,g.add(t.scene)}else{console.info("[Avatar3D] Plain GLB model detected, using fallback animations");const t=e.scene;t.updateMatrixWorld(!0);const n=(new W_).setFromObject(t),r=n.getCenter(new x_),i=n.getSize(new x_),c=new sM;t.position.sub(r),c.add(t),s.current=0,o.current=c,m.current=0,l.current=1,g.add(c);const u=v.fov*(Math.PI/180),d=.35*i.y,h=.5*i.y/Math.tan(u/2);if(v.position.set(0,d,-h),v.lookAt(0,d,0),e.animations.length>0){const n=new yk(t);a.current=n,e.animations.forEach(e=>{n.clipAction(e).play()})}}},void 0,e=>{console.error("[Avatar3D] Failed to load model:",e)}),()=>{i.current&&(g.remove(i.current.scene),i.current=null),o.current&&(g.remove(o.current),o.current=null),a.current&&(a.current.stopAllAction(),a.current=null)}},[e,g]),w.useEffect(()=>{const e=sz[t||"default"]||sz.default;p.current=e.expressions,e.headRotation?f.current.set(...e.headRotation):f.current.set(0,0,0)},[t]),function(e,t=0){const n=sN(),r=n.getState().internal.subscribe,i=AL(e);TL(()=>r(i,t,n),[t,r,n])}((e,t)=>{const g=Math.min(t,.1);d.current+=1.2*g;const v=o.current;if(v){a.current&&a.current.update(g);const e=.003*Math.sin(d.current);v.position.y=m.current+e;const t=.02*Math.sin(.3*d.current);if(v.rotation.y=s.current+t,"speaking"===n&&r>.01){const e=1+.03*r,t=l.current*e,n=v.scale.x;v.scale.setScalar(v_.lerp(n,t,.1))}else{const e=v.scale.x;Math.abs(e-l.current)>.001&&v.scale.setScalar(v_.lerp(e,l.current,.05))}return}const y=i.current;if(!y)return;const b=.003*Math.sin(d.current);if(y.scene.position.y=m.current+b,c.current+=g,c.current>=u.current){const e=(c.current-u.current)/.15;e<1?y.expressionManager?.setValue(JN.Blink,e):e<2?y.expressionManager?.setValue(JN.Blink,2-e):(y.expressionManager?.setValue(JN.Blink,0),c.current=0,u.current=4*Math.random()+2)}const x=4*g,_=new Set([...Object.keys(h.current),...Object.keys(p.current)]);for(const n of _){const e=h.current[n]||0,t=p.current[n]||0,r=v_.lerp(e,t,x);h.current[n]=r,n===JN.Blink&&c.current>=u.current||y.expressionManager?.setValue(n,r)}if("speaking"===n&&r>.01){const e=Math.min(1.5*r,.8),t=y.expressionManager?.getValue(JN.Aa)||0,n=v_.lerp(t,e,8*g);y.expressionManager?.setValue(JN.Aa,n)}else{const e=y.expressionManager?.getValue(JN.Aa)||0;e>.01&&y.expressionManager?.setValue(JN.Aa,.9*e)}if(y.humanoid){const e=y.humanoid.getNormalizedBoneNode("head");if(e){const t=.01*Math.sin(.3*d.current),n=.005*Math.cos(.2*d.current),r=f.current.x+t,i=f.current.y,o=f.current.z+n;e.rotation.x=v_.lerp(e.rotation.x,r,3*g),e.rotation.y=v_.lerp(e.rotation.y,i,3*g),e.rotation.z=v_.lerp(e.rotation.z,o,3*g)}}if("listening"===n&&y.humanoid){const e=y.humanoid.getNormalizedBoneNode("head");e&&(e.rotation.z=v_.lerp(e.rotation.z,.03,2*g))}y.update(g)}),null}function cz(){const{camera:e}=lN();return w.useEffect(()=>{e.position.set(0,.1,.6),e.lookAt(0,.1,0)},[e]),null}const uz=Object.freeze(Object.defineProperty({__proto__:null,default:function({modelUrl:e,emotion:t,callState:n,audioLevel:r,primaryColor:i,size:o}){const a=w.useMemo(()=>{switch(n){case"speaking":return.6;case"listening":return.4;case"thinking":return.3;default:return.15}},[n]),s="listening"===n||"speaking"===n;return C.jsx("div",{className:"relative flex flex-col items-center gap-4",children:C.jsx("div",{className:"relative rounded-full overflow-hidden",style:{width:`${o}px`,height:`${o}px`,boxShadow:s?`0 0 0 3px ${i}50, 0 0 30px ${i}${Math.floor(255*a).toString(16).padStart(2,"0")}, 0 0 60px ${i}20`:`0 0 0 2px ${i}25`,transition:"box-shadow 0.5s ease"},children:C.jsxs(WN,{style:{width:"100%",height:"100%",background:"transparent"},gl:{alpha:!0,antialias:!0,preserveDrawingBuffer:!1},camera:{fov:30,near:.01,far:10},dpr:[1,2],children:[C.jsx(cz,{}),C.jsx("ambientLight",{intensity:.6}),C.jsx("directionalLight",{position:[1,2,3],intensity:.8,color:"#ffffff"}),C.jsx("directionalLight",{position:[-1,1,-1],intensity:.3,color:"#b4c6e7"}),C.jsx("pointLight",{position:[0,.5,-.5],intensity:2*a,color:i,distance:3}),C.jsx(lz,{url:e,emotion:t,callState:n,audioLevel:r})]})})})}},Symbol.toStringTag,{value:"Module"}));e.BotUyoChatWidget=wv,e.ChatWidget=e=>{const t=w.useRef(null),n=w.useRef(null),r=w.useRef(null),i=w.useRef(null),[o,a]=w.useState(!1),[s,l]=w.useState(!1);return w.useEffect(()=>{if(!t.current||n.current)return;const e=t.current.attachShadow({mode:"open"});n.current=e;const o=document.createElement("style");o.textContent=D.replace(/:root/g,":host"),e.appendChild(o);const s=document.createElement("div");return s.id="botuyo-chat-widget-root",e.appendChild(s),i.current=s,r.current=_.createRoot(s),l(z()),a(!0),()=>{r.current?.unmount(),r.current=null,n.current=null,i.current=null}},[]),w.useEffect(()=>{const e=()=>l(z()),t=new MutationObserver(e);t.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});const n=window.matchMedia("(prefers-color-scheme: dark)");return n.addEventListener("change",e),()=>{t.disconnect(),n.removeEventListener("change",e)}},[]),w.useEffect(()=>{if(!i.current)return;const t=i.current;s&&!e.theme?.cssVariables?Object.entries(F).forEach(([e,n])=>{t.style.setProperty(e,n)}):s||e.theme?.cssVariables||Object.keys(F).forEach(e=>{t.style.removeProperty(e)})},[s,e.theme?.cssVariables]),w.useEffect(()=>{o&&r.current&&r.current.render(C.jsx(U,{children:C.jsx(S.Suspense,{fallback:null,children:C.jsx(B,{...e})})}))},[o,e]),C.jsx("div",{ref:t,id:"botuyo-shadow-host"})},e.ChatWidgetProvider=function({children:e,defaultLocale:t,initialState:n,onStateChange:r,...i}){const[o,a]=w.useState(n?.isOpen??!1),[s,l]=w.useState(0),c=w.useCallback(()=>{a(!0),l(0),r?.(!0)},[r]),u=w.useCallback(()=>{a(!1),r?.(!1)},[r]),d=w.useCallback(()=>{a(e=>{const t=!e;return t&&l(0),r?.(t),t})},[r]),h=w.useCallback(e=>{lv?(lv(e),Kt("ChatWidgetProvider sendMessage:",e)):Zt("sendMessage called but no handler registered")},[]),p=w.useCallback(()=>{cv?(cv(),Kt("ChatWidgetProvider clearMessages called")):Zt("clearMessages called but no handler registered")},[]),f={isOpen:o,open:c,close:u,toggle:d,sendMessage:h,clearMessages:p,unreadCount:s},m=w.useCallback((e,t)=>{"message:received"!==e||o||l(e=>e+1),i.onEvent?.(e,t)},[o,i]);return C.jsx(N,{defaultLocale:t,children:C.jsxs(hv.Provider,{value:f,children:[e,C.jsx(gv,{...i,onStateChange:e=>{a(e),e&&l(0),r?.(e)},onEvent:m})]})})},e.ChatWidgetUnstyled=gv,e.LanguageProvider=N,e.default=Sv,e.useChatWidget=function(){const e=w.useContext(hv);if(!e)throw new Error("useChatWidget must be used within a ChatWidgetProvider. Wrap your app with <ChatWidgetProvider>...</ChatWidgetProvider>");return e},e.useLanguage=O,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
2
|
+
//# sourceMappingURL=botuyo-chat.umd.js.map
|